diff --git a/sdk/storage/azure-mgmt-storagecache/_meta.json b/sdk/storage/azure-mgmt-storagecache/_meta.json index eb46e369bb37..c38eed1dc8b9 100644 --- a/sdk/storage/azure-mgmt-storagecache/_meta.json +++ b/sdk/storage/azure-mgmt-storagecache/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.12.0", + "@autorest/python@5.13.0", "@autorest/modelerfour@4.19.3" ], - "commit": "2c66a689c610dbef623d6c4e4c4e913446d5ac68", + "commit": "35dea9c9199a5481f438ab0933f96f5f0f97c80f", "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/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/storagecache/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/storagecache/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_configuration.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_configuration.py index 66d8056d0c5f..6b15ba335598 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_configuration.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class StorageCacheManagementClientConfiguration(Configuration): +class StorageCacheManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for StorageCacheManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class StorageCacheManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(StorageCacheManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-01-01" + self.api_version = api_version 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 fcd69e8a5bbb..9c61559a6e4c 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": "2022-01-01", - "total_api_version_list": ["2022-01-01"], + "chosen_version": "2022-05-01", + "total_api_version_list": ["2022-05-01"], "client": { "name": "StorageCacheManagementClient", "filename": "_storage_cache_management_client", @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageCacheManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageCacheManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageCacheManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"StorageCacheManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { 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 7de51682fb6c..deacee51a39f 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 @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import StorageCacheManagementClientConfiguration @@ -21,32 +22,37 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class StorageCacheManagementClient: - """A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. +class StorageCacheManagementClient: # pylint: disable=too-many-instance-attributes + """A Storage Cache provides scalable caching service for NAS clients, serving data from either + NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to + manage Caches. :ivar operations: Operations operations - :vartype operations: storage_cache_management_client.operations.Operations + :vartype operations: azure.mgmt.storagecache.operations.Operations :ivar skus: SkusOperations operations - :vartype skus: storage_cache_management_client.operations.SkusOperations + :vartype skus: azure.mgmt.storagecache.operations.SkusOperations :ivar usage_models: UsageModelsOperations operations - :vartype usage_models: storage_cache_management_client.operations.UsageModelsOperations + :vartype usage_models: azure.mgmt.storagecache.operations.UsageModelsOperations :ivar asc_operations: AscOperationsOperations operations - :vartype asc_operations: storage_cache_management_client.operations.AscOperationsOperations + :vartype asc_operations: azure.mgmt.storagecache.operations.AscOperationsOperations :ivar asc_usages: AscUsagesOperations operations - :vartype asc_usages: storage_cache_management_client.operations.AscUsagesOperations + :vartype asc_usages: azure.mgmt.storagecache.operations.AscUsagesOperations :ivar caches: CachesOperations operations - :vartype caches: storage_cache_management_client.operations.CachesOperations + :vartype caches: azure.mgmt.storagecache.operations.CachesOperations :ivar storage_targets: StorageTargetsOperations operations - :vartype storage_targets: storage_cache_management_client.operations.StorageTargetsOperations + :vartype storage_targets: azure.mgmt.storagecache.operations.StorageTargetsOperations :ivar storage_target: StorageTargetOperations operations - :vartype storage_target: storage_cache_management_client.operations.StorageTargetOperations + :vartype storage_target: azure.mgmt.storagecache.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. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -77,7 +83,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. 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 dbf4c577231c..e5754a47ce68 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.2.0" +VERSION = "1.0.0b1" 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 404017efd371..59b595d1f299 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 @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class StorageCacheManagementClientConfiguration(Configuration): +class StorageCacheManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for StorageCacheManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class StorageCacheManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(StorageCacheManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-01-01" + self.api_version = api_version 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 b05635dc4e33..1be910a09d35 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 @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import StorageCacheManagementClientConfiguration @@ -21,33 +22,37 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class StorageCacheManagementClient: - """A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. +class StorageCacheManagementClient: # pylint: disable=too-many-instance-attributes + """A Storage Cache provides scalable caching service for NAS clients, serving data from either + NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to + manage Caches. :ivar operations: Operations operations - :vartype operations: storage_cache_management_client.aio.operations.Operations + :vartype operations: azure.mgmt.storagecache.aio.operations.Operations :ivar skus: SkusOperations operations - :vartype skus: storage_cache_management_client.aio.operations.SkusOperations + :vartype skus: azure.mgmt.storagecache.aio.operations.SkusOperations :ivar usage_models: UsageModelsOperations operations - :vartype usage_models: storage_cache_management_client.aio.operations.UsageModelsOperations + :vartype usage_models: azure.mgmt.storagecache.aio.operations.UsageModelsOperations :ivar asc_operations: AscOperationsOperations operations - :vartype asc_operations: storage_cache_management_client.aio.operations.AscOperationsOperations + :vartype asc_operations: azure.mgmt.storagecache.aio.operations.AscOperationsOperations :ivar asc_usages: AscUsagesOperations operations - :vartype asc_usages: storage_cache_management_client.aio.operations.AscUsagesOperations + :vartype asc_usages: azure.mgmt.storagecache.aio.operations.AscUsagesOperations :ivar caches: CachesOperations operations - :vartype caches: storage_cache_management_client.aio.operations.CachesOperations + :vartype caches: azure.mgmt.storagecache.aio.operations.CachesOperations :ivar storage_targets: StorageTargetsOperations operations - :vartype storage_targets: - storage_cache_management_client.aio.operations.StorageTargetsOperations + :vartype storage_targets: azure.mgmt.storagecache.aio.operations.StorageTargetsOperations :ivar storage_target: StorageTargetOperations operations - :vartype storage_target: storage_cache_management_client.aio.operations.StorageTargetOperations + :vartype storage_target: azure.mgmt.storagecache.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. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ 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 9fc1105af4e7..a3037d159fc9 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -29,7 +28,7 @@ class AscOperationsOperations: 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -59,7 +58,7 @@ async def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AscOperation, or the result of cls(response) - :rtype: ~storage_cache_management_client.models.AscOperation + :rtype: ~azure.mgmt.storagecache.models.AscOperation :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AscOperation"] @@ -68,17 +67,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, location=location, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -92,5 +98,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}"} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_usages_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_usages_operations.py index 4e66c4c2b960..fc6481679e17 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_usages_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_asc_usages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -31,7 +29,7 @@ class AscUsagesOperations: 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -60,9 +58,11 @@ def list( :return: An iterator like instance of either ResourceUsagesListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.ResourceUsagesListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagecache.models.ResourceUsagesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUsagesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -74,6 +74,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, location=location, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -84,6 +85,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, location=location, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -101,7 +103,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,4 +120,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/usages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/usages"} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_caches_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_caches_operations.py index 7798f541f891..b17aeba7bc42 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -22,18 +21,18 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._caches_operations import build_create_or_update_request_initial, build_debug_info_request_initial, build_delete_request_initial, build_flush_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_start_request_initial, build_stop_request_initial, build_update_request, build_upgrade_firmware_request_initial +from ...operations._caches_operations import build_create_or_update_request_initial, build_debug_info_request_initial, build_delete_request_initial, build_flush_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_pause_priming_job_request_initial, build_resume_priming_job_request_initial, build_space_allocation_request_initial, build_start_priming_job_request_initial, build_start_request_initial, build_stop_priming_job_request_initial, build_stop_request_initial, build_update_request, build_upgrade_firmware_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class CachesOperations: +class CachesOperations: # pylint: disable=too-many-public-methods """CachesOperations 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -58,9 +57,11 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CachesListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.CachesListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagecache.models.CachesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CachesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -71,6 +72,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -80,6 +82,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -97,7 +100,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,7 +117,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches"} # type: ignore @distributed_trace def list_by_resource_group( @@ -125,9 +132,11 @@ def list_by_resource_group( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CachesListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.CachesListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagecache.models.CachesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CachesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -139,6 +148,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -149,6 +159,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -166,7 +177,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -179,9 +194,9 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -193,17 +208,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -213,11 +235,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -242,7 +264,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -253,6 +276,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -273,10 +297,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}"} # type: ignore @distributed_trace_async async def get( @@ -294,7 +317,7 @@ async def get( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Cache, or the result of cls(response) - :rtype: ~storage_cache_management_client.models.Cache + :rtype: ~azure.mgmt.storagecache.models.Cache :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Cache"] @@ -303,17 +326,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,7 +357,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}"} # type: ignore async def _create_or_update_initial( @@ -343,6 +373,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if cache is not None: @@ -354,6 +385,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -361,7 +393,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -380,7 +416,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}"} # type: ignore @distributed_trace_async @@ -399,8 +435,9 @@ async def begin_create_or_update( from the [-0-9a-zA-Z_] char class. :type cache_name: str :param cache: Object containing the user-selectable properties of the new Cache. If read-only - properties are included, they must match the existing values of those properties. - :type cache: ~storage_cache_management_client.models.Cache + properties are included, they must match the existing values of those properties. Default value + is None. + :type cache: ~azure.mgmt.storagecache.models.Cache :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -410,11 +447,12 @@ async def begin_create_or_update( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Cache or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~storage_cache_management_client.models.Cache] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagecache.models.Cache] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cache"] lro_delay = kwargs.pop( 'polling_interval', @@ -426,6 +464,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, cache_name=cache_name, cache=cache, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -450,10 +489,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}"} # type: ignore @distributed_trace_async async def update( @@ -471,11 +509,12 @@ async def update( from the [-0-9a-zA-Z_] char class. :type cache_name: str :param cache: Object containing the user-selectable properties of the Cache. If read-only - properties are included, they must match the existing values of those properties. - :type cache: ~storage_cache_management_client.models.Cache + properties are included, they must match the existing values of those properties. Default value + is None. + :type cache: ~azure.mgmt.storagecache.models.Cache :keyword callable cls: A custom type or function that will be passed the direct response :return: Cache, or the result of cls(response) - :rtype: ~storage_cache_management_client.models.Cache + :rtype: ~azure.mgmt.storagecache.models.Cache :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Cache"] @@ -484,6 +523,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if cache is not None: @@ -495,6 +535,7 @@ async def update( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -502,7 +543,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -516,10 +561,10 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}"} # type: ignore - async def _debug_info_initial( + async def _debug_info_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -531,17 +576,24 @@ async def _debug_info_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_debug_info_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, template_url=self._debug_info_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -551,11 +603,11 @@ async def _debug_info_initial( if cls: return cls(pipeline_response, None, {}) - _debug_info_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo'} # type: ignore + _debug_info_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo"} # type: ignore @distributed_trace_async - async def begin_debug_info( + async def begin_debug_info( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -580,7 +632,8 @@ async def begin_debug_info( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -591,6 +644,7 @@ async def begin_debug_info( raw_result = await self._debug_info_initial( resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -611,12 +665,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_debug_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo'} # type: ignore + begin_debug_info.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo"} # type: ignore - async def _flush_initial( + async def _flush_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -628,17 +681,24 @@ async def _flush_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_flush_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, template_url=self._flush_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -648,11 +708,11 @@ async def _flush_initial( if cls: return cls(pipeline_response, None, {}) - _flush_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush'} # type: ignore + _flush_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush"} # type: ignore @distributed_trace_async - async def begin_flush( + async def begin_flush( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -678,7 +738,8 @@ async def begin_flush( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -689,6 +750,7 @@ async def begin_flush( raw_result = await self._flush_initial( resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -709,12 +771,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_flush.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush'} # type: ignore + begin_flush.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush"} # type: ignore - async def _start_initial( + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -726,17 +787,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -746,11 +814,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start"} # type: ignore @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -775,7 +843,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -786,6 +855,7 @@ async def begin_start( raw_result = await self._start_initial( resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -806,12 +876,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start'} # type: ignore + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start"} # type: ignore - async def _stop_initial( + async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -823,17 +892,24 @@ async def _stop_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_stop_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, template_url=self._stop_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -843,11 +919,11 @@ async def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( + async def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -872,7 +948,8 @@ async def begin_stop( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -883,6 +960,381 @@ async def begin_stop( raw_result = await self._stop_initial( resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop"} # type: ignore + + async def _start_priming_job_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + primingjob: Optional["_models.PrimingJob"] = 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 = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if primingjob is not None: + _json = self._serialize.body(primingjob, 'PrimingJob') + else: + _json = None + + request = build_start_priming_job_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._start_priming_job_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _start_priming_job_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/startPrimingJob"} # type: ignore + + + @distributed_trace_async + async def begin_start_priming_job( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + primingjob: Optional["_models.PrimingJob"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Create a priming job. This operation is only allowed when the cache is healthy. + + :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 primingjob: Object containing the definition of a priming job. Default value is None. + :type primingjob: ~azure.mgmt.storagecache.models.PrimingJob + :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 + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + 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._start_priming_job_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + primingjob=primingjob, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start_priming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/startPrimingJob"} # type: ignore + + async def _stop_priming_job_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + priming_job_id: Optional["_models.PrimingJobIdParameter"] = 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 = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if priming_job_id is not None: + _json = self._serialize.body(priming_job_id, 'PrimingJobIdParameter') + else: + _json = None + + request = build_stop_priming_job_request_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._stop_priming_job_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _stop_priming_job_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stopPrimingJob"} # type: ignore + + + @distributed_trace_async + async def begin_stop_priming_job( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + priming_job_id: Optional["_models.PrimingJobIdParameter"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Schedule a priming job for deletion. + + :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 priming_job_id: Object containing the priming job ID. Default value is None. + :type priming_job_id: ~azure.mgmt.storagecache.models.PrimingJobIdParameter + :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 + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + 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._stop_priming_job_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + priming_job_id=priming_job_id, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop_priming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stopPrimingJob"} # type: ignore + + async def _pause_priming_job_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + priming_job_id: Optional["_models.PrimingJobIdParameter"] = 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 = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if priming_job_id is not None: + _json = self._serialize.body(priming_job_id, 'PrimingJobIdParameter') + else: + _json = None + + request = build_pause_priming_job_request_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._pause_priming_job_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _pause_priming_job_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/pausePrimingJob"} # type: ignore + + + @distributed_trace_async + async def begin_pause_priming_job( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + priming_job_id: Optional["_models.PrimingJobIdParameter"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Schedule a priming job to be paused. + + :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 priming_job_id: Object containing the priming job ID. Default value is None. + :type priming_job_id: ~azure.mgmt.storagecache.models.PrimingJobIdParameter + :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 + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + 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._pause_priming_job_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + priming_job_id=priming_job_id, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) @@ -903,12 +1355,136 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_pause_priming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/pausePrimingJob"} # type: ignore + + async def _resume_priming_job_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + priming_job_id: Optional["_models.PrimingJobIdParameter"] = 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 = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if priming_job_id is not None: + _json = self._serialize.body(priming_job_id, 'PrimingJobIdParameter') else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + _json = None + + request = build_resume_priming_job_request_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._resume_priming_job_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _resume_priming_job_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/resumePrimingJob"} # type: ignore + + + @distributed_trace_async + async def begin_resume_priming_job( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + priming_job_id: Optional["_models.PrimingJobIdParameter"] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Resumes a paused priming job. + + :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 priming_job_id: Object containing the priming job ID. Default value is None. + :type priming_job_id: ~azure.mgmt.storagecache.models.PrimingJobIdParameter + :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 + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + 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_priming_job_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + priming_job_id=priming_job_id, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop'} # type: ignore - async def _upgrade_firmware_initial( + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resume_priming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/resumePrimingJob"} # type: ignore + + async def _upgrade_firmware_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -920,17 +1496,24 @@ async def _upgrade_firmware_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_upgrade_firmware_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, template_url=self._upgrade_firmware_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201, 202, 204]: @@ -940,11 +1523,11 @@ async def _upgrade_firmware_initial( if cls: return cls(pipeline_response, None, {}) - _upgrade_firmware_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade'} # type: ignore + _upgrade_firmware_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade"} # type: ignore @distributed_trace_async - async def begin_upgrade_firmware( + async def begin_upgrade_firmware( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -970,7 +1553,8 @@ async def begin_upgrade_firmware( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -981,6 +1565,7 @@ async def begin_upgrade_firmware( raw_result = await self._upgrade_firmware_initial( resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1001,7 +1586,131 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_upgrade_firmware.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade"} # type: ignore + + async def _space_allocation_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + space_allocation: Optional[List["_models.StorageTargetSpaceAllocation"]] = 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 = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if space_allocation is not None: + _json = self._serialize.body(space_allocation, '[StorageTargetSpaceAllocation]') else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + _json = None + + request = build_space_allocation_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._space_allocation_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _space_allocation_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/spaceAllocation"} # type: ignore + + + @distributed_trace_async + async def begin_space_allocation( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + space_allocation: Optional[List["_models.StorageTargetSpaceAllocation"]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update cache space allocation. + + :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 space_allocation: List containing storage target cache space percentage allocations. + Default value is None. + :type space_allocation: list[~azure.mgmt.storagecache.models.StorageTargetSpaceAllocation] + :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 + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + 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._space_allocation_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + space_allocation=space_allocation, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_firmware.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade'} # type: ignore + begin_space_allocation.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/spaceAllocation"} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_operations.py index bc85dfb0c674..b4cead5e8e15 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -31,7 +29,7 @@ class Operations: 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -57,9 +55,11 @@ def list( :return: An iterator like instance of either ApiOperationListResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.ApiOperationListResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagecache.models.ApiOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,7 +96,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.StorageCache/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.StorageCache/operations"} # type: ignore 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 31f0d09282ec..d8b92611e28e 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -31,7 +29,7 @@ class SkusOperations: 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -56,9 +54,11 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceSkusResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.ResourceSkusResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagecache.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -78,6 +79,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -95,7 +97,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,4 +114,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus"} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py index dcf0be5402b8..615404cb3ff1 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_storage_target_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -31,7 +30,7 @@ class StorageTargetOperations: 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -46,7 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _flush_initial( + async def _flush_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -59,18 +58,25 @@ async def _flush_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_flush_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, template_url=self._flush_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -80,11 +86,11 @@ async def _flush_initial( 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 + _flush_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush"} # type: ignore @distributed_trace_async - async def begin_flush( + async def begin_flush( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -114,7 +120,8 @@ async def begin_flush( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -126,6 +133,7 @@ async def begin_flush( resource_group_name=resource_group_name, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -146,12 +154,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_flush.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush"} # type: ignore - async def _suspend_initial( + async def _suspend_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -164,18 +171,25 @@ async def _suspend_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_suspend_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, template_url=self._suspend_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -185,11 +199,11 @@ async def _suspend_initial( 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 + _suspend_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend"} # type: ignore @distributed_trace_async - async def begin_suspend( + async def begin_suspend( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -217,7 +231,8 @@ async def begin_suspend( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -229,6 +244,7 @@ async def begin_suspend( resource_group_name=resource_group_name, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -249,12 +265,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_suspend.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend"} # type: ignore - async def _resume_initial( + async def _resume_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -267,18 +282,25 @@ async def _resume_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_resume_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, template_url=self._resume_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -288,11 +310,11 @@ async def _resume_initial( 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 + _resume_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume"} # type: ignore @distributed_trace_async - async def begin_resume( + async def begin_resume( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -320,7 +342,8 @@ async def begin_resume( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -332,6 +355,7 @@ async def begin_resume( resource_group_name=resource_group_name, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -352,12 +376,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_resume.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume"} # type: ignore - async def _invalidate_initial( + async def _invalidate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -370,18 +393,25 @@ async def _invalidate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_invalidate_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, template_url=self._invalidate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -391,11 +421,11 @@ async def _invalidate_initial( if cls: return cls(pipeline_response, None, {}) - _invalidate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate'} # type: ignore + _invalidate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate"} # type: ignore @distributed_trace_async - async def begin_invalidate( + async def begin_invalidate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -424,7 +454,8 @@ async def begin_invalidate( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -436,6 +467,7 @@ async def begin_invalidate( resource_group_name=resource_group_name, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -456,7 +488,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_invalidate.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate'} # type: ignore + begin_invalidate.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate"} # 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 cd67d08304a2..5f13f2d7dd62 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -33,7 +32,7 @@ class StorageTargetsOperations: 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -48,7 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _dns_refresh_initial( + async def _dns_refresh_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -61,18 +60,25 @@ async def _dns_refresh_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_dns_refresh_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, template_url=self._dns_refresh_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -82,11 +88,11 @@ async def _dns_refresh_initial( if cls: return cls(pipeline_response, None, {}) - _dns_refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh'} # type: ignore + _dns_refresh_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh"} # type: ignore @distributed_trace_async - async def begin_dns_refresh( + async def begin_dns_refresh( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -114,7 +120,8 @@ async def begin_dns_refresh( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -126,6 +133,7 @@ async def begin_dns_refresh( resource_group_name=resource_group_name, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -146,10 +154,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_dns_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh'} # type: ignore + begin_dns_refresh.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh"} # type: ignore @distributed_trace def list_by_cache( @@ -169,9 +176,11 @@ def list_by_cache( :return: An iterator like instance of either StorageTargetsResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.StorageTargetsResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagecache.models.StorageTargetsResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageTargetsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -184,6 +193,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, template_url=self.list_by_cache.metadata['url'], ) request = _convert_request(request) @@ -195,6 +205,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -212,7 +223,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -225,9 +240,9 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_cache.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets'} # type: ignore + list_by_cache.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -241,19 +256,26 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, force=force, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -263,11 +285,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -288,7 +310,8 @@ async def begin_delete( :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. + delete discards unwritten-data in the cache instead of flushing it to back-end storage. Default + value is None. :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. @@ -302,7 +325,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -315,6 +339,7 @@ async def begin_delete( cache_name=cache_name, storage_target_name=storage_target_name, force=force, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -335,10 +360,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}"} # type: ignore @distributed_trace_async async def get( @@ -359,7 +383,7 @@ async def get( :type storage_target_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageTarget, or the result of cls(response) - :rtype: ~storage_cache_management_client.models.StorageTarget + :rtype: ~azure.mgmt.storagecache.models.StorageTarget :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageTarget"] @@ -368,18 +392,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -393,7 +424,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}"} # type: ignore async def _create_or_update_initial( @@ -410,6 +441,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if storagetarget is not None: @@ -422,6 +454,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -429,7 +462,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -448,7 +485,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}"} # type: ignore @distributed_trace_async @@ -471,8 +508,9 @@ async def begin_create_or_update( :type cache_name: str :param storage_target_name: Name of Storage Target. :type storage_target_name: str - :param storagetarget: Object containing the definition of a Storage Target. - :type storagetarget: ~storage_cache_management_client.models.StorageTarget + :param storagetarget: Object containing the definition of a Storage Target. Default value is + None. + :type storagetarget: ~azure.mgmt.storagecache.models.StorageTarget :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -483,12 +521,12 @@ async def begin_create_or_update( Retry-After header is present. :return: An instance of AsyncLROPoller that returns either StorageTarget or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~storage_cache_management_client.models.StorageTarget] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storagecache.models.StorageTarget] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageTarget"] lro_delay = kwargs.pop( 'polling_interval', @@ -501,6 +539,7 @@ async def begin_create_or_update( cache_name=cache_name, storage_target_name=storage_target_name, storagetarget=storagetarget, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -525,7 +564,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}"} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_usage_models_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/aio/operations/_usage_models_operations.py index 1f3147c22440..601c04365774 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -31,7 +29,7 @@ class UsageModelsOperations: 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -56,9 +54,11 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageModelsResult or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~storage_cache_management_client.models.UsageModelsResult] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storagecache.models.UsageModelsResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageModelsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -78,6 +79,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -95,7 +97,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,4 +114,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels"} # type: ignore 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 c17a790454f7..dcfd6d38c759 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 @@ -22,6 +22,7 @@ from ._models_py3 import CacheNetworkSettings from ._models_py3 import CacheSecuritySettings from ._models_py3 import CacheSku +from ._models_py3 import CacheUpgradeSettings from ._models_py3 import CacheUpgradeStatus from ._models_py3 import CacheUsernameDownloadSettings from ._models_py3 import CacheUsernameDownloadSettingsCredentials @@ -32,12 +33,15 @@ from ._models_py3 import ErrorResponse from ._models_py3 import KeyVaultKeyReference from ._models_py3 import KeyVaultKeyReferenceSourceVault +from ._models_py3 import LogSpecification from ._models_py3 import MetricDimension from ._models_py3 import MetricSpecification from ._models_py3 import NamespaceJunction from ._models_py3 import Nfs3Target from ._models_py3 import NfsAccessPolicy from ._models_py3 import NfsAccessRule +from ._models_py3 import PrimingJob +from ._models_py3 import PrimingJobIdParameter from ._models_py3 import ResourceSku from ._models_py3 import ResourceSkuCapabilities from ._models_py3 import ResourceSkuLocationInfo @@ -48,6 +52,7 @@ from ._models_py3 import Restriction from ._models_py3 import StorageTarget from ._models_py3 import StorageTargetResource +from ._models_py3 import StorageTargetSpaceAllocation from ._models_py3 import StorageTargetsResult from ._models_py3 import SystemData from ._models_py3 import UnknownTarget @@ -67,6 +72,7 @@ NfsAccessRuleAccess, NfsAccessRuleScope, OperationalStateType, + PrimingJobState, ProvisioningStateType, ReasonCode, StorageTargetType, @@ -91,6 +97,7 @@ 'CacheNetworkSettings', 'CacheSecuritySettings', 'CacheSku', + 'CacheUpgradeSettings', 'CacheUpgradeStatus', 'CacheUsernameDownloadSettings', 'CacheUsernameDownloadSettingsCredentials', @@ -101,12 +108,15 @@ 'ErrorResponse', 'KeyVaultKeyReference', 'KeyVaultKeyReferenceSourceVault', + 'LogSpecification', 'MetricDimension', 'MetricSpecification', 'NamespaceJunction', 'Nfs3Target', 'NfsAccessPolicy', 'NfsAccessRule', + 'PrimingJob', + 'PrimingJobIdParameter', 'ResourceSku', 'ResourceSkuCapabilities', 'ResourceSkuLocationInfo', @@ -117,6 +127,7 @@ 'Restriction', 'StorageTarget', 'StorageTargetResource', + 'StorageTargetSpaceAllocation', 'StorageTargetsResult', 'SystemData', 'UnknownTarget', @@ -133,6 +144,7 @@ 'NfsAccessRuleAccess', 'NfsAccessRuleScope', 'OperationalStateType', + 'PrimingJobState', 'ProvisioningStateType', 'ReasonCode', 'StorageTargetType', 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 d4933930d112..ad670934c9cc 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 @@ -18,7 +18,7 @@ class ApiOperation(msrest.serialization.Model): """REST API operation description: see https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation. :ivar display: The object that represents the operation. - :vartype display: ~storage_cache_management_client.models.ApiOperationDisplay + :vartype display: ~azure.mgmt.storagecache.models.ApiOperationDisplay :ivar origin: Origin of the operation. :vartype origin: str :ivar is_data_action: The flag that indicates whether the operation applies to data plane. @@ -27,7 +27,7 @@ class ApiOperation(msrest.serialization.Model): :vartype name: str :ivar service_specification: Specification of the all the metrics provided for a resource type. :vartype service_specification: - ~storage_cache_management_client.models.ApiOperationPropertiesServiceSpecification + ~azure.mgmt.storagecache.models.ApiOperationPropertiesServiceSpecification """ _attribute_map = { @@ -50,7 +50,7 @@ def __init__( ): """ :keyword display: The object that represents the operation. - :paramtype display: ~storage_cache_management_client.models.ApiOperationDisplay + :paramtype display: ~azure.mgmt.storagecache.models.ApiOperationDisplay :keyword origin: Origin of the operation. :paramtype origin: str :keyword is_data_action: The flag that indicates whether the operation applies to data plane. @@ -60,7 +60,7 @@ def __init__( :keyword service_specification: Specification of the all the metrics provided for a resource type. :paramtype service_specification: - ~storage_cache_management_client.models.ApiOperationPropertiesServiceSpecification + ~azure.mgmt.storagecache.models.ApiOperationPropertiesServiceSpecification """ super(ApiOperation, self).__init__(**kwargs) self.display = display @@ -123,7 +123,7 @@ class ApiOperationListResult(msrest.serialization.Model): :vartype next_link: str :ivar value: List of Resource Provider operations supported by the Microsoft.StorageCache resource provider. - :vartype value: list[~storage_cache_management_client.models.ApiOperation] + :vartype value: list[~azure.mgmt.storagecache.models.ApiOperation] """ _attribute_map = { @@ -143,7 +143,7 @@ def __init__( :paramtype next_link: str :keyword value: List of Resource Provider operations supported by the Microsoft.StorageCache resource provider. - :paramtype value: list[~storage_cache_management_client.models.ApiOperation] + :paramtype value: list[~azure.mgmt.storagecache.models.ApiOperation] """ super(ApiOperationListResult, self).__init__(**kwargs) self.next_link = next_link @@ -154,27 +154,32 @@ class ApiOperationPropertiesServiceSpecification(msrest.serialization.Model): """Specification of the all the metrics provided for a resource type. :ivar metric_specifications: Details about operations related to metrics. - :vartype metric_specifications: - list[~storage_cache_management_client.models.MetricSpecification] + :vartype metric_specifications: list[~azure.mgmt.storagecache.models.MetricSpecification] + :ivar log_specifications: Details about operations related to logs. + :vartype log_specifications: list[~azure.mgmt.storagecache.models.LogSpecification] """ _attribute_map = { 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, } def __init__( self, *, metric_specifications: Optional[List["MetricSpecification"]] = None, + log_specifications: Optional[List["LogSpecification"]] = None, **kwargs ): """ :keyword metric_specifications: Details about operations related to metrics. - :paramtype metric_specifications: - list[~storage_cache_management_client.models.MetricSpecification] + :paramtype metric_specifications: list[~azure.mgmt.storagecache.models.MetricSpecification] + :keyword log_specifications: Details about operations related to logs. + :paramtype log_specifications: list[~azure.mgmt.storagecache.models.LogSpecification] """ super(ApiOperationPropertiesServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications + self.log_specifications = log_specifications class AscOperation(msrest.serialization.Model): @@ -191,7 +196,7 @@ class AscOperation(msrest.serialization.Model): :ivar status: The status of the operation. :vartype status: str :ivar error: The error detail of the operation if any. - :vartype error: ~storage_cache_management_client.models.ErrorResponse + :vartype error: ~azure.mgmt.storagecache.models.ErrorResponse :ivar output: Additional operation-specific output. :vartype output: dict[str, any] """ @@ -230,7 +235,7 @@ def __init__( :keyword status: The status of the operation. :paramtype status: str :keyword error: The error detail of the operation if any. - :paramtype error: ~storage_cache_management_client.models.ErrorResponse + :paramtype error: ~azure.mgmt.storagecache.models.ErrorResponse :keyword output: Additional operation-specific output. :paramtype output: dict[str, any] """ @@ -293,39 +298,44 @@ class Cache(msrest.serialization.Model): :ivar type: Type of the Cache; Microsoft.StorageCache/Cache. :vartype type: str :ivar identity: The identity of the cache, if configured. - :vartype identity: ~storage_cache_management_client.models.CacheIdentity + :vartype identity: ~azure.mgmt.storagecache.models.CacheIdentity :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~storage_cache_management_client.models.SystemData + :vartype system_data: ~azure.mgmt.storagecache.models.SystemData :ivar sku: SKU for the Cache. - :vartype sku: ~storage_cache_management_client.models.CacheSku + :vartype sku: ~azure.mgmt.storagecache.models.CacheSku :ivar cache_size_gb: The size of this Cache, in GB. :vartype cache_size_gb: int :ivar health: Health of the Cache. - :vartype health: ~storage_cache_management_client.models.CacheHealth + :vartype health: ~azure.mgmt.storagecache.models.CacheHealth :ivar mount_addresses: Array of IP addresses that can be used by clients mounting this Cache. :vartype mount_addresses: list[str] :ivar provisioning_state: ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", "Updating". - :vartype provisioning_state: str or - ~storage_cache_management_client.models.ProvisioningStateType + :vartype provisioning_state: str or ~azure.mgmt.storagecache.models.ProvisioningStateType :ivar subnet: Subnet used for the Cache. :vartype subnet: str :ivar upgrade_status: Upgrade status of the Cache. - :vartype upgrade_status: ~storage_cache_management_client.models.CacheUpgradeStatus + :vartype upgrade_status: ~azure.mgmt.storagecache.models.CacheUpgradeStatus + :ivar upgrade_settings: Upgrade settings of the Cache. + :vartype upgrade_settings: ~azure.mgmt.storagecache.models.CacheUpgradeSettings :ivar network_settings: Specifies network settings of the cache. - :vartype network_settings: ~storage_cache_management_client.models.CacheNetworkSettings + :vartype network_settings: ~azure.mgmt.storagecache.models.CacheNetworkSettings :ivar encryption_settings: Specifies encryption settings of the cache. - :vartype encryption_settings: ~storage_cache_management_client.models.CacheEncryptionSettings + :vartype encryption_settings: ~azure.mgmt.storagecache.models.CacheEncryptionSettings :ivar security_settings: Specifies security settings of the cache. - :vartype security_settings: ~storage_cache_management_client.models.CacheSecuritySettings + :vartype security_settings: ~azure.mgmt.storagecache.models.CacheSecuritySettings :ivar directory_services_settings: Specifies Directory Services settings of the cache. - :vartype directory_services_settings: - ~storage_cache_management_client.models.CacheDirectorySettings + :vartype directory_services_settings: ~azure.mgmt.storagecache.models.CacheDirectorySettings :ivar zones: Availability zones for resources. This field should only contain a single element in the array. :vartype zones: list[str] + :ivar priming_jobs: Specifies the priming jobs defined in the cache. + :vartype priming_jobs: list[~azure.mgmt.storagecache.models.PrimingJob] + :ivar space_allocation: Specifies the space allocation percentage for each storage target in + the cache. + :vartype space_allocation: list[~azure.mgmt.storagecache.models.StorageTargetSpaceAllocation] """ _validation = { @@ -337,6 +347,8 @@ class Cache(msrest.serialization.Model): 'mount_addresses': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'upgrade_status': {'readonly': True}, + 'priming_jobs': {'readonly': True}, + 'space_allocation': {'readonly': True}, } _attribute_map = { @@ -354,11 +366,14 @@ class Cache(msrest.serialization.Model): 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'subnet': {'key': 'properties.subnet', 'type': 'str'}, 'upgrade_status': {'key': 'properties.upgradeStatus', 'type': 'CacheUpgradeStatus'}, + 'upgrade_settings': {'key': 'properties.upgradeSettings', 'type': 'CacheUpgradeSettings'}, 'network_settings': {'key': 'properties.networkSettings', 'type': 'CacheNetworkSettings'}, 'encryption_settings': {'key': 'properties.encryptionSettings', 'type': 'CacheEncryptionSettings'}, 'security_settings': {'key': 'properties.securitySettings', 'type': 'CacheSecuritySettings'}, 'directory_services_settings': {'key': 'properties.directoryServicesSettings', 'type': 'CacheDirectorySettings'}, 'zones': {'key': 'properties.zones', 'type': '[str]'}, + 'priming_jobs': {'key': 'properties.primingJobs', 'type': '[PrimingJob]'}, + 'space_allocation': {'key': 'properties.spaceAllocation', 'type': '[StorageTargetSpaceAllocation]'}, } def __init__( @@ -370,6 +385,7 @@ def __init__( sku: Optional["CacheSku"] = None, cache_size_gb: Optional[int] = None, subnet: Optional[str] = None, + upgrade_settings: Optional["CacheUpgradeSettings"] = None, network_settings: Optional["CacheNetworkSettings"] = None, encryption_settings: Optional["CacheEncryptionSettings"] = None, security_settings: Optional["CacheSecuritySettings"] = None, @@ -383,22 +399,23 @@ def __init__( :keyword location: Region name string. :paramtype location: str :keyword identity: The identity of the cache, if configured. - :paramtype identity: ~storage_cache_management_client.models.CacheIdentity + :paramtype identity: ~azure.mgmt.storagecache.models.CacheIdentity :keyword sku: SKU for the Cache. - :paramtype sku: ~storage_cache_management_client.models.CacheSku + :paramtype sku: ~azure.mgmt.storagecache.models.CacheSku :keyword cache_size_gb: The size of this Cache, in GB. :paramtype cache_size_gb: int :keyword subnet: Subnet used for the Cache. :paramtype subnet: str + :keyword upgrade_settings: Upgrade settings of the Cache. + :paramtype upgrade_settings: ~azure.mgmt.storagecache.models.CacheUpgradeSettings :keyword network_settings: Specifies network settings of the cache. - :paramtype network_settings: ~storage_cache_management_client.models.CacheNetworkSettings + :paramtype network_settings: ~azure.mgmt.storagecache.models.CacheNetworkSettings :keyword encryption_settings: Specifies encryption settings of the cache. - :paramtype encryption_settings: ~storage_cache_management_client.models.CacheEncryptionSettings + :paramtype encryption_settings: ~azure.mgmt.storagecache.models.CacheEncryptionSettings :keyword security_settings: Specifies security settings of the cache. - :paramtype security_settings: ~storage_cache_management_client.models.CacheSecuritySettings + :paramtype security_settings: ~azure.mgmt.storagecache.models.CacheSecuritySettings :keyword directory_services_settings: Specifies Directory Services settings of the cache. - :paramtype directory_services_settings: - ~storage_cache_management_client.models.CacheDirectorySettings + :paramtype directory_services_settings: ~azure.mgmt.storagecache.models.CacheDirectorySettings :keyword zones: Availability zones for resources. This field should only contain a single element in the array. :paramtype zones: list[str] @@ -418,11 +435,14 @@ def __init__( self.provisioning_state = None self.subnet = subnet self.upgrade_status = None + self.upgrade_settings = upgrade_settings self.network_settings = network_settings self.encryption_settings = encryption_settings self.security_settings = security_settings self.directory_services_settings = directory_services_settings self.zones = zones + self.priming_jobs = None + self.space_allocation = None class CacheActiveDirectorySettings(msrest.serialization.Model): @@ -449,10 +469,9 @@ class CacheActiveDirectorySettings(msrest.serialization.Model): :vartype cache_net_bios_name: str :ivar domain_joined: True if the HPC Cache is joined to the Active Directory domain. Possible values include: "Yes", "No", "Error". - :vartype domain_joined: str or ~storage_cache_management_client.models.DomainJoinedType + :vartype domain_joined: str or ~azure.mgmt.storagecache.models.DomainJoinedType :ivar credentials: Active Directory admin credentials used to join the HPC Cache to a domain. - :vartype credentials: - ~storage_cache_management_client.models.CacheActiveDirectorySettingsCredentials + :vartype credentials: ~azure.mgmt.storagecache.models.CacheActiveDirectorySettingsCredentials """ _validation = { @@ -502,8 +521,7 @@ def __init__( :paramtype cache_net_bios_name: str :keyword credentials: Active Directory admin credentials used to join the HPC Cache to a domain. - :paramtype credentials: - ~storage_cache_management_client.models.CacheActiveDirectorySettingsCredentials + :paramtype credentials: ~azure.mgmt.storagecache.models.CacheActiveDirectorySettingsCredentials """ super(CacheActiveDirectorySettings, self).__init__(**kwargs) self.primary_dns_ip_address = primary_dns_ip_address @@ -563,11 +581,10 @@ class CacheDirectorySettings(msrest.serialization.Model): :ivar active_directory: Specifies settings for joining the HPC Cache to an Active Directory domain. - :vartype active_directory: ~storage_cache_management_client.models.CacheActiveDirectorySettings + :vartype active_directory: ~azure.mgmt.storagecache.models.CacheActiveDirectorySettings :ivar username_download: Specifies settings for Extended Groups. Extended Groups allows users to be members of more than 16 groups. - :vartype username_download: - ~storage_cache_management_client.models.CacheUsernameDownloadSettings + :vartype username_download: ~azure.mgmt.storagecache.models.CacheUsernameDownloadSettings """ _attribute_map = { @@ -585,12 +602,10 @@ def __init__( """ :keyword active_directory: Specifies settings for joining the HPC Cache to an Active Directory domain. - :paramtype active_directory: - ~storage_cache_management_client.models.CacheActiveDirectorySettings + :paramtype active_directory: ~azure.mgmt.storagecache.models.CacheActiveDirectorySettings :keyword username_download: Specifies settings for Extended Groups. Extended Groups allows users to be members of more than 16 groups. - :paramtype username_download: - ~storage_cache_management_client.models.CacheUsernameDownloadSettings + :paramtype username_download: ~azure.mgmt.storagecache.models.CacheUsernameDownloadSettings """ super(CacheDirectorySettings, self).__init__(**kwargs) self.active_directory = active_directory @@ -601,7 +616,7 @@ class CacheEncryptionSettings(msrest.serialization.Model): """Cache encryption settings. :ivar key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :vartype key_encryption_key: ~storage_cache_management_client.models.KeyVaultKeyReference + :vartype key_encryption_key: ~azure.mgmt.storagecache.models.KeyVaultKeyReference :ivar rotation_to_latest_key_version_enabled: Specifies whether the service will automatically rotate to the newest version of the key in the Key Vault. :vartype rotation_to_latest_key_version_enabled: bool @@ -621,7 +636,7 @@ def __init__( ): """ :keyword key_encryption_key: Specifies the location of the key encryption key in Key Vault. - :paramtype key_encryption_key: ~storage_cache_management_client.models.KeyVaultKeyReference + :paramtype key_encryption_key: ~azure.mgmt.storagecache.models.KeyVaultKeyReference :keyword rotation_to_latest_key_version_enabled: Specifies whether the service will automatically rotate to the newest version of the key in the Key Vault. :paramtype rotation_to_latest_key_version_enabled: bool @@ -637,12 +652,13 @@ class CacheHealth(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar state: List of Cache health states. Possible values include: "Unknown", "Healthy", - "Degraded", "Down", "Transitioning", "Stopping", "Stopped", "Upgrading", "Flushing". - :vartype state: str or ~storage_cache_management_client.models.HealthStateType + "Degraded", "Down", "Transitioning", "Stopping", "Stopped", "Upgrading", "Flushing", + "WaitingForKey", "StartFailed", "UpgradeFailed". + :vartype state: str or ~azure.mgmt.storagecache.models.HealthStateType :ivar status_description: Describes explanation of state. :vartype status_description: str :ivar conditions: Outstanding conditions that need to be investigated and resolved. - :vartype conditions: list[~storage_cache_management_client.models.Condition] + :vartype conditions: list[~azure.mgmt.storagecache.models.Condition] """ _validation = { @@ -664,8 +680,9 @@ def __init__( ): """ :keyword state: List of Cache health states. Possible values include: "Unknown", "Healthy", - "Degraded", "Down", "Transitioning", "Stopping", "Stopped", "Upgrading", "Flushing". - :paramtype state: str or ~storage_cache_management_client.models.HealthStateType + "Degraded", "Down", "Transitioning", "Stopping", "Stopped", "Upgrading", "Flushing", + "WaitingForKey", "StartFailed", "UpgradeFailed". + :paramtype state: str or ~azure.mgmt.storagecache.models.HealthStateType :keyword status_description: Describes explanation of state. :paramtype status_description: str """ @@ -686,11 +703,11 @@ class CacheIdentity(msrest.serialization.Model): :vartype tenant_id: str :ivar type: The type of identity used for the cache. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :vartype type: str or ~storage_cache_management_client.models.CacheIdentityType + :vartype type: str or ~azure.mgmt.storagecache.models.CacheIdentityType :ivar user_assigned_identities: A dictionary where each key is a user assigned identity resource ID, and each key's value is an empty dictionary. :vartype user_assigned_identities: dict[str, - ~storage_cache_management_client.models.UserAssignedIdentitiesValue] + ~azure.mgmt.storagecache.models.UserAssignedIdentitiesValue] """ _validation = { @@ -715,11 +732,11 @@ def __init__( """ :keyword type: The type of identity used for the cache. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :paramtype type: str or ~storage_cache_management_client.models.CacheIdentityType + :paramtype type: str or ~azure.mgmt.storagecache.models.CacheIdentityType :keyword user_assigned_identities: A dictionary where each key is a user assigned identity resource ID, and each key's value is an empty dictionary. :paramtype user_assigned_identities: dict[str, - ~storage_cache_management_client.models.UserAssignedIdentitiesValue] + ~azure.mgmt.storagecache.models.UserAssignedIdentitiesValue] """ super(CacheIdentity, self).__init__(**kwargs) self.principal_id = None @@ -793,7 +810,7 @@ class CacheSecuritySettings(msrest.serialization.Model): """Cache security settings. :ivar access_policies: NFS access policies defined for this cache. - :vartype access_policies: list[~storage_cache_management_client.models.NfsAccessPolicy] + :vartype access_policies: list[~azure.mgmt.storagecache.models.NfsAccessPolicy] """ _attribute_map = { @@ -808,7 +825,7 @@ def __init__( ): """ :keyword access_policies: NFS access policies defined for this cache. - :paramtype access_policies: list[~storage_cache_management_client.models.NfsAccessPolicy] + :paramtype access_policies: list[~azure.mgmt.storagecache.models.NfsAccessPolicy] """ super(CacheSecuritySettings, self).__init__(**kwargs) self.access_policies = access_policies @@ -845,7 +862,7 @@ class CachesListResult(msrest.serialization.Model): :ivar next_link: URL to get the next set of Cache list results, if there are any. :vartype next_link: str :ivar value: List of Caches. - :vartype value: list[~storage_cache_management_client.models.Cache] + :vartype value: list[~azure.mgmt.storagecache.models.Cache] """ _attribute_map = { @@ -864,13 +881,53 @@ def __init__( :keyword next_link: URL to get the next set of Cache list results, if there are any. :paramtype next_link: str :keyword value: List of Caches. - :paramtype value: list[~storage_cache_management_client.models.Cache] + :paramtype value: list[~azure.mgmt.storagecache.models.Cache] """ super(CachesListResult, self).__init__(**kwargs) self.next_link = next_link self.value = value +class CacheUpgradeSettings(msrest.serialization.Model): + """Cache Upgrade Settings. + + :ivar upgrade_schedule_enabled: True if the user chooses to select an installation time between + now and firmwareUpdateDeadline. Else the firmware will automatically be installed after + firmwareUpdateDeadline if not triggered earlier via the upgrade operation. + :vartype upgrade_schedule_enabled: bool + :ivar scheduled_time: When upgradeScheduleEnabled is true, this field holds the user-chosen + upgrade time. At the user-chosen time, the firmware update will automatically be installed on + the cache. + :vartype scheduled_time: ~datetime.datetime + """ + + _attribute_map = { + 'upgrade_schedule_enabled': {'key': 'upgradeScheduleEnabled', 'type': 'bool'}, + 'scheduled_time': {'key': 'scheduledTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + upgrade_schedule_enabled: Optional[bool] = None, + scheduled_time: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword upgrade_schedule_enabled: True if the user chooses to select an installation time + between now and firmwareUpdateDeadline. Else the firmware will automatically be installed after + firmwareUpdateDeadline if not triggered earlier via the upgrade operation. + :paramtype upgrade_schedule_enabled: bool + :keyword scheduled_time: When upgradeScheduleEnabled is true, this field holds the user-chosen + upgrade time. At the user-chosen time, the firmware update will automatically be installed on + the cache. + :paramtype scheduled_time: ~datetime.datetime + """ + super(CacheUpgradeSettings, self).__init__(**kwargs) + self.upgrade_schedule_enabled = upgrade_schedule_enabled + self.scheduled_time = scheduled_time + + class CacheUpgradeStatus(msrest.serialization.Model): """Properties describing the software upgrade state of the Cache. @@ -883,8 +940,7 @@ class CacheUpgradeStatus(msrest.serialization.Model): Cache. The firmware will automatically be installed after firmwareUpdateDeadline if not triggered earlier via the upgrade operation. Possible values include: "available", "unavailable". - :vartype firmware_update_status: str or - ~storage_cache_management_client.models.FirmwareStatusType + :vartype firmware_update_status: str or ~azure.mgmt.storagecache.models.FirmwareStatusType :ivar firmware_update_deadline: Time at which the pending firmware update will automatically be installed on the Cache. :vartype firmware_update_deadline: ~datetime.datetime @@ -934,7 +990,7 @@ class CacheUsernameDownloadSettings(msrest.serialization.Model): :vartype extended_groups: bool :ivar username_source: This setting determines how the cache gets username and group names for clients. Possible values include: "AD", "LDAP", "File", "None". Default value: "None". - :vartype username_source: str or ~storage_cache_management_client.models.UsernameSource + :vartype username_source: str or ~azure.mgmt.storagecache.models.UsernameSource :ivar group_file_uri: The URI of the file containing group information (in /etc/group file format). This field must be populated when 'usernameSource' is set to 'File'. :vartype group_file_uri: str @@ -958,11 +1014,9 @@ class CacheUsernameDownloadSettings(msrest.serialization.Model): :vartype ca_certificate_uri: str :ivar username_downloaded: Indicates whether or not the HPC Cache has performed the username download successfully. Possible values include: "Yes", "No", "Error". - :vartype username_downloaded: str or - ~storage_cache_management_client.models.UsernameDownloadedType + :vartype username_downloaded: str or ~azure.mgmt.storagecache.models.UsernameDownloadedType :ivar credentials: When present, these are the credentials for the secure LDAP connection. - :vartype credentials: - ~storage_cache_management_client.models.CacheUsernameDownloadSettingsCredentials + :vartype credentials: ~azure.mgmt.storagecache.models.CacheUsernameDownloadSettingsCredentials """ _validation = { @@ -1005,7 +1059,7 @@ def __init__( :paramtype extended_groups: bool :keyword username_source: This setting determines how the cache gets username and group names for clients. Possible values include: "AD", "LDAP", "File", "None". Default value: "None". - :paramtype username_source: str or ~storage_cache_management_client.models.UsernameSource + :paramtype username_source: str or ~azure.mgmt.storagecache.models.UsernameSource :keyword group_file_uri: The URI of the file containing group information (in /etc/group file format). This field must be populated when 'usernameSource' is set to 'File'. :paramtype group_file_uri: str @@ -1029,7 +1083,7 @@ def __init__( :paramtype ca_certificate_uri: str :keyword credentials: When present, these are the credentials for the secure LDAP connection. :paramtype credentials: - ~storage_cache_management_client.models.CacheUsernameDownloadSettingsCredentials + ~azure.mgmt.storagecache.models.CacheUsernameDownloadSettingsCredentials """ super(CacheUsernameDownloadSettings, self).__init__(**kwargs) self.extended_groups = extended_groups @@ -1114,7 +1168,7 @@ class CloudErrorBody(msrest.serialization.Model): programmatically. :vartype code: str :ivar details: A list of additional details about the error. - :vartype details: list[~storage_cache_management_client.models.CloudErrorBody] + :vartype details: list[~azure.mgmt.storagecache.models.CloudErrorBody] :ivar message: A message describing the error, intended to be suitable for display in a user interface. :vartype message: str @@ -1144,7 +1198,7 @@ def __init__( programmatically. :paramtype code: str :keyword details: A list of additional details about the error. - :paramtype details: list[~storage_cache_management_client.models.CloudErrorBody] + :paramtype details: list[~azure.mgmt.storagecache.models.CloudErrorBody] :keyword message: A message describing the error, intended to be suitable for display in a user interface. :paramtype message: str @@ -1231,7 +1285,7 @@ class KeyVaultKeyReference(msrest.serialization.Model): :ivar key_url: Required. The URL referencing a key encryption key in Key Vault. :vartype key_url: str :ivar source_vault: Required. Describes a resource Id to source Key Vault. - :vartype source_vault: ~storage_cache_management_client.models.KeyVaultKeyReferenceSourceVault + :vartype source_vault: ~azure.mgmt.storagecache.models.KeyVaultKeyReferenceSourceVault """ _validation = { @@ -1255,8 +1309,7 @@ def __init__( :keyword key_url: Required. The URL referencing a key encryption key in Key Vault. :paramtype key_url: str :keyword source_vault: Required. Describes a resource Id to source Key Vault. - :paramtype source_vault: - ~storage_cache_management_client.models.KeyVaultKeyReferenceSourceVault + :paramtype source_vault: ~azure.mgmt.storagecache.models.KeyVaultKeyReferenceSourceVault """ super(KeyVaultKeyReference, self).__init__(**kwargs) self.key_url = key_url @@ -1288,6 +1341,38 @@ def __init__( self.id = id +class LogSpecification(msrest.serialization.Model): + """Details about operation related to logs. + + :ivar name: The name of the log. + :vartype name: str + :ivar display_name: Localized display name of the log. + :vartype display_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name of the log. + :paramtype name: str + :keyword display_name: Localized display name of the log. + :paramtype display_name: str + """ + super(LogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + + class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. @@ -1349,11 +1434,11 @@ class MetricSpecification(msrest.serialization.Model): :vartype aggregation_type: str :ivar supported_aggregation_types: Support metric aggregation type. :vartype supported_aggregation_types: list[str or - ~storage_cache_management_client.models.MetricAggregationType] + ~azure.mgmt.storagecache.models.MetricAggregationType] :ivar metric_class: Type of metrics. :vartype metric_class: str :ivar dimensions: Dimensions of the metric. - :vartype dimensions: list[~storage_cache_management_client.models.MetricDimension] + :vartype dimensions: list[~azure.mgmt.storagecache.models.MetricDimension] """ _attribute_map = { @@ -1393,11 +1478,11 @@ def __init__( :paramtype aggregation_type: str :keyword supported_aggregation_types: Support metric aggregation type. :paramtype supported_aggregation_types: list[str or - ~storage_cache_management_client.models.MetricAggregationType] + ~azure.mgmt.storagecache.models.MetricAggregationType] :keyword metric_class: Type of metrics. :paramtype metric_class: str :keyword dimensions: Dimensions of the metric. - :paramtype dimensions: list[~storage_cache_management_client.models.MetricDimension] + :paramtype dimensions: list[~azure.mgmt.storagecache.models.MetricDimension] """ super(MetricSpecification, self).__init__(**kwargs) self.name = name @@ -1502,7 +1587,7 @@ class NfsAccessPolicy(msrest.serialization.Model): :vartype name: str :ivar access_rules: Required. The set of rules describing client accesses allowed under this policy. - :vartype access_rules: list[~storage_cache_management_client.models.NfsAccessRule] + :vartype access_rules: list[~azure.mgmt.storagecache.models.NfsAccessRule] """ _validation = { @@ -1528,7 +1613,7 @@ def __init__( :paramtype name: str :keyword access_rules: Required. The set of rules describing client accesses allowed under this policy. - :paramtype access_rules: list[~storage_cache_management_client.models.NfsAccessRule] + :paramtype access_rules: list[~azure.mgmt.storagecache.models.NfsAccessRule] """ super(NfsAccessPolicy, self).__init__(**kwargs) self.name = name @@ -1542,7 +1627,7 @@ class NfsAccessRule(msrest.serialization.Model): :ivar scope: Required. Scope for this rule. The scope and filter determine which clients match the rule. Possible values include: "default", "network", "host". - :vartype scope: str or ~storage_cache_management_client.models.NfsAccessRuleScope + :vartype scope: str or ~azure.mgmt.storagecache.models.NfsAccessRuleScope :ivar filter: Filter applied to the scope for this rule. The filter's format depends on its scope. 'default' scope matches all clients and has no filter value. 'network' scope takes a filter in CIDR format (for example, 10.99.1.0/24). 'host' takes an IP address or fully @@ -1550,7 +1635,7 @@ class NfsAccessRule(msrest.serialization.Model): default rule, access is denied. :vartype filter: str :ivar access: Required. Access allowed by this rule. Possible values include: "no", "ro", "rw". - :vartype access: str or ~storage_cache_management_client.models.NfsAccessRuleAccess + :vartype access: str or ~azure.mgmt.storagecache.models.NfsAccessRuleAccess :ivar suid: Allow SUID semantics. :vartype suid: bool :ivar submount_access: For the default policy, allow access to subdirectories under the root @@ -1599,7 +1684,7 @@ def __init__( """ :keyword scope: Required. Scope for this rule. The scope and filter determine which clients match the rule. Possible values include: "default", "network", "host". - :paramtype scope: str or ~storage_cache_management_client.models.NfsAccessRuleScope + :paramtype scope: str or ~azure.mgmt.storagecache.models.NfsAccessRuleScope :keyword filter: Filter applied to the scope for this rule. The filter's format depends on its scope. 'default' scope matches all clients and has no filter value. 'network' scope takes a filter in CIDR format (for example, 10.99.1.0/24). 'host' takes an IP address or fully @@ -1608,7 +1693,7 @@ def __init__( :paramtype filter: str :keyword access: Required. Access allowed by this rule. Possible values include: "no", "ro", "rw". - :paramtype access: str or ~storage_cache_management_client.models.NfsAccessRuleAccess + :paramtype access: str or ~azure.mgmt.storagecache.models.NfsAccessRuleAccess :keyword suid: Allow SUID semantics. :paramtype suid: bool :keyword submount_access: For the default policy, allow access to subdirectories under the root @@ -1635,6 +1720,108 @@ def __init__( self.anonymous_gid = anonymous_gid +class PrimingJob(msrest.serialization.Model): + """A priming job instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar priming_job_name: Required. The priming job name. + :vartype priming_job_name: str + :ivar priming_manifest_url: Required. The URL for the priming manifest file to download. This + file must be readable from the HPC Cache. When the file is in Azure blob storage the URL should + include a Shared Access Signature (SAS) granting read permissions on the blob. + :vartype priming_manifest_url: str + :ivar priming_job_id: The unique identifier of the priming job. + :vartype priming_job_id: str + :ivar priming_job_state: The state of the priming operation. Possible values include: "Queued", + "Running", "Paused", "Complete". + :vartype priming_job_state: str or ~azure.mgmt.storagecache.models.PrimingJobState + :ivar priming_job_status: The status code of the priming job. + :vartype priming_job_status: str + :ivar priming_job_details: The job details or error information if any. + :vartype priming_job_details: str + :ivar priming_job_percent_complete: The current progress of the priming job, as a percentage. + :vartype priming_job_percent_complete: float + """ + + _validation = { + 'priming_job_name': {'required': True, 'pattern': r'^[-0-9a-zA-Z_]{1,80}$'}, + 'priming_manifest_url': {'required': True}, + 'priming_job_id': {'readonly': True, 'pattern': r'^[-0-9a-zA-Z_]{1,80}$'}, + 'priming_job_state': {'readonly': True}, + 'priming_job_status': {'readonly': True}, + 'priming_job_details': {'readonly': True}, + 'priming_job_percent_complete': {'readonly': True, 'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'priming_job_name': {'key': 'primingJobName', 'type': 'str'}, + 'priming_manifest_url': {'key': 'primingManifestUrl', 'type': 'str'}, + 'priming_job_id': {'key': 'primingJobId', 'type': 'str'}, + 'priming_job_state': {'key': 'primingJobState', 'type': 'str'}, + 'priming_job_status': {'key': 'primingJobStatus', 'type': 'str'}, + 'priming_job_details': {'key': 'primingJobDetails', 'type': 'str'}, + 'priming_job_percent_complete': {'key': 'primingJobPercentComplete', 'type': 'float'}, + } + + def __init__( + self, + *, + priming_job_name: str, + priming_manifest_url: str, + **kwargs + ): + """ + :keyword priming_job_name: Required. The priming job name. + :paramtype priming_job_name: str + :keyword priming_manifest_url: Required. The URL for the priming manifest file to download. + This file must be readable from the HPC Cache. When the file is in Azure blob storage the URL + should include a Shared Access Signature (SAS) granting read permissions on the blob. + :paramtype priming_manifest_url: str + """ + super(PrimingJob, self).__init__(**kwargs) + self.priming_job_name = priming_job_name + self.priming_manifest_url = priming_manifest_url + self.priming_job_id = None + self.priming_job_state = None + self.priming_job_status = None + self.priming_job_details = None + self.priming_job_percent_complete = None + + +class PrimingJobIdParameter(msrest.serialization.Model): + """Object containing the priming job ID. + + All required parameters must be populated in order to send to Azure. + + :ivar priming_job_id: Required. The unique identifier of the priming job. + :vartype priming_job_id: str + """ + + _validation = { + 'priming_job_id': {'required': True, 'pattern': r'^[-0-9a-zA-Z_]{1,80}$'}, + } + + _attribute_map = { + 'priming_job_id': {'key': 'primingJobId', 'type': 'str'}, + } + + def __init__( + self, + *, + priming_job_id: str, + **kwargs + ): + """ + :keyword priming_job_id: Required. The unique identifier of the priming job. + :paramtype priming_job_id: str + """ + super(PrimingJobIdParameter, self).__init__(**kwargs) + self.priming_job_id = priming_job_id + + class ResourceSku(msrest.serialization.Model): """A resource SKU. @@ -1643,17 +1830,17 @@ class ResourceSku(msrest.serialization.Model): :ivar resource_type: The type of resource the SKU applies to. :vartype resource_type: str :ivar capabilities: A list of capabilities of this SKU, such as throughput or ops/sec. - :vartype capabilities: list[~storage_cache_management_client.models.ResourceSkuCapabilities] + :vartype capabilities: list[~azure.mgmt.storagecache.models.ResourceSkuCapabilities] :ivar locations: The set of locations where the SKU is available. This is the supported and registered Azure Geo Regions (e.g., West US, East US, Southeast Asia, etc.). :vartype locations: list[str] :ivar location_info: The set of locations where the SKU is available. - :vartype location_info: list[~storage_cache_management_client.models.ResourceSkuLocationInfo] + :vartype location_info: list[~azure.mgmt.storagecache.models.ResourceSkuLocationInfo] :ivar name: The name of this SKU. :vartype name: str :ivar restrictions: The restrictions preventing this SKU from being used. This is empty if there are no restrictions. - :vartype restrictions: list[~storage_cache_management_client.models.Restriction] + :vartype restrictions: list[~azure.mgmt.storagecache.models.Restriction] """ _validation = { @@ -1681,14 +1868,14 @@ def __init__( ): """ :keyword capabilities: A list of capabilities of this SKU, such as throughput or ops/sec. - :paramtype capabilities: list[~storage_cache_management_client.models.ResourceSkuCapabilities] + :paramtype capabilities: list[~azure.mgmt.storagecache.models.ResourceSkuCapabilities] :keyword location_info: The set of locations where the SKU is available. - :paramtype location_info: list[~storage_cache_management_client.models.ResourceSkuLocationInfo] + :paramtype location_info: list[~azure.mgmt.storagecache.models.ResourceSkuLocationInfo] :keyword name: The name of this SKU. :paramtype name: str :keyword restrictions: The restrictions preventing this SKU from being used. This is empty if there are no restrictions. - :paramtype restrictions: list[~storage_cache_management_client.models.Restriction] + :paramtype restrictions: list[~azure.mgmt.storagecache.models.Restriction] """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = None @@ -1771,7 +1958,7 @@ class ResourceSkusResult(msrest.serialization.Model): :ivar next_link: The URI to fetch the next page of Cache SKUs. :vartype next_link: str :ivar value: The list of SKUs available for the subscription. - :vartype value: list[~storage_cache_management_client.models.ResourceSku] + :vartype value: list[~azure.mgmt.storagecache.models.ResourceSku] """ _validation = { @@ -1810,7 +1997,7 @@ class ResourceUsage(msrest.serialization.Model): :ivar current_value: The current usage of this resource. :vartype current_value: int :ivar name: Naming information for this resource type. - :vartype name: ~storage_cache_management_client.models.ResourceUsageName + :vartype name: ~azure.mgmt.storagecache.models.ResourceUsageName """ _validation = { @@ -1881,7 +2068,7 @@ class ResourceUsagesListResult(msrest.serialization.Model): :vartype next_link: str :ivar value: List of usages and limits for resources controlled by the Microsoft.StorageCache resource provider. - :vartype value: list[~storage_cache_management_client.models.ResourceUsage] + :vartype value: list[~azure.mgmt.storagecache.models.ResourceUsage] """ _validation = { @@ -1920,7 +2107,7 @@ class Restriction(msrest.serialization.Model): "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. "NotAvailableForSubscription" is related to capacity at the datacenter. Possible values include: "QuotaId", "NotAvailableForSubscription". - :vartype reason_code: str or ~storage_cache_management_client.models.ReasonCode + :vartype reason_code: str or ~azure.mgmt.storagecache.models.ReasonCode """ _validation = { @@ -1945,7 +2132,7 @@ def __init__( "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. "NotAvailableForSubscription" is related to capacity at the datacenter. Possible values include: "QuotaId", "NotAvailableForSubscription". - :paramtype reason_code: str or ~storage_cache_management_client.models.ReasonCode + :paramtype reason_code: str or ~azure.mgmt.storagecache.models.ReasonCode """ super(Restriction, self).__init__(**kwargs) self.type = None @@ -1967,7 +2154,7 @@ class StorageTargetResource(msrest.serialization.Model): :ivar location: Region name string. :vartype location: str :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~storage_cache_management_client.models.SystemData + :vartype system_data: ~azure.mgmt.storagecache.models.SystemData """ _validation = { @@ -2014,29 +2201,30 @@ class StorageTarget(StorageTargetResource): :ivar location: Region name string. :vartype location: str :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~storage_cache_management_client.models.SystemData + :vartype system_data: ~azure.mgmt.storagecache.models.SystemData :ivar junctions: List of Cache namespace junctions to target for namespace associations. - :vartype junctions: list[~storage_cache_management_client.models.NamespaceJunction] + :vartype junctions: list[~azure.mgmt.storagecache.models.NamespaceJunction] :ivar target_type: Type of the Storage Target. Possible values include: "nfs3", "clfs", "unknown", "blobNfs". - :vartype target_type: str or ~storage_cache_management_client.models.StorageTargetType + :vartype target_type: str or ~azure.mgmt.storagecache.models.StorageTargetType :ivar provisioning_state: ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: "Succeeded", "Failed", "Cancelled", "Creating", "Deleting", "Updating". - :vartype provisioning_state: str or - ~storage_cache_management_client.models.ProvisioningStateType + :vartype provisioning_state: str or ~azure.mgmt.storagecache.models.ProvisioningStateType :ivar state: Storage target operational state. Possible values include: "Ready", "Busy", "Suspended", "Flushing". - :vartype state: str or ~storage_cache_management_client.models.OperationalStateType + :vartype state: str or ~azure.mgmt.storagecache.models.OperationalStateType :ivar nfs3: Properties when targetType is nfs3. - :vartype nfs3: ~storage_cache_management_client.models.Nfs3Target + :vartype nfs3: ~azure.mgmt.storagecache.models.Nfs3Target :ivar clfs: Properties when targetType is clfs. - :vartype clfs: ~storage_cache_management_client.models.ClfsTarget + :vartype clfs: ~azure.mgmt.storagecache.models.ClfsTarget :ivar unknown: Properties when targetType is unknown. - :vartype unknown: ~storage_cache_management_client.models.UnknownTarget + :vartype unknown: ~azure.mgmt.storagecache.models.UnknownTarget :ivar blob_nfs: Properties when targetType is blobNfs. - :vartype blob_nfs: ~storage_cache_management_client.models.BlobNfsTarget + :vartype blob_nfs: ~azure.mgmt.storagecache.models.BlobNfsTarget + :ivar allocation_percentage: The percentage of cache space allocated for this storage target. + :vartype allocation_percentage: int """ _validation = { @@ -2046,6 +2234,7 @@ class StorageTarget(StorageTargetResource): 'location': {'readonly': True}, 'system_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, + 'allocation_percentage': {'readonly': True, 'maximum': 100, 'minimum': 1}, } _attribute_map = { @@ -2062,6 +2251,7 @@ class StorageTarget(StorageTargetResource): 'clfs': {'key': 'properties.clfs', 'type': 'ClfsTarget'}, 'unknown': {'key': 'properties.unknown', 'type': 'UnknownTarget'}, 'blob_nfs': {'key': 'properties.blobNfs', 'type': 'BlobNfsTarget'}, + 'allocation_percentage': {'key': 'properties.allocationPercentage', 'type': 'int'}, } def __init__( @@ -2078,21 +2268,21 @@ def __init__( ): """ :keyword junctions: List of Cache namespace junctions to target for namespace associations. - :paramtype junctions: list[~storage_cache_management_client.models.NamespaceJunction] + :paramtype junctions: list[~azure.mgmt.storagecache.models.NamespaceJunction] :keyword target_type: Type of the Storage Target. Possible values include: "nfs3", "clfs", "unknown", "blobNfs". - :paramtype target_type: str or ~storage_cache_management_client.models.StorageTargetType + :paramtype target_type: str or ~azure.mgmt.storagecache.models.StorageTargetType :keyword state: Storage target operational state. Possible values include: "Ready", "Busy", "Suspended", "Flushing". - :paramtype state: str or ~storage_cache_management_client.models.OperationalStateType + :paramtype state: str or ~azure.mgmt.storagecache.models.OperationalStateType :keyword nfs3: Properties when targetType is nfs3. - :paramtype nfs3: ~storage_cache_management_client.models.Nfs3Target + :paramtype nfs3: ~azure.mgmt.storagecache.models.Nfs3Target :keyword clfs: Properties when targetType is clfs. - :paramtype clfs: ~storage_cache_management_client.models.ClfsTarget + :paramtype clfs: ~azure.mgmt.storagecache.models.ClfsTarget :keyword unknown: Properties when targetType is unknown. - :paramtype unknown: ~storage_cache_management_client.models.UnknownTarget + :paramtype unknown: ~azure.mgmt.storagecache.models.UnknownTarget :keyword blob_nfs: Properties when targetType is blobNfs. - :paramtype blob_nfs: ~storage_cache_management_client.models.BlobNfsTarget + :paramtype blob_nfs: ~azure.mgmt.storagecache.models.BlobNfsTarget """ super(StorageTarget, self).__init__(**kwargs) self.junctions = junctions @@ -2103,6 +2293,45 @@ def __init__( self.clfs = clfs self.unknown = unknown self.blob_nfs = blob_nfs + self.allocation_percentage = None + + +class StorageTargetSpaceAllocation(msrest.serialization.Model): + """Storage Target space allocation properties. + + :ivar name: Name of the storage target. + :vartype name: str + :ivar allocation_percentage: The percentage of cache space allocated for this storage target. + :vartype allocation_percentage: int + """ + + _validation = { + 'name': {'pattern': r'^[-0-9a-zA-Z_]{1,80}$'}, + 'allocation_percentage': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'allocation_percentage': {'key': 'allocationPercentage', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + allocation_percentage: Optional[int] = None, + **kwargs + ): + """ + :keyword name: Name of the storage target. + :paramtype name: str + :keyword allocation_percentage: The percentage of cache space allocated for this storage + target. + :paramtype allocation_percentage: int + """ + super(StorageTargetSpaceAllocation, self).__init__(**kwargs) + self.name = name + self.allocation_percentage = allocation_percentage class StorageTargetsResult(msrest.serialization.Model): @@ -2111,7 +2340,7 @@ class StorageTargetsResult(msrest.serialization.Model): :ivar next_link: The URI to fetch the next page of Storage Targets. :vartype next_link: str :ivar value: The list of Storage Targets defined for the Cache. - :vartype value: list[~storage_cache_management_client.models.StorageTarget] + :vartype value: list[~azure.mgmt.storagecache.models.StorageTarget] """ _attribute_map = { @@ -2130,7 +2359,7 @@ def __init__( :keyword next_link: The URI to fetch the next page of Storage Targets. :paramtype next_link: str :keyword value: The list of Storage Targets defined for the Cache. - :paramtype value: list[~storage_cache_management_client.models.StorageTarget] + :paramtype value: list[~azure.mgmt.storagecache.models.StorageTarget] """ super(StorageTargetsResult, self).__init__(**kwargs) self.next_link = next_link @@ -2144,14 +2373,14 @@ class SystemData(msrest.serialization.Model): :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :vartype created_by_type: str or ~storage_cache_management_client.models.CreatedByType + :vartype created_by_type: str or ~azure.mgmt.storagecache.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :vartype last_modified_by_type: str or ~storage_cache_management_client.models.CreatedByType + :vartype last_modified_by_type: str or ~azure.mgmt.storagecache.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime """ @@ -2181,14 +2410,14 @@ def __init__( :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :paramtype created_by_type: str or ~storage_cache_management_client.models.CreatedByType + :paramtype created_by_type: str or ~azure.mgmt.storagecache.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :paramtype last_modified_by_type: str or ~storage_cache_management_client.models.CreatedByType + :paramtype last_modified_by_type: str or ~azure.mgmt.storagecache.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ @@ -2232,7 +2461,7 @@ class UsageModel(msrest.serialization.Model): """A usage model. :ivar display: Localized information describing this usage model. - :vartype display: ~storage_cache_management_client.models.UsageModelDisplay + :vartype display: ~azure.mgmt.storagecache.models.UsageModelDisplay :ivar model_name: Non-localized keyword name for this usage model. :vartype model_name: str :ivar target_type: The type of Storage Target to which this model is applicable (only nfs3 as @@ -2256,7 +2485,7 @@ def __init__( ): """ :keyword display: Localized information describing this usage model. - :paramtype display: ~storage_cache_management_client.models.UsageModelDisplay + :paramtype display: ~azure.mgmt.storagecache.models.UsageModelDisplay :keyword model_name: Non-localized keyword name for this usage model. :paramtype model_name: str :keyword target_type: The type of Storage Target to which this model is applicable (only nfs3 @@ -2300,7 +2529,7 @@ class UsageModelsResult(msrest.serialization.Model): :ivar next_link: The URI to fetch the next page of Cache usage models. :vartype next_link: str :ivar value: The list of usage models available for the subscription. - :vartype value: list[~storage_cache_management_client.models.UsageModel] + :vartype value: list[~azure.mgmt.storagecache.models.UsageModel] """ _attribute_map = { @@ -2319,7 +2548,7 @@ def __init__( :keyword next_link: The URI to fetch the next page of Cache usage models. :paramtype next_link: str :keyword value: The list of usage models available for the subscription. - :paramtype value: list[~storage_cache_management_client.models.UsageModel] + :paramtype value: list[~azure.mgmt.storagecache.models.UsageModel] """ super(UsageModelsResult, self).__init__(**kwargs) self.next_link = next_link 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 da3ba535a618..a5b22cb00a2d 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 @@ -59,6 +59,9 @@ class HealthStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): STOPPED = "Stopped" UPGRADING = "Upgrading" FLUSHING = "Flushing" + WAITING_FOR_KEY = "WaitingForKey" + START_FAILED = "StartFailed" + UPGRADE_FAILED = "UpgradeFailed" class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): @@ -95,6 +98,15 @@ class OperationalStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUSPENDED = "Suspended" FLUSHING = "Flushing" +class PrimingJobState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The state of the priming operation. + """ + + QUEUED = "Queued" + RUNNING = "Running" + PAUSED = "Paused" + COMPLETE = "Complete" + class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property 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 4c7fdcae3052..5b65fb1a9e04 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,31 +31,32 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "location": _SERIALIZER.url("location", location, 'str'), "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -66,7 +67,7 @@ class AscOperationsOperations(object): 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -96,7 +97,7 @@ def get( :type operation_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AscOperation, or the result of cls(response) - :rtype: ~storage_cache_management_client.models.AscOperation + :rtype: ~azure.mgmt.storagecache.models.AscOperation :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AscOperation"] @@ -105,17 +106,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, location=location, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -129,5 +137,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}"} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_usages_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_usages_operations.py index 7d1b5ca6d350..a603bc8f5e4f 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_usages_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_asc_usages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,30 +31,31 @@ def build_list_request( location: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/usages') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/usages") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "location": _SERIALIZER.url("location", location, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -65,7 +66,7 @@ class AscUsagesOperations(object): 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -93,10 +94,11 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceUsagesListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~storage_cache_management_client.models.ResourceUsagesListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagecache.models.ResourceUsagesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUsagesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -108,6 +110,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, location=location, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -118,6 +121,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, location=location, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -135,7 +139,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -148,4 +156,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/usages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/usages"} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_caches_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_caches_operations.py index 6c779ba3f8f9..a8d9fa60d09f 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,29 +33,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -65,30 +66,31 @@ def build_list_by_resource_group_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -99,31 +101,32 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -134,31 +137,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -172,35 +176,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-01-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -216,35 +220,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-01-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -257,31 +261,32 @@ def build_debug_info_request_initial( cache_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -292,31 +297,32 @@ def build_flush_request_initial( cache_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -327,31 +333,32 @@ def build_start_request_initial( cache_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -362,31 +369,208 @@ def build_stop_request_initial( cache_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_priming_job_request_initial( + resource_group_name: str, + subscription_id: str, + cache_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/startPrimingJob") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_stop_priming_job_request_initial( + resource_group_name: str, + cache_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stopPrimingJob") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_pause_priming_job_request_initial( + resource_group_name: str, + cache_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/pausePrimingJob") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_resume_priming_job_request_initial( + resource_group_name: str, + cache_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/resumePrimingJob") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, **kwargs ) @@ -397,42 +581,87 @@ def build_upgrade_firmware_request_initial( cache_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_space_allocation_request_initial( + resource_group_name: str, + subscription_id: str, + cache_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/spaceAllocation") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, **kwargs ) -class CachesOperations(object): +class CachesOperations(object): # pylint: disable=too-many-public-methods """CachesOperations 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -456,9 +685,11 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CachesListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~storage_cache_management_client.models.CachesListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagecache.models.CachesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CachesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -469,6 +700,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -478,6 +710,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -495,7 +728,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -508,7 +745,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches"} # type: ignore @distributed_trace def list_by_resource_group( @@ -522,9 +759,11 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CachesListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~storage_cache_management_client.models.CachesListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagecache.models.CachesListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CachesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -536,6 +775,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -546,6 +786,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -563,7 +804,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -576,9 +821,9 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -590,17 +835,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -610,11 +862,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -639,7 +891,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -650,6 +903,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -670,10 +924,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}"} # type: ignore @distributed_trace def get( @@ -691,7 +944,7 @@ def get( :type cache_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Cache, or the result of cls(response) - :rtype: ~storage_cache_management_client.models.Cache + :rtype: ~azure.mgmt.storagecache.models.Cache :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Cache"] @@ -700,17 +953,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -724,7 +984,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}"} # type: ignore def _create_or_update_initial( @@ -740,6 +1000,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if cache is not None: @@ -751,6 +1012,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -758,7 +1020,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -777,7 +1043,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}"} # type: ignore @distributed_trace @@ -796,8 +1062,9 @@ def begin_create_or_update( from the [-0-9a-zA-Z_] char class. :type cache_name: str :param cache: Object containing the user-selectable properties of the new Cache. If read-only - properties are included, they must match the existing values of those properties. - :type cache: ~storage_cache_management_client.models.Cache + properties are included, they must match the existing values of those properties. Default value + is None. + :type cache: ~azure.mgmt.storagecache.models.Cache :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -807,11 +1074,12 @@ def begin_create_or_update( :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either Cache or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~storage_cache_management_client.models.Cache] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagecache.models.Cache] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cache"] lro_delay = kwargs.pop( 'polling_interval', @@ -823,6 +1091,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, cache_name=cache_name, cache=cache, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -847,10 +1116,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}"} # type: ignore @distributed_trace def update( @@ -868,11 +1136,12 @@ def update( from the [-0-9a-zA-Z_] char class. :type cache_name: str :param cache: Object containing the user-selectable properties of the Cache. If read-only - properties are included, they must match the existing values of those properties. - :type cache: ~storage_cache_management_client.models.Cache + properties are included, they must match the existing values of those properties. Default value + is None. + :type cache: ~azure.mgmt.storagecache.models.Cache :keyword callable cls: A custom type or function that will be passed the direct response :return: Cache, or the result of cls(response) - :rtype: ~storage_cache_management_client.models.Cache + :rtype: ~azure.mgmt.storagecache.models.Cache :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Cache"] @@ -881,6 +1150,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if cache is not None: @@ -892,6 +1162,7 @@ def update( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -899,7 +1170,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -913,10 +1188,10 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}"} # type: ignore - def _debug_info_initial( + def _debug_info_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -928,17 +1203,24 @@ def _debug_info_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_debug_info_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, template_url=self._debug_info_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -948,11 +1230,11 @@ def _debug_info_initial( if cls: return cls(pipeline_response, None, {}) - _debug_info_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo'} # type: ignore + _debug_info_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo"} # type: ignore @distributed_trace - def begin_debug_info( + def begin_debug_info( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -977,7 +1259,8 @@ def begin_debug_info( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -988,6 +1271,7 @@ def begin_debug_info( raw_result = self._debug_info_initial( resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1008,12 +1292,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_debug_info.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo'} # type: ignore + begin_debug_info.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo"} # type: ignore - def _flush_initial( + def _flush_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -1025,17 +1308,24 @@ def _flush_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_flush_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, template_url=self._flush_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -1045,11 +1335,11 @@ def _flush_initial( if cls: return cls(pipeline_response, None, {}) - _flush_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush'} # type: ignore + _flush_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush"} # type: ignore @distributed_trace - def begin_flush( + def begin_flush( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -1075,7 +1365,8 @@ def begin_flush( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1086,6 +1377,7 @@ def begin_flush( raw_result = self._flush_initial( resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1106,12 +1398,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_flush.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush'} # type: ignore + begin_flush.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -1123,17 +1414,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_start_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -1143,11 +1441,11 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start"} # type: ignore @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -1172,7 +1470,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1183,6 +1482,7 @@ def begin_start( raw_result = self._start_initial( resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1203,12 +1503,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start'} # type: ignore + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start"} # type: ignore - def _stop_initial( + def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -1220,17 +1519,24 @@ def _stop_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_stop_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, template_url=self._stop_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -1240,11 +1546,11 @@ def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop"} # type: ignore @distributed_trace - def begin_stop( + def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -1269,7 +1575,8 @@ def begin_stop( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1280,6 +1587,7 @@ def begin_stop( raw_result = self._stop_initial( resource_group_name=resource_group_name, cache_name=cache_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1300,15 +1608,15 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop'} # type: ignore + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop"} # type: ignore - def _upgrade_firmware_initial( + def _start_priming_job_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, + primingjob: Optional["_models.PrimingJob"] = None, **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] @@ -1317,44 +1625,65 @@ def _upgrade_firmware_initial( } error_map.update(kwargs.pop('error_map', {})) - - request = build_upgrade_firmware_request_initial( + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if primingjob is not None: + _json = self._serialize.body(primingjob, 'PrimingJob') + else: + _json = None + + request = build_start_priming_job_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, - template_url=self._upgrade_firmware_initial.metadata['url'], + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._start_priming_job_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response - if response.status_code not in [201, 202, 204]: + if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) - _upgrade_firmware_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade'} # type: ignore + _start_priming_job_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/startPrimingJob"} # type: ignore @distributed_trace - def begin_upgrade_firmware( + def begin_start_priming_job( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, + primingjob: Optional["_models.PrimingJob"] = None, **kwargs: Any ) -> LROPoller[None]: - """Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no - effect. + """Create a priming job. This operation is only allowed when the cache is healthy. :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 primingjob: Object containing the definition of a priming job. Default value is None. + :type primingjob: ~azure.mgmt.storagecache.models.PrimingJob :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 @@ -1367,7 +1696,9 @@ def begin_upgrade_firmware( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1375,9 +1706,12 @@ def begin_upgrade_firmware( ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._upgrade_firmware_initial( + raw_result = self._start_priming_job_initial( resource_group_name=resource_group_name, cache_name=cache_name, + primingjob=primingjob, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) @@ -1398,7 +1732,612 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start_priming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/startPrimingJob"} # type: ignore + + def _stop_priming_job_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + priming_job_id: Optional["_models.PrimingJobIdParameter"] = 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 = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if priming_job_id is not None: + _json = self._serialize.body(priming_job_id, 'PrimingJobIdParameter') else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + _json = None + + request = build_stop_priming_job_request_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._stop_priming_job_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _stop_priming_job_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stopPrimingJob"} # type: ignore + + + @distributed_trace + def begin_stop_priming_job( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + priming_job_id: Optional["_models.PrimingJobIdParameter"] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Schedule a priming job for deletion. + + :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 priming_job_id: Object containing the priming job ID. Default value is None. + :type priming_job_id: ~azure.mgmt.storagecache.models.PrimingJobIdParameter + :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 + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + 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._stop_priming_job_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + priming_job_id=priming_job_id, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop_priming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stopPrimingJob"} # type: ignore + + def _pause_priming_job_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + priming_job_id: Optional["_models.PrimingJobIdParameter"] = 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 = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if priming_job_id is not None: + _json = self._serialize.body(priming_job_id, 'PrimingJobIdParameter') + else: + _json = None + + request = build_pause_priming_job_request_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._pause_priming_job_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _pause_priming_job_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/pausePrimingJob"} # type: ignore + + + @distributed_trace + def begin_pause_priming_job( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + priming_job_id: Optional["_models.PrimingJobIdParameter"] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Schedule a priming job to be paused. + + :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 priming_job_id: Object containing the priming job ID. Default value is None. + :type priming_job_id: ~azure.mgmt.storagecache.models.PrimingJobIdParameter + :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 + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + 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._pause_priming_job_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + priming_job_id=priming_job_id, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_pause_priming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/pausePrimingJob"} # type: ignore + + def _resume_priming_job_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + priming_job_id: Optional["_models.PrimingJobIdParameter"] = 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 = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if priming_job_id is not None: + _json = self._serialize.body(priming_job_id, 'PrimingJobIdParameter') + else: + _json = None + + request = build_resume_priming_job_request_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._resume_priming_job_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _resume_priming_job_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/resumePrimingJob"} # type: ignore + + + @distributed_trace + def begin_resume_priming_job( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + priming_job_id: Optional["_models.PrimingJobIdParameter"] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Resumes a paused priming job. + + :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 priming_job_id: Object containing the priming job ID. Default value is None. + :type priming_job_id: ~azure.mgmt.storagecache.models.PrimingJobIdParameter + :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 + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + 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_priming_job_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + priming_job_id=priming_job_id, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resume_priming_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/resumePrimingJob"} # type: ignore + + def _upgrade_firmware_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_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 = kwargs.pop('api_version', "2022-05-01") # type: str + + + request = build_upgrade_firmware_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + api_version=api_version, + template_url=self._upgrade_firmware_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [201, 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, {}) + + _upgrade_firmware_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade"} # type: ignore + + + @distributed_trace + def begin_upgrade_firmware( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no + effect. + + :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 + :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 + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + 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._upgrade_firmware_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_upgrade_firmware.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade"} # type: ignore + + def _space_allocation_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + space_allocation: Optional[List["_models.StorageTargetSpaceAllocation"]] = 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 = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if space_allocation is not None: + _json = self._serialize.body(space_allocation, '[StorageTargetSpaceAllocation]') + else: + _json = None + + request = build_space_allocation_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cache_name=cache_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._space_allocation_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _space_allocation_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/spaceAllocation"} # type: ignore + + + @distributed_trace + def begin_space_allocation( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cache_name: str, + space_allocation: Optional[List["_models.StorageTargetSpaceAllocation"]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Update cache space allocation. + + :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 space_allocation: List containing storage target cache space percentage allocations. + Default value is None. + :type space_allocation: list[~azure.mgmt.storagecache.models.StorageTargetSpaceAllocation] + :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 + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + 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._space_allocation_initial( + resource_group_name=resource_group_name, + cache_name=cache_name, + space_allocation=space_allocation, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_upgrade_firmware.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade'} # type: ignore + begin_space_allocation.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/spaceAllocation"} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_operations.py index f0ef66183e93..5bd1257dd9a0 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.StorageCache/operations') + _url = kwargs.pop("template_url", "/providers/Microsoft.StorageCache/operations") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -57,7 +58,7 @@ class Operations(object): 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -82,10 +83,11 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApiOperationListResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~storage_cache_management_client.models.ApiOperationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagecache.models.ApiOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiOperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +97,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +106,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,7 +124,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -133,4 +141,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.StorageCache/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.StorageCache/operations"} # type: ignore 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 79960b441558..c811bb0748b5 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -30,29 +30,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -63,7 +64,7 @@ class SkusOperations(object): 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -87,10 +88,11 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceSkusResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~storage_cache_management_client.models.ResourceSkusResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagecache.models.ResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkusResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -101,6 +103,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -110,6 +113,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -127,7 +131,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -140,4 +148,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus"} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py index 7d8a2ad0d1aa..80d4546ec01e 100644 --- a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py +++ b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_storage_target_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_flush_request_initial( storage_target_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -45,21 +46,21 @@ def build_flush_request_initial( "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,10 +72,11 @@ def build_suspend_request_initial( storage_target_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -82,21 +84,21 @@ def build_suspend_request_initial( "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -108,10 +110,11 @@ def build_resume_request_initial( storage_target_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -119,21 +122,21 @@ def build_resume_request_initial( "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -145,10 +148,11 @@ def build_invalidate_request_initial( storage_target_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -156,21 +160,21 @@ def build_invalidate_request_initial( "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -181,7 +185,7 @@ class StorageTargetOperations(object): 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -196,7 +200,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _flush_initial( + def _flush_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -209,18 +213,25 @@ def _flush_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_flush_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, template_url=self._flush_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -230,11 +241,11 @@ def _flush_initial( 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 + _flush_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush"} # type: ignore @distributed_trace - def begin_flush( + def begin_flush( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -264,7 +275,8 @@ def begin_flush( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -276,6 +288,7 @@ def begin_flush( resource_group_name=resource_group_name, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -296,12 +309,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_flush.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush"} # type: ignore - def _suspend_initial( + def _suspend_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -314,18 +326,25 @@ def _suspend_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_suspend_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, template_url=self._suspend_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -335,11 +354,11 @@ def _suspend_initial( 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 + _suspend_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend"} # type: ignore @distributed_trace - def begin_suspend( + def begin_suspend( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -367,7 +386,8 @@ def begin_suspend( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -379,6 +399,7 @@ def begin_suspend( resource_group_name=resource_group_name, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -399,12 +420,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_suspend.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend"} # type: ignore - def _resume_initial( + def _resume_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -417,18 +437,25 @@ def _resume_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_resume_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, template_url=self._resume_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -438,11 +465,11 @@ def _resume_initial( 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 + _resume_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume"} # type: ignore @distributed_trace - def begin_resume( + def begin_resume( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -470,7 +497,8 @@ def begin_resume( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -482,6 +510,7 @@ def begin_resume( resource_group_name=resource_group_name, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -502,12 +531,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_resume.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume"} # type: ignore - def _invalidate_initial( + def _invalidate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -520,18 +548,25 @@ def _invalidate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_invalidate_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, template_url=self._invalidate_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -541,11 +576,11 @@ def _invalidate_initial( if cls: return cls(pipeline_response, None, {}) - _invalidate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate'} # type: ignore + _invalidate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate"} # type: ignore @distributed_trace - def begin_invalidate( + def begin_invalidate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -574,7 +609,8 @@ def begin_invalidate( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -586,6 +622,7 @@ def begin_invalidate( resource_group_name=resource_group_name, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -606,7 +643,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_invalidate.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate'} # type: ignore + begin_invalidate.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate"} # 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 7834a3efc91c..da6e686a6281 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,10 +36,11 @@ def build_dns_refresh_request_initial( storage_target_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -47,21 +48,21 @@ def build_dns_refresh_request_initial( "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -72,31 +73,32 @@ def build_list_by_cache_request( cache_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "cacheName": _SERIALIZER.url("cache_name", cache_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -110,10 +112,11 @@ def build_delete_request_initial( force: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -121,23 +124,23 @@ def build_delete_request_initial( "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if force is not None: - query_parameters['force'] = _SERIALIZER.query("force", force, 'str') + _query_parameters['force'] = _SERIALIZER.query("force", force, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -149,10 +152,11 @@ def build_get_request( storage_target_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -160,21 +164,21 @@ def build_get_request( "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -189,12 +193,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-01-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}") # pylint: disable=line-too-long path_format_arguments = { "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), @@ -202,23 +206,23 @@ def build_create_or_update_request_initial( "storageTargetName": _SERIALIZER.url("storage_target_name", storage_target_name, 'str', pattern=r'^[-0-9a-zA-Z_]{1,80}$'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -231,7 +235,7 @@ class StorageTargetsOperations(object): 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -246,7 +250,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _dns_refresh_initial( + def _dns_refresh_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -259,18 +263,25 @@ def _dns_refresh_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_dns_refresh_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, template_url=self._dns_refresh_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -280,11 +291,11 @@ def _dns_refresh_initial( if cls: return cls(pipeline_response, None, {}) - _dns_refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh'} # type: ignore + _dns_refresh_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh"} # type: ignore @distributed_trace - def begin_dns_refresh( + def begin_dns_refresh( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -312,7 +323,8 @@ def begin_dns_refresh( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -324,6 +336,7 @@ def begin_dns_refresh( resource_group_name=resource_group_name, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -344,10 +357,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_dns_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh'} # type: ignore + begin_dns_refresh.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh"} # type: ignore @distributed_trace def list_by_cache( @@ -366,10 +378,11 @@ def list_by_cache( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageTargetsResult or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~storage_cache_management_client.models.StorageTargetsResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagecache.models.StorageTargetsResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageTargetsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -382,6 +395,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, template_url=self.list_by_cache.metadata['url'], ) request = _convert_request(request) @@ -393,6 +407,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -410,7 +425,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -423,9 +442,9 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_cache.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets'} # type: ignore + list_by_cache.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -439,19 +458,26 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_delete_request_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, force=force, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -461,11 +487,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, @@ -486,7 +512,8 @@ def begin_delete( :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. + delete discards unwritten-data in the cache instead of flushing it to back-end storage. Default + value is None. :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. @@ -500,7 +527,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -513,6 +541,7 @@ def begin_delete( cache_name=cache_name, storage_target_name=storage_target_name, force=force, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -533,10 +562,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}"} # type: ignore @distributed_trace def get( @@ -557,7 +585,7 @@ def get( :type storage_target_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageTarget, or the result of cls(response) - :rtype: ~storage_cache_management_client.models.StorageTarget + :rtype: ~azure.mgmt.storagecache.models.StorageTarget :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageTarget"] @@ -566,18 +594,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_get_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -591,7 +626,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}"} # type: ignore def _create_or_update_initial( @@ -608,6 +643,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if storagetarget is not None: @@ -620,6 +656,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, cache_name=cache_name, storage_target_name=storage_target_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -627,7 +664,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -646,7 +687,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}"} # type: ignore @distributed_trace @@ -669,8 +710,9 @@ def begin_create_or_update( :type cache_name: str :param storage_target_name: Name of Storage Target. :type storage_target_name: str - :param storagetarget: Object containing the definition of a Storage Target. - :type storagetarget: ~storage_cache_management_client.models.StorageTarget + :param storagetarget: Object containing the definition of a Storage Target. Default value is + None. + :type storagetarget: ~azure.mgmt.storagecache.models.StorageTarget :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -681,11 +723,12 @@ def begin_create_or_update( Retry-After header is present. :return: An instance of LROPoller that returns either StorageTarget or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~storage_cache_management_client.models.StorageTarget] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storagecache.models.StorageTarget] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageTarget"] lro_delay = kwargs.pop( 'polling_interval', @@ -698,6 +741,7 @@ def begin_create_or_update( cache_name=cache_name, storage_target_name=storage_target_name, storagetarget=storagetarget, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -722,7 +766,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}"} # type: ignore diff --git a/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_usage_models_operations.py b/sdk/storage/azure-mgmt-storagecache/azure/mgmt/storagecache/operations/_usage_models_operations.py index b5ce80e10d51..0f68039158cc 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -30,29 +30,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -63,7 +64,7 @@ class UsageModelsOperations(object): 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 + :type models: ~azure.mgmt.storagecache.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -87,9 +88,11 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UsageModelsResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~storage_cache_management_client.models.UsageModelsResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storagecache.models.UsageModelsResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.UsageModelsResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -100,6 +103,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -109,6 +113,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -126,7 +131,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -139,4 +148,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels"} # type: ignore