From 10cc7965fe60ec998d4f33aa4e64bd154b234c57 Mon Sep 17 00:00:00 2001 From: Jacob Lauzon <96087589+jalauzon-msft@users.noreply.github.com> Date: Mon, 28 Feb 2022 14:15:34 -0800 Subject: [PATCH 1/2] [Storage] Test code generation with latest autorest version (#22932) --- .../azure/storage/blob/_blob_client.py | 2 +- .../storage/blob/_blob_service_client.py | 2 +- .../azure/storage/blob/_container_client.py | 2 +- .../azure/storage/blob/_generated/__init__.py | 9 +- .../blob/_generated/_azure_blob_storage.py | 90 +- .../storage/blob/_generated/_configuration.py | 15 +- .../azure/storage/blob/_generated/_patch.py | 31 + .../azure/storage/blob/_generated/_vendor.py | 27 + .../storage/blob/_generated/aio/__init__.py | 5 + .../_generated/aio/_azure_blob_storage.py | 88 +- .../blob/_generated/aio/_configuration.py | 15 +- .../storage/blob/_generated/aio/_patch.py | 31 + .../aio/operations/_append_blob_operations.py | 475 +-- .../aio/operations/_blob_operations.py | 2017 +++++----- .../aio/operations/_block_blob_operations.py | 728 ++-- .../aio/operations/_container_operations.py | 1351 +++---- .../aio/operations/_page_blob_operations.py | 988 +++-- .../aio/operations/_service_operations.py | 542 +-- .../models/_azure_blob_storage_enums.py | 69 +- .../storage/blob/_generated/models/_models.py | 1479 +++++-- .../blob/_generated/models/_models_py3.py | 1479 +++++-- .../operations/_append_blob_operations.py | 841 ++-- .../_generated/operations/_blob_operations.py | 3524 ++++++++++++----- .../operations/_block_blob_operations.py | 1300 ++++-- .../operations/_container_operations.py | 2275 ++++++++--- .../operations/_page_blob_operations.py | 1732 +++++--- .../operations/_service_operations.py | 910 +++-- .../storage/blob/aio/_blob_client_async.py | 2 +- .../blob/aio/_blob_service_client_async.py | 2 +- .../blob/aio/_container_client_async.py | 2 +- sdk/storage/azure-storage-blob/setup.py | 2 +- .../azure-storage-blob/swagger/README.md | 30 +- .../filedatalake/_data_lake_service_client.py | 2 +- .../filedatalake/_file_system_client.py | 4 +- .../filedatalake/_generated/__init__.py | 9 +- .../_azure_data_lake_storage_restapi.py | 80 +- .../filedatalake/_generated/_configuration.py | 22 +- .../storage/filedatalake/_generated/_patch.py | 31 + .../filedatalake/_generated/_vendor.py | 27 + .../filedatalake/_generated/aio/__init__.py | 5 + .../aio/_azure_data_lake_storage_restapi.py | 78 +- .../_generated/aio/_configuration.py | 22 +- .../filedatalake/_generated/aio/_patch.py | 31 + .../aio/operations/_file_system_operations.py | 373 +- .../aio/operations/_path_operations.py | 1049 +++-- .../aio/operations/_service_operations.py | 99 +- .../_azure_data_lake_storage_restapi_enums.py | 35 +- .../filedatalake/_generated/models/_models.py | 581 ++- .../_generated/models/_models_py3.py | 581 ++- .../operations/_file_system_operations.py | 675 +++- .../_generated/operations/_path_operations.py | 1876 ++++++--- .../operations/_service_operations.py | 151 +- .../storage/filedatalake/_path_client.py | 5 +- .../aio/_data_lake_service_client_async.py | 2 +- .../aio/_file_system_client_async.py | 4 +- .../filedatalake/aio/_path_client_async.py | 5 +- .../azure-storage-file-datalake/setup.py | 2 +- .../swagger/README.md | 32 +- .../storage/fileshare/_directory_client.py | 2 +- .../azure/storage/fileshare/_file_client.py | 2 +- .../storage/fileshare/_generated/__init__.py | 9 +- .../_generated/_azure_file_storage.py | 86 +- .../fileshare/_generated/_configuration.py | 22 +- .../storage/fileshare/_generated/_patch.py | 31 + .../storage/fileshare/_generated/_vendor.py | 27 + .../fileshare/_generated/aio/__init__.py | 5 + .../_generated/aio/_azure_file_storage.py | 82 +- .../_generated/aio/_configuration.py | 22 +- .../fileshare/_generated/aio/_patch.py | 31 + .../aio/operations/_directory_operations.py | 646 +-- .../aio/operations/_file_operations.py | 1286 +++--- .../aio/operations/_service_operations.py | 204 +- .../aio/operations/_share_operations.py | 1219 +++--- .../models/_azure_file_storage_enums.py | 43 +- .../fileshare/_generated/models/_models.py | 823 ++-- .../_generated/models/_models_py3.py | 823 ++-- .../operations/_directory_operations.py | 1107 ++++-- .../_generated/operations/_file_operations.py | 2242 +++++++---- .../operations/_service_operations.py | 342 +- .../operations/_share_operations.py | 2036 +++++++--- .../azure/storage/fileshare/_share_client.py | 2 +- .../fileshare/_share_service_client.py | 2 +- .../fileshare/aio/_directory_client_async.py | 2 +- .../fileshare/aio/_file_client_async.py | 2 +- .../fileshare/aio/_share_client_async.py | 2 +- .../aio/_share_service_client_async.py | 2 +- sdk/storage/azure-storage-file-share/setup.py | 2 +- .../swagger/README.md | 26 + .../storage/queue/_generated/__init__.py | 9 +- .../queue/_generated/_azure_queue_storage.py | 70 +- .../queue/_generated/_configuration.py | 15 +- .../azure/storage/queue/_generated/_patch.py | 31 + .../azure/storage/queue/_generated/_vendor.py | 27 + .../storage/queue/_generated/aio/__init__.py | 5 + .../_generated/aio/_azure_queue_storage.py | 70 +- .../queue/_generated/aio/_configuration.py | 15 +- .../storage/queue/_generated/aio/_patch.py | 31 + .../aio/operations/_message_id_operations.py | 135 +- .../aio/operations/_messages_operations.py | 263 +- .../aio/operations/_queue_operations.py | 392 +- .../aio/operations/_service_operations.py | 304 +- .../models/_azure_queue_storage_enums.py | 23 +- .../queue/_generated/models/_models.py | 391 +- .../queue/_generated/models/_models_py3.py | 391 +- .../operations/_message_id_operations.py | 223 +- .../operations/_messages_operations.py | 436 +- .../operations/_queue_operations.py | 636 ++- .../operations/_service_operations.py | 486 ++- .../azure/storage/queue/_queue_client.py | 2 +- .../storage/queue/_queue_service_client.py | 2 +- .../storage/queue/aio/_queue_client_async.py | 3 +- .../queue/aio/_queue_service_client_async.py | 2 +- sdk/storage/azure-storage-queue/setup.py | 4 +- .../azure-storage-queue/swagger/README.md | 47 +- shared_requirements.txt | 10 +- 115 files changed, 26130 insertions(+), 14869 deletions(-) create mode 100644 sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py create mode 100644 sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_vendor.py create mode 100644 sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py create mode 100644 sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_patch.py create mode 100644 sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_vendor.py create mode 100644 sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_patch.py create mode 100644 sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py create mode 100644 sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_vendor.py create mode 100644 sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py create mode 100644 sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_patch.py create mode 100644 sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_vendor.py create mode 100644 sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_patch.py diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py index 65f901fe9be9..d39c8b00f199 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_client.py @@ -177,7 +177,7 @@ def __init__( self._raw_credential = credential if credential else sas_token self._query_str, credential = self._format_query_string(sas_token, credential, snapshot=self.snapshot) super(BlobClient, self).__init__(parsed_url, service='blob', credential=credential, **kwargs) - self._client = AzureBlobStorage(self.url, pipeline=self._pipeline) + self._client = AzureBlobStorage(self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access def _format_url(self, hostname): diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_service_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_service_client.py index 6740dc36062d..fe0369073417 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_service_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_blob_service_client.py @@ -135,7 +135,7 @@ def __init__( _, sas_token = parse_query(parsed_url.query) self._query_str, credential = self._format_query_string(sas_token, credential) super(BlobServiceClient, self).__init__(parsed_url, service='blob', credential=credential, **kwargs) - self._client = AzureBlobStorage(self.url, pipeline=self._pipeline) + self._client = AzureBlobStorage(self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access def _format_url(self, hostname): diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py index b5cbd58ba771..425fe29594bb 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_container_client.py @@ -159,7 +159,7 @@ def __init__( self._raw_credential = credential if credential else sas_token self._query_str, credential = self._format_query_string(sas_token, credential) super(ContainerClient, self).__init__(parsed_url, service='blob', credential=credential, **kwargs) - self._client = AzureBlobStorage(self.url, pipeline=self._pipeline) + self._client = AzureBlobStorage(self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access def _format_url(self, hostname): diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/__init__.py index cc760e7efd22..3980d87a807a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/__init__.py @@ -9,8 +9,7 @@ from ._azure_blob_storage import AzureBlobStorage __all__ = ['AzureBlobStorage'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py index 578f65816c03..104c2a8e3331 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py @@ -6,26 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING -from azure.core import PipelineClient from msrest import Deserializer, Serializer +from azure.core import PipelineClient + +from . import models +from ._configuration import AzureBlobStorageConfiguration +from .operations import AppendBlobOperations, BlobOperations, BlockBlobOperations, ContainerOperations, PageBlobOperations, ServiceOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import AzureBlobStorageConfiguration -from .operations import ServiceOperations -from .operations import ContainerOperations -from .operations import BlobOperations -from .operations import PageBlobOperations -from .operations import AppendBlobOperations -from .operations import BlockBlobOperations -from . import models - + from azure.core.rest import HttpRequest, HttpResponse class AzureBlobStorage(object): """AzureBlobStorage. @@ -42,55 +38,65 @@ class AzureBlobStorage(object): :vartype append_blob: azure.storage.blob.operations.AppendBlobOperations :ivar block_blob: BlockBlobOperations operations :vartype block_blob: azure.storage.blob.operations.BlockBlobOperations - :param url: The URL of the service account, container, or blob that is the target of the desired operation. + :param url: The URL of the service account, container, or blob that is the target of the + desired operation. :type url: str + :param base_url: Service URL. Default value is ''. + :type base_url: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2021-04-10". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str """ def __init__( self, url, # type: str + base_url="", # type: str **kwargs # type: Any ): # type: (...) -> None - base_url = '{url}' - self._config = AzureBlobStorageConfiguration(url, **kwargs) + self._config = AzureBlobStorageConfiguration(url=url, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.container = ContainerOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob = BlobOperations(self._client, self._config, self._serialize, self._deserialize) + self.page_blob = PageBlobOperations(self._client, self._config, self._serialize, self._deserialize) + self.append_blob = AppendBlobOperations(self._client, self._config, self._serialize, self._deserialize) + self.block_blob = BlockBlobOperations(self._client, self._config, self._serialize, self._deserialize) + - self.service = ServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.container = ContainerOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob = BlobOperations( - self._client, self._config, self._serialize, self._deserialize) - self.page_blob = PageBlobOperations( - self._client, self._config, self._serialize, self._deserialize) - self.append_blob = AppendBlobOperations( - self._client, self._config, self._serialize, self._deserialize) - self.block_blob = BlockBlobOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py index e25c0cdfe7d4..be7ef30eb6d7 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py @@ -17,14 +17,19 @@ VERSION = "unknown" -class AzureBlobStorageConfiguration(Configuration): +class AzureBlobStorageConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureBlobStorage. Note that all parameters used to create this instance are saved as instance attributes. - :param url: The URL of the service account, container, or blob that is the target of the desired operation. + :param url: The URL of the service account, container, or blob that is the target of the + desired operation. :type url: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2021-04-10". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str """ def __init__( @@ -33,12 +38,14 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(AzureBlobStorageConfiguration, self).__init__(**kwargs) + version = kwargs.pop('version', "2021-04-10") # type: str + if url is None: raise ValueError("Parameter 'url' must not be None.") - super(AzureBlobStorageConfiguration, self).__init__(**kwargs) self.url = url - self.version = "2021-04-10" + self.version = version kwargs.setdefault('sdk_moniker', 'azureblobstorage/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_vendor.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/__init__.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/__init__.py index 12cfcf636c47..3980d87a807a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/__init__.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/__init__.py @@ -8,3 +8,8 @@ from ._azure_blob_storage import AzureBlobStorage __all__ = ['AzureBlobStorage'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py index 68f116aaaa94..bc66db3a1ece 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py @@ -6,23 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from copy import deepcopy +from typing import Any, Awaitable -from azure.core import AsyncPipelineClient -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from msrest import Deserializer, Serializer -from ._configuration import AzureBlobStorageConfiguration -from .operations import ServiceOperations -from .operations import ContainerOperations -from .operations import BlobOperations -from .operations import PageBlobOperations -from .operations import AppendBlobOperations -from .operations import BlockBlobOperations -from .. import models +from azure.core import AsyncPipelineClient +from azure.core.rest import AsyncHttpResponse, HttpRequest +from .. import models +from ._configuration import AzureBlobStorageConfiguration +from .operations import AppendBlobOperations, BlobOperations, BlockBlobOperations, ContainerOperations, PageBlobOperations, ServiceOperations -class AzureBlobStorage(object): +class AzureBlobStorage: """AzureBlobStorage. :ivar service: ServiceOperations operations @@ -37,53 +33,63 @@ class AzureBlobStorage(object): :vartype append_blob: azure.storage.blob.aio.operations.AppendBlobOperations :ivar block_blob: BlockBlobOperations operations :vartype block_blob: azure.storage.blob.aio.operations.BlockBlobOperations - :param url: The URL of the service account, container, or blob that is the target of the desired operation. + :param url: The URL of the service account, container, or blob that is the target of the + desired operation. :type url: str + :param base_url: Service URL. Default value is ''. + :type base_url: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2021-04-10". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str """ def __init__( self, url: str, + base_url: str = "", **kwargs: Any ) -> None: - base_url = '{url}' - self._config = AzureBlobStorageConfiguration(url, **kwargs) + self._config = AzureBlobStorageConfiguration(url=url, **kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.container = ContainerOperations(self._client, self._config, self._serialize, self._deserialize) + self.blob = BlobOperations(self._client, self._config, self._serialize, self._deserialize) + self.page_blob = PageBlobOperations(self._client, self._config, self._serialize, self._deserialize) + self.append_blob = AppendBlobOperations(self._client, self._config, self._serialize, self._deserialize) + self.block_blob = BlockBlobOperations(self._client, self._config, self._serialize, self._deserialize) + - self.service = ServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.container = ContainerOperations( - self._client, self._config, self._serialize, self._deserialize) - self.blob = BlobOperations( - self._client, self._config, self._serialize, self._deserialize) - self.page_blob = PageBlobOperations( - self._client, self._config, self._serialize, self._deserialize) - self.append_blob = AppendBlobOperations( - self._client, self._config, self._serialize, self._deserialize) - self.block_blob = BlockBlobOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py index bcf04ce4a727..7ec5902f95fe 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py @@ -13,14 +13,19 @@ VERSION = "unknown" -class AzureBlobStorageConfiguration(Configuration): +class AzureBlobStorageConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureBlobStorage. Note that all parameters used to create this instance are saved as instance attributes. - :param url: The URL of the service account, container, or blob that is the target of the desired operation. + :param url: The URL of the service account, container, or blob that is the target of the + desired operation. :type url: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2021-04-10". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str """ def __init__( @@ -28,12 +33,14 @@ def __init__( url: str, **kwargs: Any ) -> None: + super(AzureBlobStorageConfiguration, self).__init__(**kwargs) + version = kwargs.pop('version', "2021-04-10") # type: str + if url is None: raise ValueError("Parameter 'url' must not be None.") - super(AzureBlobStorageConfiguration, self).__init__(**kwargs) self.url = url - self.version = "2021-04-10" + self.version = version kwargs.setdefault('sdk_moniker', 'azureblobstorage/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py index 4d18668ce67b..f95fe3c16901 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,15 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._append_blob_operations import build_append_block_from_url_request, build_append_block_request, build_create_request, build_seal_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,11 +43,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def create( + @distributed_trace_async + async def create( # pylint: disable=inconsistent-return-statements self, content_length: int, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, immutability_policy_expiry: Optional[datetime.datetime] = None, @@ -73,7 +77,7 @@ async def create( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str @@ -96,6 +100,10 @@ async def create( :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append + blob. The default value is "AppendBlob". Note that overriding this default value may result in + unsupported behavior. + :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -106,7 +114,9 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + blob_type = kwargs.pop('blob_type', "AppendBlob") # type: str + _blob_content_type = None _blob_content_encoding = None _blob_content_language = None @@ -129,6 +139,9 @@ async def create( _blob_content_language = blob_http_headers.blob_content_language _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_cache_control = blob_http_headers.blob_cache_control + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + if blob_http_headers is not None: _blob_content_disposition = blob_http_headers.blob_content_disposition if cpk_info is not None: _encryption_key = cpk_info.encryption_key @@ -136,87 +149,56 @@ async def create( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - blob_type = "AppendBlob" - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-blob-type'] = self._serialize.header("blob_type", blob_type, 'str') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if _blob_content_type is not None: - header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", _blob_content_type, 'str') - if _blob_content_encoding is not None: - header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", _blob_content_encoding, 'str') - if _blob_content_language is not None: - header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", _blob_content_language, 'str') - if _blob_content_md5 is not None: - header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", _blob_content_md5, 'bytearray') - if _blob_cache_control is not None: - header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", _blob_cache_control, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _blob_content_disposition is not None: - header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", _blob_content_disposition, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - if legal_hold is not None: - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_create_request( + url=self._config.url, + blob_type=blob_type, + version=self._config.version, + content_length=content_length, + timeout=timeout, + blob_content_type=_blob_content_type, + blob_content_encoding=_blob_content_encoding, + blob_content_language=_blob_content_language, + blob_content_md5=_blob_content_md5, + blob_cache_control=_blob_cache_control, + metadata=metadata, + lease_id=_lease_id, + blob_content_disposition=_blob_content_disposition, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + blob_tags_string=blob_tags_string, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + legal_hold=legal_hold, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -232,12 +214,15 @@ async def create( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + create.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - async def append_block( + + @distributed_trace_async + async def append_block( # pylint: disable=inconsistent-return-statements self, content_length: int, body: IO, @@ -277,13 +262,17 @@ async def append_block( :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param append_position_access_conditions: Parameter group. - :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions + :type append_position_access_conditions: + ~azure.storage.blob.models.AppendPositionAccessConditions :param cpk_info: Parameter group. :type cpk_info: ~azure.storage.blob.models.CpkInfo :param cpk_scope_info: Parameter group. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "appendblock". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -294,7 +283,10 @@ async def append_block( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "appendblock") # type: str + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] + _lease_id = None _max_size = None _append_position = None @@ -307,6 +299,8 @@ async def append_block( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if append_position_access_conditions is not None: _max_size = append_position_access_conditions.max_size _append_position = append_position_access_conditions.append_position @@ -316,77 +310,52 @@ async def append_block( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "appendblock" - content_type = kwargs.pop("content_type", "application/octet-stream") - accept = "application/xml" - - # Construct URL - url = self.append_block.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - if transactional_content_crc64 is not None: - header_parameters['x-ms-content-crc64'] = self._serialize.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _max_size is not None: - header_parameters['x-ms-blob-condition-maxsize'] = self._serialize.header("max_size", _max_size, 'long') - if _append_position is not None: - header_parameters['x-ms-blob-condition-appendpos'] = self._serialize.header("append_position", _append_position, 'long') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = body - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _content = body + + request = build_append_block_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + content_length=content_length, + timeout=timeout, + transactional_content_md5=transactional_content_md5, + transactional_content_crc64=transactional_content_crc64, + lease_id=_lease_id, + max_size=_max_size, + append_position=_append_position, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.append_block.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -404,12 +373,15 @@ async def append_block( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - append_block.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + append_block.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def append_block_from_url( + @distributed_trace_async + async def append_block_from_url( # pylint: disable=inconsistent-return-statements self, source_url: str, content_length: int, @@ -466,11 +438,16 @@ async def append_block_from_url( :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param append_position_access_conditions: Parameter group. - :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions + :type append_position_access_conditions: + ~azure.storage.blob.models.AppendPositionAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword comp: comp. The default value is "appendblock". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -481,7 +458,9 @@ async def append_block_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "appendblock") # type: str + _encryption_key = None _encryption_key_sha256 = None _encryption_algorithm = None @@ -498,9 +477,6 @@ async def append_block_from_url( _source_if_unmodified_since = None _source_if_match = None _source_if_none_match = None - if append_position_access_conditions is not None: - _max_size = append_position_access_conditions.max_size - _append_position = append_position_access_conditions.append_position if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 @@ -509,6 +485,9 @@ async def append_block_from_url( _encryption_scope = cpk_scope_info.encryption_scope if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id + if append_position_access_conditions is not None: + _max_size = append_position_access_conditions.max_size + _append_position = append_position_access_conditions.append_position if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since @@ -520,80 +499,51 @@ async def append_block_from_url( _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since _source_if_match = source_modified_access_conditions.source_if_match _source_if_none_match = source_modified_access_conditions.source_if_none_match - comp = "appendblock" - accept = "application/xml" - # Construct URL - url = self.append_block_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-copy-source'] = self._serialize.header("source_url", source_url, 'str') - if source_range is not None: - header_parameters['x-ms-source-range'] = self._serialize.header("source_range", source_range, 'str') - if source_content_md5 is not None: - header_parameters['x-ms-source-content-md5'] = self._serialize.header("source_content_md5", source_content_md5, 'bytearray') - if source_contentcrc64 is not None: - header_parameters['x-ms-source-content-crc64'] = self._serialize.header("source_contentcrc64", source_contentcrc64, 'bytearray') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _max_size is not None: - header_parameters['x-ms-blob-condition-maxsize'] = self._serialize.header("max_size", _max_size, 'long') - if _append_position is not None: - header_parameters['x-ms-blob-condition-appendpos'] = self._serialize.header("append_position", _append_position, 'long') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if copy_source_authorization is not None: - header_parameters['x-ms-copy-source-authorization'] = self._serialize.header("copy_source_authorization", copy_source_authorization, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_append_block_from_url_request( + url=self._config.url, + comp=comp, + version=self._config.version, + source_url=source_url, + content_length=content_length, + source_range=source_range, + source_content_md5=source_content_md5, + source_contentcrc64=source_contentcrc64, + timeout=timeout, + transactional_content_md5=transactional_content_md5, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + lease_id=_lease_id, + max_size=_max_size, + append_position=_append_position, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + request_id_parameter=request_id_parameter, + copy_source_authorization=copy_source_authorization, + template_url=self.append_block_from_url.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -610,12 +560,15 @@ async def append_block_from_url( response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - append_block_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + append_block_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - async def seal( + + @distributed_trace_async + async def seal( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -640,7 +593,11 @@ async def seal( :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param append_position_access_conditions: Parameter group. - :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions + :type append_position_access_conditions: + ~azure.storage.blob.models.AppendPositionAccessConditions + :keyword comp: comp. The default value is "seal". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -651,15 +608,15 @@ async def seal( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "seal") # type: str + _lease_id = None _if_modified_since = None _if_unmodified_since = None _if_match = None _if_none_match = None _append_position = None - if append_position_access_conditions is not None: - _append_position = append_position_access_conditions.append_position if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: @@ -667,48 +624,36 @@ async def seal( _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match - comp = "seal" - accept = "application/xml" + if append_position_access_conditions is not None: + _append_position = append_position_access_conditions.append_position - # Construct URL - url = self.seal.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _append_position is not None: - header_parameters['x-ms-blob-condition-appendpos'] = self._serialize.header("append_position", _append_position, 'long') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_seal_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + lease_id=_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + append_position=_append_position, + template_url=self.seal.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -720,7 +665,9 @@ async def seal( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-blob-sealed']=self._deserialize('bool', response.headers.get('x-ms-blob-sealed')) + if cls: return cls(pipeline_response, None, response_headers) - seal.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + seal.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py index 46a5ad21ca32..968af7598c41 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,19 +7,21 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._blob_operations import build_abort_copy_from_url_request, build_acquire_lease_request, build_break_lease_request, build_change_lease_request, build_copy_from_url_request, build_create_snapshot_request, build_delete_immutability_policy_request, build_delete_request, build_download_request, build_get_account_info_request, build_get_properties_request, build_get_tags_request, build_query_request, build_release_lease_request, build_renew_lease_request, build_set_expiry_request, build_set_http_headers_request, build_set_immutability_policy_request, build_set_legal_hold_request, build_set_metadata_request, build_set_tags_request, build_set_tier_request, build_start_copy_from_url_request, build_undelete_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class BlobOperations: +class BlobOperations: # pylint: disable=too-many-public-methods """BlobOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -40,6 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def download( self, snapshot: Optional[str] = None, @@ -100,7 +104,7 @@ async def download( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -110,82 +114,61 @@ async def download( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - accept = "application/xml" - # Construct URL - url = self.download.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if version_id is not None: - query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if range_get_content_md5 is not None: - header_parameters['x-ms-range-get-content-md5'] = self._serialize.header("range_get_content_md5", range_get_content_md5, 'bool') - if range_get_content_crc64 is not None: - header_parameters['x-ms-range-get-content-crc64'] = self._serialize.header("range_get_content_crc64", range_get_content_crc64, 'bool') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + request = build_download_request( + url=self._config.url, + version=self._config.version, + snapshot=snapshot, + version_id=version_id, + timeout=timeout, + range=range, + lease_id=_lease_id, + range_get_content_md5=range_get_content_md5, + range_get_content_crc64=range_get_content_crc64, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.download.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=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 206]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} if response.status_code == 200: response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['x-ms-or-policy-id']=self._deserialize('str', response.headers.get('x-ms-or-policy-id')) - response_headers['x-ms-or']=self._deserialize('str', response.headers.get('x-ms-or')) + response_headers['x-ms-or']=self._deserialize('{str}', response.headers.get('x-ms-or')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range')) @@ -224,13 +207,14 @@ async def download( response_headers['x-ms-immutability-policy-until-date']=self._deserialize('rfc-1123', response.headers.get('x-ms-immutability-policy-until-date')) response_headers['x-ms-immutability-policy-mode']=self._deserialize('str', response.headers.get('x-ms-immutability-policy-mode')) response_headers['x-ms-legal-hold']=self._deserialize('bool', response.headers.get('x-ms-legal-hold')) + deserialized = response.stream_download(self._client._pipeline) if response.status_code == 206: response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['x-ms-or-policy-id']=self._deserialize('str', response.headers.get('x-ms-or-policy-id')) - response_headers['x-ms-or']=self._deserialize('str', response.headers.get('x-ms-or')) + response_headers['x-ms-or']=self._deserialize('{str}', response.headers.get('x-ms-or')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range')) @@ -270,15 +254,19 @@ async def download( response_headers['x-ms-immutability-policy-until-date']=self._deserialize('rfc-1123', response.headers.get('x-ms-immutability-policy-until-date')) response_headers['x-ms-immutability-policy-mode']=self._deserialize('str', response.headers.get('x-ms-immutability-policy-mode')) response_headers['x-ms-legal-hold']=self._deserialize('bool', response.headers.get('x-ms-legal-hold')) + deserialized = response.stream_download(self._client._pipeline) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - download.metadata = {'url': '/{containerName}/{blob}'} # type: ignore - async def get_properties( + download.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + + @distributed_trace_async + async def get_properties( # pylint: disable=inconsistent-return-statements self, snapshot: Optional[str] = None, version_id: Optional[str] = None, @@ -325,7 +313,7 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -335,76 +323,58 @@ async def get_properties( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - accept = "application/xml" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if version_id is not None: - query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_properties_request( + url=self._config.url, + version=self._config.version, + snapshot=snapshot, + version_id=version_id, + timeout=timeout, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) response_headers['x-ms-creation-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-creation-time')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['x-ms-or-policy-id']=self._deserialize('str', response.headers.get('x-ms-or-policy-id')) - response_headers['x-ms-or']=self._deserialize('str', response.headers.get('x-ms-or')) + response_headers['x-ms-or']=self._deserialize('{str}', response.headers.get('x-ms-or')) response_headers['x-ms-blob-type']=self._deserialize('str', response.headers.get('x-ms-blob-type')) response_headers['x-ms-copy-completion-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')) response_headers['x-ms-copy-status-description']=self._deserialize('str', response.headers.get('x-ms-copy-status-description')) @@ -450,12 +420,15 @@ async def get_properties( response_headers['x-ms-immutability-policy-mode']=self._deserialize('str', response.headers.get('x-ms-immutability-policy-mode')) response_headers['x-ms-legal-hold']=self._deserialize('bool', response.headers.get('x-ms-legal-hold')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + get_properties.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def delete( + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, snapshot: Optional[str] = None, version_id: Optional[str] = None, @@ -502,7 +475,7 @@ async def delete( limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str :param blob_delete_type: Optional. Only possible value is 'permanent', which specifies to - permanently delete a blob if blob soft delete is enabled. + permanently delete a blob if blob soft delete is enabled. The default value is "Permanent". :type blob_delete_type: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions @@ -518,7 +491,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _if_modified_since = None _if_unmodified_since = None @@ -533,54 +506,37 @@ async def delete( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - accept = "application/xml" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if version_id is not None: - query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if blob_delete_type is not None: - query_parameters['deletetype'] = self._serialize.query("blob_delete_type", blob_delete_type, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if delete_snapshots is not None: - header_parameters['x-ms-delete-snapshots'] = self._serialize.header("delete_snapshots", delete_snapshots, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_delete_request( + url=self._config.url, + version=self._config.version, + snapshot=snapshot, + version_id=version_id, + timeout=timeout, + lease_id=_lease_id, + delete_snapshots=delete_snapshots, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + blob_delete_type=blob_delete_type, + template_url=self.delete.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -589,12 +545,15 @@ async def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + delete.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - async def undelete( + + @distributed_trace_async + async def undelete( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -610,6 +569,9 @@ async def undelete( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "undelete". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -620,36 +582,31 @@ async def undelete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "undelete" - accept = "application/xml" - # Construct URL - url = self.undelete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "undelete") # type: str + + + request = build_undelete_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.undelete.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -658,12 +615,15 @@ async def undelete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - undelete.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + undelete.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - async def set_expiry( + + @distributed_trace_async + async def set_expiry( # pylint: disable=inconsistent-return-statements self, expiry_options: Union[str, "_models.BlobExpiryOptions"], timeout: Optional[int] = None, @@ -685,6 +645,9 @@ async def set_expiry( :type request_id_parameter: str :param expires_on: The time to set the blob to expiry. :type expires_on: str + :keyword comp: comp. The default value is "expiry". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -695,39 +658,33 @@ async def set_expiry( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "expiry" - accept = "application/xml" - # Construct URL - url = self.set_expiry.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-expiry-option'] = self._serialize.header("expiry_options", expiry_options, 'str') - if expires_on is not None: - header_parameters['x-ms-expiry-time'] = self._serialize.header("expires_on", expires_on, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "expiry") # type: str + + + request = build_set_expiry_request( + url=self._config.url, + comp=comp, + version=self._config.version, + expiry_options=expiry_options, + timeout=timeout, + request_id_parameter=request_id_parameter, + expires_on=expires_on, + template_url=self.set_expiry.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -738,12 +695,15 @@ async def set_expiry( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_expiry.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_expiry.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - async def set_http_headers( + + @distributed_trace_async + async def set_http_headers( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -768,6 +728,9 @@ async def set_http_headers( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -778,7 +741,9 @@ async def set_http_headers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "properties") # type: str + _blob_cache_control = None _blob_content_type = None _blob_content_md5 = None @@ -797,7 +762,6 @@ async def set_http_headers( _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_disposition = blob_http_headers.blob_content_disposition if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: @@ -806,60 +770,42 @@ async def set_http_headers( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "properties" - accept = "application/xml" + if blob_http_headers is not None: + _blob_content_disposition = blob_http_headers.blob_content_disposition - # Construct URL - url = self.set_http_headers.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _blob_cache_control is not None: - header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", _blob_cache_control, 'str') - if _blob_content_type is not None: - header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", _blob_content_type, 'str') - if _blob_content_md5 is not None: - header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", _blob_content_md5, 'bytearray') - if _blob_content_encoding is not None: - header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", _blob_content_encoding, 'str') - if _blob_content_language is not None: - header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", _blob_content_language, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _blob_content_disposition is not None: - header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", _blob_content_disposition, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_http_headers_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + blob_cache_control=_blob_cache_control, + blob_content_type=_blob_content_type, + blob_content_md5=_blob_content_md5, + blob_content_encoding=_blob_content_encoding, + blob_content_language=_blob_content_language, + lease_id=_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + blob_content_disposition=_blob_content_disposition, + request_id_parameter=request_id_parameter, + template_url=self.set_http_headers.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -871,12 +817,15 @@ async def set_http_headers( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_http_headers.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_http_headers.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def set_immutability_policy( + @distributed_trace_async + async def set_immutability_policy( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -902,6 +851,9 @@ async def set_immutability_policy( :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "immutabilityPolicies". Note that overriding this + default value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -912,46 +864,37 @@ async def set_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "immutabilityPolicies") # type: str + _if_unmodified_since = None if modified_access_conditions is not None: _if_unmodified_since = modified_access_conditions.if_unmodified_since - comp = "immutabilityPolicies" - accept = "application/xml" - # Construct URL - url = self.set_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_immutability_policy_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + if_unmodified_since=_if_unmodified_since, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + template_url=self.set_immutability_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -962,12 +905,15 @@ async def set_immutability_policy( response_headers['x-ms-immutability-policy-until-date']=self._deserialize('rfc-1123', response.headers.get('x-ms-immutability-policy-until-date')) response_headers['x-ms-immutability-policy-mode']=self._deserialize('str', response.headers.get('x-ms-immutability-policy-mode')) + if cls: return cls(pipeline_response, None, response_headers) - set_immutability_policy.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_immutability_policy.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def delete_immutability_policy( + @distributed_trace_async + async def delete_immutability_policy( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -983,6 +929,9 @@ async def delete_immutability_policy( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "immutabilityPolicies". Note that overriding this + default value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -993,36 +942,31 @@ async def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "immutabilityPolicies" - accept = "application/xml" - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "immutabilityPolicies") # type: str + + + request = build_delete_immutability_policy_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.delete_immutability_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1031,12 +975,15 @@ async def delete_immutability_policy( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete_immutability_policy.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + delete_immutability_policy.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def set_legal_hold( + @distributed_trace_async + async def set_legal_hold( # pylint: disable=inconsistent-return-statements self, legal_hold: bool, timeout: Optional[int] = None, @@ -1055,6 +1002,9 @@ async def set_legal_hold( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "legalhold". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1065,37 +1015,32 @@ async def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "legalhold" - accept = "application/xml" - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "legalhold") # type: str + + + request = build_set_legal_hold_request( + url=self._config.url, + comp=comp, + version=self._config.version, + legal_hold=legal_hold, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.set_legal_hold.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1105,15 +1050,18 @@ async def set_legal_hold( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-legal-hold']=self._deserialize('bool', response.headers.get('x-ms-legal-hold')) + if cls: return cls(pipeline_response, None, response_headers) - set_legal_hold.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_legal_hold.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def set_metadata( + @distributed_trace_async + async def set_metadata( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None, cpk_info: Optional["_models.CpkInfo"] = None, @@ -1136,7 +1084,7 @@ async def set_metadata( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str @@ -1148,6 +1096,9 @@ async def set_metadata( :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1158,7 +1109,9 @@ async def set_metadata( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "metadata") # type: str + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -1169,72 +1122,53 @@ async def set_metadata( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "metadata" - accept = "application/xml" - # Construct URL - url = self.set_metadata.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_metadata_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.set_metadata.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1249,12 +1183,15 @@ async def set_metadata( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_metadata.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def acquire_lease( + @distributed_trace_async + async def acquire_lease( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, duration: Optional[int] = None, @@ -1284,6 +1221,12 @@ async def acquire_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "acquire". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1294,7 +1237,10 @@ async def acquire_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "acquire") # type: str + _if_modified_since = None _if_unmodified_since = None _if_match = None @@ -1306,52 +1252,36 @@ async def acquire_lease( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "lease" - action = "acquire" - accept = "application/xml" - - # Construct URL - url = self.acquire_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if duration is not None: - header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_acquire_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + timeout=timeout, + duration=duration, + proposed_lease_id=proposed_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.acquire_lease.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1363,12 +1293,15 @@ async def acquire_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + acquire_lease.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - async def release_lease( + + @distributed_trace_async + async def release_lease( # pylint: disable=inconsistent-return-statements self, lease_id: str, timeout: Optional[int] = None, @@ -1391,6 +1324,12 @@ async def release_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "release". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1401,7 +1340,10 @@ async def release_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "release") # type: str + _if_modified_since = None _if_unmodified_since = None _if_match = None @@ -1413,49 +1355,35 @@ async def release_lease( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "lease" - action = "release" - accept = "application/xml" - - # Construct URL - url = self.release_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_release_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.release_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1466,12 +1394,15 @@ async def release_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + release_lease.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - async def renew_lease( + + @distributed_trace_async + async def renew_lease( # pylint: disable=inconsistent-return-statements self, lease_id: str, timeout: Optional[int] = None, @@ -1494,6 +1425,12 @@ async def renew_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "renew". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1504,7 +1441,10 @@ async def renew_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "renew") # type: str + _if_modified_since = None _if_unmodified_since = None _if_match = None @@ -1516,49 +1456,35 @@ async def renew_lease( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "lease" - action = "renew" - accept = "application/xml" - - # Construct URL - url = self.renew_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_renew_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.renew_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1570,12 +1496,15 @@ async def renew_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + renew_lease.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def change_lease( + @distributed_trace_async + async def change_lease( # pylint: disable=inconsistent-return-statements self, lease_id: str, proposed_lease_id: str, @@ -1603,6 +1532,12 @@ async def change_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "change". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1613,7 +1548,10 @@ async def change_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "change") # type: str + _if_modified_since = None _if_unmodified_since = None _if_match = None @@ -1625,50 +1563,36 @@ async def change_lease( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "lease" - action = "change" - accept = "application/xml" - - # Construct URL - url = self.change_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_change_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + lease_id=lease_id, + proposed_lease_id=proposed_lease_id, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.change_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1680,12 +1604,15 @@ async def change_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + change_lease.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def break_lease( + @distributed_trace_async + async def break_lease( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, break_period: Optional[int] = None, @@ -1714,6 +1641,12 @@ async def break_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "break". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1724,7 +1657,10 @@ async def break_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "break") # type: str + _if_modified_since = None _if_unmodified_since = None _if_match = None @@ -1736,50 +1672,35 @@ async def break_lease( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "lease" - action = "break" - accept = "application/xml" - - # Construct URL - url = self.break_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if break_period is not None: - header_parameters['x-ms-lease-break-period'] = self._serialize.header("break_period", break_period, 'int') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_break_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + timeout=timeout, + break_period=break_period, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.break_lease.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1791,15 +1712,18 @@ async def break_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + break_lease.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def create_snapshot( + @distributed_trace_async + async def create_snapshot( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, cpk_info: Optional["_models.CpkInfo"] = None, cpk_scope_info: Optional["_models.CpkScopeInfo"] = None, @@ -1821,7 +1745,7 @@ async def create_snapshot( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str @@ -1833,6 +1757,9 @@ async def create_snapshot( :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. The default value is "snapshot". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1843,7 +1770,9 @@ async def create_snapshot( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "snapshot") # type: str + _encryption_key = None _encryption_key_sha256 = None _encryption_algorithm = None @@ -1860,66 +1789,47 @@ async def create_snapshot( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "snapshot" - accept = "application/xml" + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id - # Construct URL - url = self.create_snapshot.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_create_snapshot_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.create_snapshot.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1933,16 +1843,19 @@ async def create_snapshot( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - create_snapshot.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + create_snapshot.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def start_copy_from_url( + @distributed_trace_async + async def start_copy_from_url( # pylint: disable=inconsistent-return-statements self, copy_source: str, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, rehydrate_priority: Optional[Union[str, "_models.RehydratePriority"]] = None, request_id_parameter: Optional[str] = None, @@ -1975,7 +1888,7 @@ async def start_copy_from_url( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param tier: Optional. Indicates the tier to be set on the blob. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param rehydrate_priority: Optional: Indicates the priority with which to rehydrate an archived @@ -1997,7 +1910,8 @@ async def start_copy_from_url( :param legal_hold: Specified if a legal hold should be set on the blob. :type legal_hold: bool :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.blob.models.SourceModifiedAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. @@ -2012,7 +1926,7 @@ async def start_copy_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _source_if_modified_since = None _source_if_unmodified_since = None _source_if_match = None @@ -2024,87 +1938,61 @@ async def start_copy_from_url( _if_none_match = None _if_tags = None _lease_id = None - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id - if modified_access_conditions is not None: - _if_modified_since = modified_access_conditions.if_modified_since - _if_unmodified_since = modified_access_conditions.if_unmodified_since - _if_match = modified_access_conditions.if_match - _if_none_match = modified_access_conditions.if_none_match - _if_tags = modified_access_conditions.if_tags if source_modified_access_conditions is not None: _source_if_modified_since = source_modified_access_conditions.source_if_modified_since _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since _source_if_match = source_modified_access_conditions.source_if_match _source_if_none_match = source_modified_access_conditions.source_if_none_match _source_if_tags = source_modified_access_conditions.source_if_tags - accept = "application/xml" + if modified_access_conditions is not None: + _if_modified_since = modified_access_conditions.if_modified_since + _if_unmodified_since = modified_access_conditions.if_unmodified_since + _if_match = modified_access_conditions.if_match + _if_none_match = modified_access_conditions.if_none_match + _if_tags = modified_access_conditions.if_tags + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id - # Construct URL - url = self.start_copy_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if rehydrate_priority is not None: - header_parameters['x-ms-rehydrate-priority'] = self._serialize.header("rehydrate_priority", rehydrate_priority, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - if _source_if_tags is not None: - header_parameters['x-ms-source-if-tags'] = self._serialize.header("source_if_tags", _source_if_tags, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - if seal_blob is not None: - header_parameters['x-ms-seal-blob'] = self._serialize.header("seal_blob", seal_blob, 'bool') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - if legal_hold is not None: - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_start_copy_from_url_request( + url=self._config.url, + version=self._config.version, + copy_source=copy_source, + timeout=timeout, + metadata=metadata, + tier=tier, + rehydrate_priority=rehydrate_priority, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + source_if_tags=_source_if_tags, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + blob_tags_string=blob_tags_string, + seal_blob=seal_blob, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + legal_hold=legal_hold, + template_url=self.start_copy_from_url.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -2118,16 +2006,19 @@ async def start_copy_from_url( response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id')) response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status')) + if cls: return cls(pipeline_response, None, response_headers) - start_copy_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + start_copy_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - async def copy_from_url( + + @distributed_trace_async + async def copy_from_url( # pylint: disable=inconsistent-return-statements self, copy_source: str, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, request_id_parameter: Optional[str] = None, source_content_md5: Optional[bytearray] = None, @@ -2162,7 +2053,7 @@ async def copy_from_url( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param tier: Optional. Indicates the tier to be set on the blob. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -2184,13 +2075,18 @@ async def copy_from_url( OAuth access token to copy source. :type copy_source_authorization: str :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.blob.models.SourceModifiedAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param cpk_scope_info: Parameter group. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo + :keyword x_ms_requires_sync: This header indicates that this is a synchronous Copy Blob From + URL instead of a Asynchronous Copy Blob. The default value is "true". Note that overriding this + default value may result in unsupported behavior. + :paramtype x_ms_requires_sync: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -2201,7 +2097,9 @@ async def copy_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + x_ms_requires_sync = kwargs.pop('x_ms_requires_sync', "true") # type: str + _source_if_modified_since = None _source_if_unmodified_since = None _source_if_match = None @@ -2213,90 +2111,63 @@ async def copy_from_url( _if_tags = None _lease_id = None _encryption_scope = None - if cpk_scope_info is not None: - _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id + if source_modified_access_conditions is not None: + _source_if_modified_since = source_modified_access_conditions.source_if_modified_since + _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since + _source_if_match = source_modified_access_conditions.source_if_match + _source_if_none_match = source_modified_access_conditions.source_if_none_match if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - if source_modified_access_conditions is not None: - _source_if_modified_since = source_modified_access_conditions.source_if_modified_since - _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since - _source_if_match = source_modified_access_conditions.source_if_match - _source_if_none_match = source_modified_access_conditions.source_if_none_match - x_ms_requires_sync = "true" - accept = "application/xml" + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + if cpk_scope_info is not None: + _encryption_scope = cpk_scope_info.encryption_scope - # Construct URL - url = self.copy_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-requires-sync'] = self._serialize.header("x_ms_requires_sync", x_ms_requires_sync, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if source_content_md5 is not None: - header_parameters['x-ms-source-content-md5'] = self._serialize.header("source_content_md5", source_content_md5, 'bytearray') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - if legal_hold is not None: - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - if copy_source_authorization is not None: - header_parameters['x-ms-copy-source-authorization'] = self._serialize.header("copy_source_authorization", copy_source_authorization, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_copy_from_url_request( + url=self._config.url, + x_ms_requires_sync=x_ms_requires_sync, + version=self._config.version, + copy_source=copy_source, + timeout=timeout, + metadata=metadata, + tier=tier, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + source_content_md5=source_content_md5, + blob_tags_string=blob_tags_string, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + legal_hold=legal_hold, + copy_source_authorization=copy_source_authorization, + encryption_scope=_encryption_scope, + template_url=self.copy_from_url.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -2313,12 +2184,15 @@ async def copy_from_url( response_headers['x-ms-content-crc64']=self._deserialize('bytearray', response.headers.get('x-ms-content-crc64')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - copy_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + copy_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - async def abort_copy_from_url( + + @distributed_trace_async + async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements self, copy_id: str, timeout: Optional[int] = None, @@ -2342,6 +2216,12 @@ async def abort_copy_from_url( :type request_id_parameter: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. The default value is "copy". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword copy_action_abort_constant: Copy action. The default value is "abort". Note that + overriding this default value may result in unsupported behavior. + :paramtype copy_action_abort_constant: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -2352,45 +2232,38 @@ async def abort_copy_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "copy") # type: str + copy_action_abort_constant = kwargs.pop('copy_action_abort_constant', "abort") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "copy" - copy_action_abort_constant = "abort" - accept = "application/xml" - - # Construct URL - url = self.abort_copy_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['copyid'] = self._serialize.query("copy_id", copy_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-copy-action'] = self._serialize.header("copy_action_abort_constant", copy_action_abort_constant, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_abort_copy_from_url_request( + url=self._config.url, + comp=comp, + copy_action_abort_constant=copy_action_abort_constant, + version=self._config.version, + copy_id=copy_id, + timeout=timeout, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.abort_copy_from_url.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -2399,12 +2272,15 @@ async def abort_copy_from_url( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - abort_copy_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + abort_copy_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def set_tier( + @distributed_trace_async + async def set_tier( # pylint: disable=inconsistent-return-statements self, tier: Union[str, "_models.AccessTierRequired"], snapshot: Optional[str] = None, @@ -2448,6 +2324,9 @@ async def set_tier( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "tier". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -2458,54 +2337,43 @@ async def set_tier( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "tier") # type: str + _lease_id = None _if_tags = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_tags = modified_access_conditions.if_tags - comp = "tier" - accept = "application/xml" - # Construct URL - url = self.set_tier.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if version_id is not None: - query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if rehydrate_priority is not None: - header_parameters['x-ms-rehydrate-priority'] = self._serialize.header("rehydrate_priority", rehydrate_priority, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_tier_request( + url=self._config.url, + comp=comp, + version=self._config.version, + tier=tier, + snapshot=snapshot, + version_id=version_id, + timeout=timeout, + rehydrate_priority=rehydrate_priority, + request_id_parameter=request_id_parameter, + lease_id=_lease_id, + if_tags=_if_tags, + template_url=self.set_tier.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 [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -2513,23 +2381,33 @@ async def set_tier( response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if response.status_code == 202: response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - set_tier.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_tier.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def get_account_info( + @distributed_trace_async + async def get_account_info( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: """Returns the sku name and account kind. + :keyword restype: restype. The default value is "account". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -2540,34 +2418,31 @@ async def get_account_info( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "account" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.get_account_info.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + restype = kwargs.pop('restype', "account") # type: str + comp = kwargs.pop('comp', "properties") # type: str - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_get_account_info_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + template_url=self.get_account_info.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -2578,11 +2453,14 @@ async def get_account_info( response_headers['x-ms-sku-name']=self._deserialize('str', response.headers.get('x-ms-sku-name')) response_headers['x-ms-account-kind']=self._deserialize('str', response.headers.get('x-ms-account-kind')) + if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + get_account_info.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + @distributed_trace_async async def query( self, snapshot: Optional[str] = None, @@ -2619,6 +2497,9 @@ async def query( :type cpk_info: ~azure.storage.blob.models.CpkInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "query". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IO, or the result of cls(response) :rtype: IO @@ -2629,7 +2510,10 @@ async def query( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "query") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -2639,82 +2523,62 @@ async def query( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "query" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.query.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if query_request is not None: - body_content = self._serialize.body(query_request, 'QueryRequest', is_xml=True) + _content = self._serialize.body(query_request, 'QueryRequest', is_xml=True) else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + _content = None + + request = build_query_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + snapshot=snapshot, + timeout=timeout, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.query.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=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 206]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} if response.status_code == 200: response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range')) @@ -2745,11 +2609,12 @@ async def query( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) response_headers['x-ms-blob-content-md5']=self._deserialize('bytearray', response.headers.get('x-ms-blob-content-md5')) + deserialized = response.stream_download(self._client._pipeline) if response.status_code == 206: response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range')) @@ -2781,14 +2646,18 @@ async def query( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) response_headers['x-ms-blob-content-md5']=self._deserialize('bytearray', response.headers.get('x-ms-blob-content-md5')) + deserialized = response.stream_download(self._client._pipeline) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - query.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + query.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + + @distributed_trace_async async def get_tags( self, timeout: Optional[int] = None, @@ -2822,6 +2691,9 @@ async def get_tags( :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. The default value is "tags". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobTags, or the result of cls(response) :rtype: ~azure.storage.blob.models.BlobTags @@ -2832,51 +2704,41 @@ async def get_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "tags") # type: str + _if_tags = None _lease_id = None - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_tags = modified_access_conditions.if_tags - comp = "tags" - accept = "application/xml" + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id - # Construct URL - url = self.get_tags.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if version_id is not None: - query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_tags_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + snapshot=snapshot, + version_id=version_id, + if_tags=_if_tags, + lease_id=_lease_id, + template_url=self.get_tags.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -2884,15 +2746,19 @@ async def get_tags( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('BlobTags', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_tags.metadata = {'url': '/{containerName}/{blob}'} # type: ignore - async def set_tags( + get_tags.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + + @distributed_trace_async + async def set_tags( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, version_id: Optional[str] = None, @@ -2929,6 +2795,9 @@ async def set_tags( :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. The default value is "tags". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -2939,61 +2808,49 @@ async def set_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "tags") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + _if_tags = None _lease_id = None - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_tags = modified_access_conditions.if_tags - comp = "tags" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_tags.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if version_id is not None: - query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - if transactional_content_crc64 is not None: - header_parameters['x-ms-content-crc64'] = self._serialize.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if tags is not None: - body_content = self._serialize.body(tags, 'BlobTags', is_xml=True) + _content = self._serialize.body(tags, 'BlobTags', is_xml=True) else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _content = None + + request = build_set_tags_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + version_id=version_id, + transactional_content_md5=transactional_content_md5, + transactional_content_crc64=transactional_content_crc64, + request_id_parameter=request_id_parameter, + if_tags=_if_tags, + lease_id=_lease_id, + template_url=self.set_tags.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -3002,7 +2859,9 @@ async def set_tags( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_tags.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_tags.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py index c45f674cb758..d05cb986a2b5 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,15 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._block_blob_operations import build_commit_block_list_request, build_get_block_list_request, build_put_blob_from_url_request, build_stage_block_from_url_request, build_stage_block_request, build_upload_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,13 +43,14 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def upload( + @distributed_trace_async + async def upload( # pylint: disable=inconsistent-return-statements self, content_length: int, body: IO, timeout: Optional[int] = None, transactional_content_md5: Optional[bytearray] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, @@ -85,7 +89,7 @@ async def upload( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param tier: Optional. Indicates the tier to be set on the blob. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -110,6 +114,10 @@ async def upload( :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append + blob. The default value is "BlockBlob". Note that overriding this default value may result in + unsupported behavior. + :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -120,7 +128,10 @@ async def upload( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + blob_type = kwargs.pop('blob_type', "BlockBlob") # type: str + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] + _blob_content_type = None _blob_content_encoding = None _blob_content_language = None @@ -143,6 +154,9 @@ async def upload( _blob_content_language = blob_http_headers.blob_content_language _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_cache_control = blob_http_headers.blob_cache_control + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + if blob_http_headers is not None: _blob_content_disposition = blob_http_headers.blob_content_disposition if cpk_info is not None: _encryption_key = cpk_info.encryption_key @@ -150,95 +164,61 @@ async def upload( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - blob_type = "BlockBlob" - content_type = kwargs.pop("content_type", "application/octet-stream") - accept = "application/xml" - - # Construct URL - url = self.upload.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-blob-type'] = self._serialize.header("blob_type", blob_type, 'str') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if _blob_content_type is not None: - header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", _blob_content_type, 'str') - if _blob_content_encoding is not None: - header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", _blob_content_encoding, 'str') - if _blob_content_language is not None: - header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", _blob_content_language, 'str') - if _blob_content_md5 is not None: - header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", _blob_content_md5, 'bytearray') - if _blob_cache_control is not None: - header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", _blob_cache_control, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _blob_content_disposition is not None: - header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", _blob_content_disposition, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - if legal_hold is not None: - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = body - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _content = body + + request = build_upload_request( + url=self._config.url, + blob_type=blob_type, + version=self._config.version, + content_type=content_type, + content=_content, + content_length=content_length, + timeout=timeout, + transactional_content_md5=transactional_content_md5, + blob_content_type=_blob_content_type, + blob_content_encoding=_blob_content_encoding, + blob_content_language=_blob_content_language, + blob_content_md5=_blob_content_md5, + blob_cache_control=_blob_cache_control, + metadata=metadata, + lease_id=_lease_id, + blob_content_disposition=_blob_content_disposition, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + tier=tier, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + blob_tags_string=blob_tags_string, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + legal_hold=legal_hold, + template_url=self.upload.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -254,18 +234,21 @@ async def upload( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - upload.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + upload.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - async def put_blob_from_url( + + @distributed_trace_async + async def put_blob_from_url( # pylint: disable=inconsistent-return-statements self, content_length: int, copy_source: str, timeout: Optional[int] = None, transactional_content_md5: Optional[bytearray] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, request_id_parameter: Optional[str] = None, source_content_md5: Optional[bytearray] = None, @@ -308,7 +291,7 @@ async def put_blob_from_url( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param tier: Optional. Indicates the tier to be set on the blob. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -336,7 +319,12 @@ async def put_blob_from_url( :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append + blob. The default value is "BlockBlob". Note that overriding this default value may result in + unsupported behavior. + :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -347,7 +335,9 @@ async def put_blob_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + blob_type = kwargs.pop('blob_type', "BlockBlob") # type: str + _blob_content_type = None _blob_content_encoding = None _blob_content_language = None @@ -375,6 +365,9 @@ async def put_blob_from_url( _blob_content_language = blob_http_headers.blob_content_language _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_cache_control = blob_http_headers.blob_cache_control + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + if blob_http_headers is not None: _blob_content_disposition = blob_http_headers.blob_content_disposition if cpk_info is not None: _encryption_key = cpk_info.encryption_key @@ -382,8 +375,6 @@ async def put_blob_from_url( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since @@ -396,94 +387,58 @@ async def put_blob_from_url( _source_if_match = source_modified_access_conditions.source_if_match _source_if_none_match = source_modified_access_conditions.source_if_none_match _source_if_tags = source_modified_access_conditions.source_if_tags - blob_type = "BlockBlob" - accept = "application/xml" - # Construct URL - url = self.put_blob_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-blob-type'] = self._serialize.header("blob_type", blob_type, 'str') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if _blob_content_type is not None: - header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", _blob_content_type, 'str') - if _blob_content_encoding is not None: - header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", _blob_content_encoding, 'str') - if _blob_content_language is not None: - header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", _blob_content_language, 'str') - if _blob_content_md5 is not None: - header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", _blob_content_md5, 'bytearray') - if _blob_cache_control is not None: - header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", _blob_cache_control, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _blob_content_disposition is not None: - header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", _blob_content_disposition, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - if _source_if_tags is not None: - header_parameters['x-ms-source-if-tags'] = self._serialize.header("source_if_tags", _source_if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if source_content_md5 is not None: - header_parameters['x-ms-source-content-md5'] = self._serialize.header("source_content_md5", source_content_md5, 'bytearray') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') - if copy_source_blob_properties is not None: - header_parameters['x-ms-copy-source-blob-properties'] = self._serialize.header("copy_source_blob_properties", copy_source_blob_properties, 'bool') - if copy_source_authorization is not None: - header_parameters['x-ms-copy-source-authorization'] = self._serialize.header("copy_source_authorization", copy_source_authorization, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_put_blob_from_url_request( + url=self._config.url, + blob_type=blob_type, + version=self._config.version, + content_length=content_length, + copy_source=copy_source, + timeout=timeout, + transactional_content_md5=transactional_content_md5, + blob_content_type=_blob_content_type, + blob_content_encoding=_blob_content_encoding, + blob_content_language=_blob_content_language, + blob_content_md5=_blob_content_md5, + blob_cache_control=_blob_cache_control, + metadata=metadata, + lease_id=_lease_id, + blob_content_disposition=_blob_content_disposition, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + tier=tier, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + source_if_tags=_source_if_tags, + request_id_parameter=request_id_parameter, + source_content_md5=source_content_md5, + blob_tags_string=blob_tags_string, + copy_source_blob_properties=copy_source_blob_properties, + copy_source_authorization=copy_source_authorization, + template_url=self.put_blob_from_url.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -499,12 +454,15 @@ async def put_blob_from_url( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - put_blob_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + put_blob_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - async def stage_block( + + @distributed_trace_async + async def stage_block( # pylint: disable=inconsistent-return-statements self, block_id: str, content_length: int, @@ -548,6 +506,9 @@ async def stage_block( :type cpk_info: ~azure.storage.blob.models.CpkInfo :param cpk_scope_info: Parameter group. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo + :keyword comp: comp. The default value is "block". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -558,70 +519,57 @@ async def stage_block( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "block") # type: str + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] + _lease_id = None _encryption_key = None _encryption_key_sha256 = None _encryption_algorithm = None _encryption_scope = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id - comp = "block" - content_type = kwargs.pop("content_type", "application/octet-stream") - accept = "application/xml" - - # Construct URL - url = self.stage_block.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['blockid'] = self._serialize.query("block_id", block_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - if transactional_content_crc64 is not None: - header_parameters['x-ms-content-crc64'] = self._serialize.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = body - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _content = body + + request = build_stage_block_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + block_id=block_id, + content_length=content_length, + transactional_content_md5=transactional_content_md5, + transactional_content_crc64=transactional_content_crc64, + timeout=timeout, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + request_id_parameter=request_id_parameter, + template_url=self.stage_block.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -635,12 +583,15 @@ async def stage_block( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - stage_block.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + stage_block.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def stage_block_from_url( + @distributed_trace_async + async def stage_block_from_url( # pylint: disable=inconsistent-return-statements self, block_id: str, content_length: int, @@ -694,7 +645,11 @@ async def stage_block_from_url( :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword comp: comp. The default value is "block". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -705,7 +660,9 @@ async def stage_block_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "block") # type: str + _encryption_key = None _encryption_key_sha256 = None _encryption_algorithm = None @@ -728,65 +685,44 @@ async def stage_block_from_url( _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since _source_if_match = source_modified_access_conditions.source_if_match _source_if_none_match = source_modified_access_conditions.source_if_none_match - comp = "block" - accept = "application/xml" - # Construct URL - url = self.stage_block_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['blockid'] = self._serialize.query("block_id", block_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - header_parameters['x-ms-copy-source'] = self._serialize.header("source_url", source_url, 'str') - if source_range is not None: - header_parameters['x-ms-source-range'] = self._serialize.header("source_range", source_range, 'str') - if source_content_md5 is not None: - header_parameters['x-ms-source-content-md5'] = self._serialize.header("source_content_md5", source_content_md5, 'bytearray') - if source_contentcrc64 is not None: - header_parameters['x-ms-source-content-crc64'] = self._serialize.header("source_contentcrc64", source_contentcrc64, 'bytearray') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if copy_source_authorization is not None: - header_parameters['x-ms-copy-source-authorization'] = self._serialize.header("copy_source_authorization", copy_source_authorization, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_stage_block_from_url_request( + url=self._config.url, + comp=comp, + version=self._config.version, + block_id=block_id, + content_length=content_length, + source_url=source_url, + source_range=source_range, + source_content_md5=source_content_md5, + source_contentcrc64=source_contentcrc64, + timeout=timeout, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + lease_id=_lease_id, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + request_id_parameter=request_id_parameter, + copy_source_authorization=copy_source_authorization, + template_url=self.stage_block_from_url.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -800,18 +736,21 @@ async def stage_block_from_url( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - stage_block_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + stage_block_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def commit_block_list( + @distributed_trace_async + async def commit_block_list( # pylint: disable=inconsistent-return-statements self, blocks: "_models.BlockLookupList", timeout: Optional[int] = None, transactional_content_md5: Optional[bytearray] = None, transactional_content_crc64: Optional[bytearray] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, tier: Optional[Union[str, "_models.AccessTierOptional"]] = None, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, @@ -853,7 +792,7 @@ async def commit_block_list( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param tier: Optional. Indicates the tier to be set on the blob. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -878,6 +817,9 @@ async def commit_block_list( :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "blocklist". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -888,7 +830,10 @@ async def commit_block_list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "blocklist") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + _blob_cache_control = None _blob_content_type = None _blob_content_encoding = None @@ -911,6 +856,9 @@ async def commit_block_list( _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language _blob_content_md5 = blob_http_headers.blob_content_md5 + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + if blob_http_headers is not None: _blob_content_disposition = blob_http_headers.blob_content_disposition if cpk_info is not None: _encryption_key = cpk_info.encryption_key @@ -918,97 +866,61 @@ async def commit_block_list( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "blocklist" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.commit_block_list.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _blob_cache_control is not None: - header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", _blob_cache_control, 'str') - if _blob_content_type is not None: - header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", _blob_content_type, 'str') - if _blob_content_encoding is not None: - header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", _blob_content_encoding, 'str') - if _blob_content_language is not None: - header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", _blob_content_language, 'str') - if _blob_content_md5 is not None: - header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", _blob_content_md5, 'bytearray') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - if transactional_content_crc64 is not None: - header_parameters['x-ms-content-crc64'] = self._serialize.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _blob_content_disposition is not None: - header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", _blob_content_disposition, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - if legal_hold is not None: - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blocks, 'BlockLookupList', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _content = self._serialize.body(blocks, 'BlockLookupList', is_xml=True) + + request = build_commit_block_list_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + blob_cache_control=_blob_cache_control, + blob_content_type=_blob_content_type, + blob_content_encoding=_blob_content_encoding, + blob_content_language=_blob_content_language, + blob_content_md5=_blob_content_md5, + transactional_content_md5=transactional_content_md5, + transactional_content_crc64=transactional_content_crc64, + metadata=metadata, + lease_id=_lease_id, + blob_content_disposition=_blob_content_disposition, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + tier=tier, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + blob_tags_string=blob_tags_string, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + legal_hold=legal_hold, + template_url=self.commit_block_list.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1025,11 +937,14 @@ async def commit_block_list( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - commit_block_list.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + commit_block_list.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + @distributed_trace_async async def get_block_list( self, snapshot: Optional[str] = None, @@ -1064,6 +979,9 @@ async def get_block_list( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "blocklist". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BlockList, or the result of cls(response) :rtype: ~azure.storage.blob.models.BlockList @@ -1074,50 +992,41 @@ async def get_block_list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "blocklist") # type: str + _lease_id = None _if_tags = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_tags = modified_access_conditions.if_tags - comp = "blocklist" - accept = "application/xml" - # Construct URL - url = self.get_block_list.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - query_parameters['blocklisttype'] = self._serialize.query("list_type", list_type, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_block_list_request( + url=self._config.url, + comp=comp, + version=self._config.version, + snapshot=snapshot, + list_type=list_type, + timeout=timeout, + lease_id=_lease_id, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.get_block_list.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1129,10 +1038,13 @@ async def get_block_list( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('BlockList', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_block_list.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + + get_block_list.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py index 18c70f533d89..2ff4c7c44605 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime -from typing import Any, Callable, Dict, Generic, IO, List, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._container_operations import build_acquire_lease_request, build_break_lease_request, build_change_lease_request, build_create_request, build_delete_request, build_filter_blobs_request, build_get_access_policy_request, build_get_account_info_request, build_get_properties_request, build_list_blob_flat_segment_request, build_list_blob_hierarchy_segment_request, build_release_lease_request, build_rename_request, build_renew_lease_request, build_restore_request, build_set_access_policy_request, build_set_metadata_request, build_submit_batch_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,10 +42,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def create( + @distributed_trace_async + async def create( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, access: Optional[Union[str, "_models.PublicAccessType"]] = None, request_id_parameter: Optional[str] = None, container_cpk_scope_info: Optional["_models.ContainerCpkScopeInfo"] = None, @@ -64,7 +67,7 @@ async def create( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param access: Specifies whether data in the container may be accessed publicly and the level of access. :type access: str or ~azure.storage.blob.models.PublicAccessType @@ -73,6 +76,9 @@ async def create( :type request_id_parameter: str :param container_cpk_scope_info: Parameter group. :type container_cpk_scope_info: ~azure.storage.blob.models.ContainerCpkScopeInfo + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -83,50 +89,40 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "container") # type: str + _default_encryption_scope = None _prevent_encryption_scope_override = None if container_cpk_scope_info is not None: _default_encryption_scope = container_cpk_scope_info.default_encryption_scope _prevent_encryption_scope_override = container_cpk_scope_info.prevent_encryption_scope_override - restype = "container" - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if access is not None: - header_parameters['x-ms-blob-public-access'] = self._serialize.header("access", access, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if _default_encryption_scope is not None: - header_parameters['x-ms-default-encryption-scope'] = self._serialize.header("default_encryption_scope", _default_encryption_scope, 'str') - if _prevent_encryption_scope_override is not None: - header_parameters['x-ms-deny-encryption-scope-override'] = self._serialize.header("prevent_encryption_scope_override", _prevent_encryption_scope_override, 'bool') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_create_request( + url=self._config.url, + restype=restype, + version=self._config.version, + timeout=timeout, + metadata=metadata, + access=access, + request_id_parameter=request_id_parameter, + default_encryption_scope=_default_encryption_scope, + prevent_encryption_scope_override=_prevent_encryption_scope_override, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -137,12 +133,15 @@ async def create( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{containerName}'} # type: ignore + create.metadata = {'url': "{url}/{containerName}"} # type: ignore - async def get_properties( + + @distributed_trace_async + async def get_properties( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -162,6 +161,9 @@ async def get_properties( :type request_id_parameter: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -172,46 +174,39 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "container") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "container" - accept = "application/xml" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_properties_request( + url=self._config.url, + restype=restype, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration')) @@ -228,12 +223,15 @@ async def get_properties( response_headers['x-ms-deny-encryption-scope-override']=self._deserialize('bool', response.headers.get('x-ms-deny-encryption-scope-override')) response_headers['x-ms-immutable-storage-with-versioning-enabled']=self._deserialize('bool', response.headers.get('x-ms-immutable-storage-with-versioning-enabled')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{containerName}'} # type: ignore + get_properties.metadata = {'url': "{url}/{containerName}"} # type: ignore - async def delete( + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -256,6 +254,9 @@ async def delete( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -266,7 +267,9 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "container") # type: str + _lease_id = None _if_modified_since = None _if_unmodified_since = None @@ -275,42 +278,31 @@ async def delete( if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - restype = "container" - accept = "application/xml" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_delete_request( + url=self._config.url, + restype=restype, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.delete.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -319,15 +311,18 @@ async def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{containerName}'} # type: ignore + delete.metadata = {'url': "{url}/{containerName}"} # type: ignore + - async def set_metadata( + @distributed_trace_async + async def set_metadata( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None, modified_access_conditions: Optional["_models.ModifiedAccessConditions"] = None, @@ -347,7 +342,7 @@ async def set_metadata( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str @@ -355,6 +350,12 @@ async def set_metadata( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -365,51 +366,42 @@ async def set_metadata( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "metadata") # type: str + _lease_id = None _if_modified_since = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since - restype = "container" - comp = "metadata" - accept = "application/xml" - - # Construct URL - url = self.set_metadata.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_set_metadata_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + metadata=metadata, + if_modified_since=_if_modified_since, + request_id_parameter=request_id_parameter, + template_url=self.set_metadata.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -420,11 +412,14 @@ async def set_metadata( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {'url': '/{containerName}'} # type: ignore + set_metadata.metadata = {'url': "{url}/{containerName}"} # type: ignore + + @distributed_trace_async async def get_access_policy( self, timeout: Optional[int] = None, @@ -445,6 +440,12 @@ async def get_access_policy( :type request_id_parameter: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "acl". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier, or the result of cls(response) :rtype: list[~azure.storage.blob.models.SignedIdentifier] @@ -455,44 +456,37 @@ async def get_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "acl") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "container" - comp = "acl" - accept = "application/xml" - - # Construct URL - url = self.get_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_get_access_policy_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.get_access_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -503,15 +497,19 @@ async def get_access_policy( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[SignedIdentifier]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_access_policy.metadata = {'url': '/{containerName}'} # type: ignore - async def set_access_policy( + get_access_policy.metadata = {'url': "{url}/{containerName}"} # type: ignore + + + @distributed_trace_async + async def set_access_policy( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, access: Optional[Union[str, "_models.PublicAccessType"]] = None, @@ -541,6 +539,12 @@ async def set_access_policy( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "acl". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -551,7 +555,11 @@ async def set_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "acl") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + _lease_id = None _if_modified_since = None _if_unmodified_since = None @@ -560,55 +568,40 @@ async def set_access_policy( if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - restype = "container" - comp = "acl" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if access is not None: - header_parameters['x-ms-blob-public-access'] = self._serialize.header("access", access, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'wrapped': True, 'itemsName': 'SignedIdentifier'}} + serialization_ctxt = {"xml": {'name': 'SignedIdentifiers', 'wrapped': True, 'itemsName': 'SignedIdentifier'}} if container_acl is not None: - body_content = self._serialize.body(container_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) + _content = self._serialize.body(container_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _content = None + + request = build_set_access_policy_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + lease_id=_lease_id, + access=access, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.set_access_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -619,12 +612,15 @@ async def set_access_policy( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_access_policy.metadata = {'url': '/{containerName}'} # type: ignore + set_access_policy.metadata = {'url': "{url}/{containerName}"} # type: ignore + - async def restore( + @distributed_trace_async + async def restore( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -648,6 +644,12 @@ async def restore( :param deleted_container_version: Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore. :type deleted_container_version: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "undelete". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -658,42 +660,35 @@ async def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "container" - comp = "undelete" - accept = "application/xml" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if deleted_container_name is not None: - header_parameters['x-ms-deleted-container-name'] = self._serialize.header("deleted_container_name", deleted_container_name, 'str') - if deleted_container_version is not None: - header_parameters['x-ms-deleted-container-version'] = self._serialize.header("deleted_container_version", deleted_container_version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "undelete") # type: str + + + request = build_restore_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + deleted_container_name=deleted_container_name, + deleted_container_version=deleted_container_version, + template_url=self.restore.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -702,12 +697,15 @@ async def restore( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - restore.metadata = {'url': '/{containerName}'} # type: ignore + restore.metadata = {'url': "{url}/{containerName}"} # type: ignore - async def rename( + + @distributed_trace_async + async def rename( # pylint: disable=inconsistent-return-statements self, source_container_name: str, timeout: Optional[int] = None, @@ -730,6 +728,12 @@ async def rename( :param source_lease_id: A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. :type source_lease_id: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "rename". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -740,41 +744,35 @@ async def rename( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "container" - comp = "rename" - accept = "application/xml" - - # Construct URL - url = self.rename.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-source-container-name'] = self._serialize.header("source_container_name", source_container_name, 'str') - if source_lease_id is not None: - header_parameters['x-ms-source-lease-id'] = self._serialize.header("source_lease_id", source_lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "rename") # type: str + + + request = build_rename_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + source_container_name=source_container_name, + timeout=timeout, + request_id_parameter=request_id_parameter, + source_lease_id=source_lease_id, + template_url=self.rename.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -783,15 +781,17 @@ async def rename( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - rename.metadata = {'url': '/{containerName}'} # type: ignore + rename.metadata = {'url': "{url}/{containerName}"} # type: ignore + + @distributed_trace_async async def submit_batch( self, content_length: int, - multipart_content_type: str, body: IO, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -801,9 +801,6 @@ async def submit_batch( :param content_length: The length of the request. :type content_length: long - :param multipart_content_type: Required. The value of this header must be multipart/mixed with - a batch boundary. Example header value: multipart/mixed; boundary=batch_:code:``. - :type multipart_content_type: str :param body: Initial data. :type body: IO :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -814,6 +811,15 @@ async def submit_batch( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword multipart_content_type: Required. The value of this header must be multipart/mixed + with a batch boundary. Example header value: multipart/mixed; boundary=batch_:code:``. + :paramtype multipart_content_type: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "batch". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IO, or the result of cls(response) :rtype: IO @@ -824,59 +830,56 @@ async def submit_batch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "container" - comp = "batch" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.submit_batch.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - header_parameters['Content-Type'] = self._serialize.header("multipart_content_type", multipart_content_type, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'IO', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + + multipart_content_type = kwargs.pop('multipart_content_type') # type: str + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "batch") # type: str + + _content = self._serialize.body(body, 'IO') + + request = build_submit_batch_request( + url=self._config.url, + multipart_content_type=multipart_content_type, + restype=restype, + comp=comp, + version=self._config.version, + content=_content, + content_length=content_length, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.submit_batch.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=True, + **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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = response.stream_download(self._client._pipeline) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - submit_batch.metadata = {'url': '/{containerName}'} # type: ignore + submit_batch.metadata = {'url': "{url}/{containerName}"} # type: ignore + + + @distributed_trace_async async def filter_blobs( self, timeout: Optional[int] = None, @@ -914,6 +917,12 @@ async def filter_blobs( it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000. :type maxresults: int + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "blobs". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FilterBlobSegment, or the result of cls(response) :rtype: ~azure.storage.blob.models.FilterBlobSegment @@ -924,44 +933,36 @@ async def filter_blobs( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "container" - comp = "blobs" - accept = "application/xml" - - # Construct URL - url = self.filter_blobs.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if where is not None: - query_parameters['where'] = self._serialize.query("where", where, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "blobs") # type: str + + + request = build_filter_blobs_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + where=where, + marker=marker, + maxresults=maxresults, + template_url=self.filter_blobs.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -969,15 +970,19 @@ async def filter_blobs( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('FilterBlobSegment', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - filter_blobs.metadata = {'url': '/{containerName}'} # type: ignore - async def acquire_lease( + filter_blobs.metadata = {'url': "{url}/{containerName}"} # type: ignore + + + @distributed_trace_async + async def acquire_lease( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, duration: Optional[int] = None, @@ -1007,6 +1012,15 @@ async def acquire_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword action: Describes what lease action to take. The default value is "acquire". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1017,54 +1031,44 @@ async def acquire_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "acquire") # type: str + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - comp = "lease" - restype = "container" - action = "acquire" - accept = "application/xml" - - # Construct URL - url = self.acquire_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if duration is not None: - header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_acquire_lease_request( + url=self._config.url, + comp=comp, + restype=restype, + action=action, + version=self._config.version, + timeout=timeout, + duration=duration, + proposed_lease_id=proposed_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.acquire_lease.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1076,12 +1080,15 @@ async def acquire_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {'url': '/{containerName}'} # type: ignore + acquire_lease.metadata = {'url': "{url}/{containerName}"} # type: ignore + - async def release_lease( + @distributed_trace_async + async def release_lease( # pylint: disable=inconsistent-return-statements self, lease_id: str, timeout: Optional[int] = None, @@ -1104,6 +1111,15 @@ async def release_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword action: Describes what lease action to take. The default value is "release". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1114,51 +1130,43 @@ async def release_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "release") # type: str + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - comp = "lease" - restype = "container" - action = "release" - accept = "application/xml" - - # Construct URL - url = self.release_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_release_lease_request( + url=self._config.url, + comp=comp, + restype=restype, + action=action, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.release_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1169,12 +1177,15 @@ async def release_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {'url': '/{containerName}'} # type: ignore + release_lease.metadata = {'url': "{url}/{containerName}"} # type: ignore + - async def renew_lease( + @distributed_trace_async + async def renew_lease( # pylint: disable=inconsistent-return-statements self, lease_id: str, timeout: Optional[int] = None, @@ -1197,6 +1208,15 @@ async def renew_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword action: Describes what lease action to take. The default value is "renew". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1207,51 +1227,43 @@ async def renew_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "renew") # type: str + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - comp = "lease" - restype = "container" - action = "renew" - accept = "application/xml" - - # Construct URL - url = self.renew_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_renew_lease_request( + url=self._config.url, + comp=comp, + restype=restype, + action=action, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.renew_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1263,12 +1275,15 @@ async def renew_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {'url': '/{containerName}'} # type: ignore + renew_lease.metadata = {'url': "{url}/{containerName}"} # type: ignore - async def break_lease( + + @distributed_trace_async + async def break_lease( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, break_period: Optional[int] = None, @@ -1297,6 +1312,15 @@ async def break_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword action: Describes what lease action to take. The default value is "break". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1307,52 +1331,43 @@ async def break_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "break") # type: str + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - comp = "lease" - restype = "container" - action = "break" - accept = "application/xml" - - # Construct URL - url = self.break_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if break_period is not None: - header_parameters['x-ms-lease-break-period'] = self._serialize.header("break_period", break_period, 'int') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_break_lease_request( + url=self._config.url, + comp=comp, + restype=restype, + action=action, + version=self._config.version, + timeout=timeout, + break_period=break_period, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.break_lease.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1364,12 +1379,15 @@ async def break_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {'url': '/{containerName}'} # type: ignore + break_lease.metadata = {'url': "{url}/{containerName}"} # type: ignore - async def change_lease( + + @distributed_trace_async + async def change_lease( # pylint: disable=inconsistent-return-statements self, lease_id: str, proposed_lease_id: str, @@ -1397,6 +1415,15 @@ async def change_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword action: Describes what lease action to take. The default value is "change". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1407,52 +1434,44 @@ async def change_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "change") # type: str + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - comp = "lease" - restype = "container" - action = "change" - accept = "application/xml" - - # Construct URL - url = self.change_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_change_lease_request( + url=self._config.url, + comp=comp, + restype=restype, + action=action, + version=self._config.version, + lease_id=lease_id, + proposed_lease_id=proposed_lease_id, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.change_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1464,11 +1483,14 @@ async def change_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {'url': '/{containerName}'} # type: ignore + change_lease.metadata = {'url': "{url}/{containerName}"} # type: ignore + + @distributed_trace_async async def list_blob_flat_segment( self, prefix: Optional[str] = None, @@ -1509,6 +1531,12 @@ async def list_blob_flat_segment( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListBlobsFlatSegmentResponse, or the result of cls(response) :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse @@ -1519,46 +1547,37 @@ async def list_blob_flat_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "container" - comp = "list" - accept = "application/xml" - - # Construct URL - url = self.list_blob_flat_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if include is not None: - query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "list") # type: str + + + request = build_list_blob_flat_segment_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + prefix=prefix, + marker=marker, + maxresults=maxresults, + include=include, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.list_blob_flat_segment.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1567,14 +1586,18 @@ async def list_blob_flat_segment( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ListBlobsFlatSegmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_blob_flat_segment.metadata = {'url': '/{containerName}'} # type: ignore + list_blob_flat_segment.metadata = {'url': "{url}/{containerName}"} # type: ignore + + + @distributed_trace_async async def list_blob_hierarchy_segment( self, delimiter: str, @@ -1621,6 +1644,12 @@ async def list_blob_hierarchy_segment( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListBlobsHierarchySegmentResponse, or the result of cls(response) :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse @@ -1631,47 +1660,38 @@ async def list_blob_hierarchy_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "container" - comp = "list" - accept = "application/xml" - - # Construct URL - url = self.list_blob_hierarchy_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - query_parameters['delimiter'] = self._serialize.query("delimiter", delimiter, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if include is not None: - query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "list") # type: str + + + request = build_list_blob_hierarchy_segment_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + delimiter=delimiter, + prefix=prefix, + marker=marker, + maxresults=maxresults, + include=include, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.list_blob_hierarchy_segment.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1680,20 +1700,30 @@ async def list_blob_hierarchy_segment( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ListBlobsHierarchySegmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_blob_hierarchy_segment.metadata = {'url': '/{containerName}'} # type: ignore - async def get_account_info( + list_blob_hierarchy_segment.metadata = {'url': "{url}/{containerName}"} # type: ignore + + + @distributed_trace_async + async def get_account_info( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: """Returns the sku name and account kind. + :keyword restype: restype. The default value is "account". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1704,34 +1734,31 @@ async def get_account_info( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "account" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.get_account_info.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + restype = kwargs.pop('restype', "account") # type: str + comp = kwargs.pop('comp', "properties") # type: str - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_get_account_info_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + template_url=self.get_account_info.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1742,7 +1769,9 @@ async def get_account_info( response_headers['x-ms-sku-name']=self._deserialize('str', response.headers.get('x-ms-sku-name')) response_headers['x-ms-account-kind']=self._deserialize('str', response.headers.get('x-ms-account-kind')) + if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {'url': '/{containerName}'} # type: ignore + get_account_info.metadata = {'url': "{url}/{containerName}"} # type: ignore + diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py index 06f17558bd2a..5f9f87bd36ba 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,15 +7,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import datetime -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._page_blob_operations import build_clear_pages_request, build_copy_incremental_request, build_create_request, build_get_page_ranges_diff_request, build_get_page_ranges_request, build_resize_request, build_update_sequence_number_request, build_upload_pages_from_url_request, build_upload_pages_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,13 +43,14 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def create( + @distributed_trace_async + async def create( # pylint: disable=inconsistent-return-statements self, content_length: int, blob_content_length: int, timeout: Optional[int] = None, tier: Optional[Union[str, "_models.PremiumPageBlobAccessTier"]] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, blob_sequence_number: Optional[int] = 0, request_id_parameter: Optional[str] = None, blob_tags_string: Optional[str] = None, @@ -81,7 +85,7 @@ async def create( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param blob_sequence_number: Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. @@ -108,6 +112,10 @@ async def create( :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append + blob. The default value is "PageBlob". Note that overriding this default value may result in + unsupported behavior. + :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -118,7 +126,9 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + blob_type = kwargs.pop('blob_type', "PageBlob") # type: str + _blob_content_type = None _blob_content_encoding = None _blob_content_language = None @@ -141,6 +151,9 @@ async def create( _blob_content_language = blob_http_headers.blob_content_language _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_cache_control = blob_http_headers.blob_cache_control + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + if blob_http_headers is not None: _blob_content_disposition = blob_http_headers.blob_content_disposition if cpk_info is not None: _encryption_key = cpk_info.encryption_key @@ -148,92 +161,59 @@ async def create( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - blob_type = "PageBlob" - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-blob-type'] = self._serialize.header("blob_type", blob_type, 'str') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if _blob_content_type is not None: - header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", _blob_content_type, 'str') - if _blob_content_encoding is not None: - header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", _blob_content_encoding, 'str') - if _blob_content_language is not None: - header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", _blob_content_language, 'str') - if _blob_content_md5 is not None: - header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", _blob_content_md5, 'bytearray') - if _blob_cache_control is not None: - header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", _blob_cache_control, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _blob_content_disposition is not None: - header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", _blob_content_disposition, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-blob-content-length'] = self._serialize.header("blob_content_length", blob_content_length, 'long') - if blob_sequence_number is not None: - header_parameters['x-ms-blob-sequence-number'] = self._serialize.header("blob_sequence_number", blob_sequence_number, 'long') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - if legal_hold is not None: - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_create_request( + url=self._config.url, + blob_type=blob_type, + version=self._config.version, + content_length=content_length, + blob_content_length=blob_content_length, + timeout=timeout, + tier=tier, + blob_content_type=_blob_content_type, + blob_content_encoding=_blob_content_encoding, + blob_content_language=_blob_content_language, + blob_content_md5=_blob_content_md5, + blob_cache_control=_blob_cache_control, + metadata=metadata, + lease_id=_lease_id, + blob_content_disposition=_blob_content_disposition, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + blob_sequence_number=blob_sequence_number, + request_id_parameter=request_id_parameter, + blob_tags_string=blob_tags_string, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + legal_hold=legal_hold, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -249,12 +229,15 @@ async def create( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + create.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def upload_pages( + @distributed_trace_async + async def upload_pages( # pylint: disable=inconsistent-return-statements self, content_length: int, body: IO, @@ -299,9 +282,23 @@ async def upload_pages( :param cpk_scope_info: Parameter group. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param sequence_number_access_conditions: Parameter group. - :type sequence_number_access_conditions: ~azure.storage.blob.models.SequenceNumberAccessConditions + :type sequence_number_access_conditions: + ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "page". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword page_write: Required. You may specify one of the following options: + + + * Update: Writes the bytes specified by the request body into the specified range. The Range + and Content-Length headers must match to perform the update. + * Clear: Clears the specified range and releases the space used in storage for that range. To + clear a range, set the Content-Length header to zero, and the Range header to a value that + indicates the range to clear, up to maximum blob size. The default value is "update". Note that + overriding this default value may result in unsupported behavior. + :paramtype page_write: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -312,7 +309,11 @@ async def upload_pages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "page") # type: str + page_write = kwargs.pop('page_write', "update") # type: str + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -326,93 +327,67 @@ async def upload_pages( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id + if sequence_number_access_conditions is not None: + _if_sequence_number_less_than_or_equal_to = sequence_number_access_conditions.if_sequence_number_less_than_or_equal_to + _if_sequence_number_less_than = sequence_number_access_conditions.if_sequence_number_less_than + _if_sequence_number_equal_to = sequence_number_access_conditions.if_sequence_number_equal_to if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - if sequence_number_access_conditions is not None: - _if_sequence_number_less_than_or_equal_to = sequence_number_access_conditions.if_sequence_number_less_than_or_equal_to - _if_sequence_number_less_than = sequence_number_access_conditions.if_sequence_number_less_than - _if_sequence_number_equal_to = sequence_number_access_conditions.if_sequence_number_equal_to - comp = "page" - page_write = "update" - content_type = kwargs.pop("content_type", "application/octet-stream") - accept = "application/xml" - - # Construct URL - url = self.upload_pages.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-page-write'] = self._serialize.header("page_write", page_write, 'str') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - if transactional_content_crc64 is not None: - header_parameters['x-ms-content-crc64'] = self._serialize.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_sequence_number_less_than_or_equal_to is not None: - header_parameters['x-ms-if-sequence-number-le'] = self._serialize.header("if_sequence_number_less_than_or_equal_to", _if_sequence_number_less_than_or_equal_to, 'long') - if _if_sequence_number_less_than is not None: - header_parameters['x-ms-if-sequence-number-lt'] = self._serialize.header("if_sequence_number_less_than", _if_sequence_number_less_than, 'long') - if _if_sequence_number_equal_to is not None: - header_parameters['x-ms-if-sequence-number-eq'] = self._serialize.header("if_sequence_number_equal_to", _if_sequence_number_equal_to, 'long') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = body - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _content = body + + request = build_upload_pages_request( + url=self._config.url, + comp=comp, + page_write=page_write, + version=self._config.version, + content_type=content_type, + content=_content, + content_length=content_length, + transactional_content_md5=transactional_content_md5, + transactional_content_crc64=transactional_content_crc64, + timeout=timeout, + range=range, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_sequence_number_less_than_or_equal_to=_if_sequence_number_less_than_or_equal_to, + if_sequence_number_less_than=_if_sequence_number_less_than, + if_sequence_number_equal_to=_if_sequence_number_equal_to, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.upload_pages.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -429,12 +404,15 @@ async def upload_pages( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - upload_pages.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + upload_pages.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def clear_pages( + @distributed_trace_async + async def clear_pages( # pylint: disable=inconsistent-return-statements self, content_length: int, timeout: Optional[int] = None, @@ -468,9 +446,23 @@ async def clear_pages( :param cpk_scope_info: Parameter group. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param sequence_number_access_conditions: Parameter group. - :type sequence_number_access_conditions: ~azure.storage.blob.models.SequenceNumberAccessConditions + :type sequence_number_access_conditions: + ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "page". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword page_write: Required. You may specify one of the following options: + + + * Update: Writes the bytes specified by the request body into the specified range. The Range + and Content-Length headers must match to perform the update. + * Clear: Clears the specified range and releases the space used in storage for that range. To + clear a range, set the Content-Length header to zero, and the Range header to a value that + indicates the range to clear, up to maximum blob size. The default value is "clear". Note that + overriding this default value may result in unsupported behavior. + :paramtype page_write: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -481,7 +473,10 @@ async def clear_pages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "page") # type: str + page_write = kwargs.pop('page_write', "clear") # type: str + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -495,85 +490,62 @@ async def clear_pages( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id + if sequence_number_access_conditions is not None: + _if_sequence_number_less_than_or_equal_to = sequence_number_access_conditions.if_sequence_number_less_than_or_equal_to + _if_sequence_number_less_than = sequence_number_access_conditions.if_sequence_number_less_than + _if_sequence_number_equal_to = sequence_number_access_conditions.if_sequence_number_equal_to if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - if sequence_number_access_conditions is not None: - _if_sequence_number_less_than_or_equal_to = sequence_number_access_conditions.if_sequence_number_less_than_or_equal_to - _if_sequence_number_less_than = sequence_number_access_conditions.if_sequence_number_less_than - _if_sequence_number_equal_to = sequence_number_access_conditions.if_sequence_number_equal_to - comp = "page" - page_write = "clear" - accept = "application/xml" - - # Construct URL - url = self.clear_pages.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-page-write'] = self._serialize.header("page_write", page_write, 'str') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_sequence_number_less_than_or_equal_to is not None: - header_parameters['x-ms-if-sequence-number-le'] = self._serialize.header("if_sequence_number_less_than_or_equal_to", _if_sequence_number_less_than_or_equal_to, 'long') - if _if_sequence_number_less_than is not None: - header_parameters['x-ms-if-sequence-number-lt'] = self._serialize.header("if_sequence_number_less_than", _if_sequence_number_less_than, 'long') - if _if_sequence_number_equal_to is not None: - header_parameters['x-ms-if-sequence-number-eq'] = self._serialize.header("if_sequence_number_equal_to", _if_sequence_number_equal_to, 'long') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_clear_pages_request( + url=self._config.url, + comp=comp, + page_write=page_write, + version=self._config.version, + content_length=content_length, + timeout=timeout, + range=range, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_sequence_number_less_than_or_equal_to=_if_sequence_number_less_than_or_equal_to, + if_sequence_number_less_than=_if_sequence_number_less_than, + if_sequence_number_equal_to=_if_sequence_number_equal_to, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.clear_pages.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -587,12 +559,15 @@ async def clear_pages( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - clear_pages.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + clear_pages.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def upload_pages_from_url( + @distributed_trace_async + async def upload_pages_from_url( # pylint: disable=inconsistent-return-statements self, source_url: str, source_range: str, @@ -648,11 +623,26 @@ async def upload_pages_from_url( :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param sequence_number_access_conditions: Parameter group. - :type sequence_number_access_conditions: ~azure.storage.blob.models.SequenceNumberAccessConditions + :type sequence_number_access_conditions: + ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword comp: comp. The default value is "page". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword page_write: Required. You may specify one of the following options: + + + * Update: Writes the bytes specified by the request body into the specified range. The Range + and Content-Length headers must match to perform the update. + * Clear: Clears the specified range and releases the space used in storage for that range. To + clear a range, set the Content-Length header to zero, and the Range header to a value that + indicates the range to clear, up to maximum blob size. The default value is "update". Note that + overriding this default value may result in unsupported behavior. + :paramtype page_write: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -663,7 +653,10 @@ async def upload_pages_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "page") # type: str + page_write = kwargs.pop('page_write', "update") # type: str + _encryption_key = None _encryption_key_sha256 = None _encryption_algorithm = None @@ -689,97 +682,68 @@ async def upload_pages_from_url( _encryption_scope = cpk_scope_info.encryption_scope if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id + if sequence_number_access_conditions is not None: + _if_sequence_number_less_than_or_equal_to = sequence_number_access_conditions.if_sequence_number_less_than_or_equal_to + _if_sequence_number_less_than = sequence_number_access_conditions.if_sequence_number_less_than + _if_sequence_number_equal_to = sequence_number_access_conditions.if_sequence_number_equal_to if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - if sequence_number_access_conditions is not None: - _if_sequence_number_less_than_or_equal_to = sequence_number_access_conditions.if_sequence_number_less_than_or_equal_to - _if_sequence_number_less_than = sequence_number_access_conditions.if_sequence_number_less_than - _if_sequence_number_equal_to = sequence_number_access_conditions.if_sequence_number_equal_to if source_modified_access_conditions is not None: _source_if_modified_since = source_modified_access_conditions.source_if_modified_since _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since _source_if_match = source_modified_access_conditions.source_if_match _source_if_none_match = source_modified_access_conditions.source_if_none_match - comp = "page" - page_write = "update" - accept = "application/xml" - - # Construct URL - url = self.upload_pages_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-page-write'] = self._serialize.header("page_write", page_write, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("source_url", source_url, 'str') - header_parameters['x-ms-source-range'] = self._serialize.header("source_range", source_range, 'str') - if source_content_md5 is not None: - header_parameters['x-ms-source-content-md5'] = self._serialize.header("source_content_md5", source_content_md5, 'bytearray') - if source_contentcrc64 is not None: - header_parameters['x-ms-source-content-crc64'] = self._serialize.header("source_contentcrc64", source_contentcrc64, 'bytearray') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_sequence_number_less_than_or_equal_to is not None: - header_parameters['x-ms-if-sequence-number-le'] = self._serialize.header("if_sequence_number_less_than_or_equal_to", _if_sequence_number_less_than_or_equal_to, 'long') - if _if_sequence_number_less_than is not None: - header_parameters['x-ms-if-sequence-number-lt'] = self._serialize.header("if_sequence_number_less_than", _if_sequence_number_less_than, 'long') - if _if_sequence_number_equal_to is not None: - header_parameters['x-ms-if-sequence-number-eq'] = self._serialize.header("if_sequence_number_equal_to", _if_sequence_number_equal_to, 'long') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if copy_source_authorization is not None: - header_parameters['x-ms-copy-source-authorization'] = self._serialize.header("copy_source_authorization", copy_source_authorization, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_upload_pages_from_url_request( + url=self._config.url, + comp=comp, + page_write=page_write, + version=self._config.version, + source_url=source_url, + source_range=source_range, + content_length=content_length, + range=range, + source_content_md5=source_content_md5, + source_contentcrc64=source_contentcrc64, + timeout=timeout, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + lease_id=_lease_id, + if_sequence_number_less_than_or_equal_to=_if_sequence_number_less_than_or_equal_to, + if_sequence_number_less_than=_if_sequence_number_less_than, + if_sequence_number_equal_to=_if_sequence_number_equal_to, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + request_id_parameter=request_id_parameter, + copy_source_authorization=copy_source_authorization, + template_url=self.upload_pages_from_url.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -795,11 +759,14 @@ async def upload_pages_from_url( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - upload_pages_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + upload_pages_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + @distributed_trace_async async def get_page_ranges( self, snapshot: Optional[str] = None, @@ -833,6 +800,9 @@ async def get_page_ranges( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "pagelist". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PageList, or the result of cls(response) :rtype: ~azure.storage.blob.models.PageList @@ -843,7 +813,9 @@ async def get_page_ranges( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "pagelist") # type: str + _lease_id = None _if_modified_since = None _if_unmodified_since = None @@ -858,52 +830,36 @@ async def get_page_ranges( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "pagelist" - accept = "application/xml" - # Construct URL - url = self.get_page_ranges.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_page_ranges_request( + url=self._config.url, + comp=comp, + version=self._config.version, + snapshot=snapshot, + timeout=timeout, + range=range, + lease_id=_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.get_page_ranges.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -914,14 +870,18 @@ async def get_page_ranges( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('PageList', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_page_ranges.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + get_page_ranges.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + + @distributed_trace_async async def get_page_ranges_diff( self, snapshot: Optional[str] = None, @@ -969,6 +929,9 @@ async def get_page_ranges_diff( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "pagelist". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PageList, or the result of cls(response) :rtype: ~azure.storage.blob.models.PageList @@ -979,7 +942,9 @@ async def get_page_ranges_diff( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "pagelist") # type: str + _lease_id = None _if_modified_since = None _if_unmodified_since = None @@ -994,56 +959,38 @@ async def get_page_ranges_diff( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "pagelist" - accept = "application/xml" - # Construct URL - url = self.get_page_ranges_diff.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if prevsnapshot is not None: - query_parameters['prevsnapshot'] = self._serialize.query("prevsnapshot", prevsnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if prev_snapshot_url is not None: - header_parameters['x-ms-previous-snapshot-url'] = self._serialize.header("prev_snapshot_url", prev_snapshot_url, 'str') - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_page_ranges_diff_request( + url=self._config.url, + comp=comp, + version=self._config.version, + snapshot=snapshot, + timeout=timeout, + prevsnapshot=prevsnapshot, + prev_snapshot_url=prev_snapshot_url, + range=range, + lease_id=_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.get_page_ranges_diff.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1054,15 +1001,19 @@ async def get_page_ranges_diff( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('PageList', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_page_ranges_diff.metadata = {'url': '/{containerName}/{blob}'} # type: ignore - async def resize( + get_page_ranges_diff.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + + @distributed_trace_async + async def resize( # pylint: disable=inconsistent-return-statements self, blob_content_length: int, timeout: Optional[int] = None, @@ -1094,6 +1045,9 @@ async def resize( :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1104,7 +1058,9 @@ async def resize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "properties") # type: str + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -1115,71 +1071,53 @@ async def resize( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "properties" - accept = "application/xml" - # Construct URL - url = self.resize.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-blob-content-length'] = self._serialize.header("blob_content_length", blob_content_length, 'long') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_resize_request( + url=self._config.url, + comp=comp, + version=self._config.version, + blob_content_length=blob_content_length, + timeout=timeout, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.resize.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1191,12 +1129,15 @@ async def resize( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - resize.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + resize.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - async def update_sequence_number( + + @distributed_trace_async + async def update_sequence_number( # pylint: disable=inconsistent-return-statements self, sequence_number_action: Union[str, "_models.SequenceNumberActionType"], timeout: Optional[int] = None, @@ -1228,6 +1169,9 @@ async def update_sequence_number( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1238,7 +1182,9 @@ async def update_sequence_number( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "properties") # type: str + _lease_id = None _if_modified_since = None _if_unmodified_since = None @@ -1253,51 +1199,36 @@ async def update_sequence_number( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "properties" - accept = "application/xml" - # Construct URL - url = self.update_sequence_number.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-sequence-number-action'] = self._serialize.header("sequence_number_action", sequence_number_action, 'str') - if blob_sequence_number is not None: - header_parameters['x-ms-blob-sequence-number'] = self._serialize.header("blob_sequence_number", blob_sequence_number, 'long') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_update_sequence_number_request( + url=self._config.url, + comp=comp, + version=self._config.version, + sequence_number_action=sequence_number_action, + timeout=timeout, + lease_id=_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + blob_sequence_number=blob_sequence_number, + request_id_parameter=request_id_parameter, + template_url=self.update_sequence_number.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1309,12 +1240,15 @@ async def update_sequence_number( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - update_sequence_number.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + update_sequence_number.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - async def copy_incremental( + @distributed_trace_async + async def copy_incremental( # pylint: disable=inconsistent-return-statements self, copy_source: str, timeout: Optional[int] = None, @@ -1343,6 +1277,9 @@ async def copy_incremental( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "incrementalcopy". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1353,7 +1290,9 @@ async def copy_incremental( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "incrementalcopy") # type: str + _if_modified_since = None _if_unmodified_since = None _if_match = None @@ -1365,47 +1304,34 @@ async def copy_incremental( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "incrementalcopy" - accept = "application/xml" - # Construct URL - url = self.copy_incremental.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_copy_incremental_request( + url=self._config.url, + comp=comp, + version=self._config.version, + copy_source=copy_source, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.copy_incremental.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1418,7 +1344,9 @@ async def copy_incremental( response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id')) response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status')) + if cls: return cls(pipeline_response, None, response_headers) - copy_incremental.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + copy_incremental.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py index a6592a33f7f2..8f0432a723cb 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, IO, List, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._service_operations import build_filter_blobs_request, build_get_account_info_request, build_get_properties_request, build_get_statistics_request, build_get_user_delegation_key_request, build_list_containers_segment_request, build_set_properties_request, build_submit_batch_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +42,8 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def set_properties( + @distributed_trace_async + async def set_properties( # pylint: disable=inconsistent-return-statements self, storage_service_properties: "_models.StorageServiceProperties", timeout: Optional[int] = None, @@ -59,6 +63,12 @@ async def set_properties( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -69,43 +79,37 @@ async def set_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "properties" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + + _content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True) + + request = build_set_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.set_properties.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -113,11 +117,14 @@ async def set_properties( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {'url': '/'} # type: ignore + set_properties.metadata = {'url': "{url}/"} # type: ignore + + @distributed_trace_async async def get_properties( self, timeout: Optional[int] = None, @@ -135,6 +142,12 @@ async def get_properties( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties, or the result of cls(response) :rtype: ~azure.storage.blob.models.StorageServiceProperties @@ -145,52 +158,51 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + + + request = build_get_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('StorageServiceProperties', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_properties.metadata = {'url': '/'} # type: ignore + get_properties.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace_async async def get_statistics( self, timeout: Optional[int] = None, @@ -209,6 +221,12 @@ async def get_statistics( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "stats". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceStats, or the result of cls(response) :rtype: ~azure.storage.blob.models.StorageServiceStats @@ -219,38 +237,33 @@ async def get_statistics( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "stats" - accept = "application/xml" - - # Construct URL - url = self.get_statistics.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "stats") # type: str + + + request = build_get_statistics_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_statistics.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -258,14 +271,18 @@ async def get_statistics( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('StorageServiceStats', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_statistics.metadata = {'url': '/'} # type: ignore + get_statistics.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace_async async def list_containers_segment( self, prefix: Optional[str] = None, @@ -307,6 +324,9 @@ async def list_containers_segment( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListContainersSegmentResponse, or the result of cls(response) :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse @@ -317,58 +337,53 @@ async def list_containers_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "list" - accept = "application/xml" - # Construct URL - url = self.list_containers_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if include is not None: - query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "list") # type: str + + + request = build_list_containers_segment_request( + url=self._config.url, + comp=comp, + version=self._config.version, + prefix=prefix, + marker=marker, + maxresults=maxresults, + include=include, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.list_containers_segment.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('ListContainersSegmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_containers_segment.metadata = {'url': '/'} # type: ignore + list_containers_segment.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace_async async def get_user_delegation_key( self, key_info: "_models.KeyInfo", @@ -389,6 +404,12 @@ async def get_user_delegation_key( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "userdelegationkey". Note that overriding this + default value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: UserDelegationKey, or the result of cls(response) :rtype: ~azure.storage.blob.models.UserDelegationKey @@ -399,43 +420,37 @@ async def get_user_delegation_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "userdelegationkey" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.get_user_delegation_key.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(key_info, 'KeyInfo', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "userdelegationkey") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + + _content = self._serialize.body(key_info, 'KeyInfo', is_xml=True) + + request = build_get_user_delegation_key_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_user_delegation_key.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -443,20 +458,30 @@ async def get_user_delegation_key( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('UserDelegationKey', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_user_delegation_key.metadata = {'url': '/'} # type: ignore - async def get_account_info( + get_user_delegation_key.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace_async + async def get_account_info( # pylint: disable=inconsistent-return-statements self, **kwargs: Any ) -> None: """Returns the sku name and account kind. + :keyword restype: restype. The default value is "account". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -467,34 +492,31 @@ async def get_account_info( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "account" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.get_account_info.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + restype = kwargs.pop('restype', "account") # type: str + comp = kwargs.pop('comp', "properties") # type: str + + + request = build_get_account_info_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + template_url=self.get_account_info.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -506,15 +528,17 @@ async def get_account_info( response_headers['x-ms-account-kind']=self._deserialize('str', response.headers.get('x-ms-account-kind')) response_headers['x-ms-is-hns-enabled']=self._deserialize('bool', response.headers.get('x-ms-is-hns-enabled')) + if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {'url': '/'} # type: ignore + get_account_info.metadata = {'url': "{url}/"} # type: ignore + + @distributed_trace_async async def submit_batch( self, content_length: int, - multipart_content_type: str, body: IO, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -524,9 +548,6 @@ async def submit_batch( :param content_length: The length of the request. :type content_length: long - :param multipart_content_type: Required. The value of this header must be multipart/mixed with - a batch boundary. Example header value: multipart/mixed; boundary=batch_:code:``. - :type multipart_content_type: str :param body: Initial data. :type body: IO :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -537,6 +558,12 @@ async def submit_batch( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword multipart_content_type: Required. The value of this header must be multipart/mixed + with a batch boundary. Example header value: multipart/mixed; boundary=batch_:code:``. + :paramtype multipart_content_type: str + :keyword comp: comp. The default value is "batch". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IO, or the result of cls(response) :rtype: IO @@ -547,57 +574,54 @@ async def submit_batch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "batch" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.submit_batch.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - header_parameters['Content-Type'] = self._serialize.header("multipart_content_type", multipart_content_type, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'IO', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + + multipart_content_type = kwargs.pop('multipart_content_type') # type: str + comp = kwargs.pop('comp', "batch") # type: str + + _content = self._serialize.body(body, 'IO') + + request = build_submit_batch_request( + url=self._config.url, + multipart_content_type=multipart_content_type, + comp=comp, + version=self._config.version, + content=_content, + content_length=content_length, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.submit_batch.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=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = response.stream_download(self._client._pipeline) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - submit_batch.metadata = {'url': '/'} # type: ignore + submit_batch.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace_async async def filter_blobs( self, timeout: Optional[int] = None, @@ -636,6 +660,9 @@ async def filter_blobs( it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000. :type maxresults: int + :keyword comp: comp. The default value is "blobs". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FilterBlobSegment, or the result of cls(response) :rtype: ~azure.storage.blob.models.FilterBlobSegment @@ -646,42 +673,34 @@ async def filter_blobs( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "blobs" - accept = "application/xml" - # Construct URL - url = self.filter_blobs.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if where is not None: - query_parameters['where'] = self._serialize.query("where", where, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "blobs") # type: str + + + request = build_filter_blobs_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + where=where, + marker=marker, + maxresults=maxresults, + template_url=self.filter_blobs.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -689,10 +708,13 @@ async def filter_blobs( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('FilterBlobSegment', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - filter_blobs.metadata = {'url': '/'} # type: ignore + + filter_blobs.metadata = {'url': "{url}/"} # type: ignore + diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_azure_blob_storage_enums.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_azure_blob_storage_enums.py index 31325457b829..f26d6ce0a886 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_azure_blob_storage_enums.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_azure_blob_storage_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): P4 = "P4" P6 = "P6" @@ -43,7 +28,7 @@ class AccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COOL = "Cool" ARCHIVE = "Archive" -class AccessTierOptional(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTierOptional(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): P4 = "P4" P6 = "P6" @@ -60,7 +45,7 @@ class AccessTierOptional(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COOL = "Cool" ARCHIVE = "Archive" -class AccessTierRequired(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessTierRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): P4 = "P4" P6 = "P6" @@ -77,7 +62,7 @@ class AccessTierRequired(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COOL = "Cool" ARCHIVE = "Archive" -class AccountKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccountKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): STORAGE = "Storage" BLOB_STORAGE = "BlobStorage" @@ -85,54 +70,54 @@ class AccountKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FILE_STORAGE = "FileStorage" BLOCK_BLOB_STORAGE = "BlockBlobStorage" -class ArchiveStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ArchiveStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): REHYDRATE_PENDING_TO_HOT = "rehydrate-pending-to-hot" REHYDRATE_PENDING_TO_COOL = "rehydrate-pending-to-cool" -class BlobExpiryOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobExpiryOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NEVER_EXPIRE = "NeverExpire" RELATIVE_TO_CREATION = "RelativeToCreation" RELATIVE_TO_NOW = "RelativeToNow" ABSOLUTE = "Absolute" -class BlobImmutabilityPolicyMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobImmutabilityPolicyMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MUTABLE = "Mutable" UNLOCKED = "Unlocked" LOCKED = "Locked" -class BlobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): BLOCK_BLOB = "BlockBlob" PAGE_BLOB = "PageBlob" APPEND_BLOB = "AppendBlob" -class BlockListType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlockListType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COMMITTED = "committed" UNCOMMITTED = "uncommitted" ALL = "all" -class CopyStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CopyStatusType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PENDING = "pending" SUCCESS = "success" ABORTED = "aborted" FAILED = "failed" -class DeleteSnapshotsOptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeleteSnapshotsOptionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INCLUDE = "include" ONLY = "only" -class EncryptionAlgorithmType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionAlgorithmType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" AES256 = "AES256" -class GeoReplicationStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoReplicationStatusType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the secondary location """ @@ -140,12 +125,12 @@ class GeoReplicationStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu BOOTSTRAP = "bootstrap" UNAVAILABLE = "unavailable" -class LeaseDurationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseDurationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INFINITE = "infinite" FIXED = "fixed" -class LeaseStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): AVAILABLE = "available" LEASED = "leased" @@ -153,12 +138,12 @@ class LeaseStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "breaking" BROKEN = "broken" -class LeaseStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStatusType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LOCKED = "locked" UNLOCKED = "unlocked" -class ListBlobsIncludeItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListBlobsIncludeItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COPY = "copy" DELETED = "deleted" @@ -171,13 +156,13 @@ class ListBlobsIncludeItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LEGALHOLD = "legalhold" DELETEDWITHVERSIONS = "deletedwithversions" -class ListContainersIncludeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListContainersIncludeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): METADATA = "metadata" DELETED = "deleted" SYSTEM = "system" -class PremiumPageBlobAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PremiumPageBlobAccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): P4 = "P4" P6 = "P6" @@ -191,12 +176,12 @@ class PremiumPageBlobAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, En P70 = "P70" P80 = "P80" -class PublicAccessType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicAccessType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CONTAINER = "container" BLOB = "blob" -class QueryFormatType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class QueryFormatType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The quick query format type. """ @@ -205,7 +190,7 @@ class QueryFormatType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ARROW = "arrow" PARQUET = "parquet" -class RehydratePriority(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RehydratePriority(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High and Standard. """ @@ -213,13 +198,13 @@ class RehydratePriority(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HIGH = "High" STANDARD = "Standard" -class SequenceNumberActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SequenceNumberActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MAX = "max" UPDATE = "update" INCREMENT = "increment" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): STANDARD_LRS = "Standard_LRS" STANDARD_GRS = "Standard_GRS" @@ -227,7 +212,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_ZRS = "Standard_ZRS" PREMIUM_LRS = "Premium_LRS" -class StorageErrorCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageErrorCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Error codes returned by the service """ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models.py index abf16321bba8..69eae8f1c20e 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models.py @@ -13,12 +13,12 @@ class AccessPolicy(msrest.serialization.Model): """An Access policy. - :param start: the date-time the policy is active. - :type start: str - :param expiry: the date-time the policy expires. - :type expiry: str - :param permission: the permissions for the acl policy. - :type permission: str + :ivar start: the date-time the policy is active. + :vartype start: str + :ivar expiry: the date-time the policy expires. + :vartype expiry: str + :ivar permission: the permissions for the acl policy. + :vartype permission: str """ _attribute_map = { @@ -31,6 +31,14 @@ def __init__( self, **kwargs ): + """ + :keyword start: the date-time the policy is active. + :paramtype start: str + :keyword expiry: the date-time the policy expires. + :paramtype expiry: str + :keyword permission: the permissions for the acl policy. + :paramtype permission: str + """ super(AccessPolicy, self).__init__(**kwargs) self.start = kwargs.get('start', None) self.expiry = kwargs.get('expiry', None) @@ -40,16 +48,16 @@ def __init__( class AppendPositionAccessConditions(msrest.serialization.Model): """Parameter group. - :param max_size: Optional conditional header. The max length in bytes permitted for the append + :ivar max_size: Optional conditional header. The max length in bytes permitted for the append blob. If the Append Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed). - :type max_size: long - :param append_position: Optional conditional header, used only for the Append Block operation. - A number indicating the byte offset to compare. Append Block will succeed only if the append + :vartype max_size: long + :ivar append_position: Optional conditional header, used only for the Append Block operation. A + number indicating the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed). - :type append_position: long + :vartype append_position: long """ _attribute_map = { @@ -61,6 +69,18 @@ def __init__( self, **kwargs ): + """ + :keyword max_size: Optional conditional header. The max length in bytes permitted for the + append blob. If the Append Block operation would cause the blob to exceed that limit or if the + blob size is already greater than the value specified in this header, the request will fail + with MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed). + :paramtype max_size: long + :keyword append_position: Optional conditional header, used only for the Append Block + operation. A number indicating the byte offset to compare. Append Block will succeed only if + the append position is equal to this number. If it is not, the request will fail with the + AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed). + :paramtype append_position: long + """ super(AppendPositionAccessConditions, self).__init__(**kwargs) self.max_size = kwargs.get('max_size', None) self.append_position = kwargs.get('append_position', None) @@ -71,8 +91,8 @@ class ArrowConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param schema: Required. - :type schema: list[~azure.storage.blob.models.ArrowField] + :ivar schema: Required. + :vartype schema: list[~azure.storage.blob.models.ArrowField] """ _validation = { @@ -90,6 +110,10 @@ def __init__( self, **kwargs ): + """ + :keyword schema: Required. + :paramtype schema: list[~azure.storage.blob.models.ArrowField] + """ super(ArrowConfiguration, self).__init__(**kwargs) self.schema = kwargs['schema'] @@ -99,14 +123,14 @@ class ArrowField(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. - :type type: str - :param name: - :type name: str - :param precision: - :type precision: int - :param scale: - :type scale: int + :ivar type: Required. + :vartype type: str + :ivar name: + :vartype name: str + :ivar precision: + :vartype precision: int + :ivar scale: + :vartype scale: int """ _validation = { @@ -127,6 +151,16 @@ def __init__( self, **kwargs ): + """ + :keyword type: Required. + :paramtype type: str + :keyword name: + :paramtype name: str + :keyword precision: + :paramtype precision: int + :keyword scale: + :paramtype scale: int + """ super(ArrowField, self).__init__(**kwargs) self.type = kwargs['type'] self.name = kwargs.get('name', None) @@ -139,8 +173,8 @@ class BlobFlatListSegment(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param blob_items: Required. - :type blob_items: list[~azure.storage.blob.models.BlobItemInternal] + :ivar blob_items: Required. + :vartype blob_items: list[~azure.storage.blob.models.BlobItemInternal] """ _validation = { @@ -158,6 +192,10 @@ def __init__( self, **kwargs ): + """ + :keyword blob_items: Required. + :paramtype blob_items: list[~azure.storage.blob.models.BlobItemInternal] + """ super(BlobFlatListSegment, self).__init__(**kwargs) self.blob_items = kwargs['blob_items'] @@ -167,10 +205,10 @@ class BlobHierarchyListSegment(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param blob_prefixes: - :type blob_prefixes: list[~azure.storage.blob.models.BlobPrefix] - :param blob_items: Required. - :type blob_items: list[~azure.storage.blob.models.BlobItemInternal] + :ivar blob_prefixes: + :vartype blob_prefixes: list[~azure.storage.blob.models.BlobPrefix] + :ivar blob_items: Required. + :vartype blob_items: list[~azure.storage.blob.models.BlobItemInternal] """ _validation = { @@ -189,6 +227,12 @@ def __init__( self, **kwargs ): + """ + :keyword blob_prefixes: + :paramtype blob_prefixes: list[~azure.storage.blob.models.BlobPrefix] + :keyword blob_items: Required. + :paramtype blob_items: list[~azure.storage.blob.models.BlobItemInternal] + """ super(BlobHierarchyListSegment, self).__init__(**kwargs) self.blob_prefixes = kwargs.get('blob_prefixes', None) self.blob_items = kwargs['blob_items'] @@ -197,23 +241,23 @@ def __init__( class BlobHTTPHeaders(msrest.serialization.Model): """Parameter group. - :param blob_cache_control: Optional. Sets the blob's cache control. If specified, this property + :ivar blob_cache_control: Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request. - :type blob_cache_control: str - :param blob_content_type: Optional. Sets the blob's content type. If specified, this property - is stored with the blob and returned with a read request. - :type blob_content_type: str - :param blob_content_md5: Optional. An MD5 hash of the blob content. Note that this hash is not + :vartype blob_cache_control: str + :ivar blob_content_type: Optional. Sets the blob's content type. If specified, this property is + stored with the blob and returned with a read request. + :vartype blob_content_type: str + :ivar blob_content_md5: Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks were validated when each was uploaded. - :type blob_content_md5: bytearray - :param blob_content_encoding: Optional. Sets the blob's content encoding. If specified, this + :vartype blob_content_md5: bytearray + :ivar blob_content_encoding: Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request. - :type blob_content_encoding: str - :param blob_content_language: Optional. Set the blob's content language. If specified, this + :vartype blob_content_encoding: str + :ivar blob_content_language: Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read request. - :type blob_content_language: str - :param blob_content_disposition: Optional. Sets the blob's Content-Disposition header. - :type blob_content_disposition: str + :vartype blob_content_language: str + :ivar blob_content_disposition: Optional. Sets the blob's Content-Disposition header. + :vartype blob_content_disposition: str """ _attribute_map = { @@ -229,6 +273,25 @@ def __init__( self, **kwargs ): + """ + :keyword blob_cache_control: Optional. Sets the blob's cache control. If specified, this + property is stored with the blob and returned with a read request. + :paramtype blob_cache_control: str + :keyword blob_content_type: Optional. Sets the blob's content type. If specified, this property + is stored with the blob and returned with a read request. + :paramtype blob_content_type: str + :keyword blob_content_md5: Optional. An MD5 hash of the blob content. Note that this hash is + not validated, as the hashes for the individual blocks were validated when each was uploaded. + :paramtype blob_content_md5: bytearray + :keyword blob_content_encoding: Optional. Sets the blob's content encoding. If specified, this + property is stored with the blob and returned with a read request. + :paramtype blob_content_encoding: str + :keyword blob_content_language: Optional. Set the blob's content language. If specified, this + property is stored with the blob and returned with a read request. + :paramtype blob_content_language: str + :keyword blob_content_disposition: Optional. Sets the blob's Content-Disposition header. + :paramtype blob_content_disposition: str + """ super(BlobHTTPHeaders, self).__init__(**kwargs) self.blob_cache_control = kwargs.get('blob_cache_control', None) self.blob_content_type = kwargs.get('blob_content_type', None) @@ -243,26 +306,26 @@ class BlobItemInternal(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: ~azure.storage.blob.models.BlobName - :param deleted: Required. - :type deleted: bool - :param snapshot: Required. - :type snapshot: str - :param version_id: - :type version_id: str - :param is_current_version: - :type is_current_version: bool - :param properties: Required. Properties of a blob. - :type properties: ~azure.storage.blob.models.BlobPropertiesInternal - :param metadata: - :type metadata: ~azure.storage.blob.models.BlobMetadata - :param blob_tags: Blob tags. - :type blob_tags: ~azure.storage.blob.models.BlobTags - :param has_versions_only: - :type has_versions_only: bool - :param object_replication_metadata: Dictionary of :code:``. - :type object_replication_metadata: dict[str, str] + :ivar name: Required. + :vartype name: ~azure.storage.blob.models.BlobName + :ivar deleted: Required. + :vartype deleted: bool + :ivar snapshot: Required. + :vartype snapshot: str + :ivar version_id: + :vartype version_id: str + :ivar is_current_version: + :vartype is_current_version: bool + :ivar properties: Required. Properties of a blob. + :vartype properties: ~azure.storage.blob.models.BlobPropertiesInternal + :ivar metadata: + :vartype metadata: ~azure.storage.blob.models.BlobMetadata + :ivar blob_tags: Blob tags. + :vartype blob_tags: ~azure.storage.blob.models.BlobTags + :ivar has_versions_only: + :vartype has_versions_only: bool + :ivar object_replication_metadata: Dictionary of :code:``. + :vartype object_replication_metadata: dict[str, str] """ _validation = { @@ -292,6 +355,28 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. + :paramtype name: ~azure.storage.blob.models.BlobName + :keyword deleted: Required. + :paramtype deleted: bool + :keyword snapshot: Required. + :paramtype snapshot: str + :keyword version_id: + :paramtype version_id: str + :keyword is_current_version: + :paramtype is_current_version: bool + :keyword properties: Required. Properties of a blob. + :paramtype properties: ~azure.storage.blob.models.BlobPropertiesInternal + :keyword metadata: + :paramtype metadata: ~azure.storage.blob.models.BlobMetadata + :keyword blob_tags: Blob tags. + :paramtype blob_tags: ~azure.storage.blob.models.BlobTags + :keyword has_versions_only: + :paramtype has_versions_only: bool + :keyword object_replication_metadata: Dictionary of :code:``. + :paramtype object_replication_metadata: dict[str, str] + """ super(BlobItemInternal, self).__init__(**kwargs) self.name = kwargs['name'] self.deleted = kwargs['deleted'] @@ -308,11 +393,11 @@ def __init__( class BlobMetadata(msrest.serialization.Model): """BlobMetadata. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, str] - :param encrypted: - :type encrypted: str + :vartype additional_properties: dict[str, str] + :ivar encrypted: + :vartype encrypted: str """ _attribute_map = { @@ -327,6 +412,13 @@ def __init__( self, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, str] + :keyword encrypted: + :paramtype encrypted: str + """ super(BlobMetadata, self).__init__(**kwargs) self.additional_properties = kwargs.get('additional_properties', None) self.encrypted = kwargs.get('encrypted', None) @@ -335,10 +427,10 @@ def __init__( class BlobName(msrest.serialization.Model): """BlobName. - :param encoded: Indicates if the blob name is encoded. - :type encoded: bool - :param content: The name of the blob. - :type content: str + :ivar encoded: Indicates if the blob name is encoded. + :vartype encoded: bool + :ivar content: The name of the blob. + :vartype content: str """ _attribute_map = { @@ -350,6 +442,12 @@ def __init__( self, **kwargs ): + """ + :keyword encoded: Indicates if the blob name is encoded. + :paramtype encoded: bool + :keyword content: The name of the blob. + :paramtype content: str + """ super(BlobName, self).__init__(**kwargs) self.encoded = kwargs.get('encoded', None) self.content = kwargs.get('content', None) @@ -360,8 +458,8 @@ class BlobPrefix(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: ~azure.storage.blob.models.BlobName + :ivar name: Required. + :vartype name: ~azure.storage.blob.models.BlobName """ _validation = { @@ -376,6 +474,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. + :paramtype name: ~azure.storage.blob.models.BlobName + """ super(BlobPrefix, self).__init__(**kwargs) self.name = kwargs['name'] @@ -385,91 +487,91 @@ class BlobPropertiesInternal(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param creation_time: - :type creation_time: ~datetime.datetime - :param last_modified: Required. - :type last_modified: ~datetime.datetime - :param etag: Required. - :type etag: str - :param content_length: Size in bytes. - :type content_length: long - :param content_type: - :type content_type: str - :param content_encoding: - :type content_encoding: str - :param content_language: - :type content_language: str - :param content_md5: - :type content_md5: bytearray - :param content_disposition: - :type content_disposition: str - :param cache_control: - :type cache_control: str - :param blob_sequence_number: - :type blob_sequence_number: long - :param blob_type: Possible values include: "BlockBlob", "PageBlob", "AppendBlob". - :type blob_type: str or ~azure.storage.blob.models.BlobType - :param lease_status: Possible values include: "locked", "unlocked". - :type lease_status: str or ~azure.storage.blob.models.LeaseStatusType - :param lease_state: Possible values include: "available", "leased", "expired", "breaking", + :ivar creation_time: + :vartype creation_time: ~datetime.datetime + :ivar last_modified: Required. + :vartype last_modified: ~datetime.datetime + :ivar etag: Required. + :vartype etag: str + :ivar content_length: Size in bytes. + :vartype content_length: long + :ivar content_type: + :vartype content_type: str + :ivar content_encoding: + :vartype content_encoding: str + :ivar content_language: + :vartype content_language: str + :ivar content_md5: + :vartype content_md5: bytearray + :ivar content_disposition: + :vartype content_disposition: str + :ivar cache_control: + :vartype cache_control: str + :ivar blob_sequence_number: + :vartype blob_sequence_number: long + :ivar blob_type: Possible values include: "BlockBlob", "PageBlob", "AppendBlob". + :vartype blob_type: str or ~azure.storage.blob.models.BlobType + :ivar lease_status: Possible values include: "locked", "unlocked". + :vartype lease_status: str or ~azure.storage.blob.models.LeaseStatusType + :ivar lease_state: Possible values include: "available", "leased", "expired", "breaking", "broken". - :type lease_state: str or ~azure.storage.blob.models.LeaseStateType - :param lease_duration: Possible values include: "infinite", "fixed". - :type lease_duration: str or ~azure.storage.blob.models.LeaseDurationType - :param copy_id: - :type copy_id: str - :param copy_status: Possible values include: "pending", "success", "aborted", "failed". - :type copy_status: str or ~azure.storage.blob.models.CopyStatusType - :param copy_source: - :type copy_source: str - :param copy_progress: - :type copy_progress: str - :param copy_completion_time: - :type copy_completion_time: ~datetime.datetime - :param copy_status_description: - :type copy_status_description: str - :param server_encrypted: - :type server_encrypted: bool - :param incremental_copy: - :type incremental_copy: bool - :param destination_snapshot: - :type destination_snapshot: str - :param deleted_time: - :type deleted_time: ~datetime.datetime - :param remaining_retention_days: - :type remaining_retention_days: int - :param access_tier: Possible values include: "P4", "P6", "P10", "P15", "P20", "P30", "P40", + :vartype lease_state: str or ~azure.storage.blob.models.LeaseStateType + :ivar lease_duration: Possible values include: "infinite", "fixed". + :vartype lease_duration: str or ~azure.storage.blob.models.LeaseDurationType + :ivar copy_id: + :vartype copy_id: str + :ivar copy_status: Possible values include: "pending", "success", "aborted", "failed". + :vartype copy_status: str or ~azure.storage.blob.models.CopyStatusType + :ivar copy_source: + :vartype copy_source: str + :ivar copy_progress: + :vartype copy_progress: str + :ivar copy_completion_time: + :vartype copy_completion_time: ~datetime.datetime + :ivar copy_status_description: + :vartype copy_status_description: str + :ivar server_encrypted: + :vartype server_encrypted: bool + :ivar incremental_copy: + :vartype incremental_copy: bool + :ivar destination_snapshot: + :vartype destination_snapshot: str + :ivar deleted_time: + :vartype deleted_time: ~datetime.datetime + :ivar remaining_retention_days: + :vartype remaining_retention_days: int + :ivar access_tier: Possible values include: "P4", "P6", "P10", "P15", "P20", "P30", "P40", "P50", "P60", "P70", "P80", "Hot", "Cool", "Archive". - :type access_tier: str or ~azure.storage.blob.models.AccessTier - :param access_tier_inferred: - :type access_tier_inferred: bool - :param archive_status: Possible values include: "rehydrate-pending-to-hot", + :vartype access_tier: str or ~azure.storage.blob.models.AccessTier + :ivar access_tier_inferred: + :vartype access_tier_inferred: bool + :ivar archive_status: Possible values include: "rehydrate-pending-to-hot", "rehydrate-pending-to-cool". - :type archive_status: str or ~azure.storage.blob.models.ArchiveStatus - :param customer_provided_key_sha256: - :type customer_provided_key_sha256: str - :param encryption_scope: The name of the encryption scope under which the blob is encrypted. - :type encryption_scope: str - :param access_tier_change_time: - :type access_tier_change_time: ~datetime.datetime - :param tag_count: - :type tag_count: int - :param expires_on: - :type expires_on: ~datetime.datetime - :param is_sealed: - :type is_sealed: bool - :param rehydrate_priority: If an object is in rehydrate pending state then this header is + :vartype archive_status: str or ~azure.storage.blob.models.ArchiveStatus + :ivar customer_provided_key_sha256: + :vartype customer_provided_key_sha256: str + :ivar encryption_scope: The name of the encryption scope under which the blob is encrypted. + :vartype encryption_scope: str + :ivar access_tier_change_time: + :vartype access_tier_change_time: ~datetime.datetime + :ivar tag_count: + :vartype tag_count: int + :ivar expires_on: + :vartype expires_on: ~datetime.datetime + :ivar is_sealed: + :vartype is_sealed: bool + :ivar rehydrate_priority: If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High and Standard. Possible values include: "High", "Standard". - :type rehydrate_priority: str or ~azure.storage.blob.models.RehydratePriority - :param last_accessed_on: - :type last_accessed_on: ~datetime.datetime - :param immutability_policy_expires_on: - :type immutability_policy_expires_on: ~datetime.datetime - :param immutability_policy_mode: Possible values include: "Mutable", "Unlocked", "Locked". - :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: - :type legal_hold: bool + :vartype rehydrate_priority: str or ~azure.storage.blob.models.RehydratePriority + :ivar last_accessed_on: + :vartype last_accessed_on: ~datetime.datetime + :ivar immutability_policy_expires_on: + :vartype immutability_policy_expires_on: ~datetime.datetime + :ivar immutability_policy_mode: Possible values include: "Mutable", "Unlocked", "Locked". + :vartype immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode + :ivar legal_hold: + :vartype legal_hold: bool """ _validation = { @@ -527,6 +629,94 @@ def __init__( self, **kwargs ): + """ + :keyword creation_time: + :paramtype creation_time: ~datetime.datetime + :keyword last_modified: Required. + :paramtype last_modified: ~datetime.datetime + :keyword etag: Required. + :paramtype etag: str + :keyword content_length: Size in bytes. + :paramtype content_length: long + :keyword content_type: + :paramtype content_type: str + :keyword content_encoding: + :paramtype content_encoding: str + :keyword content_language: + :paramtype content_language: str + :keyword content_md5: + :paramtype content_md5: bytearray + :keyword content_disposition: + :paramtype content_disposition: str + :keyword cache_control: + :paramtype cache_control: str + :keyword blob_sequence_number: + :paramtype blob_sequence_number: long + :keyword blob_type: Possible values include: "BlockBlob", "PageBlob", "AppendBlob". + :paramtype blob_type: str or ~azure.storage.blob.models.BlobType + :keyword lease_status: Possible values include: "locked", "unlocked". + :paramtype lease_status: str or ~azure.storage.blob.models.LeaseStatusType + :keyword lease_state: Possible values include: "available", "leased", "expired", "breaking", + "broken". + :paramtype lease_state: str or ~azure.storage.blob.models.LeaseStateType + :keyword lease_duration: Possible values include: "infinite", "fixed". + :paramtype lease_duration: str or ~azure.storage.blob.models.LeaseDurationType + :keyword copy_id: + :paramtype copy_id: str + :keyword copy_status: Possible values include: "pending", "success", "aborted", "failed". + :paramtype copy_status: str or ~azure.storage.blob.models.CopyStatusType + :keyword copy_source: + :paramtype copy_source: str + :keyword copy_progress: + :paramtype copy_progress: str + :keyword copy_completion_time: + :paramtype copy_completion_time: ~datetime.datetime + :keyword copy_status_description: + :paramtype copy_status_description: str + :keyword server_encrypted: + :paramtype server_encrypted: bool + :keyword incremental_copy: + :paramtype incremental_copy: bool + :keyword destination_snapshot: + :paramtype destination_snapshot: str + :keyword deleted_time: + :paramtype deleted_time: ~datetime.datetime + :keyword remaining_retention_days: + :paramtype remaining_retention_days: int + :keyword access_tier: Possible values include: "P4", "P6", "P10", "P15", "P20", "P30", "P40", + "P50", "P60", "P70", "P80", "Hot", "Cool", "Archive". + :paramtype access_tier: str or ~azure.storage.blob.models.AccessTier + :keyword access_tier_inferred: + :paramtype access_tier_inferred: bool + :keyword archive_status: Possible values include: "rehydrate-pending-to-hot", + "rehydrate-pending-to-cool". + :paramtype archive_status: str or ~azure.storage.blob.models.ArchiveStatus + :keyword customer_provided_key_sha256: + :paramtype customer_provided_key_sha256: str + :keyword encryption_scope: The name of the encryption scope under which the blob is encrypted. + :paramtype encryption_scope: str + :keyword access_tier_change_time: + :paramtype access_tier_change_time: ~datetime.datetime + :keyword tag_count: + :paramtype tag_count: int + :keyword expires_on: + :paramtype expires_on: ~datetime.datetime + :keyword is_sealed: + :paramtype is_sealed: bool + :keyword rehydrate_priority: If an object is in rehydrate pending state then this header is + returned with priority of rehydrate. Valid values are High and Standard. Possible values + include: "High", "Standard". + :paramtype rehydrate_priority: str or ~azure.storage.blob.models.RehydratePriority + :keyword last_accessed_on: + :paramtype last_accessed_on: ~datetime.datetime + :keyword immutability_policy_expires_on: + :paramtype immutability_policy_expires_on: ~datetime.datetime + :keyword immutability_policy_mode: Possible values include: "Mutable", "Unlocked", "Locked". + :paramtype immutability_policy_mode: str or + ~azure.storage.blob.models.BlobImmutabilityPolicyMode + :keyword legal_hold: + :paramtype legal_hold: bool + """ super(BlobPropertiesInternal, self).__init__(**kwargs) self.creation_time = kwargs.get('creation_time', None) self.last_modified = kwargs['last_modified'] @@ -575,10 +765,10 @@ class BlobTag(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key: Required. - :type key: str - :param value: Required. - :type value: str + :ivar key: Required. + :vartype key: str + :ivar value: Required. + :vartype value: str """ _validation = { @@ -598,6 +788,12 @@ def __init__( self, **kwargs ): + """ + :keyword key: Required. + :paramtype key: str + :keyword value: Required. + :paramtype value: str + """ super(BlobTag, self).__init__(**kwargs) self.key = kwargs['key'] self.value = kwargs['value'] @@ -608,8 +804,8 @@ class BlobTags(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param blob_tag_set: Required. - :type blob_tag_set: list[~azure.storage.blob.models.BlobTag] + :ivar blob_tag_set: Required. + :vartype blob_tag_set: list[~azure.storage.blob.models.BlobTag] """ _validation = { @@ -627,6 +823,10 @@ def __init__( self, **kwargs ): + """ + :keyword blob_tag_set: Required. + :paramtype blob_tag_set: list[~azure.storage.blob.models.BlobTag] + """ super(BlobTags, self).__init__(**kwargs) self.blob_tag_set = kwargs['blob_tag_set'] @@ -636,10 +836,10 @@ class Block(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The base64 encoded block ID. - :type name: str - :param size: Required. The block size in bytes. - :type size: long + :ivar name: Required. The base64 encoded block ID. + :vartype name: str + :ivar size: Required. The block size in bytes. + :vartype size: long """ _validation = { @@ -656,6 +856,12 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The base64 encoded block ID. + :paramtype name: str + :keyword size: Required. The block size in bytes. + :paramtype size: long + """ super(Block, self).__init__(**kwargs) self.name = kwargs['name'] self.size = kwargs['size'] @@ -664,10 +870,10 @@ def __init__( class BlockList(msrest.serialization.Model): """BlockList. - :param committed_blocks: - :type committed_blocks: list[~azure.storage.blob.models.Block] - :param uncommitted_blocks: - :type uncommitted_blocks: list[~azure.storage.blob.models.Block] + :ivar committed_blocks: + :vartype committed_blocks: list[~azure.storage.blob.models.Block] + :ivar uncommitted_blocks: + :vartype uncommitted_blocks: list[~azure.storage.blob.models.Block] """ _attribute_map = { @@ -679,6 +885,12 @@ def __init__( self, **kwargs ): + """ + :keyword committed_blocks: + :paramtype committed_blocks: list[~azure.storage.blob.models.Block] + :keyword uncommitted_blocks: + :paramtype uncommitted_blocks: list[~azure.storage.blob.models.Block] + """ super(BlockList, self).__init__(**kwargs) self.committed_blocks = kwargs.get('committed_blocks', None) self.uncommitted_blocks = kwargs.get('uncommitted_blocks', None) @@ -687,12 +899,12 @@ def __init__( class BlockLookupList(msrest.serialization.Model): """BlockLookupList. - :param committed: - :type committed: list[str] - :param uncommitted: - :type uncommitted: list[str] - :param latest: - :type latest: list[str] + :ivar committed: + :vartype committed: list[str] + :ivar uncommitted: + :vartype uncommitted: list[str] + :ivar latest: + :vartype latest: list[str] """ _attribute_map = { @@ -708,6 +920,14 @@ def __init__( self, **kwargs ): + """ + :keyword committed: + :paramtype committed: list[str] + :keyword uncommitted: + :paramtype uncommitted: list[str] + :keyword latest: + :paramtype latest: list[str] + """ super(BlockLookupList, self).__init__(**kwargs) self.committed = kwargs.get('committed', None) self.uncommitted = kwargs.get('uncommitted', None) @@ -719,10 +939,10 @@ class ClearRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start: Required. - :type start: long - :param end: Required. - :type end: long + :ivar start: Required. + :vartype start: long + :ivar end: Required. + :vartype end: long """ _validation = { @@ -742,6 +962,12 @@ def __init__( self, **kwargs ): + """ + :keyword start: Required. + :paramtype start: long + :keyword end: Required. + :paramtype end: long + """ super(ClearRange, self).__init__(**kwargs) self.start = kwargs['start'] self.end = kwargs['end'] @@ -750,13 +976,13 @@ def __init__( class ContainerCpkScopeInfo(msrest.serialization.Model): """Parameter group. - :param default_encryption_scope: Optional. Version 2019-07-07 and later. Specifies the - default encryption scope to set on the container and use for all future writes. - :type default_encryption_scope: str - :param prevent_encryption_scope_override: Optional. Version 2019-07-07 and newer. If true, + :ivar default_encryption_scope: Optional. Version 2019-07-07 and later. Specifies the default + encryption scope to set on the container and use for all future writes. + :vartype default_encryption_scope: str + :ivar prevent_encryption_scope_override: Optional. Version 2019-07-07 and newer. If true, prevents any request from specifying a different encryption scope than the scope set on the container. - :type prevent_encryption_scope_override: bool + :vartype prevent_encryption_scope_override: bool """ _attribute_map = { @@ -768,6 +994,15 @@ def __init__( self, **kwargs ): + """ + :keyword default_encryption_scope: Optional. Version 2019-07-07 and later. Specifies the + default encryption scope to set on the container and use for all future writes. + :paramtype default_encryption_scope: str + :keyword prevent_encryption_scope_override: Optional. Version 2019-07-07 and newer. If true, + prevents any request from specifying a different encryption scope than the scope set on the + container. + :paramtype prevent_encryption_scope_override: bool + """ super(ContainerCpkScopeInfo, self).__init__(**kwargs) self.default_encryption_scope = kwargs.get('default_encryption_scope', None) self.prevent_encryption_scope_override = kwargs.get('prevent_encryption_scope_override', None) @@ -778,16 +1013,16 @@ class ContainerItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param deleted: - :type deleted: bool - :param version: - :type version: str - :param properties: Required. Properties of a container. - :type properties: ~azure.storage.blob.models.ContainerProperties - :param metadata: Dictionary of :code:``. - :type metadata: dict[str, str] + :ivar name: Required. + :vartype name: str + :ivar deleted: + :vartype deleted: bool + :ivar version: + :vartype version: str + :ivar properties: Required. Properties of a container. + :vartype properties: ~azure.storage.blob.models.ContainerProperties + :ivar metadata: Dictionary of :code:``. + :vartype metadata: dict[str, str] """ _validation = { @@ -810,6 +1045,18 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword deleted: + :paramtype deleted: bool + :keyword version: + :paramtype version: str + :keyword properties: Required. Properties of a container. + :paramtype properties: ~azure.storage.blob.models.ContainerProperties + :keyword metadata: Dictionary of :code:``. + :paramtype metadata: dict[str, str] + """ super(ContainerItem, self).__init__(**kwargs) self.name = kwargs['name'] self.deleted = kwargs.get('deleted', None) @@ -823,34 +1070,34 @@ class ContainerProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param last_modified: Required. - :type last_modified: ~datetime.datetime - :param etag: Required. - :type etag: str - :param lease_status: Possible values include: "locked", "unlocked". - :type lease_status: str or ~azure.storage.blob.models.LeaseStatusType - :param lease_state: Possible values include: "available", "leased", "expired", "breaking", + :ivar last_modified: Required. + :vartype last_modified: ~datetime.datetime + :ivar etag: Required. + :vartype etag: str + :ivar lease_status: Possible values include: "locked", "unlocked". + :vartype lease_status: str or ~azure.storage.blob.models.LeaseStatusType + :ivar lease_state: Possible values include: "available", "leased", "expired", "breaking", "broken". - :type lease_state: str or ~azure.storage.blob.models.LeaseStateType - :param lease_duration: Possible values include: "infinite", "fixed". - :type lease_duration: str or ~azure.storage.blob.models.LeaseDurationType - :param public_access: Possible values include: "container", "blob". - :type public_access: str or ~azure.storage.blob.models.PublicAccessType - :param has_immutability_policy: - :type has_immutability_policy: bool - :param has_legal_hold: - :type has_legal_hold: bool - :param default_encryption_scope: - :type default_encryption_scope: str - :param prevent_encryption_scope_override: - :type prevent_encryption_scope_override: bool - :param deleted_time: - :type deleted_time: ~datetime.datetime - :param remaining_retention_days: - :type remaining_retention_days: int - :param is_immutable_storage_with_versioning_enabled: Indicates if version level worm is enabled + :vartype lease_state: str or ~azure.storage.blob.models.LeaseStateType + :ivar lease_duration: Possible values include: "infinite", "fixed". + :vartype lease_duration: str or ~azure.storage.blob.models.LeaseDurationType + :ivar public_access: Possible values include: "container", "blob". + :vartype public_access: str or ~azure.storage.blob.models.PublicAccessType + :ivar has_immutability_policy: + :vartype has_immutability_policy: bool + :ivar has_legal_hold: + :vartype has_legal_hold: bool + :ivar default_encryption_scope: + :vartype default_encryption_scope: str + :ivar prevent_encryption_scope_override: + :vartype prevent_encryption_scope_override: bool + :ivar deleted_time: + :vartype deleted_time: ~datetime.datetime + :ivar remaining_retention_days: + :vartype remaining_retention_days: int + :ivar is_immutable_storage_with_versioning_enabled: Indicates if version level worm is enabled on this container. - :type is_immutable_storage_with_versioning_enabled: bool + :vartype is_immutable_storage_with_versioning_enabled: bool """ _validation = { @@ -878,6 +1125,36 @@ def __init__( self, **kwargs ): + """ + :keyword last_modified: Required. + :paramtype last_modified: ~datetime.datetime + :keyword etag: Required. + :paramtype etag: str + :keyword lease_status: Possible values include: "locked", "unlocked". + :paramtype lease_status: str or ~azure.storage.blob.models.LeaseStatusType + :keyword lease_state: Possible values include: "available", "leased", "expired", "breaking", + "broken". + :paramtype lease_state: str or ~azure.storage.blob.models.LeaseStateType + :keyword lease_duration: Possible values include: "infinite", "fixed". + :paramtype lease_duration: str or ~azure.storage.blob.models.LeaseDurationType + :keyword public_access: Possible values include: "container", "blob". + :paramtype public_access: str or ~azure.storage.blob.models.PublicAccessType + :keyword has_immutability_policy: + :paramtype has_immutability_policy: bool + :keyword has_legal_hold: + :paramtype has_legal_hold: bool + :keyword default_encryption_scope: + :paramtype default_encryption_scope: str + :keyword prevent_encryption_scope_override: + :paramtype prevent_encryption_scope_override: bool + :keyword deleted_time: + :paramtype deleted_time: ~datetime.datetime + :keyword remaining_retention_days: + :paramtype remaining_retention_days: int + :keyword is_immutable_storage_with_versioning_enabled: Indicates if version level worm is + enabled on this container. + :paramtype is_immutable_storage_with_versioning_enabled: bool + """ super(ContainerProperties, self).__init__(**kwargs) self.last_modified = kwargs['last_modified'] self.etag = kwargs['etag'] @@ -899,24 +1176,24 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. The origin domains that are permitted to make a request + :ivar allowed_origins: Required. The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS. - :type allowed_origins: str - :param allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + :vartype allowed_origins: str + :ivar allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated). - :type allowed_methods: str - :param allowed_headers: Required. the request headers that the origin domain may specify on the + :vartype allowed_methods: str + :ivar allowed_headers: Required. the request headers that the origin domain may specify on the CORS request. - :type allowed_headers: str - :param exposed_headers: Required. The response headers that may be sent in the response to the + :vartype allowed_headers: str + :ivar exposed_headers: Required. The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. - :type exposed_headers: str - :param max_age_in_seconds: Required. The maximum amount time that a browser should cache the + :vartype exposed_headers: str + :ivar max_age_in_seconds: Required. The maximum amount time that a browser should cache the preflight OPTIONS request. - :type max_age_in_seconds: int + :vartype max_age_in_seconds: int """ _validation = { @@ -939,6 +1216,26 @@ def __init__( self, **kwargs ): + """ + :keyword allowed_origins: Required. The origin domains that are permitted to make a request + against the storage service via CORS. The origin domain is the domain from which the request + originates. Note that the origin must be an exact case-sensitive match with the origin that the + user age sends to the service. You can also use the wildcard character '*' to allow all origin + domains to make requests via CORS. + :paramtype allowed_origins: str + :keyword allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + use for a CORS request. (comma separated). + :paramtype allowed_methods: str + :keyword allowed_headers: Required. the request headers that the origin domain may specify on + the CORS request. + :paramtype allowed_headers: str + :keyword exposed_headers: Required. The response headers that may be sent in the response to + the CORS request and exposed by the browser to the request issuer. + :paramtype exposed_headers: str + :keyword max_age_in_seconds: Required. The maximum amount time that a browser should cache the + preflight OPTIONS request. + :paramtype max_age_in_seconds: int + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = kwargs['allowed_origins'] self.allowed_methods = kwargs['allowed_methods'] @@ -950,17 +1247,17 @@ def __init__( class CpkInfo(msrest.serialization.Model): """Parameter group. - :param encryption_key: Optional. Specifies the encryption key to use to encrypt the data + :ivar encryption_key: Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - :type encryption_key: str - :param encryption_key_sha256: The SHA-256 hash of the provided encryption key. Must be provided + :vartype encryption_key: str + :ivar encryption_key_sha256: The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - :type encryption_key_sha256: str - :param encryption_algorithm: The algorithm used to produce the encryption key hash. Currently, + :vartype encryption_key_sha256: str + :ivar encryption_algorithm: The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: "None", "AES256". - :type encryption_algorithm: str or ~azure.storage.blob.models.EncryptionAlgorithmType + :vartype encryption_algorithm: str or ~azure.storage.blob.models.EncryptionAlgorithmType """ _attribute_map = { @@ -973,6 +1270,19 @@ def __init__( self, **kwargs ): + """ + :keyword encryption_key: Optional. Specifies the encryption key to use to encrypt the data + provided in the request. If not specified, encryption is performed with the root account + encryption key. For more information, see Encryption at Rest for Azure Storage Services. + :paramtype encryption_key: str + :keyword encryption_key_sha256: The SHA-256 hash of the provided encryption key. Must be + provided if the x-ms-encryption-key header is provided. + :paramtype encryption_key_sha256: str + :keyword encryption_algorithm: The algorithm used to produce the encryption key hash. + Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key + header is provided. Possible values include: "None", "AES256". + :paramtype encryption_algorithm: str or ~azure.storage.blob.models.EncryptionAlgorithmType + """ super(CpkInfo, self).__init__(**kwargs) self.encryption_key = kwargs.get('encryption_key', None) self.encryption_key_sha256 = kwargs.get('encryption_key_sha256', None) @@ -982,11 +1292,11 @@ def __init__( class CpkScopeInfo(msrest.serialization.Model): """Parameter group. - :param encryption_scope: Optional. Version 2019-07-07 and later. Specifies the name of the + :ivar encryption_scope: Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services. - :type encryption_scope: str + :vartype encryption_scope: str """ _attribute_map = { @@ -997,6 +1307,13 @@ def __init__( self, **kwargs ): + """ + :keyword encryption_scope: Optional. Version 2019-07-07 and later. Specifies the name of the + encryption scope to use to encrypt the data provided in the request. If not specified, + encryption is performed with the default account encryption scope. For more information, see + Encryption at Rest for Azure Storage Services. + :paramtype encryption_scope: str + """ super(CpkScopeInfo, self).__init__(**kwargs) self.encryption_scope = kwargs.get('encryption_scope', None) @@ -1004,16 +1321,16 @@ def __init__( class DelimitedTextConfiguration(msrest.serialization.Model): """Groups the settings used for interpreting the blob data if the blob is delimited text formatted. - :param column_separator: The string used to separate columns. - :type column_separator: str - :param field_quote: The string used to quote a specific field. - :type field_quote: str - :param record_separator: The string used to separate records. - :type record_separator: str - :param escape_char: The string used as an escape character. - :type escape_char: str - :param headers_present: Represents whether the data has headers. - :type headers_present: bool + :ivar column_separator: The string used to separate columns. + :vartype column_separator: str + :ivar field_quote: The string used to quote a specific field. + :vartype field_quote: str + :ivar record_separator: The string used to separate records. + :vartype record_separator: str + :ivar escape_char: The string used as an escape character. + :vartype escape_char: str + :ivar headers_present: Represents whether the data has headers. + :vartype headers_present: bool """ _attribute_map = { @@ -1031,6 +1348,18 @@ def __init__( self, **kwargs ): + """ + :keyword column_separator: The string used to separate columns. + :paramtype column_separator: str + :keyword field_quote: The string used to quote a specific field. + :paramtype field_quote: str + :keyword record_separator: The string used to separate records. + :paramtype record_separator: str + :keyword escape_char: The string used as an escape character. + :paramtype escape_char: str + :keyword headers_present: Represents whether the data has headers. + :paramtype headers_present: bool + """ super(DelimitedTextConfiguration, self).__init__(**kwargs) self.column_separator = kwargs.get('column_separator', None) self.field_quote = kwargs.get('field_quote', None) @@ -1044,12 +1373,12 @@ class FilterBlobItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param container_name: Required. - :type container_name: str - :param tags: A set of tags. Blob tags. - :type tags: ~azure.storage.blob.models.BlobTags + :ivar name: Required. + :vartype name: str + :ivar container_name: Required. + :vartype container_name: str + :ivar tags: A set of tags. Blob tags. + :vartype tags: ~azure.storage.blob.models.BlobTags """ _validation = { @@ -1070,6 +1399,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword container_name: Required. + :paramtype container_name: str + :keyword tags: A set of tags. Blob tags. + :paramtype tags: ~azure.storage.blob.models.BlobTags + """ super(FilterBlobItem, self).__init__(**kwargs) self.name = kwargs['name'] self.container_name = kwargs['container_name'] @@ -1081,14 +1418,14 @@ class FilterBlobSegment(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param where: Required. - :type where: str - :param blobs: Required. - :type blobs: list[~azure.storage.blob.models.FilterBlobItem] - :param next_marker: - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar where: Required. + :vartype where: str + :ivar blobs: Required. + :vartype blobs: list[~azure.storage.blob.models.FilterBlobItem] + :ivar next_marker: + :vartype next_marker: str """ _validation = { @@ -1111,6 +1448,16 @@ def __init__( self, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword where: Required. + :paramtype where: str + :keyword blobs: Required. + :paramtype blobs: list[~azure.storage.blob.models.FilterBlobItem] + :keyword next_marker: + :paramtype next_marker: str + """ super(FilterBlobSegment, self).__init__(**kwargs) self.service_endpoint = kwargs['service_endpoint'] self.where = kwargs['where'] @@ -1123,13 +1470,13 @@ class GeoReplication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. The status of the secondary location. Possible values include: "live", + :ivar status: Required. The status of the secondary location. Possible values include: "live", "bootstrap", "unavailable". - :type status: str or ~azure.storage.blob.models.GeoReplicationStatusType - :param last_sync_time: Required. A GMT date/time value, to the second. All primary writes + :vartype status: str or ~azure.storage.blob.models.GeoReplicationStatusType + :ivar last_sync_time: Required. A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads. - :type last_sync_time: ~datetime.datetime + :vartype last_sync_time: ~datetime.datetime """ _validation = { @@ -1146,6 +1493,15 @@ def __init__( self, **kwargs ): + """ + :keyword status: Required. The status of the secondary location. Possible values include: + "live", "bootstrap", "unavailable". + :paramtype status: str or ~azure.storage.blob.models.GeoReplicationStatusType + :keyword last_sync_time: Required. A GMT date/time value, to the second. All primary writes + preceding this value are guaranteed to be available for read operations at the secondary. + Primary writes after this point in time may or may not be available for reads. + :paramtype last_sync_time: ~datetime.datetime + """ super(GeoReplication, self).__init__(**kwargs) self.status = kwargs['status'] self.last_sync_time = kwargs['last_sync_time'] @@ -1154,8 +1510,8 @@ def __init__( class JsonTextConfiguration(msrest.serialization.Model): """json text configuration. - :param record_separator: The string used to separate records. - :type record_separator: str + :ivar record_separator: The string used to separate records. + :vartype record_separator: str """ _attribute_map = { @@ -1169,6 +1525,10 @@ def __init__( self, **kwargs ): + """ + :keyword record_separator: The string used to separate records. + :paramtype record_separator: str + """ super(JsonTextConfiguration, self).__init__(**kwargs) self.record_separator = kwargs.get('record_separator', None) @@ -1178,10 +1538,10 @@ class KeyInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start: Required. The date-time the key is active in ISO 8601 UTC time. - :type start: str - :param expiry: Required. The date-time the key expires in ISO 8601 UTC time. - :type expiry: str + :ivar start: Required. The date-time the key is active in ISO 8601 UTC time. + :vartype start: str + :ivar expiry: Required. The date-time the key expires in ISO 8601 UTC time. + :vartype expiry: str """ _validation = { @@ -1198,6 +1558,12 @@ def __init__( self, **kwargs ): + """ + :keyword start: Required. The date-time the key is active in ISO 8601 UTC time. + :paramtype start: str + :keyword expiry: Required. The date-time the key expires in ISO 8601 UTC time. + :paramtype expiry: str + """ super(KeyInfo, self).__init__(**kwargs) self.start = kwargs['start'] self.expiry = kwargs['expiry'] @@ -1206,9 +1572,9 @@ def __init__( class LeaseAccessConditions(msrest.serialization.Model): """Parameter group. - :param lease_id: If specified, the operation only succeeds if the resource's lease is active - and matches this ID. - :type lease_id: str + :ivar lease_id: If specified, the operation only succeeds if the resource's lease is active and + matches this ID. + :vartype lease_id: str """ _attribute_map = { @@ -1219,6 +1585,11 @@ def __init__( self, **kwargs ): + """ + :keyword lease_id: If specified, the operation only succeeds if the resource's lease is active + and matches this ID. + :paramtype lease_id: str + """ super(LeaseAccessConditions, self).__init__(**kwargs) self.lease_id = kwargs.get('lease_id', None) @@ -1228,20 +1599,20 @@ class ListBlobsFlatSegmentResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param container_name: Required. - :type container_name: str - :param prefix: - :type prefix: str - :param marker: - :type marker: str - :param max_results: - :type max_results: int - :param segment: Required. - :type segment: ~azure.storage.blob.models.BlobFlatListSegment - :param next_marker: - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar container_name: Required. + :vartype container_name: str + :ivar prefix: + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: + :vartype max_results: int + :ivar segment: Required. + :vartype segment: ~azure.storage.blob.models.BlobFlatListSegment + :ivar next_marker: + :vartype next_marker: str """ _validation = { @@ -1267,6 +1638,22 @@ def __init__( self, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword container_name: Required. + :paramtype container_name: str + :keyword prefix: + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: + :paramtype max_results: int + :keyword segment: Required. + :paramtype segment: ~azure.storage.blob.models.BlobFlatListSegment + :keyword next_marker: + :paramtype next_marker: str + """ super(ListBlobsFlatSegmentResponse, self).__init__(**kwargs) self.service_endpoint = kwargs['service_endpoint'] self.container_name = kwargs['container_name'] @@ -1282,22 +1669,22 @@ class ListBlobsHierarchySegmentResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param container_name: Required. - :type container_name: str - :param prefix: - :type prefix: str - :param marker: - :type marker: str - :param max_results: - :type max_results: int - :param delimiter: - :type delimiter: str - :param segment: Required. - :type segment: ~azure.storage.blob.models.BlobHierarchyListSegment - :param next_marker: - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar container_name: Required. + :vartype container_name: str + :ivar prefix: + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: + :vartype max_results: int + :ivar delimiter: + :vartype delimiter: str + :ivar segment: Required. + :vartype segment: ~azure.storage.blob.models.BlobHierarchyListSegment + :ivar next_marker: + :vartype next_marker: str """ _validation = { @@ -1324,6 +1711,24 @@ def __init__( self, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword container_name: Required. + :paramtype container_name: str + :keyword prefix: + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: + :paramtype max_results: int + :keyword delimiter: + :paramtype delimiter: str + :keyword segment: Required. + :paramtype segment: ~azure.storage.blob.models.BlobHierarchyListSegment + :keyword next_marker: + :paramtype next_marker: str + """ super(ListBlobsHierarchySegmentResponse, self).__init__(**kwargs) self.service_endpoint = kwargs['service_endpoint'] self.container_name = kwargs['container_name'] @@ -1340,18 +1745,18 @@ class ListContainersSegmentResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param prefix: - :type prefix: str - :param marker: - :type marker: str - :param max_results: - :type max_results: int - :param container_items: Required. - :type container_items: list[~azure.storage.blob.models.ContainerItem] - :param next_marker: - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar prefix: + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: + :vartype max_results: int + :ivar container_items: Required. + :vartype container_items: list[~azure.storage.blob.models.ContainerItem] + :ivar next_marker: + :vartype next_marker: str """ _validation = { @@ -1375,6 +1780,20 @@ def __init__( self, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword prefix: + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: + :paramtype max_results: int + :keyword container_items: Required. + :paramtype container_items: list[~azure.storage.blob.models.ContainerItem] + :keyword next_marker: + :paramtype next_marker: str + """ super(ListContainersSegmentResponse, self).__init__(**kwargs) self.service_endpoint = kwargs['service_endpoint'] self.prefix = kwargs.get('prefix', None) @@ -1389,17 +1808,17 @@ class Logging(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param version: Required. The version of Storage Analytics to configure. - :type version: str - :param delete: Required. Indicates whether all delete requests should be logged. - :type delete: bool - :param read: Required. Indicates whether all read requests should be logged. - :type read: bool - :param write: Required. Indicates whether all write requests should be logged. - :type write: bool - :param retention_policy: Required. the retention policy which determines how long the - associated data should persist. - :type retention_policy: ~azure.storage.blob.models.RetentionPolicy + :ivar version: Required. The version of Storage Analytics to configure. + :vartype version: str + :ivar delete: Required. Indicates whether all delete requests should be logged. + :vartype delete: bool + :ivar read: Required. Indicates whether all read requests should be logged. + :vartype read: bool + :ivar write: Required. Indicates whether all write requests should be logged. + :vartype write: bool + :ivar retention_policy: Required. the retention policy which determines how long the associated + data should persist. + :vartype retention_policy: ~azure.storage.blob.models.RetentionPolicy """ _validation = { @@ -1422,6 +1841,19 @@ def __init__( self, **kwargs ): + """ + :keyword version: Required. The version of Storage Analytics to configure. + :paramtype version: str + :keyword delete: Required. Indicates whether all delete requests should be logged. + :paramtype delete: bool + :keyword read: Required. Indicates whether all read requests should be logged. + :paramtype read: bool + :keyword write: Required. Indicates whether all write requests should be logged. + :paramtype write: bool + :keyword retention_policy: Required. the retention policy which determines how long the + associated data should persist. + :paramtype retention_policy: ~azure.storage.blob.models.RetentionPolicy + """ super(Logging, self).__init__(**kwargs) self.version = kwargs['version'] self.delete = kwargs['delete'] @@ -1435,16 +1867,16 @@ class Metrics(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param version: The version of Storage Analytics to configure. - :type version: str - :param enabled: Required. Indicates whether metrics are enabled for the Blob service. - :type enabled: bool - :param include_apis: Indicates whether metrics should generate summary statistics for called - API operations. - :type include_apis: bool - :param retention_policy: the retention policy which determines how long the associated data + :ivar version: The version of Storage Analytics to configure. + :vartype version: str + :ivar enabled: Required. Indicates whether metrics are enabled for the Blob service. + :vartype enabled: bool + :ivar include_apis: Indicates whether metrics should generate summary statistics for called API + operations. + :vartype include_apis: bool + :ivar retention_policy: the retention policy which determines how long the associated data should persist. - :type retention_policy: ~azure.storage.blob.models.RetentionPolicy + :vartype retention_policy: ~azure.storage.blob.models.RetentionPolicy """ _validation = { @@ -1462,6 +1894,18 @@ def __init__( self, **kwargs ): + """ + :keyword version: The version of Storage Analytics to configure. + :paramtype version: str + :keyword enabled: Required. Indicates whether metrics are enabled for the Blob service. + :paramtype enabled: bool + :keyword include_apis: Indicates whether metrics should generate summary statistics for called + API operations. + :paramtype include_apis: bool + :keyword retention_policy: the retention policy which determines how long the associated data + should persist. + :paramtype retention_policy: ~azure.storage.blob.models.RetentionPolicy + """ super(Metrics, self).__init__(**kwargs) self.version = kwargs.get('version', None) self.enabled = kwargs['enabled'] @@ -1472,19 +1916,19 @@ def __init__( class ModifiedAccessConditions(msrest.serialization.Model): """Parameter group. - :param if_modified_since: Specify this header value to operate only on a blob if it has been + :ivar if_modified_since: Specify this header value to operate only on a blob if it has been modified since the specified date/time. - :type if_modified_since: ~datetime.datetime - :param if_unmodified_since: Specify this header value to operate only on a blob if it has not + :vartype if_modified_since: ~datetime.datetime + :ivar if_unmodified_since: Specify this header value to operate only on a blob if it has not been modified since the specified date/time. - :type if_unmodified_since: ~datetime.datetime - :param if_match: Specify an ETag value to operate only on blobs with a matching value. - :type if_match: str - :param if_none_match: Specify an ETag value to operate only on blobs without a matching value. - :type if_none_match: str - :param if_tags: Specify a SQL where clause on blob tags to operate only on blobs with a - matching value. - :type if_tags: str + :vartype if_unmodified_since: ~datetime.datetime + :ivar if_match: Specify an ETag value to operate only on blobs with a matching value. + :vartype if_match: str + :ivar if_none_match: Specify an ETag value to operate only on blobs without a matching value. + :vartype if_none_match: str + :ivar if_tags: Specify a SQL where clause on blob tags to operate only on blobs with a matching + value. + :vartype if_tags: str """ _attribute_map = { @@ -1499,6 +1943,22 @@ def __init__( self, **kwargs ): + """ + :keyword if_modified_since: Specify this header value to operate only on a blob if it has been + modified since the specified date/time. + :paramtype if_modified_since: ~datetime.datetime + :keyword if_unmodified_since: Specify this header value to operate only on a blob if it has not + been modified since the specified date/time. + :paramtype if_unmodified_since: ~datetime.datetime + :keyword if_match: Specify an ETag value to operate only on blobs with a matching value. + :paramtype if_match: str + :keyword if_none_match: Specify an ETag value to operate only on blobs without a matching + value. + :paramtype if_none_match: str + :keyword if_tags: Specify a SQL where clause on blob tags to operate only on blobs with a + matching value. + :paramtype if_tags: str + """ super(ModifiedAccessConditions, self).__init__(**kwargs) self.if_modified_since = kwargs.get('if_modified_since', None) self.if_unmodified_since = kwargs.get('if_unmodified_since', None) @@ -1510,10 +1970,10 @@ def __init__( class PageList(msrest.serialization.Model): """the list of pages. - :param page_range: - :type page_range: list[~azure.storage.blob.models.PageRange] - :param clear_range: - :type clear_range: list[~azure.storage.blob.models.ClearRange] + :ivar page_range: + :vartype page_range: list[~azure.storage.blob.models.PageRange] + :ivar clear_range: + :vartype clear_range: list[~azure.storage.blob.models.ClearRange] """ _attribute_map = { @@ -1525,6 +1985,12 @@ def __init__( self, **kwargs ): + """ + :keyword page_range: + :paramtype page_range: list[~azure.storage.blob.models.PageRange] + :keyword clear_range: + :paramtype clear_range: list[~azure.storage.blob.models.ClearRange] + """ super(PageList, self).__init__(**kwargs) self.page_range = kwargs.get('page_range', None) self.clear_range = kwargs.get('clear_range', None) @@ -1535,10 +2001,10 @@ class PageRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start: Required. - :type start: long - :param end: Required. - :type end: long + :ivar start: Required. + :vartype start: long + :ivar end: Required. + :vartype end: long """ _validation = { @@ -1558,6 +2024,12 @@ def __init__( self, **kwargs ): + """ + :keyword start: Required. + :paramtype start: long + :keyword end: Required. + :paramtype end: long + """ super(PageRange, self).__init__(**kwargs) self.start = kwargs['start'] self.end = kwargs['end'] @@ -1568,19 +2040,19 @@ class QueryFormat(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The quick query format type. Possible values include: "delimited", + :ivar type: Required. The quick query format type. Possible values include: "delimited", "json", "arrow", "parquet". - :type type: str or ~azure.storage.blob.models.QueryFormatType - :param delimited_text_configuration: Groups the settings used for interpreting the blob data if + :vartype type: str or ~azure.storage.blob.models.QueryFormatType + :ivar delimited_text_configuration: Groups the settings used for interpreting the blob data if the blob is delimited text formatted. - :type delimited_text_configuration: ~azure.storage.blob.models.DelimitedTextConfiguration - :param json_text_configuration: json text configuration. - :type json_text_configuration: ~azure.storage.blob.models.JsonTextConfiguration - :param arrow_configuration: Groups the settings used for formatting the response if the - response should be Arrow formatted. - :type arrow_configuration: ~azure.storage.blob.models.ArrowConfiguration - :param parquet_text_configuration: Any object. - :type parquet_text_configuration: any + :vartype delimited_text_configuration: ~azure.storage.blob.models.DelimitedTextConfiguration + :ivar json_text_configuration: json text configuration. + :vartype json_text_configuration: ~azure.storage.blob.models.JsonTextConfiguration + :ivar arrow_configuration: Groups the settings used for formatting the response if the response + should be Arrow formatted. + :vartype arrow_configuration: ~azure.storage.blob.models.ArrowConfiguration + :ivar parquet_text_configuration: Any object. + :vartype parquet_text_configuration: any """ _validation = { @@ -1599,6 +2071,21 @@ def __init__( self, **kwargs ): + """ + :keyword type: Required. The quick query format type. Possible values include: "delimited", + "json", "arrow", "parquet". + :paramtype type: str or ~azure.storage.blob.models.QueryFormatType + :keyword delimited_text_configuration: Groups the settings used for interpreting the blob data + if the blob is delimited text formatted. + :paramtype delimited_text_configuration: ~azure.storage.blob.models.DelimitedTextConfiguration + :keyword json_text_configuration: json text configuration. + :paramtype json_text_configuration: ~azure.storage.blob.models.JsonTextConfiguration + :keyword arrow_configuration: Groups the settings used for formatting the response if the + response should be Arrow formatted. + :paramtype arrow_configuration: ~azure.storage.blob.models.ArrowConfiguration + :keyword parquet_text_configuration: Any object. + :paramtype parquet_text_configuration: any + """ super(QueryFormat, self).__init__(**kwargs) self.type = kwargs['type'] self.delimited_text_configuration = kwargs.get('delimited_text_configuration', None) @@ -1617,13 +2104,13 @@ class QueryRequest(msrest.serialization.Model): :ivar query_type: Required. The type of the provided query expression. Has constant value: "SQL". :vartype query_type: str - :param expression: Required. The query expression in SQL. The maximum size of the query + :ivar expression: Required. The query expression in SQL. The maximum size of the query expression is 256KiB. - :type expression: str - :param input_serialization: - :type input_serialization: ~azure.storage.blob.models.QuerySerialization - :param output_serialization: - :type output_serialization: ~azure.storage.blob.models.QuerySerialization + :vartype expression: str + :ivar input_serialization: + :vartype input_serialization: ~azure.storage.blob.models.QuerySerialization + :ivar output_serialization: + :vartype output_serialization: ~azure.storage.blob.models.QuerySerialization """ _validation = { @@ -1647,6 +2134,15 @@ def __init__( self, **kwargs ): + """ + :keyword expression: Required. The query expression in SQL. The maximum size of the query + expression is 256KiB. + :paramtype expression: str + :keyword input_serialization: + :paramtype input_serialization: ~azure.storage.blob.models.QuerySerialization + :keyword output_serialization: + :paramtype output_serialization: ~azure.storage.blob.models.QuerySerialization + """ super(QueryRequest, self).__init__(**kwargs) self.expression = kwargs['expression'] self.input_serialization = kwargs.get('input_serialization', None) @@ -1658,8 +2154,8 @@ class QuerySerialization(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param format: Required. - :type format: ~azure.storage.blob.models.QueryFormat + :ivar format: Required. + :vartype format: ~azure.storage.blob.models.QueryFormat """ _validation = { @@ -1674,6 +2170,10 @@ def __init__( self, **kwargs ): + """ + :keyword format: Required. + :paramtype format: ~azure.storage.blob.models.QueryFormat + """ super(QuerySerialization, self).__init__(**kwargs) self.format = kwargs['format'] @@ -1683,15 +2183,15 @@ class RetentionPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Indicates whether a retention policy is enabled for the storage + :ivar enabled: Required. Indicates whether a retention policy is enabled for the storage service. - :type enabled: bool - :param days: Indicates the number of days that metrics or logging or soft-deleted data should - be retained. All data older than this value will be deleted. - :type days: int - :param allow_permanent_delete: Indicates whether permanent delete is allowed on this storage + :vartype enabled: bool + :ivar days: Indicates the number of days that metrics or logging or soft-deleted data should be + retained. All data older than this value will be deleted. + :vartype days: int + :ivar allow_permanent_delete: Indicates whether permanent delete is allowed on this storage account. - :type allow_permanent_delete: bool + :vartype allow_permanent_delete: bool """ _validation = { @@ -1709,6 +2209,17 @@ def __init__( self, **kwargs ): + """ + :keyword enabled: Required. Indicates whether a retention policy is enabled for the storage + service. + :paramtype enabled: bool + :keyword days: Indicates the number of days that metrics or logging or soft-deleted data should + be retained. All data older than this value will be deleted. + :paramtype days: int + :keyword allow_permanent_delete: Indicates whether permanent delete is allowed on this storage + account. + :paramtype allow_permanent_delete: bool + """ super(RetentionPolicy, self).__init__(**kwargs) self.enabled = kwargs['enabled'] self.days = kwargs.get('days', None) @@ -1718,15 +2229,15 @@ def __init__( class SequenceNumberAccessConditions(msrest.serialization.Model): """Parameter group. - :param if_sequence_number_less_than_or_equal_to: Specify this header value to operate only on a + :ivar if_sequence_number_less_than_or_equal_to: Specify this header value to operate only on a blob if it has a sequence number less than or equal to the specified. - :type if_sequence_number_less_than_or_equal_to: long - :param if_sequence_number_less_than: Specify this header value to operate only on a blob if it + :vartype if_sequence_number_less_than_or_equal_to: long + :ivar if_sequence_number_less_than: Specify this header value to operate only on a blob if it has a sequence number less than the specified. - :type if_sequence_number_less_than: long - :param if_sequence_number_equal_to: Specify this header value to operate only on a blob if it + :vartype if_sequence_number_less_than: long + :ivar if_sequence_number_equal_to: Specify this header value to operate only on a blob if it has the specified sequence number. - :type if_sequence_number_equal_to: long + :vartype if_sequence_number_equal_to: long """ _attribute_map = { @@ -1739,6 +2250,17 @@ def __init__( self, **kwargs ): + """ + :keyword if_sequence_number_less_than_or_equal_to: Specify this header value to operate only on + a blob if it has a sequence number less than or equal to the specified. + :paramtype if_sequence_number_less_than_or_equal_to: long + :keyword if_sequence_number_less_than: Specify this header value to operate only on a blob if + it has a sequence number less than the specified. + :paramtype if_sequence_number_less_than: long + :keyword if_sequence_number_equal_to: Specify this header value to operate only on a blob if it + has the specified sequence number. + :paramtype if_sequence_number_equal_to: long + """ super(SequenceNumberAccessConditions, self).__init__(**kwargs) self.if_sequence_number_less_than_or_equal_to = kwargs.get('if_sequence_number_less_than_or_equal_to', None) self.if_sequence_number_less_than = kwargs.get('if_sequence_number_less_than', None) @@ -1750,10 +2272,10 @@ class SignedIdentifier(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. a unique id. - :type id: str - :param access_policy: An Access policy. - :type access_policy: ~azure.storage.blob.models.AccessPolicy + :ivar id: Required. a unique id. + :vartype id: str + :ivar access_policy: An Access policy. + :vartype access_policy: ~azure.storage.blob.models.AccessPolicy """ _validation = { @@ -1772,6 +2294,12 @@ def __init__( self, **kwargs ): + """ + :keyword id: Required. a unique id. + :paramtype id: str + :keyword access_policy: An Access policy. + :paramtype access_policy: ~azure.storage.blob.models.AccessPolicy + """ super(SignedIdentifier, self).__init__(**kwargs) self.id = kwargs['id'] self.access_policy = kwargs.get('access_policy', None) @@ -1780,20 +2308,20 @@ def __init__( class SourceModifiedAccessConditions(msrest.serialization.Model): """Parameter group. - :param source_if_modified_since: Specify this header value to operate only on a blob if it has + :ivar source_if_modified_since: Specify this header value to operate only on a blob if it has been modified since the specified date/time. - :type source_if_modified_since: ~datetime.datetime - :param source_if_unmodified_since: Specify this header value to operate only on a blob if it - has not been modified since the specified date/time. - :type source_if_unmodified_since: ~datetime.datetime - :param source_if_match: Specify an ETag value to operate only on blobs with a matching value. - :type source_if_match: str - :param source_if_none_match: Specify an ETag value to operate only on blobs without a matching + :vartype source_if_modified_since: ~datetime.datetime + :ivar source_if_unmodified_since: Specify this header value to operate only on a blob if it has + not been modified since the specified date/time. + :vartype source_if_unmodified_since: ~datetime.datetime + :ivar source_if_match: Specify an ETag value to operate only on blobs with a matching value. + :vartype source_if_match: str + :ivar source_if_none_match: Specify an ETag value to operate only on blobs without a matching value. - :type source_if_none_match: str - :param source_if_tags: Specify a SQL where clause on blob tags to operate only on blobs with a + :vartype source_if_none_match: str + :ivar source_if_tags: Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - :type source_if_tags: str + :vartype source_if_tags: str """ _attribute_map = { @@ -1808,6 +2336,22 @@ def __init__( self, **kwargs ): + """ + :keyword source_if_modified_since: Specify this header value to operate only on a blob if it + has been modified since the specified date/time. + :paramtype source_if_modified_since: ~datetime.datetime + :keyword source_if_unmodified_since: Specify this header value to operate only on a blob if it + has not been modified since the specified date/time. + :paramtype source_if_unmodified_since: ~datetime.datetime + :keyword source_if_match: Specify an ETag value to operate only on blobs with a matching value. + :paramtype source_if_match: str + :keyword source_if_none_match: Specify an ETag value to operate only on blobs without a + matching value. + :paramtype source_if_none_match: str + :keyword source_if_tags: Specify a SQL where clause on blob tags to operate only on blobs with + a matching value. + :paramtype source_if_tags: str + """ super(SourceModifiedAccessConditions, self).__init__(**kwargs) self.source_if_modified_since = kwargs.get('source_if_modified_since', None) self.source_if_unmodified_since = kwargs.get('source_if_unmodified_since', None) @@ -1821,14 +2365,14 @@ class StaticWebsite(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Indicates whether this account is hosting a static website. - :type enabled: bool - :param index_document: The default name of the index page under each directory. - :type index_document: str - :param error_document404_path: The absolute path of the custom 404 page. - :type error_document404_path: str - :param default_index_document_path: Absolute path of the default index page. - :type default_index_document_path: str + :ivar enabled: Required. Indicates whether this account is hosting a static website. + :vartype enabled: bool + :ivar index_document: The default name of the index page under each directory. + :vartype index_document: str + :ivar error_document404_path: The absolute path of the custom 404 page. + :vartype error_document404_path: str + :ivar default_index_document_path: Absolute path of the default index page. + :vartype default_index_document_path: str """ _validation = { @@ -1846,6 +2390,16 @@ def __init__( self, **kwargs ): + """ + :keyword enabled: Required. Indicates whether this account is hosting a static website. + :paramtype enabled: bool + :keyword index_document: The default name of the index page under each directory. + :paramtype index_document: str + :keyword error_document404_path: The absolute path of the custom 404 page. + :paramtype error_document404_path: str + :keyword default_index_document_path: Absolute path of the default index page. + :paramtype default_index_document_path: str + """ super(StaticWebsite, self).__init__(**kwargs) self.enabled = kwargs['enabled'] self.index_document = kwargs.get('index_document', None) @@ -1856,8 +2410,8 @@ def __init__( class StorageError(msrest.serialization.Model): """StorageError. - :param message: - :type message: str + :ivar message: + :vartype message: str """ _attribute_map = { @@ -1868,6 +2422,10 @@ def __init__( self, **kwargs ): + """ + :keyword message: + :paramtype message: str + """ super(StorageError, self).__init__(**kwargs) self.message = kwargs.get('message', None) @@ -1875,25 +2433,25 @@ def __init__( class StorageServiceProperties(msrest.serialization.Model): """Storage Service Properties. - :param logging: Azure Analytics Logging settings. - :type logging: ~azure.storage.blob.models.Logging - :param hour_metrics: a summary of request statistics grouped by API in hour or minute - aggregates for blobs. - :type hour_metrics: ~azure.storage.blob.models.Metrics - :param minute_metrics: a summary of request statistics grouped by API in hour or minute + :ivar logging: Azure Analytics Logging settings. + :vartype logging: ~azure.storage.blob.models.Logging + :ivar hour_metrics: a summary of request statistics grouped by API in hour or minute aggregates + for blobs. + :vartype hour_metrics: ~azure.storage.blob.models.Metrics + :ivar minute_metrics: a summary of request statistics grouped by API in hour or minute aggregates for blobs. - :type minute_metrics: ~azure.storage.blob.models.Metrics - :param cors: The set of CORS rules. - :type cors: list[~azure.storage.blob.models.CorsRule] - :param default_service_version: The default version to use for requests to the Blob service if + :vartype minute_metrics: ~azure.storage.blob.models.Metrics + :ivar cors: The set of CORS rules. + :vartype cors: list[~azure.storage.blob.models.CorsRule] + :ivar default_service_version: The default version to use for requests to the Blob service if an incoming request's version is not specified. Possible values include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: the retention policy which determines how long the associated + :vartype default_service_version: str + :ivar delete_retention_policy: the retention policy which determines how long the associated data should persist. - :type delete_retention_policy: ~azure.storage.blob.models.RetentionPolicy - :param static_website: The properties that enable an account to host a static website. - :type static_website: ~azure.storage.blob.models.StaticWebsite + :vartype delete_retention_policy: ~azure.storage.blob.models.RetentionPolicy + :ivar static_website: The properties that enable an account to host a static website. + :vartype static_website: ~azure.storage.blob.models.StaticWebsite """ _attribute_map = { @@ -1910,6 +2468,27 @@ def __init__( self, **kwargs ): + """ + :keyword logging: Azure Analytics Logging settings. + :paramtype logging: ~azure.storage.blob.models.Logging + :keyword hour_metrics: a summary of request statistics grouped by API in hour or minute + aggregates for blobs. + :paramtype hour_metrics: ~azure.storage.blob.models.Metrics + :keyword minute_metrics: a summary of request statistics grouped by API in hour or minute + aggregates for blobs. + :paramtype minute_metrics: ~azure.storage.blob.models.Metrics + :keyword cors: The set of CORS rules. + :paramtype cors: list[~azure.storage.blob.models.CorsRule] + :keyword default_service_version: The default version to use for requests to the Blob service + if an incoming request's version is not specified. Possible values include version 2008-10-27 + and all more recent versions. + :paramtype default_service_version: str + :keyword delete_retention_policy: the retention policy which determines how long the associated + data should persist. + :paramtype delete_retention_policy: ~azure.storage.blob.models.RetentionPolicy + :keyword static_website: The properties that enable an account to host a static website. + :paramtype static_website: ~azure.storage.blob.models.StaticWebsite + """ super(StorageServiceProperties, self).__init__(**kwargs) self.logging = kwargs.get('logging', None) self.hour_metrics = kwargs.get('hour_metrics', None) @@ -1923,8 +2502,8 @@ def __init__( class StorageServiceStats(msrest.serialization.Model): """Stats for the storage service. - :param geo_replication: Geo-Replication information for the Secondary Storage Service. - :type geo_replication: ~azure.storage.blob.models.GeoReplication + :ivar geo_replication: Geo-Replication information for the Secondary Storage Service. + :vartype geo_replication: ~azure.storage.blob.models.GeoReplication """ _attribute_map = { @@ -1935,6 +2514,10 @@ def __init__( self, **kwargs ): + """ + :keyword geo_replication: Geo-Replication information for the Secondary Storage Service. + :paramtype geo_replication: ~azure.storage.blob.models.GeoReplication + """ super(StorageServiceStats, self).__init__(**kwargs) self.geo_replication = kwargs.get('geo_replication', None) @@ -1944,21 +2527,20 @@ class UserDelegationKey(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param signed_oid: Required. The Azure Active Directory object ID in GUID format. - :type signed_oid: str - :param signed_tid: Required. The Azure Active Directory tenant ID in GUID format. - :type signed_tid: str - :param signed_start: Required. The date-time the key is active. - :type signed_start: ~datetime.datetime - :param signed_expiry: Required. The date-time the key expires. - :type signed_expiry: ~datetime.datetime - :param signed_service: Required. Abbreviation of the Azure Storage service that accepts the - key. - :type signed_service: str - :param signed_version: Required. The service version that created the key. - :type signed_version: str - :param value: Required. The key as a base64 string. - :type value: str + :ivar signed_oid: Required. The Azure Active Directory object ID in GUID format. + :vartype signed_oid: str + :ivar signed_tid: Required. The Azure Active Directory tenant ID in GUID format. + :vartype signed_tid: str + :ivar signed_start: Required. The date-time the key is active. + :vartype signed_start: ~datetime.datetime + :ivar signed_expiry: Required. The date-time the key expires. + :vartype signed_expiry: ~datetime.datetime + :ivar signed_service: Required. Abbreviation of the Azure Storage service that accepts the key. + :vartype signed_service: str + :ivar signed_version: Required. The service version that created the key. + :vartype signed_version: str + :ivar value: Required. The key as a base64 string. + :vartype value: str """ _validation = { @@ -1985,6 +2567,23 @@ def __init__( self, **kwargs ): + """ + :keyword signed_oid: Required. The Azure Active Directory object ID in GUID format. + :paramtype signed_oid: str + :keyword signed_tid: Required. The Azure Active Directory tenant ID in GUID format. + :paramtype signed_tid: str + :keyword signed_start: Required. The date-time the key is active. + :paramtype signed_start: ~datetime.datetime + :keyword signed_expiry: Required. The date-time the key expires. + :paramtype signed_expiry: ~datetime.datetime + :keyword signed_service: Required. Abbreviation of the Azure Storage service that accepts the + key. + :paramtype signed_service: str + :keyword signed_version: Required. The service version that created the key. + :paramtype signed_version: str + :keyword value: Required. The key as a base64 string. + :paramtype value: str + """ super(UserDelegationKey, self).__init__(**kwargs) self.signed_oid = kwargs['signed_oid'] self.signed_tid = kwargs['signed_tid'] diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py index e51ab85be0ce..4ecc6aa85f9f 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/models/_models_py3.py @@ -18,12 +18,12 @@ class AccessPolicy(msrest.serialization.Model): """An Access policy. - :param start: the date-time the policy is active. - :type start: str - :param expiry: the date-time the policy expires. - :type expiry: str - :param permission: the permissions for the acl policy. - :type permission: str + :ivar start: the date-time the policy is active. + :vartype start: str + :ivar expiry: the date-time the policy expires. + :vartype expiry: str + :ivar permission: the permissions for the acl policy. + :vartype permission: str """ _attribute_map = { @@ -40,6 +40,14 @@ def __init__( permission: Optional[str] = None, **kwargs ): + """ + :keyword start: the date-time the policy is active. + :paramtype start: str + :keyword expiry: the date-time the policy expires. + :paramtype expiry: str + :keyword permission: the permissions for the acl policy. + :paramtype permission: str + """ super(AccessPolicy, self).__init__(**kwargs) self.start = start self.expiry = expiry @@ -49,16 +57,16 @@ def __init__( class AppendPositionAccessConditions(msrest.serialization.Model): """Parameter group. - :param max_size: Optional conditional header. The max length in bytes permitted for the append + :ivar max_size: Optional conditional header. The max length in bytes permitted for the append blob. If the Append Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed). - :type max_size: long - :param append_position: Optional conditional header, used only for the Append Block operation. - A number indicating the byte offset to compare. Append Block will succeed only if the append + :vartype max_size: long + :ivar append_position: Optional conditional header, used only for the Append Block operation. A + number indicating the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed). - :type append_position: long + :vartype append_position: long """ _attribute_map = { @@ -73,6 +81,18 @@ def __init__( append_position: Optional[int] = None, **kwargs ): + """ + :keyword max_size: Optional conditional header. The max length in bytes permitted for the + append blob. If the Append Block operation would cause the blob to exceed that limit or if the + blob size is already greater than the value specified in this header, the request will fail + with MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed). + :paramtype max_size: long + :keyword append_position: Optional conditional header, used only for the Append Block + operation. A number indicating the byte offset to compare. Append Block will succeed only if + the append position is equal to this number. If it is not, the request will fail with the + AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed). + :paramtype append_position: long + """ super(AppendPositionAccessConditions, self).__init__(**kwargs) self.max_size = max_size self.append_position = append_position @@ -83,8 +103,8 @@ class ArrowConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param schema: Required. - :type schema: list[~azure.storage.blob.models.ArrowField] + :ivar schema: Required. + :vartype schema: list[~azure.storage.blob.models.ArrowField] """ _validation = { @@ -104,6 +124,10 @@ def __init__( schema: List["ArrowField"], **kwargs ): + """ + :keyword schema: Required. + :paramtype schema: list[~azure.storage.blob.models.ArrowField] + """ super(ArrowConfiguration, self).__init__(**kwargs) self.schema = schema @@ -113,14 +137,14 @@ class ArrowField(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. - :type type: str - :param name: - :type name: str - :param precision: - :type precision: int - :param scale: - :type scale: int + :ivar type: Required. + :vartype type: str + :ivar name: + :vartype name: str + :ivar precision: + :vartype precision: int + :ivar scale: + :vartype scale: int """ _validation = { @@ -146,6 +170,16 @@ def __init__( scale: Optional[int] = None, **kwargs ): + """ + :keyword type: Required. + :paramtype type: str + :keyword name: + :paramtype name: str + :keyword precision: + :paramtype precision: int + :keyword scale: + :paramtype scale: int + """ super(ArrowField, self).__init__(**kwargs) self.type = type self.name = name @@ -158,8 +192,8 @@ class BlobFlatListSegment(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param blob_items: Required. - :type blob_items: list[~azure.storage.blob.models.BlobItemInternal] + :ivar blob_items: Required. + :vartype blob_items: list[~azure.storage.blob.models.BlobItemInternal] """ _validation = { @@ -179,6 +213,10 @@ def __init__( blob_items: List["BlobItemInternal"], **kwargs ): + """ + :keyword blob_items: Required. + :paramtype blob_items: list[~azure.storage.blob.models.BlobItemInternal] + """ super(BlobFlatListSegment, self).__init__(**kwargs) self.blob_items = blob_items @@ -188,10 +226,10 @@ class BlobHierarchyListSegment(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param blob_prefixes: - :type blob_prefixes: list[~azure.storage.blob.models.BlobPrefix] - :param blob_items: Required. - :type blob_items: list[~azure.storage.blob.models.BlobItemInternal] + :ivar blob_prefixes: + :vartype blob_prefixes: list[~azure.storage.blob.models.BlobPrefix] + :ivar blob_items: Required. + :vartype blob_items: list[~azure.storage.blob.models.BlobItemInternal] """ _validation = { @@ -213,6 +251,12 @@ def __init__( blob_prefixes: Optional[List["BlobPrefix"]] = None, **kwargs ): + """ + :keyword blob_prefixes: + :paramtype blob_prefixes: list[~azure.storage.blob.models.BlobPrefix] + :keyword blob_items: Required. + :paramtype blob_items: list[~azure.storage.blob.models.BlobItemInternal] + """ super(BlobHierarchyListSegment, self).__init__(**kwargs) self.blob_prefixes = blob_prefixes self.blob_items = blob_items @@ -221,23 +265,23 @@ def __init__( class BlobHTTPHeaders(msrest.serialization.Model): """Parameter group. - :param blob_cache_control: Optional. Sets the blob's cache control. If specified, this property + :ivar blob_cache_control: Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request. - :type blob_cache_control: str - :param blob_content_type: Optional. Sets the blob's content type. If specified, this property - is stored with the blob and returned with a read request. - :type blob_content_type: str - :param blob_content_md5: Optional. An MD5 hash of the blob content. Note that this hash is not + :vartype blob_cache_control: str + :ivar blob_content_type: Optional. Sets the blob's content type. If specified, this property is + stored with the blob and returned with a read request. + :vartype blob_content_type: str + :ivar blob_content_md5: Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks were validated when each was uploaded. - :type blob_content_md5: bytearray - :param blob_content_encoding: Optional. Sets the blob's content encoding. If specified, this + :vartype blob_content_md5: bytearray + :ivar blob_content_encoding: Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request. - :type blob_content_encoding: str - :param blob_content_language: Optional. Set the blob's content language. If specified, this + :vartype blob_content_encoding: str + :ivar blob_content_language: Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read request. - :type blob_content_language: str - :param blob_content_disposition: Optional. Sets the blob's Content-Disposition header. - :type blob_content_disposition: str + :vartype blob_content_language: str + :ivar blob_content_disposition: Optional. Sets the blob's Content-Disposition header. + :vartype blob_content_disposition: str """ _attribute_map = { @@ -260,6 +304,25 @@ def __init__( blob_content_disposition: Optional[str] = None, **kwargs ): + """ + :keyword blob_cache_control: Optional. Sets the blob's cache control. If specified, this + property is stored with the blob and returned with a read request. + :paramtype blob_cache_control: str + :keyword blob_content_type: Optional. Sets the blob's content type. If specified, this property + is stored with the blob and returned with a read request. + :paramtype blob_content_type: str + :keyword blob_content_md5: Optional. An MD5 hash of the blob content. Note that this hash is + not validated, as the hashes for the individual blocks were validated when each was uploaded. + :paramtype blob_content_md5: bytearray + :keyword blob_content_encoding: Optional. Sets the blob's content encoding. If specified, this + property is stored with the blob and returned with a read request. + :paramtype blob_content_encoding: str + :keyword blob_content_language: Optional. Set the blob's content language. If specified, this + property is stored with the blob and returned with a read request. + :paramtype blob_content_language: str + :keyword blob_content_disposition: Optional. Sets the blob's Content-Disposition header. + :paramtype blob_content_disposition: str + """ super(BlobHTTPHeaders, self).__init__(**kwargs) self.blob_cache_control = blob_cache_control self.blob_content_type = blob_content_type @@ -274,26 +337,26 @@ class BlobItemInternal(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: ~azure.storage.blob.models.BlobName - :param deleted: Required. - :type deleted: bool - :param snapshot: Required. - :type snapshot: str - :param version_id: - :type version_id: str - :param is_current_version: - :type is_current_version: bool - :param properties: Required. Properties of a blob. - :type properties: ~azure.storage.blob.models.BlobPropertiesInternal - :param metadata: - :type metadata: ~azure.storage.blob.models.BlobMetadata - :param blob_tags: Blob tags. - :type blob_tags: ~azure.storage.blob.models.BlobTags - :param has_versions_only: - :type has_versions_only: bool - :param object_replication_metadata: Dictionary of :code:``. - :type object_replication_metadata: dict[str, str] + :ivar name: Required. + :vartype name: ~azure.storage.blob.models.BlobName + :ivar deleted: Required. + :vartype deleted: bool + :ivar snapshot: Required. + :vartype snapshot: str + :ivar version_id: + :vartype version_id: str + :ivar is_current_version: + :vartype is_current_version: bool + :ivar properties: Required. Properties of a blob. + :vartype properties: ~azure.storage.blob.models.BlobPropertiesInternal + :ivar metadata: + :vartype metadata: ~azure.storage.blob.models.BlobMetadata + :ivar blob_tags: Blob tags. + :vartype blob_tags: ~azure.storage.blob.models.BlobTags + :ivar has_versions_only: + :vartype has_versions_only: bool + :ivar object_replication_metadata: Dictionary of :code:``. + :vartype object_replication_metadata: dict[str, str] """ _validation = { @@ -334,6 +397,28 @@ def __init__( object_replication_metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword name: Required. + :paramtype name: ~azure.storage.blob.models.BlobName + :keyword deleted: Required. + :paramtype deleted: bool + :keyword snapshot: Required. + :paramtype snapshot: str + :keyword version_id: + :paramtype version_id: str + :keyword is_current_version: + :paramtype is_current_version: bool + :keyword properties: Required. Properties of a blob. + :paramtype properties: ~azure.storage.blob.models.BlobPropertiesInternal + :keyword metadata: + :paramtype metadata: ~azure.storage.blob.models.BlobMetadata + :keyword blob_tags: Blob tags. + :paramtype blob_tags: ~azure.storage.blob.models.BlobTags + :keyword has_versions_only: + :paramtype has_versions_only: bool + :keyword object_replication_metadata: Dictionary of :code:``. + :paramtype object_replication_metadata: dict[str, str] + """ super(BlobItemInternal, self).__init__(**kwargs) self.name = name self.deleted = deleted @@ -350,11 +435,11 @@ def __init__( class BlobMetadata(msrest.serialization.Model): """BlobMetadata. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, str] - :param encrypted: - :type encrypted: str + :vartype additional_properties: dict[str, str] + :ivar encrypted: + :vartype encrypted: str """ _attribute_map = { @@ -372,6 +457,13 @@ def __init__( encrypted: Optional[str] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, str] + :keyword encrypted: + :paramtype encrypted: str + """ super(BlobMetadata, self).__init__(**kwargs) self.additional_properties = additional_properties self.encrypted = encrypted @@ -380,10 +472,10 @@ def __init__( class BlobName(msrest.serialization.Model): """BlobName. - :param encoded: Indicates if the blob name is encoded. - :type encoded: bool - :param content: The name of the blob. - :type content: str + :ivar encoded: Indicates if the blob name is encoded. + :vartype encoded: bool + :ivar content: The name of the blob. + :vartype content: str """ _attribute_map = { @@ -398,6 +490,12 @@ def __init__( content: Optional[str] = None, **kwargs ): + """ + :keyword encoded: Indicates if the blob name is encoded. + :paramtype encoded: bool + :keyword content: The name of the blob. + :paramtype content: str + """ super(BlobName, self).__init__(**kwargs) self.encoded = encoded self.content = content @@ -408,8 +506,8 @@ class BlobPrefix(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: ~azure.storage.blob.models.BlobName + :ivar name: Required. + :vartype name: ~azure.storage.blob.models.BlobName """ _validation = { @@ -426,6 +524,10 @@ def __init__( name: "BlobName", **kwargs ): + """ + :keyword name: Required. + :paramtype name: ~azure.storage.blob.models.BlobName + """ super(BlobPrefix, self).__init__(**kwargs) self.name = name @@ -435,91 +537,91 @@ class BlobPropertiesInternal(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param creation_time: - :type creation_time: ~datetime.datetime - :param last_modified: Required. - :type last_modified: ~datetime.datetime - :param etag: Required. - :type etag: str - :param content_length: Size in bytes. - :type content_length: long - :param content_type: - :type content_type: str - :param content_encoding: - :type content_encoding: str - :param content_language: - :type content_language: str - :param content_md5: - :type content_md5: bytearray - :param content_disposition: - :type content_disposition: str - :param cache_control: - :type cache_control: str - :param blob_sequence_number: - :type blob_sequence_number: long - :param blob_type: Possible values include: "BlockBlob", "PageBlob", "AppendBlob". - :type blob_type: str or ~azure.storage.blob.models.BlobType - :param lease_status: Possible values include: "locked", "unlocked". - :type lease_status: str or ~azure.storage.blob.models.LeaseStatusType - :param lease_state: Possible values include: "available", "leased", "expired", "breaking", + :ivar creation_time: + :vartype creation_time: ~datetime.datetime + :ivar last_modified: Required. + :vartype last_modified: ~datetime.datetime + :ivar etag: Required. + :vartype etag: str + :ivar content_length: Size in bytes. + :vartype content_length: long + :ivar content_type: + :vartype content_type: str + :ivar content_encoding: + :vartype content_encoding: str + :ivar content_language: + :vartype content_language: str + :ivar content_md5: + :vartype content_md5: bytearray + :ivar content_disposition: + :vartype content_disposition: str + :ivar cache_control: + :vartype cache_control: str + :ivar blob_sequence_number: + :vartype blob_sequence_number: long + :ivar blob_type: Possible values include: "BlockBlob", "PageBlob", "AppendBlob". + :vartype blob_type: str or ~azure.storage.blob.models.BlobType + :ivar lease_status: Possible values include: "locked", "unlocked". + :vartype lease_status: str or ~azure.storage.blob.models.LeaseStatusType + :ivar lease_state: Possible values include: "available", "leased", "expired", "breaking", "broken". - :type lease_state: str or ~azure.storage.blob.models.LeaseStateType - :param lease_duration: Possible values include: "infinite", "fixed". - :type lease_duration: str or ~azure.storage.blob.models.LeaseDurationType - :param copy_id: - :type copy_id: str - :param copy_status: Possible values include: "pending", "success", "aborted", "failed". - :type copy_status: str or ~azure.storage.blob.models.CopyStatusType - :param copy_source: - :type copy_source: str - :param copy_progress: - :type copy_progress: str - :param copy_completion_time: - :type copy_completion_time: ~datetime.datetime - :param copy_status_description: - :type copy_status_description: str - :param server_encrypted: - :type server_encrypted: bool - :param incremental_copy: - :type incremental_copy: bool - :param destination_snapshot: - :type destination_snapshot: str - :param deleted_time: - :type deleted_time: ~datetime.datetime - :param remaining_retention_days: - :type remaining_retention_days: int - :param access_tier: Possible values include: "P4", "P6", "P10", "P15", "P20", "P30", "P40", + :vartype lease_state: str or ~azure.storage.blob.models.LeaseStateType + :ivar lease_duration: Possible values include: "infinite", "fixed". + :vartype lease_duration: str or ~azure.storage.blob.models.LeaseDurationType + :ivar copy_id: + :vartype copy_id: str + :ivar copy_status: Possible values include: "pending", "success", "aborted", "failed". + :vartype copy_status: str or ~azure.storage.blob.models.CopyStatusType + :ivar copy_source: + :vartype copy_source: str + :ivar copy_progress: + :vartype copy_progress: str + :ivar copy_completion_time: + :vartype copy_completion_time: ~datetime.datetime + :ivar copy_status_description: + :vartype copy_status_description: str + :ivar server_encrypted: + :vartype server_encrypted: bool + :ivar incremental_copy: + :vartype incremental_copy: bool + :ivar destination_snapshot: + :vartype destination_snapshot: str + :ivar deleted_time: + :vartype deleted_time: ~datetime.datetime + :ivar remaining_retention_days: + :vartype remaining_retention_days: int + :ivar access_tier: Possible values include: "P4", "P6", "P10", "P15", "P20", "P30", "P40", "P50", "P60", "P70", "P80", "Hot", "Cool", "Archive". - :type access_tier: str or ~azure.storage.blob.models.AccessTier - :param access_tier_inferred: - :type access_tier_inferred: bool - :param archive_status: Possible values include: "rehydrate-pending-to-hot", + :vartype access_tier: str or ~azure.storage.blob.models.AccessTier + :ivar access_tier_inferred: + :vartype access_tier_inferred: bool + :ivar archive_status: Possible values include: "rehydrate-pending-to-hot", "rehydrate-pending-to-cool". - :type archive_status: str or ~azure.storage.blob.models.ArchiveStatus - :param customer_provided_key_sha256: - :type customer_provided_key_sha256: str - :param encryption_scope: The name of the encryption scope under which the blob is encrypted. - :type encryption_scope: str - :param access_tier_change_time: - :type access_tier_change_time: ~datetime.datetime - :param tag_count: - :type tag_count: int - :param expires_on: - :type expires_on: ~datetime.datetime - :param is_sealed: - :type is_sealed: bool - :param rehydrate_priority: If an object is in rehydrate pending state then this header is + :vartype archive_status: str or ~azure.storage.blob.models.ArchiveStatus + :ivar customer_provided_key_sha256: + :vartype customer_provided_key_sha256: str + :ivar encryption_scope: The name of the encryption scope under which the blob is encrypted. + :vartype encryption_scope: str + :ivar access_tier_change_time: + :vartype access_tier_change_time: ~datetime.datetime + :ivar tag_count: + :vartype tag_count: int + :ivar expires_on: + :vartype expires_on: ~datetime.datetime + :ivar is_sealed: + :vartype is_sealed: bool + :ivar rehydrate_priority: If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High and Standard. Possible values include: "High", "Standard". - :type rehydrate_priority: str or ~azure.storage.blob.models.RehydratePriority - :param last_accessed_on: - :type last_accessed_on: ~datetime.datetime - :param immutability_policy_expires_on: - :type immutability_policy_expires_on: ~datetime.datetime - :param immutability_policy_mode: Possible values include: "Mutable", "Unlocked", "Locked". - :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: - :type legal_hold: bool + :vartype rehydrate_priority: str or ~azure.storage.blob.models.RehydratePriority + :ivar last_accessed_on: + :vartype last_accessed_on: ~datetime.datetime + :ivar immutability_policy_expires_on: + :vartype immutability_policy_expires_on: ~datetime.datetime + :ivar immutability_policy_mode: Possible values include: "Mutable", "Unlocked", "Locked". + :vartype immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode + :ivar legal_hold: + :vartype legal_hold: bool """ _validation = { @@ -618,6 +720,94 @@ def __init__( legal_hold: Optional[bool] = None, **kwargs ): + """ + :keyword creation_time: + :paramtype creation_time: ~datetime.datetime + :keyword last_modified: Required. + :paramtype last_modified: ~datetime.datetime + :keyword etag: Required. + :paramtype etag: str + :keyword content_length: Size in bytes. + :paramtype content_length: long + :keyword content_type: + :paramtype content_type: str + :keyword content_encoding: + :paramtype content_encoding: str + :keyword content_language: + :paramtype content_language: str + :keyword content_md5: + :paramtype content_md5: bytearray + :keyword content_disposition: + :paramtype content_disposition: str + :keyword cache_control: + :paramtype cache_control: str + :keyword blob_sequence_number: + :paramtype blob_sequence_number: long + :keyword blob_type: Possible values include: "BlockBlob", "PageBlob", "AppendBlob". + :paramtype blob_type: str or ~azure.storage.blob.models.BlobType + :keyword lease_status: Possible values include: "locked", "unlocked". + :paramtype lease_status: str or ~azure.storage.blob.models.LeaseStatusType + :keyword lease_state: Possible values include: "available", "leased", "expired", "breaking", + "broken". + :paramtype lease_state: str or ~azure.storage.blob.models.LeaseStateType + :keyword lease_duration: Possible values include: "infinite", "fixed". + :paramtype lease_duration: str or ~azure.storage.blob.models.LeaseDurationType + :keyword copy_id: + :paramtype copy_id: str + :keyword copy_status: Possible values include: "pending", "success", "aborted", "failed". + :paramtype copy_status: str or ~azure.storage.blob.models.CopyStatusType + :keyword copy_source: + :paramtype copy_source: str + :keyword copy_progress: + :paramtype copy_progress: str + :keyword copy_completion_time: + :paramtype copy_completion_time: ~datetime.datetime + :keyword copy_status_description: + :paramtype copy_status_description: str + :keyword server_encrypted: + :paramtype server_encrypted: bool + :keyword incremental_copy: + :paramtype incremental_copy: bool + :keyword destination_snapshot: + :paramtype destination_snapshot: str + :keyword deleted_time: + :paramtype deleted_time: ~datetime.datetime + :keyword remaining_retention_days: + :paramtype remaining_retention_days: int + :keyword access_tier: Possible values include: "P4", "P6", "P10", "P15", "P20", "P30", "P40", + "P50", "P60", "P70", "P80", "Hot", "Cool", "Archive". + :paramtype access_tier: str or ~azure.storage.blob.models.AccessTier + :keyword access_tier_inferred: + :paramtype access_tier_inferred: bool + :keyword archive_status: Possible values include: "rehydrate-pending-to-hot", + "rehydrate-pending-to-cool". + :paramtype archive_status: str or ~azure.storage.blob.models.ArchiveStatus + :keyword customer_provided_key_sha256: + :paramtype customer_provided_key_sha256: str + :keyword encryption_scope: The name of the encryption scope under which the blob is encrypted. + :paramtype encryption_scope: str + :keyword access_tier_change_time: + :paramtype access_tier_change_time: ~datetime.datetime + :keyword tag_count: + :paramtype tag_count: int + :keyword expires_on: + :paramtype expires_on: ~datetime.datetime + :keyword is_sealed: + :paramtype is_sealed: bool + :keyword rehydrate_priority: If an object is in rehydrate pending state then this header is + returned with priority of rehydrate. Valid values are High and Standard. Possible values + include: "High", "Standard". + :paramtype rehydrate_priority: str or ~azure.storage.blob.models.RehydratePriority + :keyword last_accessed_on: + :paramtype last_accessed_on: ~datetime.datetime + :keyword immutability_policy_expires_on: + :paramtype immutability_policy_expires_on: ~datetime.datetime + :keyword immutability_policy_mode: Possible values include: "Mutable", "Unlocked", "Locked". + :paramtype immutability_policy_mode: str or + ~azure.storage.blob.models.BlobImmutabilityPolicyMode + :keyword legal_hold: + :paramtype legal_hold: bool + """ super(BlobPropertiesInternal, self).__init__(**kwargs) self.creation_time = creation_time self.last_modified = last_modified @@ -666,10 +856,10 @@ class BlobTag(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key: Required. - :type key: str - :param value: Required. - :type value: str + :ivar key: Required. + :vartype key: str + :ivar value: Required. + :vartype value: str """ _validation = { @@ -692,6 +882,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword key: Required. + :paramtype key: str + :keyword value: Required. + :paramtype value: str + """ super(BlobTag, self).__init__(**kwargs) self.key = key self.value = value @@ -702,8 +898,8 @@ class BlobTags(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param blob_tag_set: Required. - :type blob_tag_set: list[~azure.storage.blob.models.BlobTag] + :ivar blob_tag_set: Required. + :vartype blob_tag_set: list[~azure.storage.blob.models.BlobTag] """ _validation = { @@ -723,6 +919,10 @@ def __init__( blob_tag_set: List["BlobTag"], **kwargs ): + """ + :keyword blob_tag_set: Required. + :paramtype blob_tag_set: list[~azure.storage.blob.models.BlobTag] + """ super(BlobTags, self).__init__(**kwargs) self.blob_tag_set = blob_tag_set @@ -732,10 +932,10 @@ class Block(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The base64 encoded block ID. - :type name: str - :param size: Required. The block size in bytes. - :type size: long + :ivar name: Required. The base64 encoded block ID. + :vartype name: str + :ivar size: Required. The block size in bytes. + :vartype size: long """ _validation = { @@ -755,6 +955,12 @@ def __init__( size: int, **kwargs ): + """ + :keyword name: Required. The base64 encoded block ID. + :paramtype name: str + :keyword size: Required. The block size in bytes. + :paramtype size: long + """ super(Block, self).__init__(**kwargs) self.name = name self.size = size @@ -763,10 +969,10 @@ def __init__( class BlockList(msrest.serialization.Model): """BlockList. - :param committed_blocks: - :type committed_blocks: list[~azure.storage.blob.models.Block] - :param uncommitted_blocks: - :type uncommitted_blocks: list[~azure.storage.blob.models.Block] + :ivar committed_blocks: + :vartype committed_blocks: list[~azure.storage.blob.models.Block] + :ivar uncommitted_blocks: + :vartype uncommitted_blocks: list[~azure.storage.blob.models.Block] """ _attribute_map = { @@ -781,6 +987,12 @@ def __init__( uncommitted_blocks: Optional[List["Block"]] = None, **kwargs ): + """ + :keyword committed_blocks: + :paramtype committed_blocks: list[~azure.storage.blob.models.Block] + :keyword uncommitted_blocks: + :paramtype uncommitted_blocks: list[~azure.storage.blob.models.Block] + """ super(BlockList, self).__init__(**kwargs) self.committed_blocks = committed_blocks self.uncommitted_blocks = uncommitted_blocks @@ -789,12 +1001,12 @@ def __init__( class BlockLookupList(msrest.serialization.Model): """BlockLookupList. - :param committed: - :type committed: list[str] - :param uncommitted: - :type uncommitted: list[str] - :param latest: - :type latest: list[str] + :ivar committed: + :vartype committed: list[str] + :ivar uncommitted: + :vartype uncommitted: list[str] + :ivar latest: + :vartype latest: list[str] """ _attribute_map = { @@ -814,6 +1026,14 @@ def __init__( latest: Optional[List[str]] = None, **kwargs ): + """ + :keyword committed: + :paramtype committed: list[str] + :keyword uncommitted: + :paramtype uncommitted: list[str] + :keyword latest: + :paramtype latest: list[str] + """ super(BlockLookupList, self).__init__(**kwargs) self.committed = committed self.uncommitted = uncommitted @@ -825,10 +1045,10 @@ class ClearRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start: Required. - :type start: long - :param end: Required. - :type end: long + :ivar start: Required. + :vartype start: long + :ivar end: Required. + :vartype end: long """ _validation = { @@ -851,6 +1071,12 @@ def __init__( end: int, **kwargs ): + """ + :keyword start: Required. + :paramtype start: long + :keyword end: Required. + :paramtype end: long + """ super(ClearRange, self).__init__(**kwargs) self.start = start self.end = end @@ -859,13 +1085,13 @@ def __init__( class ContainerCpkScopeInfo(msrest.serialization.Model): """Parameter group. - :param default_encryption_scope: Optional. Version 2019-07-07 and later. Specifies the - default encryption scope to set on the container and use for all future writes. - :type default_encryption_scope: str - :param prevent_encryption_scope_override: Optional. Version 2019-07-07 and newer. If true, + :ivar default_encryption_scope: Optional. Version 2019-07-07 and later. Specifies the default + encryption scope to set on the container and use for all future writes. + :vartype default_encryption_scope: str + :ivar prevent_encryption_scope_override: Optional. Version 2019-07-07 and newer. If true, prevents any request from specifying a different encryption scope than the scope set on the container. - :type prevent_encryption_scope_override: bool + :vartype prevent_encryption_scope_override: bool """ _attribute_map = { @@ -880,6 +1106,15 @@ def __init__( prevent_encryption_scope_override: Optional[bool] = None, **kwargs ): + """ + :keyword default_encryption_scope: Optional. Version 2019-07-07 and later. Specifies the + default encryption scope to set on the container and use for all future writes. + :paramtype default_encryption_scope: str + :keyword prevent_encryption_scope_override: Optional. Version 2019-07-07 and newer. If true, + prevents any request from specifying a different encryption scope than the scope set on the + container. + :paramtype prevent_encryption_scope_override: bool + """ super(ContainerCpkScopeInfo, self).__init__(**kwargs) self.default_encryption_scope = default_encryption_scope self.prevent_encryption_scope_override = prevent_encryption_scope_override @@ -890,16 +1125,16 @@ class ContainerItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param deleted: - :type deleted: bool - :param version: - :type version: str - :param properties: Required. Properties of a container. - :type properties: ~azure.storage.blob.models.ContainerProperties - :param metadata: Dictionary of :code:``. - :type metadata: dict[str, str] + :ivar name: Required. + :vartype name: str + :ivar deleted: + :vartype deleted: bool + :ivar version: + :vartype version: str + :ivar properties: Required. Properties of a container. + :vartype properties: ~azure.storage.blob.models.ContainerProperties + :ivar metadata: Dictionary of :code:``. + :vartype metadata: dict[str, str] """ _validation = { @@ -928,6 +1163,18 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword deleted: + :paramtype deleted: bool + :keyword version: + :paramtype version: str + :keyword properties: Required. Properties of a container. + :paramtype properties: ~azure.storage.blob.models.ContainerProperties + :keyword metadata: Dictionary of :code:``. + :paramtype metadata: dict[str, str] + """ super(ContainerItem, self).__init__(**kwargs) self.name = name self.deleted = deleted @@ -941,34 +1188,34 @@ class ContainerProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param last_modified: Required. - :type last_modified: ~datetime.datetime - :param etag: Required. - :type etag: str - :param lease_status: Possible values include: "locked", "unlocked". - :type lease_status: str or ~azure.storage.blob.models.LeaseStatusType - :param lease_state: Possible values include: "available", "leased", "expired", "breaking", + :ivar last_modified: Required. + :vartype last_modified: ~datetime.datetime + :ivar etag: Required. + :vartype etag: str + :ivar lease_status: Possible values include: "locked", "unlocked". + :vartype lease_status: str or ~azure.storage.blob.models.LeaseStatusType + :ivar lease_state: Possible values include: "available", "leased", "expired", "breaking", "broken". - :type lease_state: str or ~azure.storage.blob.models.LeaseStateType - :param lease_duration: Possible values include: "infinite", "fixed". - :type lease_duration: str or ~azure.storage.blob.models.LeaseDurationType - :param public_access: Possible values include: "container", "blob". - :type public_access: str or ~azure.storage.blob.models.PublicAccessType - :param has_immutability_policy: - :type has_immutability_policy: bool - :param has_legal_hold: - :type has_legal_hold: bool - :param default_encryption_scope: - :type default_encryption_scope: str - :param prevent_encryption_scope_override: - :type prevent_encryption_scope_override: bool - :param deleted_time: - :type deleted_time: ~datetime.datetime - :param remaining_retention_days: - :type remaining_retention_days: int - :param is_immutable_storage_with_versioning_enabled: Indicates if version level worm is enabled + :vartype lease_state: str or ~azure.storage.blob.models.LeaseStateType + :ivar lease_duration: Possible values include: "infinite", "fixed". + :vartype lease_duration: str or ~azure.storage.blob.models.LeaseDurationType + :ivar public_access: Possible values include: "container", "blob". + :vartype public_access: str or ~azure.storage.blob.models.PublicAccessType + :ivar has_immutability_policy: + :vartype has_immutability_policy: bool + :ivar has_legal_hold: + :vartype has_legal_hold: bool + :ivar default_encryption_scope: + :vartype default_encryption_scope: str + :ivar prevent_encryption_scope_override: + :vartype prevent_encryption_scope_override: bool + :ivar deleted_time: + :vartype deleted_time: ~datetime.datetime + :ivar remaining_retention_days: + :vartype remaining_retention_days: int + :ivar is_immutable_storage_with_versioning_enabled: Indicates if version level worm is enabled on this container. - :type is_immutable_storage_with_versioning_enabled: bool + :vartype is_immutable_storage_with_versioning_enabled: bool """ _validation = { @@ -1010,6 +1257,36 @@ def __init__( is_immutable_storage_with_versioning_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword last_modified: Required. + :paramtype last_modified: ~datetime.datetime + :keyword etag: Required. + :paramtype etag: str + :keyword lease_status: Possible values include: "locked", "unlocked". + :paramtype lease_status: str or ~azure.storage.blob.models.LeaseStatusType + :keyword lease_state: Possible values include: "available", "leased", "expired", "breaking", + "broken". + :paramtype lease_state: str or ~azure.storage.blob.models.LeaseStateType + :keyword lease_duration: Possible values include: "infinite", "fixed". + :paramtype lease_duration: str or ~azure.storage.blob.models.LeaseDurationType + :keyword public_access: Possible values include: "container", "blob". + :paramtype public_access: str or ~azure.storage.blob.models.PublicAccessType + :keyword has_immutability_policy: + :paramtype has_immutability_policy: bool + :keyword has_legal_hold: + :paramtype has_legal_hold: bool + :keyword default_encryption_scope: + :paramtype default_encryption_scope: str + :keyword prevent_encryption_scope_override: + :paramtype prevent_encryption_scope_override: bool + :keyword deleted_time: + :paramtype deleted_time: ~datetime.datetime + :keyword remaining_retention_days: + :paramtype remaining_retention_days: int + :keyword is_immutable_storage_with_versioning_enabled: Indicates if version level worm is + enabled on this container. + :paramtype is_immutable_storage_with_versioning_enabled: bool + """ super(ContainerProperties, self).__init__(**kwargs) self.last_modified = last_modified self.etag = etag @@ -1031,24 +1308,24 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. The origin domains that are permitted to make a request + :ivar allowed_origins: Required. The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS. - :type allowed_origins: str - :param allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + :vartype allowed_origins: str + :ivar allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated). - :type allowed_methods: str - :param allowed_headers: Required. the request headers that the origin domain may specify on the + :vartype allowed_methods: str + :ivar allowed_headers: Required. the request headers that the origin domain may specify on the CORS request. - :type allowed_headers: str - :param exposed_headers: Required. The response headers that may be sent in the response to the + :vartype allowed_headers: str + :ivar exposed_headers: Required. The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. - :type exposed_headers: str - :param max_age_in_seconds: Required. The maximum amount time that a browser should cache the + :vartype exposed_headers: str + :ivar max_age_in_seconds: Required. The maximum amount time that a browser should cache the preflight OPTIONS request. - :type max_age_in_seconds: int + :vartype max_age_in_seconds: int """ _validation = { @@ -1077,6 +1354,26 @@ def __init__( max_age_in_seconds: int, **kwargs ): + """ + :keyword allowed_origins: Required. The origin domains that are permitted to make a request + against the storage service via CORS. The origin domain is the domain from which the request + originates. Note that the origin must be an exact case-sensitive match with the origin that the + user age sends to the service. You can also use the wildcard character '*' to allow all origin + domains to make requests via CORS. + :paramtype allowed_origins: str + :keyword allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + use for a CORS request. (comma separated). + :paramtype allowed_methods: str + :keyword allowed_headers: Required. the request headers that the origin domain may specify on + the CORS request. + :paramtype allowed_headers: str + :keyword exposed_headers: Required. The response headers that may be sent in the response to + the CORS request and exposed by the browser to the request issuer. + :paramtype exposed_headers: str + :keyword max_age_in_seconds: Required. The maximum amount time that a browser should cache the + preflight OPTIONS request. + :paramtype max_age_in_seconds: int + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -1088,17 +1385,17 @@ def __init__( class CpkInfo(msrest.serialization.Model): """Parameter group. - :param encryption_key: Optional. Specifies the encryption key to use to encrypt the data + :ivar encryption_key: Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - :type encryption_key: str - :param encryption_key_sha256: The SHA-256 hash of the provided encryption key. Must be provided + :vartype encryption_key: str + :ivar encryption_key_sha256: The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - :type encryption_key_sha256: str - :param encryption_algorithm: The algorithm used to produce the encryption key hash. Currently, + :vartype encryption_key_sha256: str + :ivar encryption_algorithm: The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: "None", "AES256". - :type encryption_algorithm: str or ~azure.storage.blob.models.EncryptionAlgorithmType + :vartype encryption_algorithm: str or ~azure.storage.blob.models.EncryptionAlgorithmType """ _attribute_map = { @@ -1115,6 +1412,19 @@ def __init__( encryption_algorithm: Optional[Union[str, "EncryptionAlgorithmType"]] = None, **kwargs ): + """ + :keyword encryption_key: Optional. Specifies the encryption key to use to encrypt the data + provided in the request. If not specified, encryption is performed with the root account + encryption key. For more information, see Encryption at Rest for Azure Storage Services. + :paramtype encryption_key: str + :keyword encryption_key_sha256: The SHA-256 hash of the provided encryption key. Must be + provided if the x-ms-encryption-key header is provided. + :paramtype encryption_key_sha256: str + :keyword encryption_algorithm: The algorithm used to produce the encryption key hash. + Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key + header is provided. Possible values include: "None", "AES256". + :paramtype encryption_algorithm: str or ~azure.storage.blob.models.EncryptionAlgorithmType + """ super(CpkInfo, self).__init__(**kwargs) self.encryption_key = encryption_key self.encryption_key_sha256 = encryption_key_sha256 @@ -1124,11 +1434,11 @@ def __init__( class CpkScopeInfo(msrest.serialization.Model): """Parameter group. - :param encryption_scope: Optional. Version 2019-07-07 and later. Specifies the name of the + :ivar encryption_scope: Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to encrypt the data provided in the request. If not specified, encryption is performed with the default account encryption scope. For more information, see Encryption at Rest for Azure Storage Services. - :type encryption_scope: str + :vartype encryption_scope: str """ _attribute_map = { @@ -1141,6 +1451,13 @@ def __init__( encryption_scope: Optional[str] = None, **kwargs ): + """ + :keyword encryption_scope: Optional. Version 2019-07-07 and later. Specifies the name of the + encryption scope to use to encrypt the data provided in the request. If not specified, + encryption is performed with the default account encryption scope. For more information, see + Encryption at Rest for Azure Storage Services. + :paramtype encryption_scope: str + """ super(CpkScopeInfo, self).__init__(**kwargs) self.encryption_scope = encryption_scope @@ -1148,16 +1465,16 @@ def __init__( class DelimitedTextConfiguration(msrest.serialization.Model): """Groups the settings used for interpreting the blob data if the blob is delimited text formatted. - :param column_separator: The string used to separate columns. - :type column_separator: str - :param field_quote: The string used to quote a specific field. - :type field_quote: str - :param record_separator: The string used to separate records. - :type record_separator: str - :param escape_char: The string used as an escape character. - :type escape_char: str - :param headers_present: Represents whether the data has headers. - :type headers_present: bool + :ivar column_separator: The string used to separate columns. + :vartype column_separator: str + :ivar field_quote: The string used to quote a specific field. + :vartype field_quote: str + :ivar record_separator: The string used to separate records. + :vartype record_separator: str + :ivar escape_char: The string used as an escape character. + :vartype escape_char: str + :ivar headers_present: Represents whether the data has headers. + :vartype headers_present: bool """ _attribute_map = { @@ -1181,6 +1498,18 @@ def __init__( headers_present: Optional[bool] = None, **kwargs ): + """ + :keyword column_separator: The string used to separate columns. + :paramtype column_separator: str + :keyword field_quote: The string used to quote a specific field. + :paramtype field_quote: str + :keyword record_separator: The string used to separate records. + :paramtype record_separator: str + :keyword escape_char: The string used as an escape character. + :paramtype escape_char: str + :keyword headers_present: Represents whether the data has headers. + :paramtype headers_present: bool + """ super(DelimitedTextConfiguration, self).__init__(**kwargs) self.column_separator = column_separator self.field_quote = field_quote @@ -1194,12 +1523,12 @@ class FilterBlobItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param container_name: Required. - :type container_name: str - :param tags: A set of tags. Blob tags. - :type tags: ~azure.storage.blob.models.BlobTags + :ivar name: Required. + :vartype name: str + :ivar container_name: Required. + :vartype container_name: str + :ivar tags: A set of tags. Blob tags. + :vartype tags: ~azure.storage.blob.models.BlobTags """ _validation = { @@ -1224,6 +1553,14 @@ def __init__( tags: Optional["BlobTags"] = None, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword container_name: Required. + :paramtype container_name: str + :keyword tags: A set of tags. Blob tags. + :paramtype tags: ~azure.storage.blob.models.BlobTags + """ super(FilterBlobItem, self).__init__(**kwargs) self.name = name self.container_name = container_name @@ -1235,14 +1572,14 @@ class FilterBlobSegment(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param where: Required. - :type where: str - :param blobs: Required. - :type blobs: list[~azure.storage.blob.models.FilterBlobItem] - :param next_marker: - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar where: Required. + :vartype where: str + :ivar blobs: Required. + :vartype blobs: list[~azure.storage.blob.models.FilterBlobItem] + :ivar next_marker: + :vartype next_marker: str """ _validation = { @@ -1270,6 +1607,16 @@ def __init__( next_marker: Optional[str] = None, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword where: Required. + :paramtype where: str + :keyword blobs: Required. + :paramtype blobs: list[~azure.storage.blob.models.FilterBlobItem] + :keyword next_marker: + :paramtype next_marker: str + """ super(FilterBlobSegment, self).__init__(**kwargs) self.service_endpoint = service_endpoint self.where = where @@ -1282,13 +1629,13 @@ class GeoReplication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. The status of the secondary location. Possible values include: "live", + :ivar status: Required. The status of the secondary location. Possible values include: "live", "bootstrap", "unavailable". - :type status: str or ~azure.storage.blob.models.GeoReplicationStatusType - :param last_sync_time: Required. A GMT date/time value, to the second. All primary writes + :vartype status: str or ~azure.storage.blob.models.GeoReplicationStatusType + :ivar last_sync_time: Required. A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads. - :type last_sync_time: ~datetime.datetime + :vartype last_sync_time: ~datetime.datetime """ _validation = { @@ -1308,6 +1655,15 @@ def __init__( last_sync_time: datetime.datetime, **kwargs ): + """ + :keyword status: Required. The status of the secondary location. Possible values include: + "live", "bootstrap", "unavailable". + :paramtype status: str or ~azure.storage.blob.models.GeoReplicationStatusType + :keyword last_sync_time: Required. A GMT date/time value, to the second. All primary writes + preceding this value are guaranteed to be available for read operations at the secondary. + Primary writes after this point in time may or may not be available for reads. + :paramtype last_sync_time: ~datetime.datetime + """ super(GeoReplication, self).__init__(**kwargs) self.status = status self.last_sync_time = last_sync_time @@ -1316,8 +1672,8 @@ def __init__( class JsonTextConfiguration(msrest.serialization.Model): """json text configuration. - :param record_separator: The string used to separate records. - :type record_separator: str + :ivar record_separator: The string used to separate records. + :vartype record_separator: str """ _attribute_map = { @@ -1333,6 +1689,10 @@ def __init__( record_separator: Optional[str] = None, **kwargs ): + """ + :keyword record_separator: The string used to separate records. + :paramtype record_separator: str + """ super(JsonTextConfiguration, self).__init__(**kwargs) self.record_separator = record_separator @@ -1342,10 +1702,10 @@ class KeyInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start: Required. The date-time the key is active in ISO 8601 UTC time. - :type start: str - :param expiry: Required. The date-time the key expires in ISO 8601 UTC time. - :type expiry: str + :ivar start: Required. The date-time the key is active in ISO 8601 UTC time. + :vartype start: str + :ivar expiry: Required. The date-time the key expires in ISO 8601 UTC time. + :vartype expiry: str """ _validation = { @@ -1365,6 +1725,12 @@ def __init__( expiry: str, **kwargs ): + """ + :keyword start: Required. The date-time the key is active in ISO 8601 UTC time. + :paramtype start: str + :keyword expiry: Required. The date-time the key expires in ISO 8601 UTC time. + :paramtype expiry: str + """ super(KeyInfo, self).__init__(**kwargs) self.start = start self.expiry = expiry @@ -1373,9 +1739,9 @@ def __init__( class LeaseAccessConditions(msrest.serialization.Model): """Parameter group. - :param lease_id: If specified, the operation only succeeds if the resource's lease is active - and matches this ID. - :type lease_id: str + :ivar lease_id: If specified, the operation only succeeds if the resource's lease is active and + matches this ID. + :vartype lease_id: str """ _attribute_map = { @@ -1388,6 +1754,11 @@ def __init__( lease_id: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: If specified, the operation only succeeds if the resource's lease is active + and matches this ID. + :paramtype lease_id: str + """ super(LeaseAccessConditions, self).__init__(**kwargs) self.lease_id = lease_id @@ -1397,20 +1768,20 @@ class ListBlobsFlatSegmentResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param container_name: Required. - :type container_name: str - :param prefix: - :type prefix: str - :param marker: - :type marker: str - :param max_results: - :type max_results: int - :param segment: Required. - :type segment: ~azure.storage.blob.models.BlobFlatListSegment - :param next_marker: - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar container_name: Required. + :vartype container_name: str + :ivar prefix: + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: + :vartype max_results: int + :ivar segment: Required. + :vartype segment: ~azure.storage.blob.models.BlobFlatListSegment + :ivar next_marker: + :vartype next_marker: str """ _validation = { @@ -1444,6 +1815,22 @@ def __init__( next_marker: Optional[str] = None, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword container_name: Required. + :paramtype container_name: str + :keyword prefix: + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: + :paramtype max_results: int + :keyword segment: Required. + :paramtype segment: ~azure.storage.blob.models.BlobFlatListSegment + :keyword next_marker: + :paramtype next_marker: str + """ super(ListBlobsFlatSegmentResponse, self).__init__(**kwargs) self.service_endpoint = service_endpoint self.container_name = container_name @@ -1459,22 +1846,22 @@ class ListBlobsHierarchySegmentResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param container_name: Required. - :type container_name: str - :param prefix: - :type prefix: str - :param marker: - :type marker: str - :param max_results: - :type max_results: int - :param delimiter: - :type delimiter: str - :param segment: Required. - :type segment: ~azure.storage.blob.models.BlobHierarchyListSegment - :param next_marker: - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar container_name: Required. + :vartype container_name: str + :ivar prefix: + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: + :vartype max_results: int + :ivar delimiter: + :vartype delimiter: str + :ivar segment: Required. + :vartype segment: ~azure.storage.blob.models.BlobHierarchyListSegment + :ivar next_marker: + :vartype next_marker: str """ _validation = { @@ -1510,6 +1897,24 @@ def __init__( next_marker: Optional[str] = None, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword container_name: Required. + :paramtype container_name: str + :keyword prefix: + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: + :paramtype max_results: int + :keyword delimiter: + :paramtype delimiter: str + :keyword segment: Required. + :paramtype segment: ~azure.storage.blob.models.BlobHierarchyListSegment + :keyword next_marker: + :paramtype next_marker: str + """ super(ListBlobsHierarchySegmentResponse, self).__init__(**kwargs) self.service_endpoint = service_endpoint self.container_name = container_name @@ -1526,18 +1931,18 @@ class ListContainersSegmentResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param prefix: - :type prefix: str - :param marker: - :type marker: str - :param max_results: - :type max_results: int - :param container_items: Required. - :type container_items: list[~azure.storage.blob.models.ContainerItem] - :param next_marker: - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar prefix: + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: + :vartype max_results: int + :ivar container_items: Required. + :vartype container_items: list[~azure.storage.blob.models.ContainerItem] + :ivar next_marker: + :vartype next_marker: str """ _validation = { @@ -1568,6 +1973,20 @@ def __init__( next_marker: Optional[str] = None, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword prefix: + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: + :paramtype max_results: int + :keyword container_items: Required. + :paramtype container_items: list[~azure.storage.blob.models.ContainerItem] + :keyword next_marker: + :paramtype next_marker: str + """ super(ListContainersSegmentResponse, self).__init__(**kwargs) self.service_endpoint = service_endpoint self.prefix = prefix @@ -1582,17 +2001,17 @@ class Logging(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param version: Required. The version of Storage Analytics to configure. - :type version: str - :param delete: Required. Indicates whether all delete requests should be logged. - :type delete: bool - :param read: Required. Indicates whether all read requests should be logged. - :type read: bool - :param write: Required. Indicates whether all write requests should be logged. - :type write: bool - :param retention_policy: Required. the retention policy which determines how long the - associated data should persist. - :type retention_policy: ~azure.storage.blob.models.RetentionPolicy + :ivar version: Required. The version of Storage Analytics to configure. + :vartype version: str + :ivar delete: Required. Indicates whether all delete requests should be logged. + :vartype delete: bool + :ivar read: Required. Indicates whether all read requests should be logged. + :vartype read: bool + :ivar write: Required. Indicates whether all write requests should be logged. + :vartype write: bool + :ivar retention_policy: Required. the retention policy which determines how long the associated + data should persist. + :vartype retention_policy: ~azure.storage.blob.models.RetentionPolicy """ _validation = { @@ -1621,6 +2040,19 @@ def __init__( retention_policy: "RetentionPolicy", **kwargs ): + """ + :keyword version: Required. The version of Storage Analytics to configure. + :paramtype version: str + :keyword delete: Required. Indicates whether all delete requests should be logged. + :paramtype delete: bool + :keyword read: Required. Indicates whether all read requests should be logged. + :paramtype read: bool + :keyword write: Required. Indicates whether all write requests should be logged. + :paramtype write: bool + :keyword retention_policy: Required. the retention policy which determines how long the + associated data should persist. + :paramtype retention_policy: ~azure.storage.blob.models.RetentionPolicy + """ super(Logging, self).__init__(**kwargs) self.version = version self.delete = delete @@ -1634,16 +2066,16 @@ class Metrics(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param version: The version of Storage Analytics to configure. - :type version: str - :param enabled: Required. Indicates whether metrics are enabled for the Blob service. - :type enabled: bool - :param include_apis: Indicates whether metrics should generate summary statistics for called - API operations. - :type include_apis: bool - :param retention_policy: the retention policy which determines how long the associated data + :ivar version: The version of Storage Analytics to configure. + :vartype version: str + :ivar enabled: Required. Indicates whether metrics are enabled for the Blob service. + :vartype enabled: bool + :ivar include_apis: Indicates whether metrics should generate summary statistics for called API + operations. + :vartype include_apis: bool + :ivar retention_policy: the retention policy which determines how long the associated data should persist. - :type retention_policy: ~azure.storage.blob.models.RetentionPolicy + :vartype retention_policy: ~azure.storage.blob.models.RetentionPolicy """ _validation = { @@ -1666,6 +2098,18 @@ def __init__( retention_policy: Optional["RetentionPolicy"] = None, **kwargs ): + """ + :keyword version: The version of Storage Analytics to configure. + :paramtype version: str + :keyword enabled: Required. Indicates whether metrics are enabled for the Blob service. + :paramtype enabled: bool + :keyword include_apis: Indicates whether metrics should generate summary statistics for called + API operations. + :paramtype include_apis: bool + :keyword retention_policy: the retention policy which determines how long the associated data + should persist. + :paramtype retention_policy: ~azure.storage.blob.models.RetentionPolicy + """ super(Metrics, self).__init__(**kwargs) self.version = version self.enabled = enabled @@ -1676,19 +2120,19 @@ def __init__( class ModifiedAccessConditions(msrest.serialization.Model): """Parameter group. - :param if_modified_since: Specify this header value to operate only on a blob if it has been + :ivar if_modified_since: Specify this header value to operate only on a blob if it has been modified since the specified date/time. - :type if_modified_since: ~datetime.datetime - :param if_unmodified_since: Specify this header value to operate only on a blob if it has not + :vartype if_modified_since: ~datetime.datetime + :ivar if_unmodified_since: Specify this header value to operate only on a blob if it has not been modified since the specified date/time. - :type if_unmodified_since: ~datetime.datetime - :param if_match: Specify an ETag value to operate only on blobs with a matching value. - :type if_match: str - :param if_none_match: Specify an ETag value to operate only on blobs without a matching value. - :type if_none_match: str - :param if_tags: Specify a SQL where clause on blob tags to operate only on blobs with a - matching value. - :type if_tags: str + :vartype if_unmodified_since: ~datetime.datetime + :ivar if_match: Specify an ETag value to operate only on blobs with a matching value. + :vartype if_match: str + :ivar if_none_match: Specify an ETag value to operate only on blobs without a matching value. + :vartype if_none_match: str + :ivar if_tags: Specify a SQL where clause on blob tags to operate only on blobs with a matching + value. + :vartype if_tags: str """ _attribute_map = { @@ -1709,6 +2153,22 @@ def __init__( if_tags: Optional[str] = None, **kwargs ): + """ + :keyword if_modified_since: Specify this header value to operate only on a blob if it has been + modified since the specified date/time. + :paramtype if_modified_since: ~datetime.datetime + :keyword if_unmodified_since: Specify this header value to operate only on a blob if it has not + been modified since the specified date/time. + :paramtype if_unmodified_since: ~datetime.datetime + :keyword if_match: Specify an ETag value to operate only on blobs with a matching value. + :paramtype if_match: str + :keyword if_none_match: Specify an ETag value to operate only on blobs without a matching + value. + :paramtype if_none_match: str + :keyword if_tags: Specify a SQL where clause on blob tags to operate only on blobs with a + matching value. + :paramtype if_tags: str + """ super(ModifiedAccessConditions, self).__init__(**kwargs) self.if_modified_since = if_modified_since self.if_unmodified_since = if_unmodified_since @@ -1720,10 +2180,10 @@ def __init__( class PageList(msrest.serialization.Model): """the list of pages. - :param page_range: - :type page_range: list[~azure.storage.blob.models.PageRange] - :param clear_range: - :type clear_range: list[~azure.storage.blob.models.ClearRange] + :ivar page_range: + :vartype page_range: list[~azure.storage.blob.models.PageRange] + :ivar clear_range: + :vartype clear_range: list[~azure.storage.blob.models.ClearRange] """ _attribute_map = { @@ -1738,6 +2198,12 @@ def __init__( clear_range: Optional[List["ClearRange"]] = None, **kwargs ): + """ + :keyword page_range: + :paramtype page_range: list[~azure.storage.blob.models.PageRange] + :keyword clear_range: + :paramtype clear_range: list[~azure.storage.blob.models.ClearRange] + """ super(PageList, self).__init__(**kwargs) self.page_range = page_range self.clear_range = clear_range @@ -1748,10 +2214,10 @@ class PageRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start: Required. - :type start: long - :param end: Required. - :type end: long + :ivar start: Required. + :vartype start: long + :ivar end: Required. + :vartype end: long """ _validation = { @@ -1774,6 +2240,12 @@ def __init__( end: int, **kwargs ): + """ + :keyword start: Required. + :paramtype start: long + :keyword end: Required. + :paramtype end: long + """ super(PageRange, self).__init__(**kwargs) self.start = start self.end = end @@ -1784,19 +2256,19 @@ class QueryFormat(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The quick query format type. Possible values include: "delimited", + :ivar type: Required. The quick query format type. Possible values include: "delimited", "json", "arrow", "parquet". - :type type: str or ~azure.storage.blob.models.QueryFormatType - :param delimited_text_configuration: Groups the settings used for interpreting the blob data if + :vartype type: str or ~azure.storage.blob.models.QueryFormatType + :ivar delimited_text_configuration: Groups the settings used for interpreting the blob data if the blob is delimited text formatted. - :type delimited_text_configuration: ~azure.storage.blob.models.DelimitedTextConfiguration - :param json_text_configuration: json text configuration. - :type json_text_configuration: ~azure.storage.blob.models.JsonTextConfiguration - :param arrow_configuration: Groups the settings used for formatting the response if the - response should be Arrow formatted. - :type arrow_configuration: ~azure.storage.blob.models.ArrowConfiguration - :param parquet_text_configuration: Any object. - :type parquet_text_configuration: any + :vartype delimited_text_configuration: ~azure.storage.blob.models.DelimitedTextConfiguration + :ivar json_text_configuration: json text configuration. + :vartype json_text_configuration: ~azure.storage.blob.models.JsonTextConfiguration + :ivar arrow_configuration: Groups the settings used for formatting the response if the response + should be Arrow formatted. + :vartype arrow_configuration: ~azure.storage.blob.models.ArrowConfiguration + :ivar parquet_text_configuration: Any object. + :vartype parquet_text_configuration: any """ _validation = { @@ -1821,6 +2293,21 @@ def __init__( parquet_text_configuration: Optional[Any] = None, **kwargs ): + """ + :keyword type: Required. The quick query format type. Possible values include: "delimited", + "json", "arrow", "parquet". + :paramtype type: str or ~azure.storage.blob.models.QueryFormatType + :keyword delimited_text_configuration: Groups the settings used for interpreting the blob data + if the blob is delimited text formatted. + :paramtype delimited_text_configuration: ~azure.storage.blob.models.DelimitedTextConfiguration + :keyword json_text_configuration: json text configuration. + :paramtype json_text_configuration: ~azure.storage.blob.models.JsonTextConfiguration + :keyword arrow_configuration: Groups the settings used for formatting the response if the + response should be Arrow formatted. + :paramtype arrow_configuration: ~azure.storage.blob.models.ArrowConfiguration + :keyword parquet_text_configuration: Any object. + :paramtype parquet_text_configuration: any + """ super(QueryFormat, self).__init__(**kwargs) self.type = type self.delimited_text_configuration = delimited_text_configuration @@ -1839,13 +2326,13 @@ class QueryRequest(msrest.serialization.Model): :ivar query_type: Required. The type of the provided query expression. Has constant value: "SQL". :vartype query_type: str - :param expression: Required. The query expression in SQL. The maximum size of the query + :ivar expression: Required. The query expression in SQL. The maximum size of the query expression is 256KiB. - :type expression: str - :param input_serialization: - :type input_serialization: ~azure.storage.blob.models.QuerySerialization - :param output_serialization: - :type output_serialization: ~azure.storage.blob.models.QuerySerialization + :vartype expression: str + :ivar input_serialization: + :vartype input_serialization: ~azure.storage.blob.models.QuerySerialization + :ivar output_serialization: + :vartype output_serialization: ~azure.storage.blob.models.QuerySerialization """ _validation = { @@ -1873,6 +2360,15 @@ def __init__( output_serialization: Optional["QuerySerialization"] = None, **kwargs ): + """ + :keyword expression: Required. The query expression in SQL. The maximum size of the query + expression is 256KiB. + :paramtype expression: str + :keyword input_serialization: + :paramtype input_serialization: ~azure.storage.blob.models.QuerySerialization + :keyword output_serialization: + :paramtype output_serialization: ~azure.storage.blob.models.QuerySerialization + """ super(QueryRequest, self).__init__(**kwargs) self.expression = expression self.input_serialization = input_serialization @@ -1884,8 +2380,8 @@ class QuerySerialization(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param format: Required. - :type format: ~azure.storage.blob.models.QueryFormat + :ivar format: Required. + :vartype format: ~azure.storage.blob.models.QueryFormat """ _validation = { @@ -1902,6 +2398,10 @@ def __init__( format: "QueryFormat", **kwargs ): + """ + :keyword format: Required. + :paramtype format: ~azure.storage.blob.models.QueryFormat + """ super(QuerySerialization, self).__init__(**kwargs) self.format = format @@ -1911,15 +2411,15 @@ class RetentionPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Indicates whether a retention policy is enabled for the storage + :ivar enabled: Required. Indicates whether a retention policy is enabled for the storage service. - :type enabled: bool - :param days: Indicates the number of days that metrics or logging or soft-deleted data should - be retained. All data older than this value will be deleted. - :type days: int - :param allow_permanent_delete: Indicates whether permanent delete is allowed on this storage + :vartype enabled: bool + :ivar days: Indicates the number of days that metrics or logging or soft-deleted data should be + retained. All data older than this value will be deleted. + :vartype days: int + :ivar allow_permanent_delete: Indicates whether permanent delete is allowed on this storage account. - :type allow_permanent_delete: bool + :vartype allow_permanent_delete: bool """ _validation = { @@ -1941,6 +2441,17 @@ def __init__( allow_permanent_delete: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Required. Indicates whether a retention policy is enabled for the storage + service. + :paramtype enabled: bool + :keyword days: Indicates the number of days that metrics or logging or soft-deleted data should + be retained. All data older than this value will be deleted. + :paramtype days: int + :keyword allow_permanent_delete: Indicates whether permanent delete is allowed on this storage + account. + :paramtype allow_permanent_delete: bool + """ super(RetentionPolicy, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -1950,15 +2461,15 @@ def __init__( class SequenceNumberAccessConditions(msrest.serialization.Model): """Parameter group. - :param if_sequence_number_less_than_or_equal_to: Specify this header value to operate only on a + :ivar if_sequence_number_less_than_or_equal_to: Specify this header value to operate only on a blob if it has a sequence number less than or equal to the specified. - :type if_sequence_number_less_than_or_equal_to: long - :param if_sequence_number_less_than: Specify this header value to operate only on a blob if it + :vartype if_sequence_number_less_than_or_equal_to: long + :ivar if_sequence_number_less_than: Specify this header value to operate only on a blob if it has a sequence number less than the specified. - :type if_sequence_number_less_than: long - :param if_sequence_number_equal_to: Specify this header value to operate only on a blob if it + :vartype if_sequence_number_less_than: long + :ivar if_sequence_number_equal_to: Specify this header value to operate only on a blob if it has the specified sequence number. - :type if_sequence_number_equal_to: long + :vartype if_sequence_number_equal_to: long """ _attribute_map = { @@ -1975,6 +2486,17 @@ def __init__( if_sequence_number_equal_to: Optional[int] = None, **kwargs ): + """ + :keyword if_sequence_number_less_than_or_equal_to: Specify this header value to operate only on + a blob if it has a sequence number less than or equal to the specified. + :paramtype if_sequence_number_less_than_or_equal_to: long + :keyword if_sequence_number_less_than: Specify this header value to operate only on a blob if + it has a sequence number less than the specified. + :paramtype if_sequence_number_less_than: long + :keyword if_sequence_number_equal_to: Specify this header value to operate only on a blob if it + has the specified sequence number. + :paramtype if_sequence_number_equal_to: long + """ super(SequenceNumberAccessConditions, self).__init__(**kwargs) self.if_sequence_number_less_than_or_equal_to = if_sequence_number_less_than_or_equal_to self.if_sequence_number_less_than = if_sequence_number_less_than @@ -1986,10 +2508,10 @@ class SignedIdentifier(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. a unique id. - :type id: str - :param access_policy: An Access policy. - :type access_policy: ~azure.storage.blob.models.AccessPolicy + :ivar id: Required. a unique id. + :vartype id: str + :ivar access_policy: An Access policy. + :vartype access_policy: ~azure.storage.blob.models.AccessPolicy """ _validation = { @@ -2011,6 +2533,12 @@ def __init__( access_policy: Optional["AccessPolicy"] = None, **kwargs ): + """ + :keyword id: Required. a unique id. + :paramtype id: str + :keyword access_policy: An Access policy. + :paramtype access_policy: ~azure.storage.blob.models.AccessPolicy + """ super(SignedIdentifier, self).__init__(**kwargs) self.id = id self.access_policy = access_policy @@ -2019,20 +2547,20 @@ def __init__( class SourceModifiedAccessConditions(msrest.serialization.Model): """Parameter group. - :param source_if_modified_since: Specify this header value to operate only on a blob if it has + :ivar source_if_modified_since: Specify this header value to operate only on a blob if it has been modified since the specified date/time. - :type source_if_modified_since: ~datetime.datetime - :param source_if_unmodified_since: Specify this header value to operate only on a blob if it - has not been modified since the specified date/time. - :type source_if_unmodified_since: ~datetime.datetime - :param source_if_match: Specify an ETag value to operate only on blobs with a matching value. - :type source_if_match: str - :param source_if_none_match: Specify an ETag value to operate only on blobs without a matching + :vartype source_if_modified_since: ~datetime.datetime + :ivar source_if_unmodified_since: Specify this header value to operate only on a blob if it has + not been modified since the specified date/time. + :vartype source_if_unmodified_since: ~datetime.datetime + :ivar source_if_match: Specify an ETag value to operate only on blobs with a matching value. + :vartype source_if_match: str + :ivar source_if_none_match: Specify an ETag value to operate only on blobs without a matching value. - :type source_if_none_match: str - :param source_if_tags: Specify a SQL where clause on blob tags to operate only on blobs with a + :vartype source_if_none_match: str + :ivar source_if_tags: Specify a SQL where clause on blob tags to operate only on blobs with a matching value. - :type source_if_tags: str + :vartype source_if_tags: str """ _attribute_map = { @@ -2053,6 +2581,22 @@ def __init__( source_if_tags: Optional[str] = None, **kwargs ): + """ + :keyword source_if_modified_since: Specify this header value to operate only on a blob if it + has been modified since the specified date/time. + :paramtype source_if_modified_since: ~datetime.datetime + :keyword source_if_unmodified_since: Specify this header value to operate only on a blob if it + has not been modified since the specified date/time. + :paramtype source_if_unmodified_since: ~datetime.datetime + :keyword source_if_match: Specify an ETag value to operate only on blobs with a matching value. + :paramtype source_if_match: str + :keyword source_if_none_match: Specify an ETag value to operate only on blobs without a + matching value. + :paramtype source_if_none_match: str + :keyword source_if_tags: Specify a SQL where clause on blob tags to operate only on blobs with + a matching value. + :paramtype source_if_tags: str + """ super(SourceModifiedAccessConditions, self).__init__(**kwargs) self.source_if_modified_since = source_if_modified_since self.source_if_unmodified_since = source_if_unmodified_since @@ -2066,14 +2610,14 @@ class StaticWebsite(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Indicates whether this account is hosting a static website. - :type enabled: bool - :param index_document: The default name of the index page under each directory. - :type index_document: str - :param error_document404_path: The absolute path of the custom 404 page. - :type error_document404_path: str - :param default_index_document_path: Absolute path of the default index page. - :type default_index_document_path: str + :ivar enabled: Required. Indicates whether this account is hosting a static website. + :vartype enabled: bool + :ivar index_document: The default name of the index page under each directory. + :vartype index_document: str + :ivar error_document404_path: The absolute path of the custom 404 page. + :vartype error_document404_path: str + :ivar default_index_document_path: Absolute path of the default index page. + :vartype default_index_document_path: str """ _validation = { @@ -2096,6 +2640,16 @@ def __init__( default_index_document_path: Optional[str] = None, **kwargs ): + """ + :keyword enabled: Required. Indicates whether this account is hosting a static website. + :paramtype enabled: bool + :keyword index_document: The default name of the index page under each directory. + :paramtype index_document: str + :keyword error_document404_path: The absolute path of the custom 404 page. + :paramtype error_document404_path: str + :keyword default_index_document_path: Absolute path of the default index page. + :paramtype default_index_document_path: str + """ super(StaticWebsite, self).__init__(**kwargs) self.enabled = enabled self.index_document = index_document @@ -2106,8 +2660,8 @@ def __init__( class StorageError(msrest.serialization.Model): """StorageError. - :param message: - :type message: str + :ivar message: + :vartype message: str """ _attribute_map = { @@ -2120,6 +2674,10 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword message: + :paramtype message: str + """ super(StorageError, self).__init__(**kwargs) self.message = message @@ -2127,25 +2685,25 @@ def __init__( class StorageServiceProperties(msrest.serialization.Model): """Storage Service Properties. - :param logging: Azure Analytics Logging settings. - :type logging: ~azure.storage.blob.models.Logging - :param hour_metrics: a summary of request statistics grouped by API in hour or minute - aggregates for blobs. - :type hour_metrics: ~azure.storage.blob.models.Metrics - :param minute_metrics: a summary of request statistics grouped by API in hour or minute + :ivar logging: Azure Analytics Logging settings. + :vartype logging: ~azure.storage.blob.models.Logging + :ivar hour_metrics: a summary of request statistics grouped by API in hour or minute aggregates + for blobs. + :vartype hour_metrics: ~azure.storage.blob.models.Metrics + :ivar minute_metrics: a summary of request statistics grouped by API in hour or minute aggregates for blobs. - :type minute_metrics: ~azure.storage.blob.models.Metrics - :param cors: The set of CORS rules. - :type cors: list[~azure.storage.blob.models.CorsRule] - :param default_service_version: The default version to use for requests to the Blob service if + :vartype minute_metrics: ~azure.storage.blob.models.Metrics + :ivar cors: The set of CORS rules. + :vartype cors: list[~azure.storage.blob.models.CorsRule] + :ivar default_service_version: The default version to use for requests to the Blob service if an incoming request's version is not specified. Possible values include version 2008-10-27 and all more recent versions. - :type default_service_version: str - :param delete_retention_policy: the retention policy which determines how long the associated + :vartype default_service_version: str + :ivar delete_retention_policy: the retention policy which determines how long the associated data should persist. - :type delete_retention_policy: ~azure.storage.blob.models.RetentionPolicy - :param static_website: The properties that enable an account to host a static website. - :type static_website: ~azure.storage.blob.models.StaticWebsite + :vartype delete_retention_policy: ~azure.storage.blob.models.RetentionPolicy + :ivar static_website: The properties that enable an account to host a static website. + :vartype static_website: ~azure.storage.blob.models.StaticWebsite """ _attribute_map = { @@ -2170,6 +2728,27 @@ def __init__( static_website: Optional["StaticWebsite"] = None, **kwargs ): + """ + :keyword logging: Azure Analytics Logging settings. + :paramtype logging: ~azure.storage.blob.models.Logging + :keyword hour_metrics: a summary of request statistics grouped by API in hour or minute + aggregates for blobs. + :paramtype hour_metrics: ~azure.storage.blob.models.Metrics + :keyword minute_metrics: a summary of request statistics grouped by API in hour or minute + aggregates for blobs. + :paramtype minute_metrics: ~azure.storage.blob.models.Metrics + :keyword cors: The set of CORS rules. + :paramtype cors: list[~azure.storage.blob.models.CorsRule] + :keyword default_service_version: The default version to use for requests to the Blob service + if an incoming request's version is not specified. Possible values include version 2008-10-27 + and all more recent versions. + :paramtype default_service_version: str + :keyword delete_retention_policy: the retention policy which determines how long the associated + data should persist. + :paramtype delete_retention_policy: ~azure.storage.blob.models.RetentionPolicy + :keyword static_website: The properties that enable an account to host a static website. + :paramtype static_website: ~azure.storage.blob.models.StaticWebsite + """ super(StorageServiceProperties, self).__init__(**kwargs) self.logging = logging self.hour_metrics = hour_metrics @@ -2183,8 +2762,8 @@ def __init__( class StorageServiceStats(msrest.serialization.Model): """Stats for the storage service. - :param geo_replication: Geo-Replication information for the Secondary Storage Service. - :type geo_replication: ~azure.storage.blob.models.GeoReplication + :ivar geo_replication: Geo-Replication information for the Secondary Storage Service. + :vartype geo_replication: ~azure.storage.blob.models.GeoReplication """ _attribute_map = { @@ -2197,6 +2776,10 @@ def __init__( geo_replication: Optional["GeoReplication"] = None, **kwargs ): + """ + :keyword geo_replication: Geo-Replication information for the Secondary Storage Service. + :paramtype geo_replication: ~azure.storage.blob.models.GeoReplication + """ super(StorageServiceStats, self).__init__(**kwargs) self.geo_replication = geo_replication @@ -2206,21 +2789,20 @@ class UserDelegationKey(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param signed_oid: Required. The Azure Active Directory object ID in GUID format. - :type signed_oid: str - :param signed_tid: Required. The Azure Active Directory tenant ID in GUID format. - :type signed_tid: str - :param signed_start: Required. The date-time the key is active. - :type signed_start: ~datetime.datetime - :param signed_expiry: Required. The date-time the key expires. - :type signed_expiry: ~datetime.datetime - :param signed_service: Required. Abbreviation of the Azure Storage service that accepts the - key. - :type signed_service: str - :param signed_version: Required. The service version that created the key. - :type signed_version: str - :param value: Required. The key as a base64 string. - :type value: str + :ivar signed_oid: Required. The Azure Active Directory object ID in GUID format. + :vartype signed_oid: str + :ivar signed_tid: Required. The Azure Active Directory tenant ID in GUID format. + :vartype signed_tid: str + :ivar signed_start: Required. The date-time the key is active. + :vartype signed_start: ~datetime.datetime + :ivar signed_expiry: Required. The date-time the key expires. + :vartype signed_expiry: ~datetime.datetime + :ivar signed_service: Required. Abbreviation of the Azure Storage service that accepts the key. + :vartype signed_service: str + :ivar signed_version: Required. The service version that created the key. + :vartype signed_version: str + :ivar value: Required. The key as a base64 string. + :vartype value: str """ _validation = { @@ -2255,6 +2837,23 @@ def __init__( value: str, **kwargs ): + """ + :keyword signed_oid: Required. The Azure Active Directory object ID in GUID format. + :paramtype signed_oid: str + :keyword signed_tid: Required. The Azure Active Directory tenant ID in GUID format. + :paramtype signed_tid: str + :keyword signed_start: Required. The date-time the key is active. + :paramtype signed_start: ~datetime.datetime + :keyword signed_expiry: Required. The date-time the key expires. + :paramtype signed_expiry: ~datetime.datetime + :keyword signed_service: Required. Abbreviation of the Azure Storage service that accepts the + key. + :paramtype signed_service: str + :keyword signed_version: Required. The service version that created the key. + :paramtype signed_version: str + :keyword value: Required. The key as a base64 string. + :paramtype value: str + """ super(UserDelegationKey, self).__init__(**kwargs) self.signed_oid = signed_oid self.signed_tid = signed_tid diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py index b38af4b94f10..74b23b6ec62c 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,21 +8,389 @@ # -------------------------------------------------------------------------- import datetime from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union - + from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + blob_type = kwargs.pop('blob_type', "AppendBlob") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_length = kwargs.pop('content_length') # type: int + timeout = kwargs.pop('timeout', None) # type: Optional[int] + blob_content_type = kwargs.pop('blob_content_type', None) # type: Optional[str] + blob_content_encoding = kwargs.pop('blob_content_encoding', None) # type: Optional[str] + blob_content_language = kwargs.pop('blob_content_language', None) # type: Optional[str] + blob_content_md5 = kwargs.pop('blob_content_md5', None) # type: Optional[bytearray] + blob_cache_control = kwargs.pop('blob_cache_control', None) # type: Optional[str] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + blob_content_disposition = kwargs.pop('blob_content_disposition', None) # type: Optional[str] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + blob_tags_string = kwargs.pop('blob_tags_string', None) # type: Optional[str] + immutability_policy_expiry = kwargs.pop('immutability_policy_expiry', None) # type: Optional[datetime.datetime] + immutability_policy_mode = kwargs.pop('immutability_policy_mode', None) # type: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] + legal_hold = kwargs.pop('legal_hold', None) # type: Optional[bool] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-blob-type'] = _SERIALIZER.header("blob_type", blob_type, 'str') + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + if blob_content_type is not None: + _header_parameters['x-ms-blob-content-type'] = _SERIALIZER.header("blob_content_type", blob_content_type, 'str') + if blob_content_encoding is not None: + _header_parameters['x-ms-blob-content-encoding'] = _SERIALIZER.header("blob_content_encoding", blob_content_encoding, 'str') + if blob_content_language is not None: + _header_parameters['x-ms-blob-content-language'] = _SERIALIZER.header("blob_content_language", blob_content_language, 'str') + if blob_content_md5 is not None: + _header_parameters['x-ms-blob-content-md5'] = _SERIALIZER.header("blob_content_md5", blob_content_md5, 'bytearray') + if blob_cache_control is not None: + _header_parameters['x-ms-blob-cache-control'] = _SERIALIZER.header("blob_cache_control", blob_cache_control, 'str') + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if blob_content_disposition is not None: + _header_parameters['x-ms-blob-content-disposition'] = _SERIALIZER.header("blob_content_disposition", blob_content_disposition, 'str') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if blob_tags_string is not None: + _header_parameters['x-ms-tags'] = _SERIALIZER.header("blob_tags_string", blob_tags_string, 'str') + if immutability_policy_expiry is not None: + _header_parameters['x-ms-immutability-policy-until-date'] = _SERIALIZER.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') + if immutability_policy_mode is not None: + _header_parameters['x-ms-immutability-policy-mode'] = _SERIALIZER.header("immutability_policy_mode", immutability_policy_mode, 'str') + if legal_hold is not None: + _header_parameters['x-ms-legal-hold'] = _SERIALIZER.header("legal_hold", legal_hold, 'bool') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_append_block_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "appendblock") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + content_length = kwargs.pop('content_length') # type: int + timeout = kwargs.pop('timeout', None) # type: Optional[int] + transactional_content_md5 = kwargs.pop('transactional_content_md5', None) # type: Optional[bytearray] + transactional_content_crc64 = kwargs.pop('transactional_content_crc64', None) # type: Optional[bytearray] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + max_size = kwargs.pop('max_size', None) # type: Optional[int] + append_position = kwargs.pop('append_position', None) # type: Optional[int] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + if transactional_content_md5 is not None: + _header_parameters['Content-MD5'] = _SERIALIZER.header("transactional_content_md5", transactional_content_md5, 'bytearray') + if transactional_content_crc64 is not None: + _header_parameters['x-ms-content-crc64'] = _SERIALIZER.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if max_size is not None: + _header_parameters['x-ms-blob-condition-maxsize'] = _SERIALIZER.header("max_size", max_size, 'long') + if append_position is not None: + _header_parameters['x-ms-blob-condition-appendpos'] = _SERIALIZER.header("append_position", append_position, 'long') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_append_block_from_url_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "appendblock") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + source_url = kwargs.pop('source_url') # type: str + content_length = kwargs.pop('content_length') # type: int + source_range = kwargs.pop('source_range', None) # type: Optional[str] + source_content_md5 = kwargs.pop('source_content_md5', None) # type: Optional[bytearray] + source_contentcrc64 = kwargs.pop('source_contentcrc64', None) # type: Optional[bytearray] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + transactional_content_md5 = kwargs.pop('transactional_content_md5', None) # type: Optional[bytearray] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + max_size = kwargs.pop('max_size', None) # type: Optional[int] + append_position = kwargs.pop('append_position', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + source_if_modified_since = kwargs.pop('source_if_modified_since', None) # type: Optional[datetime.datetime] + source_if_unmodified_since = kwargs.pop('source_if_unmodified_since', None) # type: Optional[datetime.datetime] + source_if_match = kwargs.pop('source_if_match', None) # type: Optional[str] + source_if_none_match = kwargs.pop('source_if_none_match', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + copy_source_authorization = kwargs.pop('copy_source_authorization', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-copy-source'] = _SERIALIZER.header("source_url", source_url, 'str') + if source_range is not None: + _header_parameters['x-ms-source-range'] = _SERIALIZER.header("source_range", source_range, 'str') + if source_content_md5 is not None: + _header_parameters['x-ms-source-content-md5'] = _SERIALIZER.header("source_content_md5", source_content_md5, 'bytearray') + if source_contentcrc64 is not None: + _header_parameters['x-ms-source-content-crc64'] = _SERIALIZER.header("source_contentcrc64", source_contentcrc64, 'bytearray') + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + if transactional_content_md5 is not None: + _header_parameters['Content-MD5'] = _SERIALIZER.header("transactional_content_md5", transactional_content_md5, 'bytearray') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if max_size is not None: + _header_parameters['x-ms-blob-condition-maxsize'] = _SERIALIZER.header("max_size", max_size, 'long') + if append_position is not None: + _header_parameters['x-ms-blob-condition-appendpos'] = _SERIALIZER.header("append_position", append_position, 'long') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + if source_if_modified_since is not None: + _header_parameters['x-ms-source-if-modified-since'] = _SERIALIZER.header("source_if_modified_since", source_if_modified_since, 'rfc-1123') + if source_if_unmodified_since is not None: + _header_parameters['x-ms-source-if-unmodified-since'] = _SERIALIZER.header("source_if_unmodified_since", source_if_unmodified_since, 'rfc-1123') + if source_if_match is not None: + _header_parameters['x-ms-source-if-match'] = _SERIALIZER.header("source_if_match", source_if_match, 'str') + if source_if_none_match is not None: + _header_parameters['x-ms-source-if-none-match'] = _SERIALIZER.header("source_if_none_match", source_if_none_match, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if copy_source_authorization is not None: + _header_parameters['x-ms-copy-source-authorization'] = _SERIALIZER.header("copy_source_authorization", copy_source_authorization, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_seal_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "seal") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + append_position = kwargs.pop('append_position', None) # type: Optional[int] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if append_position is not None: + _header_parameters['x-ms-blob-condition-appendpos'] = _SERIALIZER.header("append_position", append_position, 'long') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class AppendBlobOperations(object): """AppendBlobOperations operations. @@ -44,11 +413,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def create( + @distributed_trace + def create( # pylint: disable=inconsistent-return-statements self, content_length, # type: int timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] request_id_parameter=None, # type: Optional[str] blob_tags_string=None, # type: Optional[str] immutability_policy_expiry=None, # type: Optional[datetime.datetime] @@ -78,7 +448,7 @@ def create( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str @@ -101,6 +471,10 @@ def create( :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append + blob. The default value is "AppendBlob". Note that overriding this default value may result in + unsupported behavior. + :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -111,7 +485,9 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + blob_type = kwargs.pop('blob_type', "AppendBlob") # type: str + _blob_content_type = None _blob_content_encoding = None _blob_content_language = None @@ -134,6 +510,9 @@ def create( _blob_content_language = blob_http_headers.blob_content_language _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_cache_control = blob_http_headers.blob_cache_control + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + if blob_http_headers is not None: _blob_content_disposition = blob_http_headers.blob_content_disposition if cpk_info is not None: _encryption_key = cpk_info.encryption_key @@ -141,87 +520,56 @@ def create( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - blob_type = "AppendBlob" - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-blob-type'] = self._serialize.header("blob_type", blob_type, 'str') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if _blob_content_type is not None: - header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", _blob_content_type, 'str') - if _blob_content_encoding is not None: - header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", _blob_content_encoding, 'str') - if _blob_content_language is not None: - header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", _blob_content_language, 'str') - if _blob_content_md5 is not None: - header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", _blob_content_md5, 'bytearray') - if _blob_cache_control is not None: - header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", _blob_cache_control, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _blob_content_disposition is not None: - header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", _blob_content_disposition, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - if legal_hold is not None: - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_create_request( + url=self._config.url, + blob_type=blob_type, + version=self._config.version, + content_length=content_length, + timeout=timeout, + blob_content_type=_blob_content_type, + blob_content_encoding=_blob_content_encoding, + blob_content_language=_blob_content_language, + blob_content_md5=_blob_content_md5, + blob_cache_control=_blob_cache_control, + metadata=metadata, + lease_id=_lease_id, + blob_content_disposition=_blob_content_disposition, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + blob_tags_string=blob_tags_string, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + legal_hold=legal_hold, + template_url=self.create.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -237,12 +585,15 @@ def create( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + create.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def append_block( + + @distributed_trace + def append_block( # pylint: disable=inconsistent-return-statements self, content_length, # type: int body, # type: IO @@ -283,13 +634,17 @@ def append_block( :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param append_position_access_conditions: Parameter group. - :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions + :type append_position_access_conditions: + ~azure.storage.blob.models.AppendPositionAccessConditions :param cpk_info: Parameter group. :type cpk_info: ~azure.storage.blob.models.CpkInfo :param cpk_scope_info: Parameter group. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "appendblock". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -300,7 +655,10 @@ def append_block( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "appendblock") # type: str + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] + _lease_id = None _max_size = None _append_position = None @@ -313,6 +671,8 @@ def append_block( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if append_position_access_conditions is not None: _max_size = append_position_access_conditions.max_size _append_position = append_position_access_conditions.append_position @@ -322,77 +682,52 @@ def append_block( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "appendblock" - content_type = kwargs.pop("content_type", "application/octet-stream") - accept = "application/xml" - - # Construct URL - url = self.append_block.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - if transactional_content_crc64 is not None: - header_parameters['x-ms-content-crc64'] = self._serialize.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _max_size is not None: - header_parameters['x-ms-blob-condition-maxsize'] = self._serialize.header("max_size", _max_size, 'long') - if _append_position is not None: - header_parameters['x-ms-blob-condition-appendpos'] = self._serialize.header("append_position", _append_position, 'long') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = body - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _content = body + + request = build_append_block_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + content_length=content_length, + timeout=timeout, + transactional_content_md5=transactional_content_md5, + transactional_content_crc64=transactional_content_crc64, + lease_id=_lease_id, + max_size=_max_size, + append_position=_append_position, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.append_block.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -410,12 +745,15 @@ def append_block( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - append_block.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + append_block.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def append_block_from_url( + @distributed_trace + def append_block_from_url( # pylint: disable=inconsistent-return-statements self, source_url, # type: str content_length, # type: int @@ -473,11 +811,16 @@ def append_block_from_url( :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param append_position_access_conditions: Parameter group. - :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions + :type append_position_access_conditions: + ~azure.storage.blob.models.AppendPositionAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword comp: comp. The default value is "appendblock". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -488,7 +831,9 @@ def append_block_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "appendblock") # type: str + _encryption_key = None _encryption_key_sha256 = None _encryption_algorithm = None @@ -505,9 +850,6 @@ def append_block_from_url( _source_if_unmodified_since = None _source_if_match = None _source_if_none_match = None - if append_position_access_conditions is not None: - _max_size = append_position_access_conditions.max_size - _append_position = append_position_access_conditions.append_position if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 @@ -516,6 +858,9 @@ def append_block_from_url( _encryption_scope = cpk_scope_info.encryption_scope if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id + if append_position_access_conditions is not None: + _max_size = append_position_access_conditions.max_size + _append_position = append_position_access_conditions.append_position if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since @@ -527,80 +872,51 @@ def append_block_from_url( _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since _source_if_match = source_modified_access_conditions.source_if_match _source_if_none_match = source_modified_access_conditions.source_if_none_match - comp = "appendblock" - accept = "application/xml" - # Construct URL - url = self.append_block_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-copy-source'] = self._serialize.header("source_url", source_url, 'str') - if source_range is not None: - header_parameters['x-ms-source-range'] = self._serialize.header("source_range", source_range, 'str') - if source_content_md5 is not None: - header_parameters['x-ms-source-content-md5'] = self._serialize.header("source_content_md5", source_content_md5, 'bytearray') - if source_contentcrc64 is not None: - header_parameters['x-ms-source-content-crc64'] = self._serialize.header("source_contentcrc64", source_contentcrc64, 'bytearray') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _max_size is not None: - header_parameters['x-ms-blob-condition-maxsize'] = self._serialize.header("max_size", _max_size, 'long') - if _append_position is not None: - header_parameters['x-ms-blob-condition-appendpos'] = self._serialize.header("append_position", _append_position, 'long') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if copy_source_authorization is not None: - header_parameters['x-ms-copy-source-authorization'] = self._serialize.header("copy_source_authorization", copy_source_authorization, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_append_block_from_url_request( + url=self._config.url, + comp=comp, + version=self._config.version, + source_url=source_url, + content_length=content_length, + source_range=source_range, + source_content_md5=source_content_md5, + source_contentcrc64=source_contentcrc64, + timeout=timeout, + transactional_content_md5=transactional_content_md5, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + lease_id=_lease_id, + max_size=_max_size, + append_position=_append_position, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + request_id_parameter=request_id_parameter, + copy_source_authorization=copy_source_authorization, + template_url=self.append_block_from_url.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -617,12 +933,15 @@ def append_block_from_url( response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - append_block_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + append_block_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def seal( + + @distributed_trace + def seal( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -648,7 +967,11 @@ def seal( :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param append_position_access_conditions: Parameter group. - :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions + :type append_position_access_conditions: + ~azure.storage.blob.models.AppendPositionAccessConditions + :keyword comp: comp. The default value is "seal". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -659,15 +982,15 @@ def seal( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "seal") # type: str + _lease_id = None _if_modified_since = None _if_unmodified_since = None _if_match = None _if_none_match = None _append_position = None - if append_position_access_conditions is not None: - _append_position = append_position_access_conditions.append_position if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: @@ -675,48 +998,36 @@ def seal( _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match - comp = "seal" - accept = "application/xml" + if append_position_access_conditions is not None: + _append_position = append_position_access_conditions.append_position - # Construct URL - url = self.seal.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _append_position is not None: - header_parameters['x-ms-blob-condition-appendpos'] = self._serialize.header("append_position", _append_position, 'long') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_seal_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + lease_id=_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + append_position=_append_position, + template_url=self.seal.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -728,7 +1039,9 @@ def seal( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-blob-sealed']=self._deserialize('bool', response.headers.get('x-ms-blob-sealed')) + if cls: return cls(pipeline_response, None, response_headers) - seal.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + seal.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py index e041221239fa..367645b0be87 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,22 +8,1531 @@ # -------------------------------------------------------------------------- import datetime from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union - + from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class BlobOperations(object): +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_download_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2021-04-10") # type: str + snapshot = kwargs.pop('snapshot', None) # type: Optional[str] + version_id = kwargs.pop('version_id', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + range = kwargs.pop('range', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + range_get_content_md5 = kwargs.pop('range_get_content_md5', None) # type: Optional[bool] + range_get_content_crc64 = kwargs.pop('range_get_content_crc64', None) # type: Optional[bool] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if snapshot is not None: + _query_parameters['snapshot'] = _SERIALIZER.query("snapshot", snapshot, 'str') + if version_id is not None: + _query_parameters['versionid'] = _SERIALIZER.query("version_id", version_id, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if range is not None: + _header_parameters['x-ms-range'] = _SERIALIZER.header("range", range, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if range_get_content_md5 is not None: + _header_parameters['x-ms-range-get-content-md5'] = _SERIALIZER.header("range_get_content_md5", range_get_content_md5, 'bool') + if range_get_content_crc64 is not None: + _header_parameters['x-ms-range-get-content-crc64'] = _SERIALIZER.header("range_get_content_crc64", range_get_content_crc64, 'bool') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2021-04-10") # type: str + snapshot = kwargs.pop('snapshot', None) # type: Optional[str] + version_id = kwargs.pop('version_id', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if snapshot is not None: + _query_parameters['snapshot'] = _SERIALIZER.query("snapshot", snapshot, 'str') + if version_id is not None: + _query_parameters['versionid'] = _SERIALIZER.query("version_id", version_id, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2021-04-10") # type: str + snapshot = kwargs.pop('snapshot', None) # type: Optional[str] + version_id = kwargs.pop('version_id', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + delete_snapshots = kwargs.pop('delete_snapshots', None) # type: Optional[Union[str, "_models.DeleteSnapshotsOptionType"]] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + blob_delete_type = kwargs.pop('blob_delete_type', "Permanent") # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if snapshot is not None: + _query_parameters['snapshot'] = _SERIALIZER.query("snapshot", snapshot, 'str') + if version_id is not None: + _query_parameters['versionid'] = _SERIALIZER.query("version_id", version_id, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if blob_delete_type is not None: + _query_parameters['deletetype'] = _SERIALIZER.query("blob_delete_type", blob_delete_type, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if delete_snapshots is not None: + _header_parameters['x-ms-delete-snapshots'] = _SERIALIZER.header("delete_snapshots", delete_snapshots, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_undelete_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "undelete") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_expiry_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "expiry") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + expiry_options = kwargs.pop('expiry_options') # type: Union[str, "_models.BlobExpiryOptions"] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + expires_on = kwargs.pop('expires_on', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-expiry-option'] = _SERIALIZER.header("expiry_options", expiry_options, 'str') + if expires_on is not None: + _header_parameters['x-ms-expiry-time'] = _SERIALIZER.header("expires_on", expires_on, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_http_headers_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + blob_cache_control = kwargs.pop('blob_cache_control', None) # type: Optional[str] + blob_content_type = kwargs.pop('blob_content_type', None) # type: Optional[str] + blob_content_md5 = kwargs.pop('blob_content_md5', None) # type: Optional[bytearray] + blob_content_encoding = kwargs.pop('blob_content_encoding', None) # type: Optional[str] + blob_content_language = kwargs.pop('blob_content_language', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + blob_content_disposition = kwargs.pop('blob_content_disposition', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if blob_cache_control is not None: + _header_parameters['x-ms-blob-cache-control'] = _SERIALIZER.header("blob_cache_control", blob_cache_control, 'str') + if blob_content_type is not None: + _header_parameters['x-ms-blob-content-type'] = _SERIALIZER.header("blob_content_type", blob_content_type, 'str') + if blob_content_md5 is not None: + _header_parameters['x-ms-blob-content-md5'] = _SERIALIZER.header("blob_content_md5", blob_content_md5, 'bytearray') + if blob_content_encoding is not None: + _header_parameters['x-ms-blob-content-encoding'] = _SERIALIZER.header("blob_content_encoding", blob_content_encoding, 'str') + if blob_content_language is not None: + _header_parameters['x-ms-blob-content-language'] = _SERIALIZER.header("blob_content_language", blob_content_language, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + if blob_content_disposition is not None: + _header_parameters['x-ms-blob-content-disposition'] = _SERIALIZER.header("blob_content_disposition", blob_content_disposition, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_immutability_policy_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "immutabilityPolicies") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + immutability_policy_expiry = kwargs.pop('immutability_policy_expiry', None) # type: Optional[datetime.datetime] + immutability_policy_mode = kwargs.pop('immutability_policy_mode', None) # type: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if immutability_policy_expiry is not None: + _header_parameters['x-ms-immutability-policy-until-date'] = _SERIALIZER.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') + if immutability_policy_mode is not None: + _header_parameters['x-ms-immutability-policy-mode'] = _SERIALIZER.header("immutability_policy_mode", immutability_policy_mode, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_immutability_policy_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "immutabilityPolicies") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_legal_hold_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "legalhold") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + legal_hold = kwargs.pop('legal_hold') # type: bool + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-legal-hold'] = _SERIALIZER.header("legal_hold", legal_hold, 'bool') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_metadata_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "metadata") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_acquire_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "acquire") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + duration = kwargs.pop('duration', None) # type: Optional[int] + proposed_lease_id = kwargs.pop('proposed_lease_id', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + if duration is not None: + _header_parameters['x-ms-lease-duration'] = _SERIALIZER.header("duration", duration, 'int') + if proposed_lease_id is not None: + _header_parameters['x-ms-proposed-lease-id'] = _SERIALIZER.header("proposed_lease_id", proposed_lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_release_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "release") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + lease_id = kwargs.pop('lease_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_renew_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "renew") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + lease_id = kwargs.pop('lease_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_change_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "change") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + lease_id = kwargs.pop('lease_id') # type: str + proposed_lease_id = kwargs.pop('proposed_lease_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['x-ms-proposed-lease-id'] = _SERIALIZER.header("proposed_lease_id", proposed_lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_break_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "break") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + break_period = kwargs.pop('break_period', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + if break_period is not None: + _header_parameters['x-ms-lease-break-period'] = _SERIALIZER.header("break_period", break_period, 'int') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_snapshot_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "snapshot") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_copy_from_url_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2021-04-10") # type: str + copy_source = kwargs.pop('copy_source') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + tier = kwargs.pop('tier', None) # type: Optional[Union[str, "_models.AccessTierOptional"]] + rehydrate_priority = kwargs.pop('rehydrate_priority', None) # type: Optional[Union[str, "_models.RehydratePriority"]] + source_if_modified_since = kwargs.pop('source_if_modified_since', None) # type: Optional[datetime.datetime] + source_if_unmodified_since = kwargs.pop('source_if_unmodified_since', None) # type: Optional[datetime.datetime] + source_if_match = kwargs.pop('source_if_match', None) # type: Optional[str] + source_if_none_match = kwargs.pop('source_if_none_match', None) # type: Optional[str] + source_if_tags = kwargs.pop('source_if_tags', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + blob_tags_string = kwargs.pop('blob_tags_string', None) # type: Optional[str] + seal_blob = kwargs.pop('seal_blob', None) # type: Optional[bool] + immutability_policy_expiry = kwargs.pop('immutability_policy_expiry', None) # type: Optional[datetime.datetime] + immutability_policy_mode = kwargs.pop('immutability_policy_mode', None) # type: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] + legal_hold = kwargs.pop('legal_hold', None) # type: Optional[bool] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + if tier is not None: + _header_parameters['x-ms-access-tier'] = _SERIALIZER.header("tier", tier, 'str') + if rehydrate_priority is not None: + _header_parameters['x-ms-rehydrate-priority'] = _SERIALIZER.header("rehydrate_priority", rehydrate_priority, 'str') + if source_if_modified_since is not None: + _header_parameters['x-ms-source-if-modified-since'] = _SERIALIZER.header("source_if_modified_since", source_if_modified_since, 'rfc-1123') + if source_if_unmodified_since is not None: + _header_parameters['x-ms-source-if-unmodified-since'] = _SERIALIZER.header("source_if_unmodified_since", source_if_unmodified_since, 'rfc-1123') + if source_if_match is not None: + _header_parameters['x-ms-source-if-match'] = _SERIALIZER.header("source_if_match", source_if_match, 'str') + if source_if_none_match is not None: + _header_parameters['x-ms-source-if-none-match'] = _SERIALIZER.header("source_if_none_match", source_if_none_match, 'str') + if source_if_tags is not None: + _header_parameters['x-ms-source-if-tags'] = _SERIALIZER.header("source_if_tags", source_if_tags, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-copy-source'] = _SERIALIZER.header("copy_source", copy_source, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if blob_tags_string is not None: + _header_parameters['x-ms-tags'] = _SERIALIZER.header("blob_tags_string", blob_tags_string, 'str') + if seal_blob is not None: + _header_parameters['x-ms-seal-blob'] = _SERIALIZER.header("seal_blob", seal_blob, 'bool') + if immutability_policy_expiry is not None: + _header_parameters['x-ms-immutability-policy-until-date'] = _SERIALIZER.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') + if immutability_policy_mode is not None: + _header_parameters['x-ms-immutability-policy-mode'] = _SERIALIZER.header("immutability_policy_mode", immutability_policy_mode, 'str') + if legal_hold is not None: + _header_parameters['x-ms-legal-hold'] = _SERIALIZER.header("legal_hold", legal_hold, 'bool') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_copy_from_url_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + x_ms_requires_sync = kwargs.pop('x_ms_requires_sync', "true") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + copy_source = kwargs.pop('copy_source') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + tier = kwargs.pop('tier', None) # type: Optional[Union[str, "_models.AccessTierOptional"]] + source_if_modified_since = kwargs.pop('source_if_modified_since', None) # type: Optional[datetime.datetime] + source_if_unmodified_since = kwargs.pop('source_if_unmodified_since', None) # type: Optional[datetime.datetime] + source_if_match = kwargs.pop('source_if_match', None) # type: Optional[str] + source_if_none_match = kwargs.pop('source_if_none_match', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + source_content_md5 = kwargs.pop('source_content_md5', None) # type: Optional[bytearray] + blob_tags_string = kwargs.pop('blob_tags_string', None) # type: Optional[str] + immutability_policy_expiry = kwargs.pop('immutability_policy_expiry', None) # type: Optional[datetime.datetime] + immutability_policy_mode = kwargs.pop('immutability_policy_mode', None) # type: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] + legal_hold = kwargs.pop('legal_hold', None) # type: Optional[bool] + copy_source_authorization = kwargs.pop('copy_source_authorization', None) # type: Optional[str] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-requires-sync'] = _SERIALIZER.header("x_ms_requires_sync", x_ms_requires_sync, 'str') + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + if tier is not None: + _header_parameters['x-ms-access-tier'] = _SERIALIZER.header("tier", tier, 'str') + if source_if_modified_since is not None: + _header_parameters['x-ms-source-if-modified-since'] = _SERIALIZER.header("source_if_modified_since", source_if_modified_since, 'rfc-1123') + if source_if_unmodified_since is not None: + _header_parameters['x-ms-source-if-unmodified-since'] = _SERIALIZER.header("source_if_unmodified_since", source_if_unmodified_since, 'rfc-1123') + if source_if_match is not None: + _header_parameters['x-ms-source-if-match'] = _SERIALIZER.header("source_if_match", source_if_match, 'str') + if source_if_none_match is not None: + _header_parameters['x-ms-source-if-none-match'] = _SERIALIZER.header("source_if_none_match", source_if_none_match, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-copy-source'] = _SERIALIZER.header("copy_source", copy_source, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if source_content_md5 is not None: + _header_parameters['x-ms-source-content-md5'] = _SERIALIZER.header("source_content_md5", source_content_md5, 'bytearray') + if blob_tags_string is not None: + _header_parameters['x-ms-tags'] = _SERIALIZER.header("blob_tags_string", blob_tags_string, 'str') + if immutability_policy_expiry is not None: + _header_parameters['x-ms-immutability-policy-until-date'] = _SERIALIZER.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') + if immutability_policy_mode is not None: + _header_parameters['x-ms-immutability-policy-mode'] = _SERIALIZER.header("immutability_policy_mode", immutability_policy_mode, 'str') + if legal_hold is not None: + _header_parameters['x-ms-legal-hold'] = _SERIALIZER.header("legal_hold", legal_hold, 'bool') + if copy_source_authorization is not None: + _header_parameters['x-ms-copy-source-authorization'] = _SERIALIZER.header("copy_source_authorization", copy_source_authorization, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_abort_copy_from_url_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "copy") # type: str + copy_action_abort_constant = kwargs.pop('copy_action_abort_constant', "abort") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + copy_id = kwargs.pop('copy_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['copyid'] = _SERIALIZER.query("copy_id", copy_id, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-copy-action'] = _SERIALIZER.header("copy_action_abort_constant", copy_action_abort_constant, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_tier_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "tier") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + tier = kwargs.pop('tier') # type: Union[str, "_models.AccessTierRequired"] + snapshot = kwargs.pop('snapshot', None) # type: Optional[str] + version_id = kwargs.pop('version_id', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + rehydrate_priority = kwargs.pop('rehydrate_priority', None) # type: Optional[Union[str, "_models.RehydratePriority"]] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if snapshot is not None: + _query_parameters['snapshot'] = _SERIALIZER.query("snapshot", snapshot, 'str') + if version_id is not None: + _query_parameters['versionid'] = _SERIALIZER.query("version_id", version_id, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-access-tier'] = _SERIALIZER.header("tier", tier, 'str') + if rehydrate_priority is not None: + _header_parameters['x-ms-rehydrate-priority'] = _SERIALIZER.header("rehydrate_priority", rehydrate_priority, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_account_info_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "account") # type: str + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_query_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "query") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + snapshot = kwargs.pop('snapshot', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if snapshot is not None: + _query_parameters['snapshot'] = _SERIALIZER.query("snapshot", snapshot, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_tags_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "tags") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + snapshot = kwargs.pop('snapshot', None) # type: Optional[str] + version_id = kwargs.pop('version_id', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if snapshot is not None: + _query_parameters['snapshot'] = _SERIALIZER.query("snapshot", snapshot, 'str') + if version_id is not None: + _query_parameters['versionid'] = _SERIALIZER.query("version_id", version_id, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_tags_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "tags") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + version_id = kwargs.pop('version_id', None) # type: Optional[str] + transactional_content_md5 = kwargs.pop('transactional_content_md5', None) # type: Optional[bytearray] + transactional_content_crc64 = kwargs.pop('transactional_content_crc64', None) # type: Optional[bytearray] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if version_id is not None: + _query_parameters['versionid'] = _SERIALIZER.query("version_id", version_id, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if transactional_content_md5 is not None: + _header_parameters['Content-MD5'] = _SERIALIZER.header("transactional_content_md5", transactional_content_md5, 'bytearray') + if transactional_content_crc64 is not None: + _header_parameters['x-ms-content-crc64'] = _SERIALIZER.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class BlobOperations(object): # pylint: disable=too-many-public-methods """BlobOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -44,6 +1554,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def download( self, snapshot=None, # type: Optional[str] @@ -105,7 +1616,7 @@ def download( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -115,82 +1626,61 @@ def download( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - accept = "application/xml" - # Construct URL - url = self.download.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if version_id is not None: - query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if range_get_content_md5 is not None: - header_parameters['x-ms-range-get-content-md5'] = self._serialize.header("range_get_content_md5", range_get_content_md5, 'bool') - if range_get_content_crc64 is not None: - header_parameters['x-ms-range-get-content-crc64'] = self._serialize.header("range_get_content_crc64", range_get_content_crc64, 'bool') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + request = build_download_request( + url=self._config.url, + version=self._config.version, + snapshot=snapshot, + version_id=version_id, + timeout=timeout, + range=range, + lease_id=_lease_id, + range_get_content_md5=range_get_content_md5, + range_get_content_crc64=range_get_content_crc64, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.download.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=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 206]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} if response.status_code == 200: response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['x-ms-or-policy-id']=self._deserialize('str', response.headers.get('x-ms-or-policy-id')) - response_headers['x-ms-or']=self._deserialize('str', response.headers.get('x-ms-or')) + response_headers['x-ms-or']=self._deserialize('{str}', response.headers.get('x-ms-or')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range')) @@ -229,13 +1719,14 @@ def download( response_headers['x-ms-immutability-policy-until-date']=self._deserialize('rfc-1123', response.headers.get('x-ms-immutability-policy-until-date')) response_headers['x-ms-immutability-policy-mode']=self._deserialize('str', response.headers.get('x-ms-immutability-policy-mode')) response_headers['x-ms-legal-hold']=self._deserialize('bool', response.headers.get('x-ms-legal-hold')) + deserialized = response.stream_download(self._client._pipeline) if response.status_code == 206: response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['x-ms-or-policy-id']=self._deserialize('str', response.headers.get('x-ms-or-policy-id')) - response_headers['x-ms-or']=self._deserialize('str', response.headers.get('x-ms-or')) + response_headers['x-ms-or']=self._deserialize('{str}', response.headers.get('x-ms-or')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range')) @@ -275,15 +1766,19 @@ def download( response_headers['x-ms-immutability-policy-until-date']=self._deserialize('rfc-1123', response.headers.get('x-ms-immutability-policy-until-date')) response_headers['x-ms-immutability-policy-mode']=self._deserialize('str', response.headers.get('x-ms-immutability-policy-mode')) response_headers['x-ms-legal-hold']=self._deserialize('bool', response.headers.get('x-ms-legal-hold')) + deserialized = response.stream_download(self._client._pipeline) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - download.metadata = {'url': '/{containerName}/{blob}'} # type: ignore - def get_properties( + download.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + + @distributed_trace + def get_properties( # pylint: disable=inconsistent-return-statements self, snapshot=None, # type: Optional[str] version_id=None, # type: Optional[str] @@ -331,7 +1826,7 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -341,76 +1836,58 @@ def get_properties( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - accept = "application/xml" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if version_id is not None: - query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_properties_request( + url=self._config.url, + version=self._config.version, + snapshot=snapshot, + version_id=version_id, + timeout=timeout, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) response_headers['x-ms-creation-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-creation-time')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['x-ms-or-policy-id']=self._deserialize('str', response.headers.get('x-ms-or-policy-id')) - response_headers['x-ms-or']=self._deserialize('str', response.headers.get('x-ms-or')) + response_headers['x-ms-or']=self._deserialize('{str}', response.headers.get('x-ms-or')) response_headers['x-ms-blob-type']=self._deserialize('str', response.headers.get('x-ms-blob-type')) response_headers['x-ms-copy-completion-time']=self._deserialize('rfc-1123', response.headers.get('x-ms-copy-completion-time')) response_headers['x-ms-copy-status-description']=self._deserialize('str', response.headers.get('x-ms-copy-status-description')) @@ -456,12 +1933,15 @@ def get_properties( response_headers['x-ms-immutability-policy-mode']=self._deserialize('str', response.headers.get('x-ms-immutability-policy-mode')) response_headers['x-ms-legal-hold']=self._deserialize('bool', response.headers.get('x-ms-legal-hold')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + get_properties.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def delete( + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, snapshot=None, # type: Optional[str] version_id=None, # type: Optional[str] @@ -509,7 +1989,7 @@ def delete( limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str :param blob_delete_type: Optional. Only possible value is 'permanent', which specifies to - permanently delete a blob if blob soft delete is enabled. + permanently delete a blob if blob soft delete is enabled. The default value is "Permanent". :type blob_delete_type: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions @@ -525,7 +2005,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _if_modified_since = None _if_unmodified_since = None @@ -540,54 +2020,37 @@ def delete( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - accept = "application/xml" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if version_id is not None: - query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if blob_delete_type is not None: - query_parameters['deletetype'] = self._serialize.query("blob_delete_type", blob_delete_type, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if delete_snapshots is not None: - header_parameters['x-ms-delete-snapshots'] = self._serialize.header("delete_snapshots", delete_snapshots, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_delete_request( + url=self._config.url, + version=self._config.version, + snapshot=snapshot, + version_id=version_id, + timeout=timeout, + lease_id=_lease_id, + delete_snapshots=delete_snapshots, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + blob_delete_type=blob_delete_type, + template_url=self.delete.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -596,12 +2059,15 @@ def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + delete.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def undelete( + @distributed_trace + def undelete( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -618,6 +2084,9 @@ def undelete( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "undelete". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -628,36 +2097,31 @@ def undelete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "undelete" - accept = "application/xml" - # Construct URL - url = self.undelete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "undelete") # type: str + + + request = build_undelete_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.undelete.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -666,12 +2130,15 @@ def undelete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - undelete.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + undelete.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def set_expiry( + @distributed_trace + def set_expiry( # pylint: disable=inconsistent-return-statements self, expiry_options, # type: Union[str, "_models.BlobExpiryOptions"] timeout=None, # type: Optional[int] @@ -694,6 +2161,9 @@ def set_expiry( :type request_id_parameter: str :param expires_on: The time to set the blob to expiry. :type expires_on: str + :keyword comp: comp. The default value is "expiry". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -704,39 +2174,33 @@ def set_expiry( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "expiry" - accept = "application/xml" - # Construct URL - url = self.set_expiry.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-expiry-option'] = self._serialize.header("expiry_options", expiry_options, 'str') - if expires_on is not None: - header_parameters['x-ms-expiry-time'] = self._serialize.header("expires_on", expires_on, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "expiry") # type: str + + + request = build_set_expiry_request( + url=self._config.url, + comp=comp, + version=self._config.version, + expiry_options=expiry_options, + timeout=timeout, + request_id_parameter=request_id_parameter, + expires_on=expires_on, + template_url=self.set_expiry.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -747,12 +2211,15 @@ def set_expiry( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_expiry.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_expiry.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def set_http_headers( + @distributed_trace + def set_http_headers( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -778,6 +2245,9 @@ def set_http_headers( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -788,7 +2258,9 @@ def set_http_headers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "properties") # type: str + _blob_cache_control = None _blob_content_type = None _blob_content_md5 = None @@ -807,7 +2279,6 @@ def set_http_headers( _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language - _blob_content_disposition = blob_http_headers.blob_content_disposition if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: @@ -816,60 +2287,42 @@ def set_http_headers( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "properties" - accept = "application/xml" + if blob_http_headers is not None: + _blob_content_disposition = blob_http_headers.blob_content_disposition - # Construct URL - url = self.set_http_headers.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _blob_cache_control is not None: - header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", _blob_cache_control, 'str') - if _blob_content_type is not None: - header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", _blob_content_type, 'str') - if _blob_content_md5 is not None: - header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", _blob_content_md5, 'bytearray') - if _blob_content_encoding is not None: - header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", _blob_content_encoding, 'str') - if _blob_content_language is not None: - header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", _blob_content_language, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _blob_content_disposition is not None: - header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", _blob_content_disposition, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_http_headers_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + blob_cache_control=_blob_cache_control, + blob_content_type=_blob_content_type, + blob_content_md5=_blob_content_md5, + blob_content_encoding=_blob_content_encoding, + blob_content_language=_blob_content_language, + lease_id=_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + blob_content_disposition=_blob_content_disposition, + request_id_parameter=request_id_parameter, + template_url=self.set_http_headers.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -881,12 +2334,15 @@ def set_http_headers( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_http_headers.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_http_headers.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def set_immutability_policy( + + @distributed_trace + def set_immutability_policy( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -913,6 +2369,9 @@ def set_immutability_policy( :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "immutabilityPolicies". Note that overriding this + default value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -923,46 +2382,37 @@ def set_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "immutabilityPolicies") # type: str + _if_unmodified_since = None if modified_access_conditions is not None: _if_unmodified_since = modified_access_conditions.if_unmodified_since - comp = "immutabilityPolicies" - accept = "application/xml" - # Construct URL - url = self.set_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_immutability_policy_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + if_unmodified_since=_if_unmodified_since, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + template_url=self.set_immutability_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -973,12 +2423,15 @@ def set_immutability_policy( response_headers['x-ms-immutability-policy-until-date']=self._deserialize('rfc-1123', response.headers.get('x-ms-immutability-policy-until-date')) response_headers['x-ms-immutability-policy-mode']=self._deserialize('str', response.headers.get('x-ms-immutability-policy-mode')) + if cls: return cls(pipeline_response, None, response_headers) - set_immutability_policy.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_immutability_policy.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def delete_immutability_policy( + + @distributed_trace + def delete_immutability_policy( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -995,6 +2448,9 @@ def delete_immutability_policy( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "immutabilityPolicies". Note that overriding this + default value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1005,36 +2461,31 @@ def delete_immutability_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "immutabilityPolicies" - accept = "application/xml" - # Construct URL - url = self.delete_immutability_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "immutabilityPolicies") # type: str + + + request = build_delete_immutability_policy_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.delete_immutability_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1043,12 +2494,15 @@ def delete_immutability_policy( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete_immutability_policy.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + delete_immutability_policy.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def set_legal_hold( + + @distributed_trace + def set_legal_hold( # pylint: disable=inconsistent-return-statements self, legal_hold, # type: bool timeout=None, # type: Optional[int] @@ -1068,6 +2522,9 @@ def set_legal_hold( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "legalhold". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1078,37 +2535,32 @@ def set_legal_hold( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "legalhold" - accept = "application/xml" - # Construct URL - url = self.set_legal_hold.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "legalhold") # type: str + + + request = build_set_legal_hold_request( + url=self._config.url, + comp=comp, + version=self._config.version, + legal_hold=legal_hold, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.set_legal_hold.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1118,15 +2570,18 @@ def set_legal_hold( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-legal-hold']=self._deserialize('bool', response.headers.get('x-ms-legal-hold')) + if cls: return cls(pipeline_response, None, response_headers) - set_legal_hold.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_legal_hold.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def set_metadata( + + @distributed_trace + def set_metadata( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] request_id_parameter=None, # type: Optional[str] lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"] cpk_info=None, # type: Optional["_models.CpkInfo"] @@ -1150,7 +2605,7 @@ def set_metadata( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str @@ -1162,6 +2617,9 @@ def set_metadata( :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1172,7 +2630,9 @@ def set_metadata( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "metadata") # type: str + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -1183,72 +2643,53 @@ def set_metadata( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "metadata" - accept = "application/xml" - # Construct URL - url = self.set_metadata.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_metadata_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.set_metadata.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1263,12 +2704,15 @@ def set_metadata( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_metadata.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def acquire_lease( + + @distributed_trace + def acquire_lease( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] duration=None, # type: Optional[int] @@ -1299,6 +2743,12 @@ def acquire_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "acquire". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1309,7 +2759,10 @@ def acquire_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "acquire") # type: str + _if_modified_since = None _if_unmodified_since = None _if_match = None @@ -1321,52 +2774,36 @@ def acquire_lease( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "lease" - action = "acquire" - accept = "application/xml" - - # Construct URL - url = self.acquire_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if duration is not None: - header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_acquire_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + timeout=timeout, + duration=duration, + proposed_lease_id=proposed_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.acquire_lease.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1378,12 +2815,15 @@ def acquire_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + acquire_lease.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def release_lease( + @distributed_trace + def release_lease( # pylint: disable=inconsistent-return-statements self, lease_id, # type: str timeout=None, # type: Optional[int] @@ -1407,6 +2847,12 @@ def release_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "release". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1417,7 +2863,10 @@ def release_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "release") # type: str + _if_modified_since = None _if_unmodified_since = None _if_match = None @@ -1429,49 +2878,35 @@ def release_lease( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "lease" - action = "release" - accept = "application/xml" - - # Construct URL - url = self.release_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_release_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.release_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1482,12 +2917,15 @@ def release_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + release_lease.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def renew_lease( + @distributed_trace + def renew_lease( # pylint: disable=inconsistent-return-statements self, lease_id, # type: str timeout=None, # type: Optional[int] @@ -1511,6 +2949,12 @@ def renew_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "renew". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1521,7 +2965,10 @@ def renew_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "renew") # type: str + _if_modified_since = None _if_unmodified_since = None _if_match = None @@ -1533,49 +2980,35 @@ def renew_lease( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "lease" - action = "renew" - accept = "application/xml" - - # Construct URL - url = self.renew_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_renew_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.renew_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1587,12 +3020,15 @@ def renew_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + renew_lease.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def change_lease( + @distributed_trace + def change_lease( # pylint: disable=inconsistent-return-statements self, lease_id, # type: str proposed_lease_id, # type: str @@ -1621,6 +3057,12 @@ def change_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "change". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1631,7 +3073,10 @@ def change_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "change") # type: str + _if_modified_since = None _if_unmodified_since = None _if_match = None @@ -1643,50 +3088,36 @@ def change_lease( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "lease" - action = "change" - accept = "application/xml" - - # Construct URL - url = self.change_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_change_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + lease_id=lease_id, + proposed_lease_id=proposed_lease_id, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.change_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1698,12 +3129,15 @@ def change_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + change_lease.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def break_lease( + @distributed_trace + def break_lease( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] break_period=None, # type: Optional[int] @@ -1733,6 +3167,12 @@ def break_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "break". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1743,7 +3183,10 @@ def break_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "break") # type: str + _if_modified_since = None _if_unmodified_since = None _if_match = None @@ -1755,50 +3198,35 @@ def break_lease( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "lease" - action = "break" - accept = "application/xml" - - # Construct URL - url = self.break_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if break_period is not None: - header_parameters['x-ms-lease-break-period'] = self._serialize.header("break_period", break_period, 'int') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_break_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + timeout=timeout, + break_period=break_period, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.break_lease.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1810,15 +3238,18 @@ def break_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + break_lease.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def create_snapshot( + + @distributed_trace + def create_snapshot( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] request_id_parameter=None, # type: Optional[str] cpk_info=None, # type: Optional["_models.CpkInfo"] cpk_scope_info=None, # type: Optional["_models.CpkScopeInfo"] @@ -1841,7 +3272,7 @@ def create_snapshot( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str @@ -1853,6 +3284,9 @@ def create_snapshot( :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. The default value is "snapshot". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1863,7 +3297,9 @@ def create_snapshot( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "snapshot") # type: str + _encryption_key = None _encryption_key_sha256 = None _encryption_algorithm = None @@ -1880,66 +3316,47 @@ def create_snapshot( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "snapshot" - accept = "application/xml" + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id - # Construct URL - url = self.create_snapshot.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_create_snapshot_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.create_snapshot.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1953,16 +3370,19 @@ def create_snapshot( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - create_snapshot.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + create_snapshot.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def start_copy_from_url( + + @distributed_trace + def start_copy_from_url( # pylint: disable=inconsistent-return-statements self, copy_source, # type: str timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] tier=None, # type: Optional[Union[str, "_models.AccessTierOptional"]] rehydrate_priority=None, # type: Optional[Union[str, "_models.RehydratePriority"]] request_id_parameter=None, # type: Optional[str] @@ -1996,7 +3416,7 @@ def start_copy_from_url( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param tier: Optional. Indicates the tier to be set on the blob. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param rehydrate_priority: Optional: Indicates the priority with which to rehydrate an archived @@ -2018,7 +3438,8 @@ def start_copy_from_url( :param legal_hold: Specified if a legal hold should be set on the blob. :type legal_hold: bool :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.blob.models.SourceModifiedAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. @@ -2033,7 +3454,7 @@ def start_copy_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _source_if_modified_since = None _source_if_unmodified_since = None _source_if_match = None @@ -2045,87 +3466,61 @@ def start_copy_from_url( _if_none_match = None _if_tags = None _lease_id = None - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id - if modified_access_conditions is not None: - _if_modified_since = modified_access_conditions.if_modified_since - _if_unmodified_since = modified_access_conditions.if_unmodified_since - _if_match = modified_access_conditions.if_match - _if_none_match = modified_access_conditions.if_none_match - _if_tags = modified_access_conditions.if_tags if source_modified_access_conditions is not None: _source_if_modified_since = source_modified_access_conditions.source_if_modified_since _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since _source_if_match = source_modified_access_conditions.source_if_match _source_if_none_match = source_modified_access_conditions.source_if_none_match _source_if_tags = source_modified_access_conditions.source_if_tags - accept = "application/xml" + if modified_access_conditions is not None: + _if_modified_since = modified_access_conditions.if_modified_since + _if_unmodified_since = modified_access_conditions.if_unmodified_since + _if_match = modified_access_conditions.if_match + _if_none_match = modified_access_conditions.if_none_match + _if_tags = modified_access_conditions.if_tags + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id - # Construct URL - url = self.start_copy_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if rehydrate_priority is not None: - header_parameters['x-ms-rehydrate-priority'] = self._serialize.header("rehydrate_priority", rehydrate_priority, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - if _source_if_tags is not None: - header_parameters['x-ms-source-if-tags'] = self._serialize.header("source_if_tags", _source_if_tags, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - if seal_blob is not None: - header_parameters['x-ms-seal-blob'] = self._serialize.header("seal_blob", seal_blob, 'bool') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - if legal_hold is not None: - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_start_copy_from_url_request( + url=self._config.url, + version=self._config.version, + copy_source=copy_source, + timeout=timeout, + metadata=metadata, + tier=tier, + rehydrate_priority=rehydrate_priority, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + source_if_tags=_source_if_tags, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + blob_tags_string=blob_tags_string, + seal_blob=seal_blob, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + legal_hold=legal_hold, + template_url=self.start_copy_from_url.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -2139,16 +3534,19 @@ def start_copy_from_url( response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id')) response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status')) + if cls: return cls(pipeline_response, None, response_headers) - start_copy_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + start_copy_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def copy_from_url( + @distributed_trace + def copy_from_url( # pylint: disable=inconsistent-return-statements self, copy_source, # type: str timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] tier=None, # type: Optional[Union[str, "_models.AccessTierOptional"]] request_id_parameter=None, # type: Optional[str] source_content_md5=None, # type: Optional[bytearray] @@ -2184,7 +3582,7 @@ def copy_from_url( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param tier: Optional. Indicates the tier to be set on the blob. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -2206,13 +3604,18 @@ def copy_from_url( OAuth access token to copy source. :type copy_source_authorization: str :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.blob.models.SourceModifiedAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param cpk_scope_info: Parameter group. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo + :keyword x_ms_requires_sync: This header indicates that this is a synchronous Copy Blob From + URL instead of a Asynchronous Copy Blob. The default value is "true". Note that overriding this + default value may result in unsupported behavior. + :paramtype x_ms_requires_sync: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -2223,7 +3626,9 @@ def copy_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + x_ms_requires_sync = kwargs.pop('x_ms_requires_sync', "true") # type: str + _source_if_modified_since = None _source_if_unmodified_since = None _source_if_match = None @@ -2235,90 +3640,63 @@ def copy_from_url( _if_tags = None _lease_id = None _encryption_scope = None - if cpk_scope_info is not None: - _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id + if source_modified_access_conditions is not None: + _source_if_modified_since = source_modified_access_conditions.source_if_modified_since + _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since + _source_if_match = source_modified_access_conditions.source_if_match + _source_if_none_match = source_modified_access_conditions.source_if_none_match if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - if source_modified_access_conditions is not None: - _source_if_modified_since = source_modified_access_conditions.source_if_modified_since - _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since - _source_if_match = source_modified_access_conditions.source_if_match - _source_if_none_match = source_modified_access_conditions.source_if_none_match - x_ms_requires_sync = "true" - accept = "application/xml" + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + if cpk_scope_info is not None: + _encryption_scope = cpk_scope_info.encryption_scope - # Construct URL - url = self.copy_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-requires-sync'] = self._serialize.header("x_ms_requires_sync", x_ms_requires_sync, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if source_content_md5 is not None: - header_parameters['x-ms-source-content-md5'] = self._serialize.header("source_content_md5", source_content_md5, 'bytearray') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - if legal_hold is not None: - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - if copy_source_authorization is not None: - header_parameters['x-ms-copy-source-authorization'] = self._serialize.header("copy_source_authorization", copy_source_authorization, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_copy_from_url_request( + url=self._config.url, + x_ms_requires_sync=x_ms_requires_sync, + version=self._config.version, + copy_source=copy_source, + timeout=timeout, + metadata=metadata, + tier=tier, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + source_content_md5=source_content_md5, + blob_tags_string=blob_tags_string, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + legal_hold=legal_hold, + copy_source_authorization=copy_source_authorization, + encryption_scope=_encryption_scope, + template_url=self.copy_from_url.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -2335,12 +3713,15 @@ def copy_from_url( response_headers['x-ms-content-crc64']=self._deserialize('bytearray', response.headers.get('x-ms-content-crc64')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - copy_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + copy_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def abort_copy_from_url( + @distributed_trace + def abort_copy_from_url( # pylint: disable=inconsistent-return-statements self, copy_id, # type: str timeout=None, # type: Optional[int] @@ -2365,6 +3746,12 @@ def abort_copy_from_url( :type request_id_parameter: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. The default value is "copy". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword copy_action_abort_constant: Copy action. The default value is "abort". Note that + overriding this default value may result in unsupported behavior. + :paramtype copy_action_abort_constant: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -2375,45 +3762,38 @@ def abort_copy_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "copy") # type: str + copy_action_abort_constant = kwargs.pop('copy_action_abort_constant', "abort") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "copy" - copy_action_abort_constant = "abort" - accept = "application/xml" - - # Construct URL - url = self.abort_copy_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['copyid'] = self._serialize.query("copy_id", copy_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-copy-action'] = self._serialize.header("copy_action_abort_constant", copy_action_abort_constant, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_abort_copy_from_url_request( + url=self._config.url, + comp=comp, + copy_action_abort_constant=copy_action_abort_constant, + version=self._config.version, + copy_id=copy_id, + timeout=timeout, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.abort_copy_from_url.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -2422,12 +3802,15 @@ def abort_copy_from_url( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - abort_copy_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + abort_copy_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def set_tier( + + @distributed_trace + def set_tier( # pylint: disable=inconsistent-return-statements self, tier, # type: Union[str, "_models.AccessTierRequired"] snapshot=None, # type: Optional[str] @@ -2472,6 +3855,9 @@ def set_tier( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "tier". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -2482,54 +3868,43 @@ def set_tier( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "tier") # type: str + _lease_id = None _if_tags = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_tags = modified_access_conditions.if_tags - comp = "tier" - accept = "application/xml" - # Construct URL - url = self.set_tier.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if version_id is not None: - query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if rehydrate_priority is not None: - header_parameters['x-ms-rehydrate-priority'] = self._serialize.header("rehydrate_priority", rehydrate_priority, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_tier_request( + url=self._config.url, + comp=comp, + version=self._config.version, + tier=tier, + snapshot=snapshot, + version_id=version_id, + timeout=timeout, + rehydrate_priority=rehydrate_priority, + request_id_parameter=request_id_parameter, + lease_id=_lease_id, + if_tags=_if_tags, + template_url=self.set_tier.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 [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -2537,24 +3912,34 @@ def set_tier( response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if response.status_code == 202: response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - set_tier.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_tier.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def get_account_info( + + @distributed_trace + def get_account_info( # pylint: disable=inconsistent-return-statements self, **kwargs # type: Any ): # type: (...) -> None """Returns the sku name and account kind. + :keyword restype: restype. The default value is "account". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -2565,34 +3950,31 @@ def get_account_info( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "account" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.get_account_info.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') + restype = kwargs.pop('restype', "account") # type: str + comp = kwargs.pop('comp', "properties") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_get_account_info_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + template_url=self.get_account_info.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -2603,11 +3985,14 @@ def get_account_info( response_headers['x-ms-sku-name']=self._deserialize('str', response.headers.get('x-ms-sku-name')) response_headers['x-ms-account-kind']=self._deserialize('str', response.headers.get('x-ms-account-kind')) + if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + get_account_info.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + @distributed_trace def query( self, snapshot=None, # type: Optional[str] @@ -2645,6 +4030,9 @@ def query( :type cpk_info: ~azure.storage.blob.models.CpkInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "query". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IO, or the result of cls(response) :rtype: IO @@ -2655,7 +4043,10 @@ def query( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "query") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -2665,82 +4056,62 @@ def query( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "query" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.query.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if query_request is not None: - body_content = self._serialize.body(query_request, 'QueryRequest', is_xml=True) + _content = self._serialize.body(query_request, 'QueryRequest', is_xml=True) else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + _content = None + + request = build_query_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + snapshot=snapshot, + timeout=timeout, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.query.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=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 206]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} if response.status_code == 200: response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range')) @@ -2771,11 +4142,12 @@ def query( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) response_headers['x-ms-blob-content-md5']=self._deserialize('bytearray', response.headers.get('x-ms-blob-content-md5')) + deserialized = response.stream_download(self._client._pipeline) if response.status_code == 206: response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range')) @@ -2807,14 +4179,18 @@ def query( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) response_headers['x-ms-blob-content-md5']=self._deserialize('bytearray', response.headers.get('x-ms-blob-content-md5')) + deserialized = response.stream_download(self._client._pipeline) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - query.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + query.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + + @distributed_trace def get_tags( self, timeout=None, # type: Optional[int] @@ -2849,6 +4225,9 @@ def get_tags( :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. The default value is "tags". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BlobTags, or the result of cls(response) :rtype: ~azure.storage.blob.models.BlobTags @@ -2859,51 +4238,41 @@ def get_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "tags") # type: str + _if_tags = None _lease_id = None - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_tags = modified_access_conditions.if_tags - comp = "tags" - accept = "application/xml" + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id - # Construct URL - url = self.get_tags.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if version_id is not None: - query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_tags_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + snapshot=snapshot, + version_id=version_id, + if_tags=_if_tags, + lease_id=_lease_id, + template_url=self.get_tags.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -2911,15 +4280,19 @@ def get_tags( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('BlobTags', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_tags.metadata = {'url': '/{containerName}/{blob}'} # type: ignore - def set_tags( + get_tags.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + + @distributed_trace + def set_tags( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] version_id=None, # type: Optional[str] @@ -2957,6 +4330,9 @@ def set_tags( :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword comp: comp. The default value is "tags". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -2967,61 +4343,49 @@ def set_tags( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "tags") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + _if_tags = None _lease_id = None - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_tags = modified_access_conditions.if_tags - comp = "tags" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_tags.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if version_id is not None: - query_parameters['versionid'] = self._serialize.query("version_id", version_id, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - if transactional_content_crc64 is not None: - header_parameters['x-ms-content-crc64'] = self._serialize.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if tags is not None: - body_content = self._serialize.body(tags, 'BlobTags', is_xml=True) + _content = self._serialize.body(tags, 'BlobTags', is_xml=True) else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _content = None + + request = build_set_tags_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + version_id=version_id, + transactional_content_md5=transactional_content_md5, + transactional_content_crc64=transactional_content_crc64, + request_id_parameter=request_id_parameter, + if_tags=_if_tags, + lease_id=_lease_id, + template_url=self.set_tags.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -3030,7 +4394,9 @@ def set_tags( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_tags.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + set_tags.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py index 3cbe55e0be52..8b0e7656c967 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,21 +8,595 @@ # -------------------------------------------------------------------------- import datetime from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union - + from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_upload_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + blob_type = kwargs.pop('blob_type', "BlockBlob") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + content_length = kwargs.pop('content_length') # type: int + timeout = kwargs.pop('timeout', None) # type: Optional[int] + transactional_content_md5 = kwargs.pop('transactional_content_md5', None) # type: Optional[bytearray] + blob_content_type = kwargs.pop('blob_content_type', None) # type: Optional[str] + blob_content_encoding = kwargs.pop('blob_content_encoding', None) # type: Optional[str] + blob_content_language = kwargs.pop('blob_content_language', None) # type: Optional[str] + blob_content_md5 = kwargs.pop('blob_content_md5', None) # type: Optional[bytearray] + blob_cache_control = kwargs.pop('blob_cache_control', None) # type: Optional[str] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + blob_content_disposition = kwargs.pop('blob_content_disposition', None) # type: Optional[str] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + tier = kwargs.pop('tier', None) # type: Optional[Union[str, "_models.AccessTierOptional"]] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + blob_tags_string = kwargs.pop('blob_tags_string', None) # type: Optional[str] + immutability_policy_expiry = kwargs.pop('immutability_policy_expiry', None) # type: Optional[datetime.datetime] + immutability_policy_mode = kwargs.pop('immutability_policy_mode', None) # type: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] + legal_hold = kwargs.pop('legal_hold', None) # type: Optional[bool] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-blob-type'] = _SERIALIZER.header("blob_type", blob_type, 'str') + if transactional_content_md5 is not None: + _header_parameters['Content-MD5'] = _SERIALIZER.header("transactional_content_md5", transactional_content_md5, 'bytearray') + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + if blob_content_type is not None: + _header_parameters['x-ms-blob-content-type'] = _SERIALIZER.header("blob_content_type", blob_content_type, 'str') + if blob_content_encoding is not None: + _header_parameters['x-ms-blob-content-encoding'] = _SERIALIZER.header("blob_content_encoding", blob_content_encoding, 'str') + if blob_content_language is not None: + _header_parameters['x-ms-blob-content-language'] = _SERIALIZER.header("blob_content_language", blob_content_language, 'str') + if blob_content_md5 is not None: + _header_parameters['x-ms-blob-content-md5'] = _SERIALIZER.header("blob_content_md5", blob_content_md5, 'bytearray') + if blob_cache_control is not None: + _header_parameters['x-ms-blob-cache-control'] = _SERIALIZER.header("blob_cache_control", blob_cache_control, 'str') + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if blob_content_disposition is not None: + _header_parameters['x-ms-blob-content-disposition'] = _SERIALIZER.header("blob_content_disposition", blob_content_disposition, 'str') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if tier is not None: + _header_parameters['x-ms-access-tier'] = _SERIALIZER.header("tier", tier, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if blob_tags_string is not None: + _header_parameters['x-ms-tags'] = _SERIALIZER.header("blob_tags_string", blob_tags_string, 'str') + if immutability_policy_expiry is not None: + _header_parameters['x-ms-immutability-policy-until-date'] = _SERIALIZER.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') + if immutability_policy_mode is not None: + _header_parameters['x-ms-immutability-policy-mode'] = _SERIALIZER.header("immutability_policy_mode", immutability_policy_mode, 'str') + if legal_hold is not None: + _header_parameters['x-ms-legal-hold'] = _SERIALIZER.header("legal_hold", legal_hold, 'bool') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_put_blob_from_url_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + blob_type = kwargs.pop('blob_type', "BlockBlob") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_length = kwargs.pop('content_length') # type: int + copy_source = kwargs.pop('copy_source') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + transactional_content_md5 = kwargs.pop('transactional_content_md5', None) # type: Optional[bytearray] + blob_content_type = kwargs.pop('blob_content_type', None) # type: Optional[str] + blob_content_encoding = kwargs.pop('blob_content_encoding', None) # type: Optional[str] + blob_content_language = kwargs.pop('blob_content_language', None) # type: Optional[str] + blob_content_md5 = kwargs.pop('blob_content_md5', None) # type: Optional[bytearray] + blob_cache_control = kwargs.pop('blob_cache_control', None) # type: Optional[str] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + blob_content_disposition = kwargs.pop('blob_content_disposition', None) # type: Optional[str] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + tier = kwargs.pop('tier', None) # type: Optional[Union[str, "_models.AccessTierOptional"]] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + source_if_modified_since = kwargs.pop('source_if_modified_since', None) # type: Optional[datetime.datetime] + source_if_unmodified_since = kwargs.pop('source_if_unmodified_since', None) # type: Optional[datetime.datetime] + source_if_match = kwargs.pop('source_if_match', None) # type: Optional[str] + source_if_none_match = kwargs.pop('source_if_none_match', None) # type: Optional[str] + source_if_tags = kwargs.pop('source_if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + source_content_md5 = kwargs.pop('source_content_md5', None) # type: Optional[bytearray] + blob_tags_string = kwargs.pop('blob_tags_string', None) # type: Optional[str] + copy_source_blob_properties = kwargs.pop('copy_source_blob_properties', None) # type: Optional[bool] + copy_source_authorization = kwargs.pop('copy_source_authorization', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-blob-type'] = _SERIALIZER.header("blob_type", blob_type, 'str') + if transactional_content_md5 is not None: + _header_parameters['Content-MD5'] = _SERIALIZER.header("transactional_content_md5", transactional_content_md5, 'bytearray') + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + if blob_content_type is not None: + _header_parameters['x-ms-blob-content-type'] = _SERIALIZER.header("blob_content_type", blob_content_type, 'str') + if blob_content_encoding is not None: + _header_parameters['x-ms-blob-content-encoding'] = _SERIALIZER.header("blob_content_encoding", blob_content_encoding, 'str') + if blob_content_language is not None: + _header_parameters['x-ms-blob-content-language'] = _SERIALIZER.header("blob_content_language", blob_content_language, 'str') + if blob_content_md5 is not None: + _header_parameters['x-ms-blob-content-md5'] = _SERIALIZER.header("blob_content_md5", blob_content_md5, 'bytearray') + if blob_cache_control is not None: + _header_parameters['x-ms-blob-cache-control'] = _SERIALIZER.header("blob_cache_control", blob_cache_control, 'str') + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if blob_content_disposition is not None: + _header_parameters['x-ms-blob-content-disposition'] = _SERIALIZER.header("blob_content_disposition", blob_content_disposition, 'str') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if tier is not None: + _header_parameters['x-ms-access-tier'] = _SERIALIZER.header("tier", tier, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + if source_if_modified_since is not None: + _header_parameters['x-ms-source-if-modified-since'] = _SERIALIZER.header("source_if_modified_since", source_if_modified_since, 'rfc-1123') + if source_if_unmodified_since is not None: + _header_parameters['x-ms-source-if-unmodified-since'] = _SERIALIZER.header("source_if_unmodified_since", source_if_unmodified_since, 'rfc-1123') + if source_if_match is not None: + _header_parameters['x-ms-source-if-match'] = _SERIALIZER.header("source_if_match", source_if_match, 'str') + if source_if_none_match is not None: + _header_parameters['x-ms-source-if-none-match'] = _SERIALIZER.header("source_if_none_match", source_if_none_match, 'str') + if source_if_tags is not None: + _header_parameters['x-ms-source-if-tags'] = _SERIALIZER.header("source_if_tags", source_if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if source_content_md5 is not None: + _header_parameters['x-ms-source-content-md5'] = _SERIALIZER.header("source_content_md5", source_content_md5, 'bytearray') + if blob_tags_string is not None: + _header_parameters['x-ms-tags'] = _SERIALIZER.header("blob_tags_string", blob_tags_string, 'str') + _header_parameters['x-ms-copy-source'] = _SERIALIZER.header("copy_source", copy_source, 'str') + if copy_source_blob_properties is not None: + _header_parameters['x-ms-copy-source-blob-properties'] = _SERIALIZER.header("copy_source_blob_properties", copy_source_blob_properties, 'bool') + if copy_source_authorization is not None: + _header_parameters['x-ms-copy-source-authorization'] = _SERIALIZER.header("copy_source_authorization", copy_source_authorization, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stage_block_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "block") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + block_id = kwargs.pop('block_id') # type: str + content_length = kwargs.pop('content_length') # type: int + transactional_content_md5 = kwargs.pop('transactional_content_md5', None) # type: Optional[bytearray] + transactional_content_crc64 = kwargs.pop('transactional_content_crc64', None) # type: Optional[bytearray] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['blockid'] = _SERIALIZER.query("block_id", block_id, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + if transactional_content_md5 is not None: + _header_parameters['Content-MD5'] = _SERIALIZER.header("transactional_content_md5", transactional_content_md5, 'bytearray') + if transactional_content_crc64 is not None: + _header_parameters['x-ms-content-crc64'] = _SERIALIZER.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stage_block_from_url_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "block") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + block_id = kwargs.pop('block_id') # type: str + content_length = kwargs.pop('content_length') # type: int + source_url = kwargs.pop('source_url') # type: str + source_range = kwargs.pop('source_range', None) # type: Optional[str] + source_content_md5 = kwargs.pop('source_content_md5', None) # type: Optional[bytearray] + source_contentcrc64 = kwargs.pop('source_contentcrc64', None) # type: Optional[bytearray] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + source_if_modified_since = kwargs.pop('source_if_modified_since', None) # type: Optional[datetime.datetime] + source_if_unmodified_since = kwargs.pop('source_if_unmodified_since', None) # type: Optional[datetime.datetime] + source_if_match = kwargs.pop('source_if_match', None) # type: Optional[str] + source_if_none_match = kwargs.pop('source_if_none_match', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + copy_source_authorization = kwargs.pop('copy_source_authorization', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['blockid'] = _SERIALIZER.query("block_id", block_id, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + _header_parameters['x-ms-copy-source'] = _SERIALIZER.header("source_url", source_url, 'str') + if source_range is not None: + _header_parameters['x-ms-source-range'] = _SERIALIZER.header("source_range", source_range, 'str') + if source_content_md5 is not None: + _header_parameters['x-ms-source-content-md5'] = _SERIALIZER.header("source_content_md5", source_content_md5, 'bytearray') + if source_contentcrc64 is not None: + _header_parameters['x-ms-source-content-crc64'] = _SERIALIZER.header("source_contentcrc64", source_contentcrc64, 'bytearray') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if source_if_modified_since is not None: + _header_parameters['x-ms-source-if-modified-since'] = _SERIALIZER.header("source_if_modified_since", source_if_modified_since, 'rfc-1123') + if source_if_unmodified_since is not None: + _header_parameters['x-ms-source-if-unmodified-since'] = _SERIALIZER.header("source_if_unmodified_since", source_if_unmodified_since, 'rfc-1123') + if source_if_match is not None: + _header_parameters['x-ms-source-if-match'] = _SERIALIZER.header("source_if_match", source_if_match, 'str') + if source_if_none_match is not None: + _header_parameters['x-ms-source-if-none-match'] = _SERIALIZER.header("source_if_none_match", source_if_none_match, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if copy_source_authorization is not None: + _header_parameters['x-ms-copy-source-authorization'] = _SERIALIZER.header("copy_source_authorization", copy_source_authorization, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_commit_block_list_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "blocklist") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + blob_cache_control = kwargs.pop('blob_cache_control', None) # type: Optional[str] + blob_content_type = kwargs.pop('blob_content_type', None) # type: Optional[str] + blob_content_encoding = kwargs.pop('blob_content_encoding', None) # type: Optional[str] + blob_content_language = kwargs.pop('blob_content_language', None) # type: Optional[str] + blob_content_md5 = kwargs.pop('blob_content_md5', None) # type: Optional[bytearray] + transactional_content_md5 = kwargs.pop('transactional_content_md5', None) # type: Optional[bytearray] + transactional_content_crc64 = kwargs.pop('transactional_content_crc64', None) # type: Optional[bytearray] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + blob_content_disposition = kwargs.pop('blob_content_disposition', None) # type: Optional[str] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + tier = kwargs.pop('tier', None) # type: Optional[Union[str, "_models.AccessTierOptional"]] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + blob_tags_string = kwargs.pop('blob_tags_string', None) # type: Optional[str] + immutability_policy_expiry = kwargs.pop('immutability_policy_expiry', None) # type: Optional[datetime.datetime] + immutability_policy_mode = kwargs.pop('immutability_policy_mode', None) # type: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] + legal_hold = kwargs.pop('legal_hold', None) # type: Optional[bool] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if blob_cache_control is not None: + _header_parameters['x-ms-blob-cache-control'] = _SERIALIZER.header("blob_cache_control", blob_cache_control, 'str') + if blob_content_type is not None: + _header_parameters['x-ms-blob-content-type'] = _SERIALIZER.header("blob_content_type", blob_content_type, 'str') + if blob_content_encoding is not None: + _header_parameters['x-ms-blob-content-encoding'] = _SERIALIZER.header("blob_content_encoding", blob_content_encoding, 'str') + if blob_content_language is not None: + _header_parameters['x-ms-blob-content-language'] = _SERIALIZER.header("blob_content_language", blob_content_language, 'str') + if blob_content_md5 is not None: + _header_parameters['x-ms-blob-content-md5'] = _SERIALIZER.header("blob_content_md5", blob_content_md5, 'bytearray') + if transactional_content_md5 is not None: + _header_parameters['Content-MD5'] = _SERIALIZER.header("transactional_content_md5", transactional_content_md5, 'bytearray') + if transactional_content_crc64 is not None: + _header_parameters['x-ms-content-crc64'] = _SERIALIZER.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if blob_content_disposition is not None: + _header_parameters['x-ms-blob-content-disposition'] = _SERIALIZER.header("blob_content_disposition", blob_content_disposition, 'str') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if tier is not None: + _header_parameters['x-ms-access-tier'] = _SERIALIZER.header("tier", tier, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if blob_tags_string is not None: + _header_parameters['x-ms-tags'] = _SERIALIZER.header("blob_tags_string", blob_tags_string, 'str') + if immutability_policy_expiry is not None: + _header_parameters['x-ms-immutability-policy-until-date'] = _SERIALIZER.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') + if immutability_policy_mode is not None: + _header_parameters['x-ms-immutability-policy-mode'] = _SERIALIZER.header("immutability_policy_mode", immutability_policy_mode, 'str') + if legal_hold is not None: + _header_parameters['x-ms-legal-hold'] = _SERIALIZER.header("legal_hold", legal_hold, 'bool') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_block_list_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "blocklist") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + snapshot = kwargs.pop('snapshot', None) # type: Optional[str] + list_type = kwargs.pop('list_type', "committed") # type: Union[str, "_models.BlockListType"] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if snapshot is not None: + _query_parameters['snapshot'] = _SERIALIZER.query("snapshot", snapshot, 'str') + _query_parameters['blocklisttype'] = _SERIALIZER.query("list_type", list_type, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class BlockBlobOperations(object): """BlockBlobOperations operations. @@ -44,13 +619,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def upload( + @distributed_trace + def upload( # pylint: disable=inconsistent-return-statements self, content_length, # type: int body, # type: IO timeout=None, # type: Optional[int] transactional_content_md5=None, # type: Optional[bytearray] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] tier=None, # type: Optional[Union[str, "_models.AccessTierOptional"]] request_id_parameter=None, # type: Optional[str] blob_tags_string=None, # type: Optional[str] @@ -90,7 +666,7 @@ def upload( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param tier: Optional. Indicates the tier to be set on the blob. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -115,6 +691,10 @@ def upload( :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append + blob. The default value is "BlockBlob". Note that overriding this default value may result in + unsupported behavior. + :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -125,7 +705,10 @@ def upload( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + blob_type = kwargs.pop('blob_type', "BlockBlob") # type: str + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] + _blob_content_type = None _blob_content_encoding = None _blob_content_language = None @@ -148,6 +731,9 @@ def upload( _blob_content_language = blob_http_headers.blob_content_language _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_cache_control = blob_http_headers.blob_cache_control + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + if blob_http_headers is not None: _blob_content_disposition = blob_http_headers.blob_content_disposition if cpk_info is not None: _encryption_key = cpk_info.encryption_key @@ -155,95 +741,61 @@ def upload( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - blob_type = "BlockBlob" - content_type = kwargs.pop("content_type", "application/octet-stream") - accept = "application/xml" - - # Construct URL - url = self.upload.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-blob-type'] = self._serialize.header("blob_type", blob_type, 'str') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if _blob_content_type is not None: - header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", _blob_content_type, 'str') - if _blob_content_encoding is not None: - header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", _blob_content_encoding, 'str') - if _blob_content_language is not None: - header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", _blob_content_language, 'str') - if _blob_content_md5 is not None: - header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", _blob_content_md5, 'bytearray') - if _blob_cache_control is not None: - header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", _blob_cache_control, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _blob_content_disposition is not None: - header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", _blob_content_disposition, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - if legal_hold is not None: - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = body - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _content = body + + request = build_upload_request( + url=self._config.url, + blob_type=blob_type, + version=self._config.version, + content_type=content_type, + content=_content, + content_length=content_length, + timeout=timeout, + transactional_content_md5=transactional_content_md5, + blob_content_type=_blob_content_type, + blob_content_encoding=_blob_content_encoding, + blob_content_language=_blob_content_language, + blob_content_md5=_blob_content_md5, + blob_cache_control=_blob_cache_control, + metadata=metadata, + lease_id=_lease_id, + blob_content_disposition=_blob_content_disposition, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + tier=tier, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + blob_tags_string=blob_tags_string, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + legal_hold=legal_hold, + template_url=self.upload.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -259,18 +811,21 @@ def upload( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - upload.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + upload.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def put_blob_from_url( + @distributed_trace + def put_blob_from_url( # pylint: disable=inconsistent-return-statements self, content_length, # type: int copy_source, # type: str timeout=None, # type: Optional[int] transactional_content_md5=None, # type: Optional[bytearray] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] tier=None, # type: Optional[Union[str, "_models.AccessTierOptional"]] request_id_parameter=None, # type: Optional[str] source_content_md5=None, # type: Optional[bytearray] @@ -314,7 +869,7 @@ def put_blob_from_url( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param tier: Optional. Indicates the tier to be set on the blob. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -342,7 +897,12 @@ def put_blob_from_url( :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append + blob. The default value is "BlockBlob". Note that overriding this default value may result in + unsupported behavior. + :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -353,7 +913,9 @@ def put_blob_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + blob_type = kwargs.pop('blob_type', "BlockBlob") # type: str + _blob_content_type = None _blob_content_encoding = None _blob_content_language = None @@ -381,6 +943,9 @@ def put_blob_from_url( _blob_content_language = blob_http_headers.blob_content_language _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_cache_control = blob_http_headers.blob_cache_control + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + if blob_http_headers is not None: _blob_content_disposition = blob_http_headers.blob_content_disposition if cpk_info is not None: _encryption_key = cpk_info.encryption_key @@ -388,8 +953,6 @@ def put_blob_from_url( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since @@ -402,94 +965,58 @@ def put_blob_from_url( _source_if_match = source_modified_access_conditions.source_if_match _source_if_none_match = source_modified_access_conditions.source_if_none_match _source_if_tags = source_modified_access_conditions.source_if_tags - blob_type = "BlockBlob" - accept = "application/xml" - # Construct URL - url = self.put_blob_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-blob-type'] = self._serialize.header("blob_type", blob_type, 'str') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if _blob_content_type is not None: - header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", _blob_content_type, 'str') - if _blob_content_encoding is not None: - header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", _blob_content_encoding, 'str') - if _blob_content_language is not None: - header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", _blob_content_language, 'str') - if _blob_content_md5 is not None: - header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", _blob_content_md5, 'bytearray') - if _blob_cache_control is not None: - header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", _blob_cache_control, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _blob_content_disposition is not None: - header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", _blob_content_disposition, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - if _source_if_tags is not None: - header_parameters['x-ms-source-if-tags'] = self._serialize.header("source_if_tags", _source_if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if source_content_md5 is not None: - header_parameters['x-ms-source-content-md5'] = self._serialize.header("source_content_md5", source_content_md5, 'bytearray') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') - if copy_source_blob_properties is not None: - header_parameters['x-ms-copy-source-blob-properties'] = self._serialize.header("copy_source_blob_properties", copy_source_blob_properties, 'bool') - if copy_source_authorization is not None: - header_parameters['x-ms-copy-source-authorization'] = self._serialize.header("copy_source_authorization", copy_source_authorization, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_put_blob_from_url_request( + url=self._config.url, + blob_type=blob_type, + version=self._config.version, + content_length=content_length, + copy_source=copy_source, + timeout=timeout, + transactional_content_md5=transactional_content_md5, + blob_content_type=_blob_content_type, + blob_content_encoding=_blob_content_encoding, + blob_content_language=_blob_content_language, + blob_content_md5=_blob_content_md5, + blob_cache_control=_blob_cache_control, + metadata=metadata, + lease_id=_lease_id, + blob_content_disposition=_blob_content_disposition, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + tier=tier, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + source_if_tags=_source_if_tags, + request_id_parameter=request_id_parameter, + source_content_md5=source_content_md5, + blob_tags_string=blob_tags_string, + copy_source_blob_properties=copy_source_blob_properties, + copy_source_authorization=copy_source_authorization, + template_url=self.put_blob_from_url.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -505,12 +1032,15 @@ def put_blob_from_url( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - put_blob_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + put_blob_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def stage_block( + @distributed_trace + def stage_block( # pylint: disable=inconsistent-return-statements self, block_id, # type: str content_length, # type: int @@ -555,6 +1085,9 @@ def stage_block( :type cpk_info: ~azure.storage.blob.models.CpkInfo :param cpk_scope_info: Parameter group. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo + :keyword comp: comp. The default value is "block". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -565,70 +1098,57 @@ def stage_block( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "block") # type: str + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] + _lease_id = None _encryption_key = None _encryption_key_sha256 = None _encryption_algorithm = None _encryption_scope = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id - comp = "block" - content_type = kwargs.pop("content_type", "application/octet-stream") - accept = "application/xml" - - # Construct URL - url = self.stage_block.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['blockid'] = self._serialize.query("block_id", block_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - if transactional_content_crc64 is not None: - header_parameters['x-ms-content-crc64'] = self._serialize.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = body - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _content = body + + request = build_stage_block_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + block_id=block_id, + content_length=content_length, + transactional_content_md5=transactional_content_md5, + transactional_content_crc64=transactional_content_crc64, + timeout=timeout, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + request_id_parameter=request_id_parameter, + template_url=self.stage_block.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -642,12 +1162,15 @@ def stage_block( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - stage_block.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + stage_block.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def stage_block_from_url( + + @distributed_trace + def stage_block_from_url( # pylint: disable=inconsistent-return-statements self, block_id, # type: str content_length, # type: int @@ -702,7 +1225,11 @@ def stage_block_from_url( :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword comp: comp. The default value is "block". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -713,7 +1240,9 @@ def stage_block_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "block") # type: str + _encryption_key = None _encryption_key_sha256 = None _encryption_algorithm = None @@ -736,65 +1265,44 @@ def stage_block_from_url( _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since _source_if_match = source_modified_access_conditions.source_if_match _source_if_none_match = source_modified_access_conditions.source_if_none_match - comp = "block" - accept = "application/xml" - # Construct URL - url = self.stage_block_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['blockid'] = self._serialize.query("block_id", block_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - header_parameters['x-ms-copy-source'] = self._serialize.header("source_url", source_url, 'str') - if source_range is not None: - header_parameters['x-ms-source-range'] = self._serialize.header("source_range", source_range, 'str') - if source_content_md5 is not None: - header_parameters['x-ms-source-content-md5'] = self._serialize.header("source_content_md5", source_content_md5, 'bytearray') - if source_contentcrc64 is not None: - header_parameters['x-ms-source-content-crc64'] = self._serialize.header("source_contentcrc64", source_contentcrc64, 'bytearray') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if copy_source_authorization is not None: - header_parameters['x-ms-copy-source-authorization'] = self._serialize.header("copy_source_authorization", copy_source_authorization, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_stage_block_from_url_request( + url=self._config.url, + comp=comp, + version=self._config.version, + block_id=block_id, + content_length=content_length, + source_url=source_url, + source_range=source_range, + source_content_md5=source_content_md5, + source_contentcrc64=source_contentcrc64, + timeout=timeout, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + lease_id=_lease_id, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + request_id_parameter=request_id_parameter, + copy_source_authorization=copy_source_authorization, + template_url=self.stage_block_from_url.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -808,18 +1316,21 @@ def stage_block_from_url( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - stage_block_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + stage_block_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def commit_block_list( + @distributed_trace + def commit_block_list( # pylint: disable=inconsistent-return-statements self, blocks, # type: "_models.BlockLookupList" timeout=None, # type: Optional[int] transactional_content_md5=None, # type: Optional[bytearray] transactional_content_crc64=None, # type: Optional[bytearray] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] tier=None, # type: Optional[Union[str, "_models.AccessTierOptional"]] request_id_parameter=None, # type: Optional[str] blob_tags_string=None, # type: Optional[str] @@ -862,7 +1373,7 @@ def commit_block_list( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param tier: Optional. Indicates the tier to be set on the blob. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character @@ -887,6 +1398,9 @@ def commit_block_list( :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "blocklist". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -897,7 +1411,10 @@ def commit_block_list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "blocklist") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + _blob_cache_control = None _blob_content_type = None _blob_content_encoding = None @@ -920,6 +1437,9 @@ def commit_block_list( _blob_content_encoding = blob_http_headers.blob_content_encoding _blob_content_language = blob_http_headers.blob_content_language _blob_content_md5 = blob_http_headers.blob_content_md5 + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + if blob_http_headers is not None: _blob_content_disposition = blob_http_headers.blob_content_disposition if cpk_info is not None: _encryption_key = cpk_info.encryption_key @@ -927,97 +1447,61 @@ def commit_block_list( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "blocklist" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.commit_block_list.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _blob_cache_control is not None: - header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", _blob_cache_control, 'str') - if _blob_content_type is not None: - header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", _blob_content_type, 'str') - if _blob_content_encoding is not None: - header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", _blob_content_encoding, 'str') - if _blob_content_language is not None: - header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", _blob_content_language, 'str') - if _blob_content_md5 is not None: - header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", _blob_content_md5, 'bytearray') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - if transactional_content_crc64 is not None: - header_parameters['x-ms-content-crc64'] = self._serialize.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _blob_content_disposition is not None: - header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", _blob_content_disposition, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - if legal_hold is not None: - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(blocks, 'BlockLookupList', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _content = self._serialize.body(blocks, 'BlockLookupList', is_xml=True) + + request = build_commit_block_list_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + blob_cache_control=_blob_cache_control, + blob_content_type=_blob_content_type, + blob_content_encoding=_blob_content_encoding, + blob_content_language=_blob_content_language, + blob_content_md5=_blob_content_md5, + transactional_content_md5=transactional_content_md5, + transactional_content_crc64=transactional_content_crc64, + metadata=metadata, + lease_id=_lease_id, + blob_content_disposition=_blob_content_disposition, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + tier=tier, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + blob_tags_string=blob_tags_string, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + legal_hold=legal_hold, + template_url=self.commit_block_list.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1034,11 +1518,14 @@ def commit_block_list( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - commit_block_list.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + commit_block_list.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + @distributed_trace def get_block_list( self, snapshot=None, # type: Optional[str] @@ -1074,6 +1561,9 @@ def get_block_list( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "blocklist". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BlockList, or the result of cls(response) :rtype: ~azure.storage.blob.models.BlockList @@ -1084,50 +1574,41 @@ def get_block_list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "blocklist") # type: str + _lease_id = None _if_tags = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_tags = modified_access_conditions.if_tags - comp = "blocklist" - accept = "application/xml" - # Construct URL - url = self.get_block_list.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - query_parameters['blocklisttype'] = self._serialize.query("list_type", list_type, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_block_list_request( + url=self._config.url, + comp=comp, + version=self._config.version, + snapshot=snapshot, + list_type=list_type, + timeout=timeout, + lease_id=_lease_id, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.get_block_list.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1139,10 +1620,13 @@ def get_block_list( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('BlockList', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_block_list.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + + get_block_list.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py index c9f8080eebf6..e92b12f34c1e 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,21 +8,948 @@ # -------------------------------------------------------------------------- import datetime from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, List, Optional, TypeVar, Union - + from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "container") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + access = kwargs.pop('access', None) # type: Optional[Union[str, "_models.PublicAccessType"]] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + default_encryption_scope = kwargs.pop('default_encryption_scope', None) # type: Optional[str] + prevent_encryption_scope_override = kwargs.pop('prevent_encryption_scope_override', None) # type: Optional[bool] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + if access is not None: + _header_parameters['x-ms-blob-public-access'] = _SERIALIZER.header("access", access, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if default_encryption_scope is not None: + _header_parameters['x-ms-default-encryption-scope'] = _SERIALIZER.header("default_encryption_scope", default_encryption_scope, 'str') + if prevent_encryption_scope_override is not None: + _header_parameters['x-ms-deny-encryption-scope-override'] = _SERIALIZER.header("prevent_encryption_scope_override", prevent_encryption_scope_override, 'bool') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "container") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "container") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_metadata_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "metadata") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_access_policy_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "acl") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_access_policy_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "acl") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + access = kwargs.pop('access', None) # type: Optional[Union[str, "_models.PublicAccessType"]] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if access is not None: + _header_parameters['x-ms-blob-public-access'] = _SERIALIZER.header("access", access, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_restore_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "undelete") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + deleted_container_name = kwargs.pop('deleted_container_name', None) # type: Optional[str] + deleted_container_version = kwargs.pop('deleted_container_version', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if deleted_container_name is not None: + _header_parameters['x-ms-deleted-container-name'] = _SERIALIZER.header("deleted_container_name", deleted_container_name, 'str') + if deleted_container_version is not None: + _header_parameters['x-ms-deleted-container-version'] = _SERIALIZER.header("deleted_container_version", deleted_container_version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_rename_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "rename") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + source_container_name = kwargs.pop('source_container_name') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + source_lease_id = kwargs.pop('source_lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-source-container-name'] = _SERIALIZER.header("source_container_name", source_container_name, 'str') + if source_lease_id is not None: + _header_parameters['x-ms-source-lease-id'] = _SERIALIZER.header("source_lease_id", source_lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_submit_batch_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + multipart_content_type = kwargs.pop('multipart_content_type') # type: str + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "batch") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_length = kwargs.pop('content_length') # type: int + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + _header_parameters['Content-Type'] = _SERIALIZER.header("multipart_content_type", multipart_content_type, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_filter_blobs_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "blobs") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + where = kwargs.pop('where', None) # type: Optional[str] + marker = kwargs.pop('marker', None) # type: Optional[str] + maxresults = kwargs.pop('maxresults', None) # type: Optional[int] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if where is not None: + _query_parameters['where'] = _SERIALIZER.query("where", where, 'str') + if marker is not None: + _query_parameters['marker'] = _SERIALIZER.query("marker", marker, 'str') + if maxresults is not None: + _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', minimum=1) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_acquire_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "acquire") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + duration = kwargs.pop('duration', None) # type: Optional[int] + proposed_lease_id = kwargs.pop('proposed_lease_id', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + if duration is not None: + _header_parameters['x-ms-lease-duration'] = _SERIALIZER.header("duration", duration, 'int') + if proposed_lease_id is not None: + _header_parameters['x-ms-proposed-lease-id'] = _SERIALIZER.header("proposed_lease_id", proposed_lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_release_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "release") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + lease_id = kwargs.pop('lease_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_renew_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "renew") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + lease_id = kwargs.pop('lease_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_break_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "break") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + break_period = kwargs.pop('break_period', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + if break_period is not None: + _header_parameters['x-ms-lease-break-period'] = _SERIALIZER.header("break_period", break_period, 'int') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_change_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "change") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + lease_id = kwargs.pop('lease_id') # type: str + proposed_lease_id = kwargs.pop('proposed_lease_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['x-ms-proposed-lease-id'] = _SERIALIZER.header("proposed_lease_id", proposed_lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_blob_flat_segment_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "list") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + prefix = kwargs.pop('prefix', None) # type: Optional[str] + marker = kwargs.pop('marker', None) # type: Optional[str] + maxresults = kwargs.pop('maxresults', None) # type: Optional[int] + include = kwargs.pop('include', None) # type: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if prefix is not None: + _query_parameters['prefix'] = _SERIALIZER.query("prefix", prefix, 'str') + if marker is not None: + _query_parameters['marker'] = _SERIALIZER.query("marker", marker, 'str') + if maxresults is not None: + _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', minimum=1) + if include is not None: + _query_parameters['include'] = _SERIALIZER.query("include", include, '[str]', div=',') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_blob_hierarchy_segment_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "list") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + delimiter = kwargs.pop('delimiter') # type: str + prefix = kwargs.pop('prefix', None) # type: Optional[str] + marker = kwargs.pop('marker', None) # type: Optional[str] + maxresults = kwargs.pop('maxresults', None) # type: Optional[int] + include = kwargs.pop('include', None) # type: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if prefix is not None: + _query_parameters['prefix'] = _SERIALIZER.query("prefix", prefix, 'str') + _query_parameters['delimiter'] = _SERIALIZER.query("delimiter", delimiter, 'str') + if marker is not None: + _query_parameters['marker'] = _SERIALIZER.query("marker", marker, 'str') + if maxresults is not None: + _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', minimum=1) + if include is not None: + _query_parameters['include'] = _SERIALIZER.query("include", include, '[str]', div=',') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_account_info_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "account") # type: str + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class ContainerOperations(object): """ContainerOperations operations. @@ -44,10 +972,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def create( + @distributed_trace + def create( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] access=None, # type: Optional[Union[str, "_models.PublicAccessType"]] request_id_parameter=None, # type: Optional[str] container_cpk_scope_info=None, # type: Optional["_models.ContainerCpkScopeInfo"] @@ -69,7 +998,7 @@ def create( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param access: Specifies whether data in the container may be accessed publicly and the level of access. :type access: str or ~azure.storage.blob.models.PublicAccessType @@ -78,6 +1007,9 @@ def create( :type request_id_parameter: str :param container_cpk_scope_info: Parameter group. :type container_cpk_scope_info: ~azure.storage.blob.models.ContainerCpkScopeInfo + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -88,50 +1020,40 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "container") # type: str + _default_encryption_scope = None _prevent_encryption_scope_override = None if container_cpk_scope_info is not None: _default_encryption_scope = container_cpk_scope_info.default_encryption_scope _prevent_encryption_scope_override = container_cpk_scope_info.prevent_encryption_scope_override - restype = "container" - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if access is not None: - header_parameters['x-ms-blob-public-access'] = self._serialize.header("access", access, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if _default_encryption_scope is not None: - header_parameters['x-ms-default-encryption-scope'] = self._serialize.header("default_encryption_scope", _default_encryption_scope, 'str') - if _prevent_encryption_scope_override is not None: - header_parameters['x-ms-deny-encryption-scope-override'] = self._serialize.header("prevent_encryption_scope_override", _prevent_encryption_scope_override, 'bool') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_create_request( + url=self._config.url, + restype=restype, + version=self._config.version, + timeout=timeout, + metadata=metadata, + access=access, + request_id_parameter=request_id_parameter, + default_encryption_scope=_default_encryption_scope, + prevent_encryption_scope_override=_prevent_encryption_scope_override, + template_url=self.create.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -142,12 +1064,15 @@ def create( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{containerName}'} # type: ignore + create.metadata = {'url': "{url}/{containerName}"} # type: ignore + - def get_properties( + @distributed_trace + def get_properties( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -168,6 +1093,9 @@ def get_properties( :type request_id_parameter: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -178,46 +1106,39 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "container") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "container" - accept = "application/xml" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_properties_request( + url=self._config.url, + restype=restype, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration')) @@ -234,12 +1155,15 @@ def get_properties( response_headers['x-ms-deny-encryption-scope-override']=self._deserialize('bool', response.headers.get('x-ms-deny-encryption-scope-override')) response_headers['x-ms-immutable-storage-with-versioning-enabled']=self._deserialize('bool', response.headers.get('x-ms-immutable-storage-with-versioning-enabled')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{containerName}'} # type: ignore + get_properties.metadata = {'url': "{url}/{containerName}"} # type: ignore + - def delete( + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -263,6 +1187,9 @@ def delete( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -273,7 +1200,9 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "container") # type: str + _lease_id = None _if_modified_since = None _if_unmodified_since = None @@ -282,42 +1211,31 @@ def delete( if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - restype = "container" - accept = "application/xml" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_delete_request( + url=self._config.url, + restype=restype, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.delete.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -326,15 +1244,18 @@ def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{containerName}'} # type: ignore + delete.metadata = {'url': "{url}/{containerName}"} # type: ignore - def set_metadata( + + @distributed_trace + def set_metadata( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] request_id_parameter=None, # type: Optional[str] lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"] modified_access_conditions=None, # type: Optional["_models.ModifiedAccessConditions"] @@ -355,7 +1276,7 @@ def set_metadata( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str @@ -363,6 +1284,12 @@ def set_metadata( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -373,51 +1300,42 @@ def set_metadata( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "metadata") # type: str + _lease_id = None _if_modified_since = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since - restype = "container" - comp = "metadata" - accept = "application/xml" - - # Construct URL - url = self.set_metadata.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_set_metadata_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + metadata=metadata, + if_modified_since=_if_modified_since, + request_id_parameter=request_id_parameter, + template_url=self.set_metadata.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -428,11 +1346,14 @@ def set_metadata( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {'url': '/{containerName}'} # type: ignore + set_metadata.metadata = {'url': "{url}/{containerName}"} # type: ignore + + @distributed_trace def get_access_policy( self, timeout=None, # type: Optional[int] @@ -454,6 +1375,12 @@ def get_access_policy( :type request_id_parameter: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "acl". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier, or the result of cls(response) :rtype: list[~azure.storage.blob.models.SignedIdentifier] @@ -464,44 +1391,37 @@ def get_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "acl") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "container" - comp = "acl" - accept = "application/xml" - - # Construct URL - url = self.get_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_get_access_policy_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.get_access_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -512,15 +1432,19 @@ def get_access_policy( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[SignedIdentifier]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_access_policy.metadata = {'url': '/{containerName}'} # type: ignore - def set_access_policy( + get_access_policy.metadata = {'url': "{url}/{containerName}"} # type: ignore + + + @distributed_trace + def set_access_policy( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] access=None, # type: Optional[Union[str, "_models.PublicAccessType"]] @@ -551,6 +1475,12 @@ def set_access_policy( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "acl". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -561,7 +1491,11 @@ def set_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "acl") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + _lease_id = None _if_modified_since = None _if_unmodified_since = None @@ -570,55 +1504,40 @@ def set_access_policy( if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - restype = "container" - comp = "acl" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if access is not None: - header_parameters['x-ms-blob-public-access'] = self._serialize.header("access", access, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'wrapped': True, 'itemsName': 'SignedIdentifier'}} + serialization_ctxt = {"xml": {'name': 'SignedIdentifiers', 'wrapped': True, 'itemsName': 'SignedIdentifier'}} if container_acl is not None: - body_content = self._serialize.body(container_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) + _content = self._serialize.body(container_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _content = None + + request = build_set_access_policy_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + lease_id=_lease_id, + access=access, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.set_access_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -629,12 +1548,15 @@ def set_access_policy( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_access_policy.metadata = {'url': '/{containerName}'} # type: ignore + set_access_policy.metadata = {'url': "{url}/{containerName}"} # type: ignore - def restore( + + @distributed_trace + def restore( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -659,6 +1581,12 @@ def restore( :param deleted_container_version: Optional. Version 2019-12-12 and later. Specifies the version of the deleted container to restore. :type deleted_container_version: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "undelete". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -669,42 +1597,35 @@ def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "container" - comp = "undelete" - accept = "application/xml" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if deleted_container_name is not None: - header_parameters['x-ms-deleted-container-name'] = self._serialize.header("deleted_container_name", deleted_container_name, 'str') - if deleted_container_version is not None: - header_parameters['x-ms-deleted-container-version'] = self._serialize.header("deleted_container_version", deleted_container_version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "undelete") # type: str + + + request = build_restore_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + deleted_container_name=deleted_container_name, + deleted_container_version=deleted_container_version, + template_url=self.restore.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -713,12 +1634,15 @@ def restore( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - restore.metadata = {'url': '/{containerName}'} # type: ignore + restore.metadata = {'url': "{url}/{containerName}"} # type: ignore + - def rename( + @distributed_trace + def rename( # pylint: disable=inconsistent-return-statements self, source_container_name, # type: str timeout=None, # type: Optional[int] @@ -742,6 +1666,12 @@ def rename( :param source_lease_id: A lease ID for the source path. If specified, the source path must have an active lease and the lease ID must match. :type source_lease_id: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "rename". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -752,41 +1682,35 @@ def rename( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "container" - comp = "rename" - accept = "application/xml" - - # Construct URL - url = self.rename.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-source-container-name'] = self._serialize.header("source_container_name", source_container_name, 'str') - if source_lease_id is not None: - header_parameters['x-ms-source-lease-id'] = self._serialize.header("source_lease_id", source_lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "rename") # type: str + + + request = build_rename_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + source_container_name=source_container_name, + timeout=timeout, + request_id_parameter=request_id_parameter, + source_lease_id=source_lease_id, + template_url=self.rename.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -795,15 +1719,17 @@ def rename( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - rename.metadata = {'url': '/{containerName}'} # type: ignore + rename.metadata = {'url': "{url}/{containerName}"} # type: ignore + + @distributed_trace def submit_batch( self, content_length, # type: int - multipart_content_type, # type: str body, # type: IO timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -814,9 +1740,6 @@ def submit_batch( :param content_length: The length of the request. :type content_length: long - :param multipart_content_type: Required. The value of this header must be multipart/mixed with - a batch boundary. Example header value: multipart/mixed; boundary=batch_:code:``. - :type multipart_content_type: str :param body: Initial data. :type body: IO :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -827,6 +1750,15 @@ def submit_batch( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword multipart_content_type: Required. The value of this header must be multipart/mixed + with a batch boundary. Example header value: multipart/mixed; boundary=batch_:code:``. + :paramtype multipart_content_type: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "batch". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IO, or the result of cls(response) :rtype: IO @@ -837,59 +1769,56 @@ def submit_batch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "container" - comp = "batch" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.submit_batch.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - header_parameters['Content-Type'] = self._serialize.header("multipart_content_type", multipart_content_type, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'IO', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + + multipart_content_type = kwargs.pop('multipart_content_type') # type: str + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "batch") # type: str + + _content = self._serialize.body(body, 'IO') + + request = build_submit_batch_request( + url=self._config.url, + multipart_content_type=multipart_content_type, + restype=restype, + comp=comp, + version=self._config.version, + content=_content, + content_length=content_length, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.submit_batch.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=True, + **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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = response.stream_download(self._client._pipeline) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - submit_batch.metadata = {'url': '/{containerName}'} # type: ignore + submit_batch.metadata = {'url': "{url}/{containerName}"} # type: ignore + + + @distributed_trace def filter_blobs( self, timeout=None, # type: Optional[int] @@ -928,6 +1857,12 @@ def filter_blobs( it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000. :type maxresults: int + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "blobs". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FilterBlobSegment, or the result of cls(response) :rtype: ~azure.storage.blob.models.FilterBlobSegment @@ -938,44 +1873,36 @@ def filter_blobs( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "container" - comp = "blobs" - accept = "application/xml" - - # Construct URL - url = self.filter_blobs.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if where is not None: - query_parameters['where'] = self._serialize.query("where", where, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "blobs") # type: str + + + request = build_filter_blobs_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + where=where, + marker=marker, + maxresults=maxresults, + template_url=self.filter_blobs.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -983,15 +1910,19 @@ def filter_blobs( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('FilterBlobSegment', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - filter_blobs.metadata = {'url': '/{containerName}'} # type: ignore - def acquire_lease( + filter_blobs.metadata = {'url': "{url}/{containerName}"} # type: ignore + + + @distributed_trace + def acquire_lease( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] duration=None, # type: Optional[int] @@ -1022,6 +1953,15 @@ def acquire_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword action: Describes what lease action to take. The default value is "acquire". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1032,54 +1972,44 @@ def acquire_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "acquire") # type: str + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - comp = "lease" - restype = "container" - action = "acquire" - accept = "application/xml" - - # Construct URL - url = self.acquire_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if duration is not None: - header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_acquire_lease_request( + url=self._config.url, + comp=comp, + restype=restype, + action=action, + version=self._config.version, + timeout=timeout, + duration=duration, + proposed_lease_id=proposed_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.acquire_lease.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1091,12 +2021,15 @@ def acquire_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {'url': '/{containerName}'} # type: ignore + acquire_lease.metadata = {'url': "{url}/{containerName}"} # type: ignore + - def release_lease( + @distributed_trace + def release_lease( # pylint: disable=inconsistent-return-statements self, lease_id, # type: str timeout=None, # type: Optional[int] @@ -1120,6 +2053,15 @@ def release_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword action: Describes what lease action to take. The default value is "release". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1130,51 +2072,43 @@ def release_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "release") # type: str + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - comp = "lease" - restype = "container" - action = "release" - accept = "application/xml" - - # Construct URL - url = self.release_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_release_lease_request( + url=self._config.url, + comp=comp, + restype=restype, + action=action, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.release_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1185,12 +2119,15 @@ def release_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {'url': '/{containerName}'} # type: ignore + release_lease.metadata = {'url': "{url}/{containerName}"} # type: ignore + - def renew_lease( + @distributed_trace + def renew_lease( # pylint: disable=inconsistent-return-statements self, lease_id, # type: str timeout=None, # type: Optional[int] @@ -1214,6 +2151,15 @@ def renew_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword action: Describes what lease action to take. The default value is "renew". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1224,51 +2170,43 @@ def renew_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "renew") # type: str + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - comp = "lease" - restype = "container" - action = "renew" - accept = "application/xml" - - # Construct URL - url = self.renew_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_renew_lease_request( + url=self._config.url, + comp=comp, + restype=restype, + action=action, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.renew_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1280,12 +2218,15 @@ def renew_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {'url': '/{containerName}'} # type: ignore + renew_lease.metadata = {'url': "{url}/{containerName}"} # type: ignore - def break_lease( + + @distributed_trace + def break_lease( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] break_period=None, # type: Optional[int] @@ -1315,6 +2256,15 @@ def break_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword action: Describes what lease action to take. The default value is "break". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1325,52 +2275,43 @@ def break_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "break") # type: str + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - comp = "lease" - restype = "container" - action = "break" - accept = "application/xml" - - # Construct URL - url = self.break_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if break_period is not None: - header_parameters['x-ms-lease-break-period'] = self._serialize.header("break_period", break_period, 'int') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_break_lease_request( + url=self._config.url, + comp=comp, + restype=restype, + action=action, + version=self._config.version, + timeout=timeout, + break_period=break_period, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.break_lease.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1382,12 +2323,15 @@ def break_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {'url': '/{containerName}'} # type: ignore + break_lease.metadata = {'url': "{url}/{containerName}"} # type: ignore - def change_lease( + + @distributed_trace + def change_lease( # pylint: disable=inconsistent-return-statements self, lease_id, # type: str proposed_lease_id, # type: str @@ -1416,6 +2360,15 @@ def change_lease( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword action: Describes what lease action to take. The default value is "change". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1426,52 +2379,44 @@ def change_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + restype = kwargs.pop('restype', "container") # type: str + action = kwargs.pop('action', "change") # type: str + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - comp = "lease" - restype = "container" - action = "change" - accept = "application/xml" - - # Construct URL - url = self.change_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_change_lease_request( + url=self._config.url, + comp=comp, + restype=restype, + action=action, + version=self._config.version, + lease_id=lease_id, + proposed_lease_id=proposed_lease_id, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.change_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1483,11 +2428,14 @@ def change_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {'url': '/{containerName}'} # type: ignore + change_lease.metadata = {'url': "{url}/{containerName}"} # type: ignore + + @distributed_trace def list_blob_flat_segment( self, prefix=None, # type: Optional[str] @@ -1529,6 +2477,12 @@ def list_blob_flat_segment( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListBlobsFlatSegmentResponse, or the result of cls(response) :rtype: ~azure.storage.blob.models.ListBlobsFlatSegmentResponse @@ -1539,46 +2493,37 @@ def list_blob_flat_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "container" - comp = "list" - accept = "application/xml" - - # Construct URL - url = self.list_blob_flat_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if include is not None: - query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "list") # type: str + + + request = build_list_blob_flat_segment_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + prefix=prefix, + marker=marker, + maxresults=maxresults, + include=include, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.list_blob_flat_segment.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1587,14 +2532,18 @@ def list_blob_flat_segment( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ListBlobsFlatSegmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_blob_flat_segment.metadata = {'url': '/{containerName}'} # type: ignore + list_blob_flat_segment.metadata = {'url': "{url}/{containerName}"} # type: ignore + + + @distributed_trace def list_blob_hierarchy_segment( self, delimiter, # type: str @@ -1642,6 +2591,12 @@ def list_blob_hierarchy_segment( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "container". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListBlobsHierarchySegmentResponse, or the result of cls(response) :rtype: ~azure.storage.blob.models.ListBlobsHierarchySegmentResponse @@ -1652,47 +2607,38 @@ def list_blob_hierarchy_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "container" - comp = "list" - accept = "application/xml" - - # Construct URL - url = self.list_blob_hierarchy_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - query_parameters['delimiter'] = self._serialize.query("delimiter", delimiter, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if include is not None: - query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "list") # type: str + + + request = build_list_blob_hierarchy_segment_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + delimiter=delimiter, + prefix=prefix, + marker=marker, + maxresults=maxresults, + include=include, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.list_blob_hierarchy_segment.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1701,21 +2647,31 @@ def list_blob_hierarchy_segment( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ListBlobsHierarchySegmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_blob_hierarchy_segment.metadata = {'url': '/{containerName}'} # type: ignore - def get_account_info( + list_blob_hierarchy_segment.metadata = {'url': "{url}/{containerName}"} # type: ignore + + + @distributed_trace + def get_account_info( # pylint: disable=inconsistent-return-statements self, **kwargs # type: Any ): # type: (...) -> None """Returns the sku name and account kind. + :keyword restype: restype. The default value is "account". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1726,34 +2682,31 @@ def get_account_info( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "account" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.get_account_info.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + restype = kwargs.pop('restype', "account") # type: str + comp = kwargs.pop('comp', "properties") # type: str - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_get_account_info_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + template_url=self.get_account_info.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1764,7 +2717,9 @@ def get_account_info( response_headers['x-ms-sku-name']=self._deserialize('str', response.headers.get('x-ms-sku-name')) response_headers['x-ms-account-kind']=self._deserialize('str', response.headers.get('x-ms-account-kind')) + if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {'url': '/{containerName}'} # type: ignore + get_account_info.metadata = {'url': "{url}/{containerName}"} # type: ignore + diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py index c953df2b9a7c..364e589f72e1 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,21 +8,767 @@ # -------------------------------------------------------------------------- import datetime from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union - + from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + blob_type = kwargs.pop('blob_type', "PageBlob") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_length = kwargs.pop('content_length') # type: int + blob_content_length = kwargs.pop('blob_content_length') # type: int + timeout = kwargs.pop('timeout', None) # type: Optional[int] + tier = kwargs.pop('tier', None) # type: Optional[Union[str, "_models.PremiumPageBlobAccessTier"]] + blob_content_type = kwargs.pop('blob_content_type', None) # type: Optional[str] + blob_content_encoding = kwargs.pop('blob_content_encoding', None) # type: Optional[str] + blob_content_language = kwargs.pop('blob_content_language', None) # type: Optional[str] + blob_content_md5 = kwargs.pop('blob_content_md5', None) # type: Optional[bytearray] + blob_cache_control = kwargs.pop('blob_cache_control', None) # type: Optional[str] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + blob_content_disposition = kwargs.pop('blob_content_disposition', None) # type: Optional[str] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + blob_sequence_number = kwargs.pop('blob_sequence_number', 0) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + blob_tags_string = kwargs.pop('blob_tags_string', None) # type: Optional[str] + immutability_policy_expiry = kwargs.pop('immutability_policy_expiry', None) # type: Optional[datetime.datetime] + immutability_policy_mode = kwargs.pop('immutability_policy_mode', None) # type: Optional[Union[str, "_models.BlobImmutabilityPolicyMode"]] + legal_hold = kwargs.pop('legal_hold', None) # type: Optional[bool] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-blob-type'] = _SERIALIZER.header("blob_type", blob_type, 'str') + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + if tier is not None: + _header_parameters['x-ms-access-tier'] = _SERIALIZER.header("tier", tier, 'str') + if blob_content_type is not None: + _header_parameters['x-ms-blob-content-type'] = _SERIALIZER.header("blob_content_type", blob_content_type, 'str') + if blob_content_encoding is not None: + _header_parameters['x-ms-blob-content-encoding'] = _SERIALIZER.header("blob_content_encoding", blob_content_encoding, 'str') + if blob_content_language is not None: + _header_parameters['x-ms-blob-content-language'] = _SERIALIZER.header("blob_content_language", blob_content_language, 'str') + if blob_content_md5 is not None: + _header_parameters['x-ms-blob-content-md5'] = _SERIALIZER.header("blob_content_md5", blob_content_md5, 'bytearray') + if blob_cache_control is not None: + _header_parameters['x-ms-blob-cache-control'] = _SERIALIZER.header("blob_cache_control", blob_cache_control, 'str') + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if blob_content_disposition is not None: + _header_parameters['x-ms-blob-content-disposition'] = _SERIALIZER.header("blob_content_disposition", blob_content_disposition, 'str') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-blob-content-length'] = _SERIALIZER.header("blob_content_length", blob_content_length, 'long') + if blob_sequence_number is not None: + _header_parameters['x-ms-blob-sequence-number'] = _SERIALIZER.header("blob_sequence_number", blob_sequence_number, 'long') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if blob_tags_string is not None: + _header_parameters['x-ms-tags'] = _SERIALIZER.header("blob_tags_string", blob_tags_string, 'str') + if immutability_policy_expiry is not None: + _header_parameters['x-ms-immutability-policy-until-date'] = _SERIALIZER.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') + if immutability_policy_mode is not None: + _header_parameters['x-ms-immutability-policy-mode'] = _SERIALIZER.header("immutability_policy_mode", immutability_policy_mode, 'str') + if legal_hold is not None: + _header_parameters['x-ms-legal-hold'] = _SERIALIZER.header("legal_hold", legal_hold, 'bool') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_upload_pages_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "page") # type: str + page_write = kwargs.pop('page_write', "update") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + content_length = kwargs.pop('content_length') # type: int + transactional_content_md5 = kwargs.pop('transactional_content_md5', None) # type: Optional[bytearray] + transactional_content_crc64 = kwargs.pop('transactional_content_crc64', None) # type: Optional[bytearray] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + range = kwargs.pop('range', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + if_sequence_number_less_than_or_equal_to = kwargs.pop('if_sequence_number_less_than_or_equal_to', None) # type: Optional[int] + if_sequence_number_less_than = kwargs.pop('if_sequence_number_less_than', None) # type: Optional[int] + if_sequence_number_equal_to = kwargs.pop('if_sequence_number_equal_to', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-page-write'] = _SERIALIZER.header("page_write", page_write, 'str') + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + if transactional_content_md5 is not None: + _header_parameters['Content-MD5'] = _SERIALIZER.header("transactional_content_md5", transactional_content_md5, 'bytearray') + if transactional_content_crc64 is not None: + _header_parameters['x-ms-content-crc64'] = _SERIALIZER.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') + if range is not None: + _header_parameters['x-ms-range'] = _SERIALIZER.header("range", range, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if if_sequence_number_less_than_or_equal_to is not None: + _header_parameters['x-ms-if-sequence-number-le'] = _SERIALIZER.header("if_sequence_number_less_than_or_equal_to", if_sequence_number_less_than_or_equal_to, 'long') + if if_sequence_number_less_than is not None: + _header_parameters['x-ms-if-sequence-number-lt'] = _SERIALIZER.header("if_sequence_number_less_than", if_sequence_number_less_than, 'long') + if if_sequence_number_equal_to is not None: + _header_parameters['x-ms-if-sequence-number-eq'] = _SERIALIZER.header("if_sequence_number_equal_to", if_sequence_number_equal_to, 'long') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_clear_pages_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "page") # type: str + page_write = kwargs.pop('page_write', "clear") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_length = kwargs.pop('content_length') # type: int + timeout = kwargs.pop('timeout', None) # type: Optional[int] + range = kwargs.pop('range', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + if_sequence_number_less_than_or_equal_to = kwargs.pop('if_sequence_number_less_than_or_equal_to', None) # type: Optional[int] + if_sequence_number_less_than = kwargs.pop('if_sequence_number_less_than', None) # type: Optional[int] + if_sequence_number_equal_to = kwargs.pop('if_sequence_number_equal_to', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-page-write'] = _SERIALIZER.header("page_write", page_write, 'str') + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + if range is not None: + _header_parameters['x-ms-range'] = _SERIALIZER.header("range", range, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if if_sequence_number_less_than_or_equal_to is not None: + _header_parameters['x-ms-if-sequence-number-le'] = _SERIALIZER.header("if_sequence_number_less_than_or_equal_to", if_sequence_number_less_than_or_equal_to, 'long') + if if_sequence_number_less_than is not None: + _header_parameters['x-ms-if-sequence-number-lt'] = _SERIALIZER.header("if_sequence_number_less_than", if_sequence_number_less_than, 'long') + if if_sequence_number_equal_to is not None: + _header_parameters['x-ms-if-sequence-number-eq'] = _SERIALIZER.header("if_sequence_number_equal_to", if_sequence_number_equal_to, 'long') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_upload_pages_from_url_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "page") # type: str + page_write = kwargs.pop('page_write', "update") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + source_url = kwargs.pop('source_url') # type: str + source_range = kwargs.pop('source_range') # type: str + content_length = kwargs.pop('content_length') # type: int + range = kwargs.pop('range') # type: str + source_content_md5 = kwargs.pop('source_content_md5', None) # type: Optional[bytearray] + source_contentcrc64 = kwargs.pop('source_contentcrc64', None) # type: Optional[bytearray] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + if_sequence_number_less_than_or_equal_to = kwargs.pop('if_sequence_number_less_than_or_equal_to', None) # type: Optional[int] + if_sequence_number_less_than = kwargs.pop('if_sequence_number_less_than', None) # type: Optional[int] + if_sequence_number_equal_to = kwargs.pop('if_sequence_number_equal_to', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + source_if_modified_since = kwargs.pop('source_if_modified_since', None) # type: Optional[datetime.datetime] + source_if_unmodified_since = kwargs.pop('source_if_unmodified_since', None) # type: Optional[datetime.datetime] + source_if_match = kwargs.pop('source_if_match', None) # type: Optional[str] + source_if_none_match = kwargs.pop('source_if_none_match', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + copy_source_authorization = kwargs.pop('copy_source_authorization', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-page-write'] = _SERIALIZER.header("page_write", page_write, 'str') + _header_parameters['x-ms-copy-source'] = _SERIALIZER.header("source_url", source_url, 'str') + _header_parameters['x-ms-source-range'] = _SERIALIZER.header("source_range", source_range, 'str') + if source_content_md5 is not None: + _header_parameters['x-ms-source-content-md5'] = _SERIALIZER.header("source_content_md5", source_content_md5, 'bytearray') + if source_contentcrc64 is not None: + _header_parameters['x-ms-source-content-crc64'] = _SERIALIZER.header("source_contentcrc64", source_contentcrc64, 'bytearray') + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + _header_parameters['x-ms-range'] = _SERIALIZER.header("range", range, 'str') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_sequence_number_less_than_or_equal_to is not None: + _header_parameters['x-ms-if-sequence-number-le'] = _SERIALIZER.header("if_sequence_number_less_than_or_equal_to", if_sequence_number_less_than_or_equal_to, 'long') + if if_sequence_number_less_than is not None: + _header_parameters['x-ms-if-sequence-number-lt'] = _SERIALIZER.header("if_sequence_number_less_than", if_sequence_number_less_than, 'long') + if if_sequence_number_equal_to is not None: + _header_parameters['x-ms-if-sequence-number-eq'] = _SERIALIZER.header("if_sequence_number_equal_to", if_sequence_number_equal_to, 'long') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + if source_if_modified_since is not None: + _header_parameters['x-ms-source-if-modified-since'] = _SERIALIZER.header("source_if_modified_since", source_if_modified_since, 'rfc-1123') + if source_if_unmodified_since is not None: + _header_parameters['x-ms-source-if-unmodified-since'] = _SERIALIZER.header("source_if_unmodified_since", source_if_unmodified_since, 'rfc-1123') + if source_if_match is not None: + _header_parameters['x-ms-source-if-match'] = _SERIALIZER.header("source_if_match", source_if_match, 'str') + if source_if_none_match is not None: + _header_parameters['x-ms-source-if-none-match'] = _SERIALIZER.header("source_if_none_match", source_if_none_match, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if copy_source_authorization is not None: + _header_parameters['x-ms-copy-source-authorization'] = _SERIALIZER.header("copy_source_authorization", copy_source_authorization, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_page_ranges_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "pagelist") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + snapshot = kwargs.pop('snapshot', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + range = kwargs.pop('range', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if snapshot is not None: + _query_parameters['snapshot'] = _SERIALIZER.query("snapshot", snapshot, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if range is not None: + _header_parameters['x-ms-range'] = _SERIALIZER.header("range", range, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_page_ranges_diff_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "pagelist") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + snapshot = kwargs.pop('snapshot', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + prevsnapshot = kwargs.pop('prevsnapshot', None) # type: Optional[str] + prev_snapshot_url = kwargs.pop('prev_snapshot_url', None) # type: Optional[str] + range = kwargs.pop('range', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if snapshot is not None: + _query_parameters['snapshot'] = _SERIALIZER.query("snapshot", snapshot, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if prevsnapshot is not None: + _query_parameters['prevsnapshot'] = _SERIALIZER.query("prevsnapshot", prevsnapshot, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if prev_snapshot_url is not None: + _header_parameters['x-ms-previous-snapshot-url'] = _SERIALIZER.header("prev_snapshot_url", prev_snapshot_url, 'str') + if range is not None: + _header_parameters['x-ms-range'] = _SERIALIZER.header("range", range, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_resize_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + blob_content_length = kwargs.pop('blob_content_length') # type: int + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + encryption_key = kwargs.pop('encryption_key', None) # type: Optional[str] + encryption_key_sha256 = kwargs.pop('encryption_key_sha256', None) # type: Optional[str] + encryption_algorithm = kwargs.pop('encryption_algorithm', None) # type: Optional[Union[str, "_models.EncryptionAlgorithmType"]] + encryption_scope = kwargs.pop('encryption_scope', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if encryption_key is not None: + _header_parameters['x-ms-encryption-key'] = _SERIALIZER.header("encryption_key", encryption_key, 'str') + if encryption_key_sha256 is not None: + _header_parameters['x-ms-encryption-key-sha256'] = _SERIALIZER.header("encryption_key_sha256", encryption_key_sha256, 'str') + if encryption_algorithm is not None: + _header_parameters['x-ms-encryption-algorithm'] = _SERIALIZER.header("encryption_algorithm", encryption_algorithm, 'str') + if encryption_scope is not None: + _header_parameters['x-ms-encryption-scope'] = _SERIALIZER.header("encryption_scope", encryption_scope, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-blob-content-length'] = _SERIALIZER.header("blob_content_length", blob_content_length, 'long') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_sequence_number_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + sequence_number_action = kwargs.pop('sequence_number_action') # type: Union[str, "_models.SequenceNumberActionType"] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + blob_sequence_number = kwargs.pop('blob_sequence_number', 0) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-sequence-number-action'] = _SERIALIZER.header("sequence_number_action", sequence_number_action, 'str') + if blob_sequence_number is not None: + _header_parameters['x-ms-blob-sequence-number'] = _SERIALIZER.header("blob_sequence_number", blob_sequence_number, 'long') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_copy_incremental_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "incrementalcopy") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + copy_source = kwargs.pop('copy_source') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_tags = kwargs.pop('if_tags', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{containerName}/{blob}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_tags is not None: + _header_parameters['x-ms-if-tags'] = _SERIALIZER.header("if_tags", if_tags, 'str') + _header_parameters['x-ms-copy-source'] = _SERIALIZER.header("copy_source", copy_source, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class PageBlobOperations(object): """PageBlobOperations operations. @@ -44,13 +791,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def create( + @distributed_trace + def create( # pylint: disable=inconsistent-return-statements self, content_length, # type: int blob_content_length, # type: int timeout=None, # type: Optional[int] tier=None, # type: Optional[Union[str, "_models.PremiumPageBlobAccessTier"]] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] blob_sequence_number=0, # type: Optional[int] request_id_parameter=None, # type: Optional[str] blob_tags_string=None, # type: Optional[str] @@ -86,7 +834,7 @@ def create( file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - :type metadata: str + :type metadata: dict[str, str] :param blob_sequence_number: Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. @@ -113,6 +861,10 @@ def create( :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append + blob. The default value is "PageBlob". Note that overriding this default value may result in + unsupported behavior. + :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -123,7 +875,9 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + blob_type = kwargs.pop('blob_type', "PageBlob") # type: str + _blob_content_type = None _blob_content_encoding = None _blob_content_language = None @@ -146,6 +900,9 @@ def create( _blob_content_language = blob_http_headers.blob_content_language _blob_content_md5 = blob_http_headers.blob_content_md5 _blob_cache_control = blob_http_headers.blob_cache_control + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + if blob_http_headers is not None: _blob_content_disposition = blob_http_headers.blob_content_disposition if cpk_info is not None: _encryption_key = cpk_info.encryption_key @@ -153,92 +910,59 @@ def create( _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - blob_type = "PageBlob" - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-blob-type'] = self._serialize.header("blob_type", blob_type, 'str') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("tier", tier, 'str') - if _blob_content_type is not None: - header_parameters['x-ms-blob-content-type'] = self._serialize.header("blob_content_type", _blob_content_type, 'str') - if _blob_content_encoding is not None: - header_parameters['x-ms-blob-content-encoding'] = self._serialize.header("blob_content_encoding", _blob_content_encoding, 'str') - if _blob_content_language is not None: - header_parameters['x-ms-blob-content-language'] = self._serialize.header("blob_content_language", _blob_content_language, 'str') - if _blob_content_md5 is not None: - header_parameters['x-ms-blob-content-md5'] = self._serialize.header("blob_content_md5", _blob_content_md5, 'bytearray') - if _blob_cache_control is not None: - header_parameters['x-ms-blob-cache-control'] = self._serialize.header("blob_cache_control", _blob_cache_control, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _blob_content_disposition is not None: - header_parameters['x-ms-blob-content-disposition'] = self._serialize.header("blob_content_disposition", _blob_content_disposition, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-blob-content-length'] = self._serialize.header("blob_content_length", blob_content_length, 'long') - if blob_sequence_number is not None: - header_parameters['x-ms-blob-sequence-number'] = self._serialize.header("blob_sequence_number", blob_sequence_number, 'long') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if blob_tags_string is not None: - header_parameters['x-ms-tags'] = self._serialize.header("blob_tags_string", blob_tags_string, 'str') - if immutability_policy_expiry is not None: - header_parameters['x-ms-immutability-policy-until-date'] = self._serialize.header("immutability_policy_expiry", immutability_policy_expiry, 'rfc-1123') - if immutability_policy_mode is not None: - header_parameters['x-ms-immutability-policy-mode'] = self._serialize.header("immutability_policy_mode", immutability_policy_mode, 'str') - if legal_hold is not None: - header_parameters['x-ms-legal-hold'] = self._serialize.header("legal_hold", legal_hold, 'bool') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_create_request( + url=self._config.url, + blob_type=blob_type, + version=self._config.version, + content_length=content_length, + blob_content_length=blob_content_length, + timeout=timeout, + tier=tier, + blob_content_type=_blob_content_type, + blob_content_encoding=_blob_content_encoding, + blob_content_language=_blob_content_language, + blob_content_md5=_blob_content_md5, + blob_cache_control=_blob_cache_control, + metadata=metadata, + lease_id=_lease_id, + blob_content_disposition=_blob_content_disposition, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + blob_sequence_number=blob_sequence_number, + request_id_parameter=request_id_parameter, + blob_tags_string=blob_tags_string, + immutability_policy_expiry=immutability_policy_expiry, + immutability_policy_mode=immutability_policy_mode, + legal_hold=legal_hold, + template_url=self.create.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -254,12 +978,15 @@ def create( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + create.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def upload_pages( + @distributed_trace + def upload_pages( # pylint: disable=inconsistent-return-statements self, content_length, # type: int body, # type: IO @@ -305,9 +1032,23 @@ def upload_pages( :param cpk_scope_info: Parameter group. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param sequence_number_access_conditions: Parameter group. - :type sequence_number_access_conditions: ~azure.storage.blob.models.SequenceNumberAccessConditions + :type sequence_number_access_conditions: + ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "page". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword page_write: Required. You may specify one of the following options: + + + * Update: Writes the bytes specified by the request body into the specified range. The Range + and Content-Length headers must match to perform the update. + * Clear: Clears the specified range and releases the space used in storage for that range. To + clear a range, set the Content-Length header to zero, and the Range header to a value that + indicates the range to clear, up to maximum blob size. The default value is "update". Note that + overriding this default value may result in unsupported behavior. + :paramtype page_write: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -318,7 +1059,11 @@ def upload_pages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "page") # type: str + page_write = kwargs.pop('page_write', "update") # type: str + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -332,93 +1077,67 @@ def upload_pages( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id + if sequence_number_access_conditions is not None: + _if_sequence_number_less_than_or_equal_to = sequence_number_access_conditions.if_sequence_number_less_than_or_equal_to + _if_sequence_number_less_than = sequence_number_access_conditions.if_sequence_number_less_than + _if_sequence_number_equal_to = sequence_number_access_conditions.if_sequence_number_equal_to if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - if sequence_number_access_conditions is not None: - _if_sequence_number_less_than_or_equal_to = sequence_number_access_conditions.if_sequence_number_less_than_or_equal_to - _if_sequence_number_less_than = sequence_number_access_conditions.if_sequence_number_less_than - _if_sequence_number_equal_to = sequence_number_access_conditions.if_sequence_number_equal_to - comp = "page" - page_write = "update" - content_type = kwargs.pop("content_type", "application/octet-stream") - accept = "application/xml" - - # Construct URL - url = self.upload_pages.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-page-write'] = self._serialize.header("page_write", page_write, 'str') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if transactional_content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_md5", transactional_content_md5, 'bytearray') - if transactional_content_crc64 is not None: - header_parameters['x-ms-content-crc64'] = self._serialize.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_sequence_number_less_than_or_equal_to is not None: - header_parameters['x-ms-if-sequence-number-le'] = self._serialize.header("if_sequence_number_less_than_or_equal_to", _if_sequence_number_less_than_or_equal_to, 'long') - if _if_sequence_number_less_than is not None: - header_parameters['x-ms-if-sequence-number-lt'] = self._serialize.header("if_sequence_number_less_than", _if_sequence_number_less_than, 'long') - if _if_sequence_number_equal_to is not None: - header_parameters['x-ms-if-sequence-number-eq'] = self._serialize.header("if_sequence_number_equal_to", _if_sequence_number_equal_to, 'long') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = body - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _content = body + + request = build_upload_pages_request( + url=self._config.url, + comp=comp, + page_write=page_write, + version=self._config.version, + content_type=content_type, + content=_content, + content_length=content_length, + transactional_content_md5=transactional_content_md5, + transactional_content_crc64=transactional_content_crc64, + timeout=timeout, + range=range, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_sequence_number_less_than_or_equal_to=_if_sequence_number_less_than_or_equal_to, + if_sequence_number_less_than=_if_sequence_number_less_than, + if_sequence_number_equal_to=_if_sequence_number_equal_to, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.upload_pages.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -435,12 +1154,15 @@ def upload_pages( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - upload_pages.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + upload_pages.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def clear_pages( + @distributed_trace + def clear_pages( # pylint: disable=inconsistent-return-statements self, content_length, # type: int timeout=None, # type: Optional[int] @@ -475,9 +1197,23 @@ def clear_pages( :param cpk_scope_info: Parameter group. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param sequence_number_access_conditions: Parameter group. - :type sequence_number_access_conditions: ~azure.storage.blob.models.SequenceNumberAccessConditions + :type sequence_number_access_conditions: + ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "page". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword page_write: Required. You may specify one of the following options: + + + * Update: Writes the bytes specified by the request body into the specified range. The Range + and Content-Length headers must match to perform the update. + * Clear: Clears the specified range and releases the space used in storage for that range. To + clear a range, set the Content-Length header to zero, and the Range header to a value that + indicates the range to clear, up to maximum blob size. The default value is "clear". Note that + overriding this default value may result in unsupported behavior. + :paramtype page_write: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -488,7 +1224,10 @@ def clear_pages( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "page") # type: str + page_write = kwargs.pop('page_write', "clear") # type: str + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -502,85 +1241,62 @@ def clear_pages( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id + if sequence_number_access_conditions is not None: + _if_sequence_number_less_than_or_equal_to = sequence_number_access_conditions.if_sequence_number_less_than_or_equal_to + _if_sequence_number_less_than = sequence_number_access_conditions.if_sequence_number_less_than + _if_sequence_number_equal_to = sequence_number_access_conditions.if_sequence_number_equal_to if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - if sequence_number_access_conditions is not None: - _if_sequence_number_less_than_or_equal_to = sequence_number_access_conditions.if_sequence_number_less_than_or_equal_to - _if_sequence_number_less_than = sequence_number_access_conditions.if_sequence_number_less_than - _if_sequence_number_equal_to = sequence_number_access_conditions.if_sequence_number_equal_to - comp = "page" - page_write = "clear" - accept = "application/xml" - - # Construct URL - url = self.clear_pages.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-page-write'] = self._serialize.header("page_write", page_write, 'str') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_sequence_number_less_than_or_equal_to is not None: - header_parameters['x-ms-if-sequence-number-le'] = self._serialize.header("if_sequence_number_less_than_or_equal_to", _if_sequence_number_less_than_or_equal_to, 'long') - if _if_sequence_number_less_than is not None: - header_parameters['x-ms-if-sequence-number-lt'] = self._serialize.header("if_sequence_number_less_than", _if_sequence_number_less_than, 'long') - if _if_sequence_number_equal_to is not None: - header_parameters['x-ms-if-sequence-number-eq'] = self._serialize.header("if_sequence_number_equal_to", _if_sequence_number_equal_to, 'long') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_clear_pages_request( + url=self._config.url, + comp=comp, + page_write=page_write, + version=self._config.version, + content_length=content_length, + timeout=timeout, + range=range, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_sequence_number_less_than_or_equal_to=_if_sequence_number_less_than_or_equal_to, + if_sequence_number_less_than=_if_sequence_number_less_than, + if_sequence_number_equal_to=_if_sequence_number_equal_to, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.clear_pages.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -594,12 +1310,15 @@ def clear_pages( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - clear_pages.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + clear_pages.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def upload_pages_from_url( + + @distributed_trace + def upload_pages_from_url( # pylint: disable=inconsistent-return-statements self, source_url, # type: str source_range, # type: str @@ -656,11 +1375,26 @@ def upload_pages_from_url( :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param sequence_number_access_conditions: Parameter group. - :type sequence_number_access_conditions: ~azure.storage.blob.models.SequenceNumberAccessConditions + :type sequence_number_access_conditions: + ~azure.storage.blob.models.SequenceNumberAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.blob.models.SourceModifiedAccessConditions + :keyword comp: comp. The default value is "page". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword page_write: Required. You may specify one of the following options: + + + * Update: Writes the bytes specified by the request body into the specified range. The Range + and Content-Length headers must match to perform the update. + * Clear: Clears the specified range and releases the space used in storage for that range. To + clear a range, set the Content-Length header to zero, and the Range header to a value that + indicates the range to clear, up to maximum blob size. The default value is "update". Note that + overriding this default value may result in unsupported behavior. + :paramtype page_write: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -671,7 +1405,10 @@ def upload_pages_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "page") # type: str + page_write = kwargs.pop('page_write', "update") # type: str + _encryption_key = None _encryption_key_sha256 = None _encryption_algorithm = None @@ -697,97 +1434,68 @@ def upload_pages_from_url( _encryption_scope = cpk_scope_info.encryption_scope if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id + if sequence_number_access_conditions is not None: + _if_sequence_number_less_than_or_equal_to = sequence_number_access_conditions.if_sequence_number_less_than_or_equal_to + _if_sequence_number_less_than = sequence_number_access_conditions.if_sequence_number_less_than + _if_sequence_number_equal_to = sequence_number_access_conditions.if_sequence_number_equal_to if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - if sequence_number_access_conditions is not None: - _if_sequence_number_less_than_or_equal_to = sequence_number_access_conditions.if_sequence_number_less_than_or_equal_to - _if_sequence_number_less_than = sequence_number_access_conditions.if_sequence_number_less_than - _if_sequence_number_equal_to = sequence_number_access_conditions.if_sequence_number_equal_to if source_modified_access_conditions is not None: _source_if_modified_since = source_modified_access_conditions.source_if_modified_since _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since _source_if_match = source_modified_access_conditions.source_if_match _source_if_none_match = source_modified_access_conditions.source_if_none_match - comp = "page" - page_write = "update" - accept = "application/xml" - - # Construct URL - url = self.upload_pages_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-page-write'] = self._serialize.header("page_write", page_write, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("source_url", source_url, 'str') - header_parameters['x-ms-source-range'] = self._serialize.header("source_range", source_range, 'str') - if source_content_md5 is not None: - header_parameters['x-ms-source-content-md5'] = self._serialize.header("source_content_md5", source_content_md5, 'bytearray') - if source_contentcrc64 is not None: - header_parameters['x-ms-source-content-crc64'] = self._serialize.header("source_contentcrc64", source_contentcrc64, 'bytearray') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_sequence_number_less_than_or_equal_to is not None: - header_parameters['x-ms-if-sequence-number-le'] = self._serialize.header("if_sequence_number_less_than_or_equal_to", _if_sequence_number_less_than_or_equal_to, 'long') - if _if_sequence_number_less_than is not None: - header_parameters['x-ms-if-sequence-number-lt'] = self._serialize.header("if_sequence_number_less_than", _if_sequence_number_less_than, 'long') - if _if_sequence_number_equal_to is not None: - header_parameters['x-ms-if-sequence-number-eq'] = self._serialize.header("if_sequence_number_equal_to", _if_sequence_number_equal_to, 'long') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if copy_source_authorization is not None: - header_parameters['x-ms-copy-source-authorization'] = self._serialize.header("copy_source_authorization", copy_source_authorization, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_upload_pages_from_url_request( + url=self._config.url, + comp=comp, + page_write=page_write, + version=self._config.version, + source_url=source_url, + source_range=source_range, + content_length=content_length, + range=range, + source_content_md5=source_content_md5, + source_contentcrc64=source_contentcrc64, + timeout=timeout, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + lease_id=_lease_id, + if_sequence_number_less_than_or_equal_to=_if_sequence_number_less_than_or_equal_to, + if_sequence_number_less_than=_if_sequence_number_less_than, + if_sequence_number_equal_to=_if_sequence_number_equal_to, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + request_id_parameter=request_id_parameter, + copy_source_authorization=copy_source_authorization, + template_url=self.upload_pages_from_url.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -803,11 +1511,14 @@ def upload_pages_from_url( response_headers['x-ms-encryption-key-sha256']=self._deserialize('str', response.headers.get('x-ms-encryption-key-sha256')) response_headers['x-ms-encryption-scope']=self._deserialize('str', response.headers.get('x-ms-encryption-scope')) + if cls: return cls(pipeline_response, None, response_headers) - upload_pages_from_url.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + upload_pages_from_url.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + @distributed_trace def get_page_ranges( self, snapshot=None, # type: Optional[str] @@ -842,6 +1553,9 @@ def get_page_ranges( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "pagelist". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PageList, or the result of cls(response) :rtype: ~azure.storage.blob.models.PageList @@ -852,7 +1566,9 @@ def get_page_ranges( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "pagelist") # type: str + _lease_id = None _if_modified_since = None _if_unmodified_since = None @@ -867,52 +1583,36 @@ def get_page_ranges( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "pagelist" - accept = "application/xml" - # Construct URL - url = self.get_page_ranges.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_page_ranges_request( + url=self._config.url, + comp=comp, + version=self._config.version, + snapshot=snapshot, + timeout=timeout, + range=range, + lease_id=_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.get_page_ranges.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -923,14 +1623,18 @@ def get_page_ranges( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('PageList', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_page_ranges.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + get_page_ranges.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + + @distributed_trace def get_page_ranges_diff( self, snapshot=None, # type: Optional[str] @@ -979,6 +1683,9 @@ def get_page_ranges_diff( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "pagelist". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PageList, or the result of cls(response) :rtype: ~azure.storage.blob.models.PageList @@ -989,7 +1696,9 @@ def get_page_ranges_diff( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "pagelist") # type: str + _lease_id = None _if_modified_since = None _if_unmodified_since = None @@ -1004,56 +1713,38 @@ def get_page_ranges_diff( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "pagelist" - accept = "application/xml" - # Construct URL - url = self.get_page_ranges_diff.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if snapshot is not None: - query_parameters['snapshot'] = self._serialize.query("snapshot", snapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if prevsnapshot is not None: - query_parameters['prevsnapshot'] = self._serialize.query("prevsnapshot", prevsnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if prev_snapshot_url is not None: - header_parameters['x-ms-previous-snapshot-url'] = self._serialize.header("prev_snapshot_url", prev_snapshot_url, 'str') - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_page_ranges_diff_request( + url=self._config.url, + comp=comp, + version=self._config.version, + snapshot=snapshot, + timeout=timeout, + prevsnapshot=prevsnapshot, + prev_snapshot_url=prev_snapshot_url, + range=range, + lease_id=_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.get_page_ranges_diff.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1064,15 +1755,19 @@ def get_page_ranges_diff( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('PageList', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_page_ranges_diff.metadata = {'url': '/{containerName}/{blob}'} # type: ignore - def resize( + get_page_ranges_diff.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + + + @distributed_trace + def resize( # pylint: disable=inconsistent-return-statements self, blob_content_length, # type: int timeout=None, # type: Optional[int] @@ -1105,6 +1800,9 @@ def resize( :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1115,7 +1813,9 @@ def resize( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "properties") # type: str + _lease_id = None _encryption_key = None _encryption_key_sha256 = None @@ -1126,71 +1826,53 @@ def resize( _if_match = None _if_none_match = None _if_tags = None + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id if cpk_info is not None: _encryption_key = cpk_info.encryption_key _encryption_key_sha256 = cpk_info.encryption_key_sha256 _encryption_algorithm = cpk_info.encryption_algorithm if cpk_scope_info is not None: _encryption_scope = cpk_scope_info.encryption_scope - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "properties" - accept = "application/xml" - # Construct URL - url = self.resize.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _encryption_key is not None: - header_parameters['x-ms-encryption-key'] = self._serialize.header("encryption_key", _encryption_key, 'str') - if _encryption_key_sha256 is not None: - header_parameters['x-ms-encryption-key-sha256'] = self._serialize.header("encryption_key_sha256", _encryption_key_sha256, 'str') - if _encryption_algorithm is not None: - header_parameters['x-ms-encryption-algorithm'] = self._serialize.header("encryption_algorithm", _encryption_algorithm, 'str') - if _encryption_scope is not None: - header_parameters['x-ms-encryption-scope'] = self._serialize.header("encryption_scope", _encryption_scope, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-blob-content-length'] = self._serialize.header("blob_content_length", blob_content_length, 'long') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_resize_request( + url=self._config.url, + comp=comp, + version=self._config.version, + blob_content_length=blob_content_length, + timeout=timeout, + lease_id=_lease_id, + encryption_key=_encryption_key, + encryption_key_sha256=_encryption_key_sha256, + encryption_algorithm=_encryption_algorithm, + encryption_scope=_encryption_scope, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.resize.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1202,12 +1884,15 @@ def resize( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - resize.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + resize.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore - def update_sequence_number( + + @distributed_trace + def update_sequence_number( # pylint: disable=inconsistent-return-statements self, sequence_number_action, # type: Union[str, "_models.SequenceNumberActionType"] timeout=None, # type: Optional[int] @@ -1240,6 +1925,9 @@ def update_sequence_number( :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1250,7 +1938,9 @@ def update_sequence_number( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "properties") # type: str + _lease_id = None _if_modified_since = None _if_unmodified_since = None @@ -1265,51 +1955,36 @@ def update_sequence_number( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "properties" - accept = "application/xml" - # Construct URL - url = self.update_sequence_number.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-sequence-number-action'] = self._serialize.header("sequence_number_action", sequence_number_action, 'str') - if blob_sequence_number is not None: - header_parameters['x-ms-blob-sequence-number'] = self._serialize.header("blob_sequence_number", blob_sequence_number, 'long') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_update_sequence_number_request( + url=self._config.url, + comp=comp, + version=self._config.version, + sequence_number_action=sequence_number_action, + timeout=timeout, + lease_id=_lease_id, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + blob_sequence_number=blob_sequence_number, + request_id_parameter=request_id_parameter, + template_url=self.update_sequence_number.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1321,12 +1996,15 @@ def update_sequence_number( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - update_sequence_number.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + update_sequence_number.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + - def copy_incremental( + @distributed_trace + def copy_incremental( # pylint: disable=inconsistent-return-statements self, copy_source, # type: str timeout=None, # type: Optional[int] @@ -1356,6 +2034,9 @@ def copy_incremental( :type request_id_parameter: str :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions + :keyword comp: comp. The default value is "incrementalcopy". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1366,7 +2047,9 @@ def copy_incremental( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "incrementalcopy") # type: str + _if_modified_since = None _if_unmodified_since = None _if_match = None @@ -1378,47 +2061,34 @@ def copy_incremental( _if_match = modified_access_conditions.if_match _if_none_match = modified_access_conditions.if_none_match _if_tags = modified_access_conditions.if_tags - comp = "incrementalcopy" - accept = "application/xml" - # Construct URL - url = self.copy_incremental.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_tags is not None: - header_parameters['x-ms-if-tags'] = self._serialize.header("if_tags", _if_tags, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_copy_incremental_request( + url=self._config.url, + comp=comp, + version=self._config.version, + copy_source=copy_source, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + if_match=_if_match, + if_none_match=_if_none_match, + if_tags=_if_tags, + request_id_parameter=request_id_parameter, + template_url=self.copy_incremental.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1431,7 +2101,9 @@ def copy_incremental( response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id')) response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status')) + if cls: return cls(pipeline_response, None, response_headers) - copy_incremental.metadata = {'url': '/{containerName}/{blob}'} # type: ignore + copy_incremental.metadata = {'url': "{url}/{containerName}/{blob}"} # type: ignore + diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py index 63628418ddd5..6e1e74f5b213 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,21 +7,391 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, List, Optional, TypeVar, Union - + from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_set_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_statistics_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "stats") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_containers_segment_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "list") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + prefix = kwargs.pop('prefix', None) # type: Optional[str] + marker = kwargs.pop('marker', None) # type: Optional[str] + maxresults = kwargs.pop('maxresults', None) # type: Optional[int] + include = kwargs.pop('include', None) # type: Optional[List[Union[str, "_models.ListContainersIncludeType"]]] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if prefix is not None: + _query_parameters['prefix'] = _SERIALIZER.query("prefix", prefix, 'str') + if marker is not None: + _query_parameters['marker'] = _SERIALIZER.query("marker", marker, 'str') + if maxresults is not None: + _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', minimum=1) + if include is not None: + _query_parameters['include'] = _SERIALIZER.query("include", include, '[str]', div=',') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_user_delegation_key_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "userdelegationkey") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_account_info_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "account") # type: str + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_submit_batch_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + multipart_content_type = kwargs.pop('multipart_content_type') # type: str + comp = kwargs.pop('comp', "batch") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_length = kwargs.pop('content_length') # type: int + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + _header_parameters['Content-Type'] = _SERIALIZER.header("multipart_content_type", multipart_content_type, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_filter_blobs_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "blobs") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + where = kwargs.pop('where', None) # type: Optional[str] + marker = kwargs.pop('marker', None) # type: Optional[str] + maxresults = kwargs.pop('maxresults', None) # type: Optional[int] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if where is not None: + _query_parameters['where'] = _SERIALIZER.query("where", where, 'str') + if marker is not None: + _query_parameters['marker'] = _SERIALIZER.query("marker", marker, 'str') + if maxresults is not None: + _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', minimum=1) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class ServiceOperations(object): """ServiceOperations operations. @@ -43,7 +414,8 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def set_properties( + @distributed_trace + def set_properties( # pylint: disable=inconsistent-return-statements self, storage_service_properties, # type: "_models.StorageServiceProperties" timeout=None, # type: Optional[int] @@ -64,6 +436,12 @@ def set_properties( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -74,43 +452,37 @@ def set_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "properties" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + + _content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True) + + request = build_set_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.set_properties.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -118,11 +490,14 @@ def set_properties( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {'url': '/'} # type: ignore + set_properties.metadata = {'url': "{url}/"} # type: ignore + + @distributed_trace def get_properties( self, timeout=None, # type: Optional[int] @@ -141,6 +516,12 @@ def get_properties( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties, or the result of cls(response) :rtype: ~azure.storage.blob.models.StorageServiceProperties @@ -151,52 +532,51 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + + + request = build_get_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('StorageServiceProperties', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_properties.metadata = {'url': '/'} # type: ignore + get_properties.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace def get_statistics( self, timeout=None, # type: Optional[int] @@ -216,6 +596,12 @@ def get_statistics( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "stats". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceStats, or the result of cls(response) :rtype: ~azure.storage.blob.models.StorageServiceStats @@ -226,38 +612,33 @@ def get_statistics( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "stats" - accept = "application/xml" - - # Construct URL - url = self.get_statistics.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "stats") # type: str + + + request = build_get_statistics_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_statistics.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -265,14 +646,18 @@ def get_statistics( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('StorageServiceStats', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_statistics.metadata = {'url': '/'} # type: ignore + get_statistics.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace def list_containers_segment( self, prefix=None, # type: Optional[str] @@ -315,6 +700,9 @@ def list_containers_segment( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListContainersSegmentResponse, or the result of cls(response) :rtype: ~azure.storage.blob.models.ListContainersSegmentResponse @@ -325,58 +713,53 @@ def list_containers_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "list" - accept = "application/xml" - # Construct URL - url = self.list_containers_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if include is not None: - query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "list") # type: str + + + request = build_list_containers_segment_request( + url=self._config.url, + comp=comp, + version=self._config.version, + prefix=prefix, + marker=marker, + maxresults=maxresults, + include=include, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.list_containers_segment.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-client-request-id']=self._deserialize('str', response.headers.get('x-ms-client-request-id')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('ListContainersSegmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_containers_segment.metadata = {'url': '/'} # type: ignore + list_containers_segment.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace def get_user_delegation_key( self, key_info, # type: "_models.KeyInfo" @@ -398,6 +781,12 @@ def get_user_delegation_key( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "userdelegationkey". Note that overriding this + default value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: UserDelegationKey, or the result of cls(response) :rtype: ~azure.storage.blob.models.UserDelegationKey @@ -408,43 +797,37 @@ def get_user_delegation_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "userdelegationkey" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.get_user_delegation_key.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(key_info, 'KeyInfo', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "userdelegationkey") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + + _content = self._serialize.body(key_info, 'KeyInfo', is_xml=True) + + request = build_get_user_delegation_key_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_user_delegation_key.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -452,21 +835,31 @@ def get_user_delegation_key( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('UserDelegationKey', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_user_delegation_key.metadata = {'url': '/'} # type: ignore - def get_account_info( + get_user_delegation_key.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace + def get_account_info( # pylint: disable=inconsistent-return-statements self, **kwargs # type: Any ): # type: (...) -> None """Returns the sku name and account kind. + :keyword restype: restype. The default value is "account". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -477,34 +870,31 @@ def get_account_info( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "account" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.get_account_info.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + restype = kwargs.pop('restype', "account") # type: str + comp = kwargs.pop('comp', "properties") # type: str + + + request = build_get_account_info_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + template_url=self.get_account_info.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -516,15 +906,17 @@ def get_account_info( response_headers['x-ms-account-kind']=self._deserialize('str', response.headers.get('x-ms-account-kind')) response_headers['x-ms-is-hns-enabled']=self._deserialize('bool', response.headers.get('x-ms-is-hns-enabled')) + if cls: return cls(pipeline_response, None, response_headers) - get_account_info.metadata = {'url': '/'} # type: ignore + get_account_info.metadata = {'url': "{url}/"} # type: ignore + + @distributed_trace def submit_batch( self, content_length, # type: int - multipart_content_type, # type: str body, # type: IO timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -535,9 +927,6 @@ def submit_batch( :param content_length: The length of the request. :type content_length: long - :param multipart_content_type: Required. The value of this header must be multipart/mixed with - a batch boundary. Example header value: multipart/mixed; boundary=batch_:code:``. - :type multipart_content_type: str :param body: Initial data. :type body: IO :param timeout: The timeout parameter is expressed in seconds. For more information, see @@ -548,6 +937,12 @@ def submit_batch( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword multipart_content_type: Required. The value of this header must be multipart/mixed + with a batch boundary. Example header value: multipart/mixed; boundary=batch_:code:``. + :paramtype multipart_content_type: str + :keyword comp: comp. The default value is "batch". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: IO, or the result of cls(response) :rtype: IO @@ -558,57 +953,54 @@ def submit_batch( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "batch" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.submit_batch.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - header_parameters['Content-Type'] = self._serialize.header("multipart_content_type", multipart_content_type, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'IO', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + + multipart_content_type = kwargs.pop('multipart_content_type') # type: str + comp = kwargs.pop('comp', "batch") # type: str + + _content = self._serialize.body(body, 'IO') + + request = build_submit_batch_request( + url=self._config.url, + multipart_content_type=multipart_content_type, + comp=comp, + version=self._config.version, + content=_content, + content_length=content_length, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.submit_batch.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=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = response.stream_download(self._client._pipeline) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - submit_batch.metadata = {'url': '/'} # type: ignore + submit_batch.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace def filter_blobs( self, timeout=None, # type: Optional[int] @@ -648,6 +1040,9 @@ def filter_blobs( it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000. :type maxresults: int + :keyword comp: comp. The default value is "blobs". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FilterBlobSegment, or the result of cls(response) :rtype: ~azure.storage.blob.models.FilterBlobSegment @@ -658,42 +1053,34 @@ def filter_blobs( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "blobs" - accept = "application/xml" - # Construct URL - url = self.filter_blobs.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if where is not None: - query_parameters['where'] = self._serialize.query("where", where, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "blobs") # type: str + + + request = build_filter_blobs_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + where=where, + marker=marker, + maxresults=maxresults, + template_url=self.filter_blobs.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -701,10 +1088,13 @@ def filter_blobs( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('FilterBlobSegment', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - filter_blobs.metadata = {'url': '/'} # type: ignore + + filter_blobs.metadata = {'url': "{url}/"} # type: ignore + diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py index 203c31f60e6c..701eb93b07c6 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_client_async.py @@ -120,7 +120,7 @@ def __init__( snapshot=snapshot, credential=credential, **kwargs) - self._client = AzureBlobStorage(url=self.url, pipeline=self._pipeline) + self._client = AzureBlobStorage(self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access @distributed_trace_async diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_service_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_service_client_async.py index 10ec3cb80889..7a10101acd23 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_service_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_blob_service_client_async.py @@ -117,7 +117,7 @@ def __init__( account_url, credential=credential, **kwargs) - self._client = AzureBlobStorage(url=self.url, pipeline=self._pipeline) + self._client = AzureBlobStorage(self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access @distributed_trace_async diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py index 43e5608ada09..4409c5bc667a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/aio/_container_client_async.py @@ -117,7 +117,7 @@ def __init__( container_name=container_name, credential=credential, **kwargs) - self._client = AzureBlobStorage(url=self.url, pipeline=self._pipeline) + self._client = AzureBlobStorage(self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access @distributed_trace_async diff --git a/sdk/storage/azure-storage-blob/setup.py b/sdk/storage/azure-storage-blob/setup.py index 546ef830e258..51ab672f1573 100644 --- a/sdk/storage/azure-storage-blob/setup.py +++ b/sdk/storage/azure-storage-blob/setup.py @@ -76,7 +76,7 @@ ]), python_requires=">=3.6", install_requires=[ - "azure-core<2.0.0,>=1.15.0", + "azure-core<2.0.0,>=1.20.1", "msrest>=0.6.21", "cryptography>=2.1.4" ], diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index 4ccfce7d3777..c9d9fec277c0 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -122,7 +122,7 @@ directive: if (property.includes('/{containerName}/{blob}')) { $[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/ContainerName") && false == param['$ref'].endsWith("#/parameters/Blob"))}); - } + } else if (property.includes('/{containerName}')) { $[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/ContainerName"))}); @@ -139,4 +139,30 @@ directive: $.properties.OrMetadata = $.properties.ObjectReplicationMetadata; $.properties.OrMetadata["x-ms-client-name"] = "ObjectReplicationMetadata"; delete $.properties.ObjectReplicationMetadata; -``` \ No newline at end of file +``` + +### Remove x-ms-parameterized-host +``` yaml +directive: +- from: swagger-document + where: $ + transform: > + $["x-ms-parameterized-host"] = undefined; +``` + +### Add url parameter to each operation and add it to the url +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + for (const property in $) + { + $[property]["parameters"].push({"$ref": "#/parameters/Url"}); + + var oldName = property; + var newName = '{url}' + property; + $[newName] = $[oldName]; + delete $[oldName]; + } +``` diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_data_lake_service_client.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_data_lake_service_client.py index 099a26408f91..41a0f01ddfab 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_data_lake_service_client.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_data_lake_service_client.py @@ -97,7 +97,7 @@ def __init__( # ADLS doesn't support secondary endpoint, make sure it's empty self._hosts[LocationMode.SECONDARY] = "" - self._client = AzureDataLakeStorageRESTAPI(self.url, pipeline=self._pipeline) + self._client = AzureDataLakeStorageRESTAPI(self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) #pylint: disable=protected-access def __enter__(self): diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_file_system_client.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_file_system_client.py index 96c89ced28ae..9db9b8316f8f 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_file_system_client.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_file_system_client.py @@ -107,10 +107,12 @@ def __init__( _hosts=datalake_hosts, **kwargs) # ADLS doesn't support secondary endpoint, make sure it's empty self._hosts[LocationMode.SECONDARY] = "" - self._client = AzureDataLakeStorageRESTAPI(self.url, file_system=file_system_name, pipeline=self._pipeline) + self._client = AzureDataLakeStorageRESTAPI(self.url, base_url=self.url, + file_system=file_system_name, pipeline=self._pipeline) api_version = get_api_version(kwargs) self._client._config.version = api_version # pylint: disable=protected-access self._datalake_client_for_blob_operation = AzureDataLakeStorageRESTAPI(self._container_client.url, + base_url=self._container_client.url, file_system=file_system_name, pipeline=self._pipeline) self._datalake_client_for_blob_operation._config.version = api_version # pylint: disable=protected-access diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/__init__.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/__init__.py index 5cd3ae2368bc..b0b85e193a75 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/__init__.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/__init__.py @@ -9,8 +9,7 @@ from ._azure_data_lake_storage_restapi import AzureDataLakeStorageRESTAPI __all__ = ['AzureDataLakeStorageRESTAPI'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_azure_data_lake_storage_restapi.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_azure_data_lake_storage_restapi.py index 33e26f2ed8c8..6f136ca8f7ab 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_azure_data_lake_storage_restapi.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_azure_data_lake_storage_restapi.py @@ -6,23 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING -from azure.core import PipelineClient from msrest import Deserializer, Serializer +from azure.core import PipelineClient + +from . import models +from ._configuration import AzureDataLakeStorageRESTAPIConfiguration +from .operations import FileSystemOperations, PathOperations, ServiceOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import AzureDataLakeStorageRESTAPIConfiguration -from .operations import ServiceOperations -from .operations import FileSystemOperations -from .operations import PathOperations -from . import models - + from azure.core.rest import HttpRequest, HttpResponse class AzureDataLakeStorageRESTAPI(object): """Azure Data Lake Storage provides storage for Hadoop and other big data workloads. @@ -33,49 +32,66 @@ class AzureDataLakeStorageRESTAPI(object): :vartype file_system: azure.storage.filedatalake.operations.FileSystemOperations :ivar path: PathOperations operations :vartype path: azure.storage.filedatalake.operations.PathOperations - :param url: The URL of the service account, container, or blob that is the target of the desired operation. + :param url: The URL of the service account, container, or blob that is the target of the + desired operation. :type url: str + :param base_url: Service URL. Default value is ''. + :type base_url: str + :keyword resource: The value must be "filesystem" for all filesystem operations. The default + value is "filesystem". Note that overriding this default value may result in unsupported + behavior. + :paramtype resource: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2020-10-02". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str """ def __init__( self, url, # type: str + base_url="", # type: str **kwargs # type: Any ): # type: (...) -> None - base_url = '{url}' - self._config = AzureDataLakeStorageRESTAPIConfiguration(url, **kwargs) + self._config = AzureDataLakeStorageRESTAPIConfiguration(url=url, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_system = FileSystemOperations(self._client, self._config, self._serialize, self._deserialize) + self.path = PathOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_system = FileSystemOperations( - self._client, self._config, self._serialize, self._deserialize) - self.path = PathOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_configuration.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_configuration.py index e461c9f34184..6a8f7d7950a1 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_configuration.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_configuration.py @@ -17,14 +17,23 @@ VERSION = "unknown" -class AzureDataLakeStorageRESTAPIConfiguration(Configuration): +class AzureDataLakeStorageRESTAPIConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureDataLakeStorageRESTAPI. Note that all parameters used to create this instance are saved as instance attributes. - :param url: The URL of the service account, container, or blob that is the target of the desired operation. + :param url: The URL of the service account, container, or blob that is the target of the + desired operation. :type url: str + :keyword resource: The value must be "filesystem" for all filesystem operations. The default + value is "filesystem". Note that overriding this default value may result in unsupported + behavior. + :paramtype resource: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2020-10-02". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str """ def __init__( @@ -33,13 +42,16 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(AzureDataLakeStorageRESTAPIConfiguration, self).__init__(**kwargs) + resource = kwargs.pop('resource', "filesystem") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + if url is None: raise ValueError("Parameter 'url' must not be None.") - super(AzureDataLakeStorageRESTAPIConfiguration, self).__init__(**kwargs) self.url = url - self.resource = "filesystem" - self.version = "2020-10-02" + self.resource = resource + self.version = version kwargs.setdefault('sdk_moniker', 'azuredatalakestoragerestapi/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_patch.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_vendor.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/__init__.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/__init__.py index 24daed3d5402..b0b85e193a75 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/__init__.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/__init__.py @@ -8,3 +8,8 @@ from ._azure_data_lake_storage_restapi import AzureDataLakeStorageRESTAPI __all__ = ['AzureDataLakeStorageRESTAPI'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_azure_data_lake_storage_restapi.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_azure_data_lake_storage_restapi.py index 438366ec7b4e..be64a6b6cc1a 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_azure_data_lake_storage_restapi.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_azure_data_lake_storage_restapi.py @@ -6,20 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from copy import deepcopy +from typing import Any, Awaitable -from azure.core import AsyncPipelineClient -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from msrest import Deserializer, Serializer -from ._configuration import AzureDataLakeStorageRESTAPIConfiguration -from .operations import ServiceOperations -from .operations import FileSystemOperations -from .operations import PathOperations -from .. import models +from azure.core import AsyncPipelineClient +from azure.core.rest import AsyncHttpResponse, HttpRequest +from .. import models +from ._configuration import AzureDataLakeStorageRESTAPIConfiguration +from .operations import FileSystemOperations, PathOperations, ServiceOperations -class AzureDataLakeStorageRESTAPI(object): +class AzureDataLakeStorageRESTAPI: """Azure Data Lake Storage provides storage for Hadoop and other big data workloads. :ivar service: ServiceOperations operations @@ -28,47 +27,64 @@ class AzureDataLakeStorageRESTAPI(object): :vartype file_system: azure.storage.filedatalake.aio.operations.FileSystemOperations :ivar path: PathOperations operations :vartype path: azure.storage.filedatalake.aio.operations.PathOperations - :param url: The URL of the service account, container, or blob that is the target of the desired operation. + :param url: The URL of the service account, container, or blob that is the target of the + desired operation. :type url: str + :param base_url: Service URL. Default value is ''. + :type base_url: str + :keyword resource: The value must be "filesystem" for all filesystem operations. The default + value is "filesystem". Note that overriding this default value may result in unsupported + behavior. + :paramtype resource: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2020-10-02". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str """ def __init__( self, url: str, + base_url: str = "", **kwargs: Any ) -> None: - base_url = '{url}' - self._config = AzureDataLakeStorageRESTAPIConfiguration(url, **kwargs) + self._config = AzureDataLakeStorageRESTAPIConfiguration(url=url, **kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.file_system = FileSystemOperations(self._client, self._config, self._serialize, self._deserialize) + self.path = PathOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file_system = FileSystemOperations( - self._client, self._config, self._serialize, self._deserialize) - self.path = PathOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_configuration.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_configuration.py index 8faa4a2d8bd1..c8c4d24203d4 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_configuration.py @@ -13,14 +13,23 @@ VERSION = "unknown" -class AzureDataLakeStorageRESTAPIConfiguration(Configuration): +class AzureDataLakeStorageRESTAPIConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureDataLakeStorageRESTAPI. Note that all parameters used to create this instance are saved as instance attributes. - :param url: The URL of the service account, container, or blob that is the target of the desired operation. + :param url: The URL of the service account, container, or blob that is the target of the + desired operation. :type url: str + :keyword resource: The value must be "filesystem" for all filesystem operations. The default + value is "filesystem". Note that overriding this default value may result in unsupported + behavior. + :paramtype resource: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2020-10-02". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str """ def __init__( @@ -28,13 +37,16 @@ def __init__( url: str, **kwargs: Any ) -> None: + super(AzureDataLakeStorageRESTAPIConfiguration, self).__init__(**kwargs) + resource = kwargs.pop('resource', "filesystem") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + if url is None: raise ValueError("Parameter 'url' must not be None.") - super(AzureDataLakeStorageRESTAPIConfiguration, self).__init__(**kwargs) self.url = url - self.resource = "filesystem" - self.version = "2020-10-02" + self.resource = resource + self.version = version kwargs.setdefault('sdk_moniker', 'azuredatalakestoragerestapi/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_patch.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_file_system_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_file_system_operations.py index 17fe0a062f8e..65df1f9bfc86 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_file_system_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_file_system_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._file_system_operations import build_create_request, build_delete_request, build_get_properties_request, build_list_blob_hierarchy_segment_request, build_list_paths_request, build_set_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +42,8 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def create( + @distributed_trace_async + async def create( # pylint: disable=inconsistent-return-statements self, request_id_parameter: Optional[str] = None, timeout: Optional[int] = None, @@ -78,37 +81,30 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/json" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['resource'] = self._serialize.query("self._config.resource", self._config.resource, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if properties is not None: - header_parameters['x-ms-properties'] = self._serialize.header("properties", properties, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_create_request( + url=self._config.url, + resource=self._config.resource, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + properties=properties, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -119,12 +115,15 @@ async def create( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['x-ms-namespace-enabled']=self._deserialize('str', response.headers.get('x-ms-namespace-enabled')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{filesystem}'} # type: ignore + create.metadata = {'url': "{url}/{filesystem}"} # type: ignore - async def set_properties( + + @distributed_trace_async + async def set_properties( # pylint: disable=inconsistent-return-statements self, request_id_parameter: Optional[str] = None, timeout: Optional[int] = None, @@ -166,47 +165,37 @@ async def set_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - accept = "application/json" - # Construct URL - url = self.set_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['resource'] = self._serialize.query("self._config.resource", self._config.resource, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if properties is not None: - header_parameters['x-ms-properties'] = self._serialize.header("properties", properties, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.patch(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_properties_request( + url=self._config.url, + resource=self._config.resource, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + properties=properties, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.set_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -216,12 +205,15 @@ async def set_properties( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {'url': '/{filesystem}'} # type: ignore + set_properties.metadata = {'url': "{url}/{filesystem}"} # type: ignore + - async def get_properties( + @distributed_trace_async + async def get_properties( # pylint: disable=inconsistent-return-statements self, request_id_parameter: Optional[str] = None, timeout: Optional[int] = None, @@ -249,35 +241,29 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/json" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['resource'] = self._serialize.query("self._config.resource", self._config.resource, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_get_properties_request( + url=self._config.url, + resource=self._config.resource, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -289,12 +275,15 @@ async def get_properties( response_headers['x-ms-properties']=self._deserialize('str', response.headers.get('x-ms-properties')) response_headers['x-ms-namespace-enabled']=self._deserialize('str', response.headers.get('x-ms-namespace-enabled')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{filesystem}'} # type: ignore + get_properties.metadata = {'url': "{url}/{filesystem}"} # type: ignore + - async def delete( + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, request_id_parameter: Optional[str] = None, timeout: Optional[int] = None, @@ -333,45 +322,36 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - accept = "application/json" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['resource'] = self._serialize.query("self._config.resource", self._config.resource, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_delete_request( + url=self._config.url, + resource=self._config.resource, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.delete.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -379,11 +359,14 @@ async def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{filesystem}'} # type: ignore + delete.metadata = {'url': "{url}/{filesystem}"} # type: ignore + + @distributed_trace_async async def list_paths( self, recursive: bool, @@ -438,44 +421,34 @@ async def list_paths( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/json" - # Construct URL - url = self.list_paths.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['resource'] = self._serialize.query("self._config.resource", self._config.resource, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if continuation is not None: - query_parameters['continuation'] = self._serialize.query("continuation", continuation, 'str') - if path is not None: - query_parameters['directory'] = self._serialize.query("path", path, 'str') - query_parameters['recursive'] = self._serialize.query("recursive", recursive, 'bool') - if max_results is not None: - query_parameters['maxResults'] = self._serialize.query("max_results", max_results, 'int', minimum=1) - if upn is not None: - query_parameters['upn'] = self._serialize.query("upn", upn, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_list_paths_request( + url=self._config.url, + resource=self._config.resource, + version=self._config.version, + recursive=recursive, + request_id_parameter=request_id_parameter, + timeout=timeout, + continuation=continuation, + path=path, + max_results=max_results, + upn=upn, + template_url=self.list_paths.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -485,14 +458,18 @@ async def list_paths( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['x-ms-continuation']=self._deserialize('str', response.headers.get('x-ms-continuation')) + deserialized = self._deserialize('PathList', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_paths.metadata = {'url': '/{filesystem}'} # type: ignore + list_paths.metadata = {'url': "{url}/{filesystem}"} # type: ignore + + + @distributed_trace_async async def list_blob_hierarchy_segment( self, prefix: Optional[str] = None, @@ -528,7 +505,7 @@ async def list_blob_hierarchy_segment( response. :type include: list[str or ~azure.storage.filedatalake.models.ListBlobsIncludeItem] :param showonly: Include this parameter to specify one or more datasets to include in the - response. + response. The default value is "deleted". :type showonly: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:` None: self._deserialize = deserializer self._config = config - async def create( + @distributed_trace_async + async def create( # pylint: disable=inconsistent-return-statements self, request_id_parameter: Optional[str] = None, timeout: Optional[int] = None, @@ -125,7 +128,8 @@ async def create( :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.filedatalake.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.filedatalake.models.SourceModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -136,12 +140,12 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _cache_control = None _content_encoding = None _content_language = None _content_disposition = None - _content_type = None + _content_type_parameter = None _lease_id = None _if_match = None _if_none_match = None @@ -151,6 +155,12 @@ async def create( _source_if_none_match = None _source_if_modified_since = None _source_if_unmodified_since = None + if path_http_headers is not None: + _cache_control = path_http_headers.cache_control + _content_encoding = path_http_headers.content_encoding + _content_language = path_http_headers.content_language + _content_disposition = path_http_headers.content_disposition + _content_type_parameter = path_http_headers.content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: @@ -158,89 +168,54 @@ async def create( _if_none_match = modified_access_conditions.if_none_match _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - if path_http_headers is not None: - _cache_control = path_http_headers.cache_control - _content_encoding = path_http_headers.content_encoding - _content_language = path_http_headers.content_language - _content_disposition = path_http_headers.content_disposition - _content_type = path_http_headers.content_type if source_modified_access_conditions is not None: _source_if_match = source_modified_access_conditions.source_if_match _source_if_none_match = source_modified_access_conditions.source_if_none_match _source_if_modified_since = source_modified_access_conditions.source_if_modified_since _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since - accept = "application/json" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if resource is not None: - query_parameters['resource'] = self._serialize.query("resource", resource, 'str') - if continuation is not None: - query_parameters['continuation'] = self._serialize.query("continuation", continuation, 'str') - if mode is not None: - query_parameters['mode'] = self._serialize.query("mode", mode, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _cache_control is not None: - header_parameters['x-ms-cache-control'] = self._serialize.header("cache_control", _cache_control, 'str') - if _content_encoding is not None: - header_parameters['x-ms-content-encoding'] = self._serialize.header("content_encoding", _content_encoding, 'str') - if _content_language is not None: - header_parameters['x-ms-content-language'] = self._serialize.header("content_language", _content_language, 'str') - if _content_disposition is not None: - header_parameters['x-ms-content-disposition'] = self._serialize.header("content_disposition", _content_disposition, 'str') - if _content_type is not None: - header_parameters['x-ms-content-type'] = self._serialize.header("content_type", _content_type, 'str') - if rename_source is not None: - header_parameters['x-ms-rename-source'] = self._serialize.header("rename_source", rename_source, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if source_lease_id is not None: - header_parameters['x-ms-source-lease-id'] = self._serialize.header("source_lease_id", source_lease_id, 'str') - if properties is not None: - header_parameters['x-ms-properties'] = self._serialize.header("properties", properties, 'str') - if permissions is not None: - header_parameters['x-ms-permissions'] = self._serialize.header("permissions", permissions, 'str') - if umask is not None: - header_parameters['x-ms-umask'] = self._serialize.header("umask", umask, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_create_request( + url=self._config.url, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + resource=resource, + continuation=continuation, + mode=mode, + cache_control=_cache_control, + content_encoding=_content_encoding, + content_language=_content_language, + content_disposition=_content_disposition, + content_type_parameter=_content_type_parameter, + rename_source=rename_source, + lease_id=_lease_id, + source_lease_id=source_lease_id, + properties=properties, + permissions=permissions, + umask=umask, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -252,11 +227,14 @@ async def create( response_headers['x-ms-continuation']=self._deserialize('str', response.headers.get('x-ms-continuation')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + create.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + + @distributed_trace_async async def update( self, action: Union[str, "_models.PathUpdateAction"], @@ -396,11 +374,13 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] + _content_md5 = None _lease_id = None _cache_control = None - _content_type = None + _content_type_parameter = None _content_disposition = None _content_encoding = None _content_language = None @@ -408,104 +388,74 @@ async def update( _if_none_match = None _if_modified_since = None _if_unmodified_since = None + if path_http_headers is not None: + _content_md5 = path_http_headers.content_md5 if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - if modified_access_conditions is not None: - _if_match = modified_access_conditions.if_match - _if_none_match = modified_access_conditions.if_none_match - _if_modified_since = modified_access_conditions.if_modified_since - _if_unmodified_since = modified_access_conditions.if_unmodified_since if path_http_headers is not None: - _content_md5 = path_http_headers.content_md5 _cache_control = path_http_headers.cache_control - _content_type = path_http_headers.content_type + _content_type_parameter = path_http_headers.content_type _content_disposition = path_http_headers.content_disposition _content_encoding = path_http_headers.content_encoding _content_language = path_http_headers.content_language - content_type = kwargs.pop("content_type", "application/octet-stream") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - query_parameters['action'] = self._serialize.query("action", action, 'str') - if max_records is not None: - query_parameters['maxRecords'] = self._serialize.query("max_records", max_records, 'int', minimum=1) - if continuation is not None: - query_parameters['continuation'] = self._serialize.query("continuation", continuation, 'str') - query_parameters['mode'] = self._serialize.query("mode", mode, 'str') - if force_flag is not None: - query_parameters['forceFlag'] = self._serialize.query("force_flag", force_flag, 'bool') - if position is not None: - query_parameters['position'] = self._serialize.query("position", position, 'long') - if retain_uncommitted_data is not None: - query_parameters['retainUncommittedData'] = self._serialize.query("retain_uncommitted_data", retain_uncommitted_data, 'bool') - if close is not None: - query_parameters['close'] = self._serialize.query("close", close, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if content_length is not None: - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long', minimum=0) - if _content_md5 is not None: - header_parameters['x-ms-content-md5'] = self._serialize.header("content_md5", _content_md5, 'bytearray') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _cache_control is not None: - header_parameters['x-ms-cache-control'] = self._serialize.header("cache_control", _cache_control, 'str') - if _content_type is not None: - header_parameters['x-ms-content-type'] = self._serialize.header("content_type", _content_type, 'str') - if _content_disposition is not None: - header_parameters['x-ms-content-disposition'] = self._serialize.header("content_disposition", _content_disposition, 'str') - if _content_encoding is not None: - header_parameters['x-ms-content-encoding'] = self._serialize.header("content_encoding", _content_encoding, 'str') - if _content_language is not None: - header_parameters['x-ms-content-language'] = self._serialize.header("content_language", _content_language, 'str') - if properties is not None: - header_parameters['x-ms-properties'] = self._serialize.header("properties", properties, 'str') - if owner is not None: - header_parameters['x-ms-owner'] = self._serialize.header("owner", owner, 'str') - if group is not None: - header_parameters['x-ms-group'] = self._serialize.header("group", group, 'str') - if permissions is not None: - header_parameters['x-ms-permissions'] = self._serialize.header("permissions", permissions, 'str') - if acl is not None: - header_parameters['x-ms-acl'] = self._serialize.header("acl", acl, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = body - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + if modified_access_conditions is not None: + _if_match = modified_access_conditions.if_match + _if_none_match = modified_access_conditions.if_none_match + _if_modified_since = modified_access_conditions.if_modified_since + _if_unmodified_since = modified_access_conditions.if_unmodified_since + _content = body + + request = build_update_request( + url=self._config.url, + version=self._config.version, + content_type=content_type, + content=_content, + action=action, + mode=mode, + request_id_parameter=request_id_parameter, + timeout=timeout, + max_records=max_records, + continuation=continuation, + force_flag=force_flag, + position=position, + retain_uncommitted_data=retain_uncommitted_data, + close=close, + content_length=content_length, + content_md5=_content_md5, + lease_id=_lease_id, + cache_control=_cache_control, + content_type_parameter=_content_type_parameter, + content_disposition=_content_disposition, + content_encoding=_content_encoding, + content_language=_content_language, + properties=properties, + owner=owner, + group=group, + permissions=permissions, + acl=acl, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) @@ -523,6 +473,7 @@ async def update( response_headers['x-ms-continuation']=self._deserialize('str', response.headers.get('x-ms-continuation')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('SetAccessControlRecursiveResponse', pipeline_response) if response.status_code == 202: @@ -530,14 +481,18 @@ async def update( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - update.metadata = {'url': '/{filesystem}/{path}'} # type: ignore - async def lease( + update.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + + + @distributed_trace_async + async def lease( # pylint: disable=inconsistent-return-statements self, x_ms_lease_action: Union[str, "_models.PathLeaseAction"], request_id_parameter: Optional[str] = None, @@ -600,7 +555,7 @@ async def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _if_match = None _if_none_match = None @@ -613,51 +568,36 @@ async def lease( _if_none_match = modified_access_conditions.if_none_match _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - accept = "application/json" - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['x-ms-lease-action'] = self._serialize.header("x_ms_lease_action", x_ms_lease_action, 'str') - if x_ms_lease_duration is not None: - header_parameters['x-ms-lease-duration'] = self._serialize.header("x_ms_lease_duration", x_ms_lease_duration, 'int') - if x_ms_lease_break_period is not None: - header_parameters['x-ms-lease-break-period'] = self._serialize.header("x_ms_lease_break_period", x_ms_lease_break_period, 'int') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_lease_request( + url=self._config.url, + version=self._config.version, + x_ms_lease_action=x_ms_lease_action, + request_id_parameter=request_id_parameter, + timeout=timeout, + x_ms_lease_duration=x_ms_lease_duration, + x_ms_lease_break_period=x_ms_lease_break_period, + lease_id=_lease_id, + proposed_lease_id=proposed_lease_id, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.lease.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 [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -668,6 +608,7 @@ async def lease( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id')) + if response.status_code == 201: response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) @@ -676,6 +617,7 @@ async def lease( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id')) + if response.status_code == 202: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) @@ -683,12 +625,15 @@ async def lease( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['x-ms-lease-time']=self._deserialize('str', response.headers.get('x-ms-lease-time')) + if cls: return cls(pipeline_response, None, response_headers) - lease.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + lease.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + + @distributed_trace_async async def read( self, request_id_parameter: Optional[str] = None, @@ -737,7 +682,7 @@ async def read( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _if_match = None _if_none_match = None @@ -750,48 +695,34 @@ async def read( _if_none_match = modified_access_conditions.if_none_match _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - accept = "application/json" - # Construct URL - url = self.read.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if range is not None: - header_parameters['Range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if x_ms_range_get_content_md5 is not None: - header_parameters['x-ms-range-get-content-md5'] = self._serialize.header("x_ms_range_get_content_md5", x_ms_range_get_content_md5, 'bool') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + request = build_read_request( + url=self._config.url, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + range=range, + lease_id=_lease_id, + x_ms_range_get_content_md5=x_ms_range_get_content_md5, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.read.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=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 206]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -815,6 +746,7 @@ async def read( response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration')) response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state')) response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status')) + deserialized = response.stream_download(self._client._pipeline) if response.status_code == 206: @@ -838,15 +770,19 @@ async def read( response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration')) response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state')) response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status')) + deserialized = response.stream_download(self._client._pipeline) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - read.metadata = {'url': '/{filesystem}/{path}'} # type: ignore - async def get_properties( + read.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + + + @distributed_trace_async + async def get_properties( # pylint: disable=inconsistent-return-statements self, request_id_parameter: Optional[str] = None, timeout: Optional[int] = None, @@ -898,7 +834,7 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _if_match = None _if_none_match = None @@ -911,48 +847,34 @@ async def get_properties( _if_none_match = modified_access_conditions.if_none_match _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - accept = "application/json" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if action is not None: - query_parameters['action'] = self._serialize.query("action", action, 'str') - if upn is not None: - query_parameters['upn'] = self._serialize.query("upn", upn, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_properties_request( + url=self._config.url, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + action=action, + upn=upn, + lease_id=_lease_id, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -980,12 +902,15 @@ async def get_properties( response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state')) response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + get_properties.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore - async def delete( + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, request_id_parameter: Optional[str] = None, timeout: Optional[int] = None, @@ -1031,7 +956,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _if_match = None _if_none_match = None @@ -1044,48 +969,34 @@ async def delete( _if_none_match = modified_access_conditions.if_none_match _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - accept = "application/json" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if recursive is not None: - query_parameters['recursive'] = self._serialize.query("recursive", recursive, 'bool') - if continuation is not None: - query_parameters['continuation'] = self._serialize.query("continuation", continuation, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_delete_request( + url=self._config.url, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + recursive=recursive, + continuation=continuation, + lease_id=_lease_id, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.delete.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1095,12 +1006,15 @@ async def delete( response_headers['x-ms-continuation']=self._deserialize('str', response.headers.get('x-ms-continuation')) response_headers['x-ms-deletion-id']=self._deserialize('str', response.headers.get('x-ms-deletion-id')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + delete.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore - async def set_access_control( + + @distributed_trace_async + async def set_access_control( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, owner: Optional[str] = None, @@ -1140,6 +1054,9 @@ async def set_access_control( :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions + :keyword action: action. The default value is "setAccessControl". Note that overriding this + default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1150,7 +1067,9 @@ async def set_access_control( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + action = kwargs.pop('action', "setAccessControl") # type: str + _lease_id = None _if_match = None _if_none_match = None @@ -1163,54 +1082,37 @@ async def set_access_control( _if_none_match = modified_access_conditions.if_none_match _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - action = "setAccessControl" - accept = "application/json" - # Construct URL - url = self.set_access_control.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['action'] = self._serialize.query("action", action, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if owner is not None: - header_parameters['x-ms-owner'] = self._serialize.header("owner", owner, 'str') - if group is not None: - header_parameters['x-ms-group'] = self._serialize.header("group", group, 'str') - if permissions is not None: - header_parameters['x-ms-permissions'] = self._serialize.header("permissions", permissions, 'str') - if acl is not None: - header_parameters['x-ms-acl'] = self._serialize.header("acl", acl, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.patch(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_access_control_request( + url=self._config.url, + action=action, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + owner=owner, + group=group, + permissions=permissions, + acl=acl, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.set_access_control.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1221,11 +1123,14 @@ async def set_access_control( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - set_access_control.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + set_access_control.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + + @distributed_trace_async async def set_access_control_recursive( self, mode: Union[str, "_models.PathSetAccessControlRecursiveMode"], @@ -1273,6 +1178,9 @@ async def set_access_control_recursive( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword action: action. The default value is "setAccessControlRecursive". Note that overriding + this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SetAccessControlRecursiveResponse, or the result of cls(response) :rtype: ~azure.storage.filedatalake.models.SetAccessControlRecursiveResponse @@ -1283,45 +1191,36 @@ async def set_access_control_recursive( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - action = "setAccessControlRecursive" - accept = "application/json" - # Construct URL - url = self.set_access_control_recursive.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['action'] = self._serialize.query("action", action, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if continuation is not None: - query_parameters['continuation'] = self._serialize.query("continuation", continuation, 'str') - query_parameters['mode'] = self._serialize.query("mode", mode, 'str') - if force_flag is not None: - query_parameters['forceFlag'] = self._serialize.query("force_flag", force_flag, 'bool') - if max_records is not None: - query_parameters['maxRecords'] = self._serialize.query("max_records", max_records, 'int', minimum=1) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if acl is not None: - header_parameters['x-ms-acl'] = self._serialize.header("acl", acl, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.patch(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + action = kwargs.pop('action', "setAccessControlRecursive") # type: str + + + request = build_set_access_control_recursive_request( + url=self._config.url, + action=action, + version=self._config.version, + mode=mode, + timeout=timeout, + continuation=continuation, + force_flag=force_flag, + max_records=max_records, + acl=acl, + request_id_parameter=request_id_parameter, + template_url=self.set_access_control_recursive.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1330,15 +1229,19 @@ async def set_access_control_recursive( response_headers['x-ms-continuation']=self._deserialize('str', response.headers.get('x-ms-continuation')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('SetAccessControlRecursiveResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - set_access_control_recursive.metadata = {'url': '/{filesystem}/{path}'} # type: ignore - async def flush_data( + set_access_control_recursive.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + + + @distributed_trace_async + async def flush_data( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, position: Optional[int] = None, @@ -1395,6 +1298,9 @@ async def flush_data( :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions + :keyword action: action. The default value is "flush". Note that overriding this default value + may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1405,11 +1311,13 @@ async def flush_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + action = kwargs.pop('action', "flush") # type: str + _content_md5 = None _lease_id = None _cache_control = None - _content_type = None + _content_type_parameter = None _content_disposition = None _content_encoding = None _content_language = None @@ -1417,80 +1325,58 @@ async def flush_data( _if_none_match = None _if_modified_since = None _if_unmodified_since = None + if path_http_headers is not None: + _content_md5 = path_http_headers.content_md5 if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - if modified_access_conditions is not None: - _if_match = modified_access_conditions.if_match - _if_none_match = modified_access_conditions.if_none_match - _if_modified_since = modified_access_conditions.if_modified_since - _if_unmodified_since = modified_access_conditions.if_unmodified_since if path_http_headers is not None: - _content_md5 = path_http_headers.content_md5 _cache_control = path_http_headers.cache_control - _content_type = path_http_headers.content_type + _content_type_parameter = path_http_headers.content_type _content_disposition = path_http_headers.content_disposition _content_encoding = path_http_headers.content_encoding _content_language = path_http_headers.content_language - action = "flush" - accept = "application/json" + if modified_access_conditions is not None: + _if_match = modified_access_conditions.if_match + _if_none_match = modified_access_conditions.if_none_match + _if_modified_since = modified_access_conditions.if_modified_since + _if_unmodified_since = modified_access_conditions.if_unmodified_since - # Construct URL - url = self.flush_data.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['action'] = self._serialize.query("action", action, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if position is not None: - query_parameters['position'] = self._serialize.query("position", position, 'long') - if retain_uncommitted_data is not None: - query_parameters['retainUncommittedData'] = self._serialize.query("retain_uncommitted_data", retain_uncommitted_data, 'bool') - if close is not None: - query_parameters['close'] = self._serialize.query("close", close, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if content_length is not None: - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long', minimum=0) - if _content_md5 is not None: - header_parameters['x-ms-content-md5'] = self._serialize.header("content_md5", _content_md5, 'bytearray') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _cache_control is not None: - header_parameters['x-ms-cache-control'] = self._serialize.header("cache_control", _cache_control, 'str') - if _content_type is not None: - header_parameters['x-ms-content-type'] = self._serialize.header("content_type", _content_type, 'str') - if _content_disposition is not None: - header_parameters['x-ms-content-disposition'] = self._serialize.header("content_disposition", _content_disposition, 'str') - if _content_encoding is not None: - header_parameters['x-ms-content-encoding'] = self._serialize.header("content_encoding", _content_encoding, 'str') - if _content_language is not None: - header_parameters['x-ms-content-language'] = self._serialize.header("content_language", _content_language, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.patch(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_flush_data_request( + url=self._config.url, + action=action, + version=self._config.version, + timeout=timeout, + position=position, + retain_uncommitted_data=retain_uncommitted_data, + close=close, + content_length=content_length, + content_md5=_content_md5, + lease_id=_lease_id, + cache_control=_cache_control, + content_type_parameter=_content_type_parameter, + content_disposition=_content_disposition, + content_encoding=_content_encoding, + content_language=_content_language, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.flush_data.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1502,12 +1388,15 @@ async def flush_data( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - flush_data.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + flush_data.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + - async def append_data( + @distributed_trace_async + async def append_data( # pylint: disable=inconsistent-return-statements self, body: IO, position: Optional[int] = None, @@ -1549,6 +1438,9 @@ async def append_data( :type path_http_headers: ~azure.storage.filedatalake.models.PathHTTPHeaders :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions + :keyword action: action. The default value is "append". Note that overriding this default value + may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1559,57 +1451,46 @@ async def append_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + action = kwargs.pop('action', "append") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _transactional_content_hash = None _lease_id = None - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if path_http_headers is not None: _transactional_content_hash = path_http_headers.transactional_content_hash - action = "append" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.append_data.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['action'] = self._serialize.query("action", action, 'str') - if position is not None: - query_parameters['position'] = self._serialize.query("position", position, 'long') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if content_length is not None: - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long', minimum=0) - if _transactional_content_hash is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_hash", _transactional_content_hash, 'bytearray') - if transactional_content_crc64 is not None: - header_parameters['x-ms-content-crc64'] = self._serialize.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = body - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + _content = body + + request = build_append_data_request( + url=self._config.url, + action=action, + version=self._config.version, + content_type=content_type, + content=_content, + position=position, + timeout=timeout, + content_length=content_length, + transactional_content_hash=_transactional_content_hash, + transactional_content_crc64=transactional_content_crc64, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.append_data.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1622,12 +1503,15 @@ async def append_data( response_headers['x-ms-content-crc64']=self._deserialize('bytearray', response.headers.get('x-ms-content-crc64')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - append_data.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + append_data.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore - async def set_expiry( + + @distributed_trace_async + async def set_expiry( # pylint: disable=inconsistent-return-statements self, expiry_options: Union[str, "_models.PathExpiryOptions"], timeout: Optional[int] = None, @@ -1649,6 +1533,9 @@ async def set_expiry( :type request_id_parameter: str :param expires_on: The time to set the blob to expiry. :type expires_on: str + :keyword comp: comp. The default value is "expiry". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1659,39 +1546,33 @@ async def set_expiry( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "expiry" - accept = "application/json" - # Construct URL - url = self.set_expiry.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-expiry-option'] = self._serialize.header("expiry_options", expiry_options, 'str') - if expires_on is not None: - header_parameters['x-ms-expiry-time'] = self._serialize.header("expires_on", expires_on, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "expiry") # type: str + + + request = build_set_expiry_request( + url=self._config.url, + comp=comp, + version=self._config.version, + expiry_options=expiry_options, + timeout=timeout, + request_id_parameter=request_id_parameter, + expires_on=expires_on, + template_url=self.set_expiry.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1702,12 +1583,15 @@ async def set_expiry( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_expiry.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + set_expiry.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore - async def undelete( + + @distributed_trace_async + async def undelete( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, undelete_source: Optional[str] = None, @@ -1727,6 +1611,9 @@ async def undelete( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "undelete". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1737,38 +1624,32 @@ async def undelete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "undelete" - accept = "application/json" - # Construct URL - url = self.undelete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if undelete_source is not None: - header_parameters['x-ms-undelete-source'] = self._serialize.header("undelete_source", undelete_source, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "undelete") # type: str + + + request = build_undelete_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + undelete_source=undelete_source, + request_id_parameter=request_id_parameter, + template_url=self.undelete.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1778,7 +1659,9 @@ async def undelete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - undelete.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + undelete.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_service_operations.py index 4572042d12a6..dd5365398f2a 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, 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 from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._service_operations import build_list_file_systems_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_file_systems( self, prefix: Optional[str] = None, @@ -72,59 +76,59 @@ def list_file_systems( href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.`. :type timeout: int + :keyword resource: The value must be "account" for all account operations. The default value is + "account". Note that overriding this default value may result in unsupported behavior. + :paramtype resource: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileSystemList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.filedatalake.models.FileSystemList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.storage.filedatalake.models.FileSystemList] :raises: ~azure.core.exceptions.HttpResponseError """ + resource = kwargs.pop('resource', "account") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileSystemList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - resource = "account" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_file_systems.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['resource'] = self._serialize.query("resource", resource, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - if continuation is not None: - query_parameters['continuation'] = self._serialize.query("continuation", continuation, 'str') - if max_results is not None: - query_parameters['maxResults'] = self._serialize.query("max_results", max_results, 'int', minimum=1) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_file_systems_request( + url=self._config.url, + resource=resource, + version=self._config.version, + prefix=prefix, + continuation=continuation, + max_results=max_results, + request_id_parameter=request_id_parameter, + timeout=timeout, + template_url=self.list_file_systems.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_file_systems_request( + url=self._config.url, + resource=resource, + version=self._config.version, + prefix=prefix, + continuation=continuation, + max_results=max_results, + request_id_parameter=request_id_parameter, + timeout=timeout, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('FileSystemList', pipeline_response) + deserialized = self._deserialize("FileSystemList", pipeline_response) list_of_elem = deserialized.filesystems if cls: list_of_elem = cls(list_of_elem) @@ -133,17 +137,22 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_file_systems.metadata = {'url': '/'} # type: ignore + list_file_systems.metadata = {'url': "{url}/"} # type: ignore diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_azure_data_lake_storage_restapi_enums.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_azure_data_lake_storage_restapi_enums.py index 804050e9e0d0..001cce1f2907 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_azure_data_lake_storage_restapi_enums.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_azure_data_lake_storage_restapi_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ListBlobsIncludeItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListBlobsIncludeItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): COPY = "copy" DELETED = "deleted" @@ -36,19 +21,19 @@ class ListBlobsIncludeItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): VERSIONS = "versions" TAGS = "tags" -class PathExpiryOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PathExpiryOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NEVER_EXPIRE = "NeverExpire" RELATIVE_TO_CREATION = "RelativeToCreation" RELATIVE_TO_NOW = "RelativeToNow" ABSOLUTE = "Absolute" -class PathGetPropertiesAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PathGetPropertiesAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET_ACCESS_CONTROL = "getAccessControl" GET_STATUS = "getStatus" -class PathLeaseAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PathLeaseAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ACQUIRE = "acquire" BREAK_ENUM = "break" @@ -56,23 +41,23 @@ class PathLeaseAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RENEW = "renew" RELEASE = "release" -class PathRenameMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PathRenameMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): LEGACY = "legacy" POSIX = "posix" -class PathResourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PathResourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DIRECTORY = "directory" FILE = "file" -class PathSetAccessControlRecursiveMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PathSetAccessControlRecursiveMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SET = "set" MODIFY = "modify" REMOVE = "remove" -class PathUpdateAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PathUpdateAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): APPEND = "append" FLUSH = "flush" diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_models.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_models.py index 3814aa7b0ae2..8dc76d1e72f1 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_models.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_models.py @@ -13,12 +13,12 @@ class AclFailedEntry(msrest.serialization.Model): """AclFailedEntry. - :param name: - :type name: str - :param type: - :type type: str - :param error_message: - :type error_message: str + :ivar name: + :vartype name: str + :ivar type: + :vartype type: str + :ivar error_message: + :vartype error_message: str """ _attribute_map = { @@ -31,6 +31,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword type: + :paramtype type: str + :keyword error_message: + :paramtype error_message: str + """ super(AclFailedEntry, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.type = kwargs.get('type', None) @@ -42,10 +50,10 @@ class BlobHierarchyListSegment(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param blob_prefixes: - :type blob_prefixes: list[~azure.storage.filedatalake.models.BlobPrefix] - :param blob_items: Required. - :type blob_items: list[~azure.storage.filedatalake.models.BlobItemInternal] + :ivar blob_prefixes: + :vartype blob_prefixes: list[~azure.storage.filedatalake.models.BlobPrefix] + :ivar blob_items: Required. + :vartype blob_items: list[~azure.storage.filedatalake.models.BlobItemInternal] """ _validation = { @@ -64,6 +72,12 @@ def __init__( self, **kwargs ): + """ + :keyword blob_prefixes: + :paramtype blob_prefixes: list[~azure.storage.filedatalake.models.BlobPrefix] + :keyword blob_items: Required. + :paramtype blob_items: list[~azure.storage.filedatalake.models.BlobItemInternal] + """ super(BlobHierarchyListSegment, self).__init__(**kwargs) self.blob_prefixes = kwargs.get('blob_prefixes', None) self.blob_items = kwargs['blob_items'] @@ -74,20 +88,20 @@ class BlobItemInternal(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param deleted: Required. - :type deleted: bool - :param snapshot: Required. - :type snapshot: str - :param version_id: - :type version_id: str - :param is_current_version: - :type is_current_version: bool - :param properties: Required. Properties of a blob. - :type properties: ~azure.storage.filedatalake.models.BlobPropertiesInternal - :param deletion_id: - :type deletion_id: str + :ivar name: Required. + :vartype name: str + :ivar deleted: Required. + :vartype deleted: bool + :ivar snapshot: Required. + :vartype snapshot: str + :ivar version_id: + :vartype version_id: str + :ivar is_current_version: + :vartype is_current_version: bool + :ivar properties: Required. Properties of a blob. + :vartype properties: ~azure.storage.filedatalake.models.BlobPropertiesInternal + :ivar deletion_id: + :vartype deletion_id: str """ _validation = { @@ -114,6 +128,22 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword deleted: Required. + :paramtype deleted: bool + :keyword snapshot: Required. + :paramtype snapshot: str + :keyword version_id: + :paramtype version_id: str + :keyword is_current_version: + :paramtype is_current_version: bool + :keyword properties: Required. Properties of a blob. + :paramtype properties: ~azure.storage.filedatalake.models.BlobPropertiesInternal + :keyword deletion_id: + :paramtype deletion_id: str + """ super(BlobItemInternal, self).__init__(**kwargs) self.name = kwargs['name'] self.deleted = kwargs['deleted'] @@ -129,8 +159,8 @@ class BlobPrefix(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str + :ivar name: Required. + :vartype name: str """ _validation = { @@ -145,6 +175,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + """ super(BlobPrefix, self).__init__(**kwargs) self.name = kwargs['name'] @@ -154,66 +188,66 @@ class BlobPropertiesInternal(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param creation_time: - :type creation_time: ~datetime.datetime - :param last_modified: Required. - :type last_modified: ~datetime.datetime - :param etag: Required. - :type etag: str - :param content_length: Size in bytes. - :type content_length: long - :param content_type: - :type content_type: str - :param content_encoding: - :type content_encoding: str - :param content_language: - :type content_language: str - :param content_md5: - :type content_md5: bytearray - :param content_disposition: - :type content_disposition: str - :param cache_control: - :type cache_control: str - :param blob_sequence_number: - :type blob_sequence_number: long - :param copy_id: - :type copy_id: str - :param copy_source: - :type copy_source: str - :param copy_progress: - :type copy_progress: str - :param copy_completion_time: - :type copy_completion_time: ~datetime.datetime - :param copy_status_description: - :type copy_status_description: str - :param server_encrypted: - :type server_encrypted: bool - :param incremental_copy: - :type incremental_copy: bool - :param destination_snapshot: - :type destination_snapshot: str - :param deleted_time: - :type deleted_time: ~datetime.datetime - :param remaining_retention_days: - :type remaining_retention_days: int - :param access_tier_inferred: - :type access_tier_inferred: bool - :param customer_provided_key_sha256: - :type customer_provided_key_sha256: str - :param encryption_scope: The name of the encryption scope under which the blob is encrypted. - :type encryption_scope: str - :param access_tier_change_time: - :type access_tier_change_time: ~datetime.datetime - :param tag_count: - :type tag_count: int - :param expires_on: - :type expires_on: ~datetime.datetime - :param is_sealed: - :type is_sealed: bool - :param last_accessed_on: - :type last_accessed_on: ~datetime.datetime - :param delete_time: - :type delete_time: ~datetime.datetime + :ivar creation_time: + :vartype creation_time: ~datetime.datetime + :ivar last_modified: Required. + :vartype last_modified: ~datetime.datetime + :ivar etag: Required. + :vartype etag: str + :ivar content_length: Size in bytes. + :vartype content_length: long + :ivar content_type: + :vartype content_type: str + :ivar content_encoding: + :vartype content_encoding: str + :ivar content_language: + :vartype content_language: str + :ivar content_md5: + :vartype content_md5: bytearray + :ivar content_disposition: + :vartype content_disposition: str + :ivar cache_control: + :vartype cache_control: str + :ivar blob_sequence_number: + :vartype blob_sequence_number: long + :ivar copy_id: + :vartype copy_id: str + :ivar copy_source: + :vartype copy_source: str + :ivar copy_progress: + :vartype copy_progress: str + :ivar copy_completion_time: + :vartype copy_completion_time: ~datetime.datetime + :ivar copy_status_description: + :vartype copy_status_description: str + :ivar server_encrypted: + :vartype server_encrypted: bool + :ivar incremental_copy: + :vartype incremental_copy: bool + :ivar destination_snapshot: + :vartype destination_snapshot: str + :ivar deleted_time: + :vartype deleted_time: ~datetime.datetime + :ivar remaining_retention_days: + :vartype remaining_retention_days: int + :ivar access_tier_inferred: + :vartype access_tier_inferred: bool + :ivar customer_provided_key_sha256: + :vartype customer_provided_key_sha256: str + :ivar encryption_scope: The name of the encryption scope under which the blob is encrypted. + :vartype encryption_scope: str + :ivar access_tier_change_time: + :vartype access_tier_change_time: ~datetime.datetime + :ivar tag_count: + :vartype tag_count: int + :ivar expires_on: + :vartype expires_on: ~datetime.datetime + :ivar is_sealed: + :vartype is_sealed: bool + :ivar last_accessed_on: + :vartype last_accessed_on: ~datetime.datetime + :ivar delete_time: + :vartype delete_time: ~datetime.datetime """ _validation = { @@ -261,6 +295,68 @@ def __init__( self, **kwargs ): + """ + :keyword creation_time: + :paramtype creation_time: ~datetime.datetime + :keyword last_modified: Required. + :paramtype last_modified: ~datetime.datetime + :keyword etag: Required. + :paramtype etag: str + :keyword content_length: Size in bytes. + :paramtype content_length: long + :keyword content_type: + :paramtype content_type: str + :keyword content_encoding: + :paramtype content_encoding: str + :keyword content_language: + :paramtype content_language: str + :keyword content_md5: + :paramtype content_md5: bytearray + :keyword content_disposition: + :paramtype content_disposition: str + :keyword cache_control: + :paramtype cache_control: str + :keyword blob_sequence_number: + :paramtype blob_sequence_number: long + :keyword copy_id: + :paramtype copy_id: str + :keyword copy_source: + :paramtype copy_source: str + :keyword copy_progress: + :paramtype copy_progress: str + :keyword copy_completion_time: + :paramtype copy_completion_time: ~datetime.datetime + :keyword copy_status_description: + :paramtype copy_status_description: str + :keyword server_encrypted: + :paramtype server_encrypted: bool + :keyword incremental_copy: + :paramtype incremental_copy: bool + :keyword destination_snapshot: + :paramtype destination_snapshot: str + :keyword deleted_time: + :paramtype deleted_time: ~datetime.datetime + :keyword remaining_retention_days: + :paramtype remaining_retention_days: int + :keyword access_tier_inferred: + :paramtype access_tier_inferred: bool + :keyword customer_provided_key_sha256: + :paramtype customer_provided_key_sha256: str + :keyword encryption_scope: The name of the encryption scope under which the blob is encrypted. + :paramtype encryption_scope: str + :keyword access_tier_change_time: + :paramtype access_tier_change_time: ~datetime.datetime + :keyword tag_count: + :paramtype tag_count: int + :keyword expires_on: + :paramtype expires_on: ~datetime.datetime + :keyword is_sealed: + :paramtype is_sealed: bool + :keyword last_accessed_on: + :paramtype last_accessed_on: ~datetime.datetime + :keyword delete_time: + :paramtype delete_time: ~datetime.datetime + """ super(BlobPropertiesInternal, self).__init__(**kwargs) self.creation_time = kwargs.get('creation_time', None) self.last_modified = kwargs['last_modified'] @@ -297,12 +393,12 @@ def __init__( class FileSystem(msrest.serialization.Model): """FileSystem. - :param name: - :type name: str - :param last_modified: - :type last_modified: str - :param e_tag: - :type e_tag: str + :ivar name: + :vartype name: str + :ivar last_modified: + :vartype last_modified: str + :ivar e_tag: + :vartype e_tag: str """ _attribute_map = { @@ -315,6 +411,14 @@ def __init__( self, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword last_modified: + :paramtype last_modified: str + :keyword e_tag: + :paramtype e_tag: str + """ super(FileSystem, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.last_modified = kwargs.get('last_modified', None) @@ -324,8 +428,8 @@ def __init__( class FileSystemList(msrest.serialization.Model): """FileSystemList. - :param filesystems: - :type filesystems: list[~azure.storage.filedatalake.models.FileSystem] + :ivar filesystems: + :vartype filesystems: list[~azure.storage.filedatalake.models.FileSystem] """ _attribute_map = { @@ -336,6 +440,10 @@ def __init__( self, **kwargs ): + """ + :keyword filesystems: + :paramtype filesystems: list[~azure.storage.filedatalake.models.FileSystem] + """ super(FileSystemList, self).__init__(**kwargs) self.filesystems = kwargs.get('filesystems', None) @@ -343,9 +451,9 @@ def __init__( class LeaseAccessConditions(msrest.serialization.Model): """Parameter group. - :param lease_id: If specified, the operation only succeeds if the resource's lease is active - and matches this ID. - :type lease_id: str + :ivar lease_id: If specified, the operation only succeeds if the resource's lease is active and + matches this ID. + :vartype lease_id: str """ _attribute_map = { @@ -356,6 +464,11 @@ def __init__( self, **kwargs ): + """ + :keyword lease_id: If specified, the operation only succeeds if the resource's lease is active + and matches this ID. + :paramtype lease_id: str + """ super(LeaseAccessConditions, self).__init__(**kwargs) self.lease_id = kwargs.get('lease_id', None) @@ -365,22 +478,22 @@ class ListBlobsHierarchySegmentResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param container_name: Required. - :type container_name: str - :param prefix: - :type prefix: str - :param marker: - :type marker: str - :param max_results: - :type max_results: int - :param delimiter: - :type delimiter: str - :param segment: Required. - :type segment: ~azure.storage.filedatalake.models.BlobHierarchyListSegment - :param next_marker: - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar container_name: Required. + :vartype container_name: str + :ivar prefix: + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: + :vartype max_results: int + :ivar delimiter: + :vartype delimiter: str + :ivar segment: Required. + :vartype segment: ~azure.storage.filedatalake.models.BlobHierarchyListSegment + :ivar next_marker: + :vartype next_marker: str """ _validation = { @@ -407,6 +520,24 @@ def __init__( self, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword container_name: Required. + :paramtype container_name: str + :keyword prefix: + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: + :paramtype max_results: int + :keyword delimiter: + :paramtype delimiter: str + :keyword segment: Required. + :paramtype segment: ~azure.storage.filedatalake.models.BlobHierarchyListSegment + :keyword next_marker: + :paramtype next_marker: str + """ super(ListBlobsHierarchySegmentResponse, self).__init__(**kwargs) self.service_endpoint = kwargs['service_endpoint'] self.container_name = kwargs['container_name'] @@ -421,16 +552,16 @@ def __init__( class ModifiedAccessConditions(msrest.serialization.Model): """Parameter group. - :param if_modified_since: Specify this header value to operate only on a blob if it has been + :ivar if_modified_since: Specify this header value to operate only on a blob if it has been modified since the specified date/time. - :type if_modified_since: ~datetime.datetime - :param if_unmodified_since: Specify this header value to operate only on a blob if it has not + :vartype if_modified_since: ~datetime.datetime + :ivar if_unmodified_since: Specify this header value to operate only on a blob if it has not been modified since the specified date/time. - :type if_unmodified_since: ~datetime.datetime - :param if_match: Specify an ETag value to operate only on blobs with a matching value. - :type if_match: str - :param if_none_match: Specify an ETag value to operate only on blobs without a matching value. - :type if_none_match: str + :vartype if_unmodified_since: ~datetime.datetime + :ivar if_match: Specify an ETag value to operate only on blobs with a matching value. + :vartype if_match: str + :ivar if_none_match: Specify an ETag value to operate only on blobs without a matching value. + :vartype if_none_match: str """ _attribute_map = { @@ -444,6 +575,19 @@ def __init__( self, **kwargs ): + """ + :keyword if_modified_since: Specify this header value to operate only on a blob if it has been + modified since the specified date/time. + :paramtype if_modified_since: ~datetime.datetime + :keyword if_unmodified_since: Specify this header value to operate only on a blob if it has not + been modified since the specified date/time. + :paramtype if_unmodified_since: ~datetime.datetime + :keyword if_match: Specify an ETag value to operate only on blobs with a matching value. + :paramtype if_match: str + :keyword if_none_match: Specify an ETag value to operate only on blobs without a matching + value. + :paramtype if_none_match: str + """ super(ModifiedAccessConditions, self).__init__(**kwargs) self.if_modified_since = kwargs.get('if_modified_since', None) self.if_unmodified_since = kwargs.get('if_unmodified_since', None) @@ -454,24 +598,24 @@ def __init__( class Path(msrest.serialization.Model): """Path. - :param name: - :type name: str - :param is_directory: - :type is_directory: bool - :param last_modified: - :type last_modified: str - :param e_tag: - :type e_tag: str - :param content_length: - :type content_length: long - :param owner: - :type owner: str - :param group: - :type group: str - :param permissions: - :type permissions: str - :param encryption_scope: The name of the encryption scope under which the blob is encrypted. - :type encryption_scope: str + :ivar name: + :vartype name: str + :ivar is_directory: + :vartype is_directory: bool + :ivar last_modified: + :vartype last_modified: str + :ivar e_tag: + :vartype e_tag: str + :ivar content_length: + :vartype content_length: long + :ivar owner: + :vartype owner: str + :ivar group: + :vartype group: str + :ivar permissions: + :vartype permissions: str + :ivar encryption_scope: The name of the encryption scope under which the blob is encrypted. + :vartype encryption_scope: str """ _attribute_map = { @@ -490,6 +634,26 @@ def __init__( self, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword is_directory: + :paramtype is_directory: bool + :keyword last_modified: + :paramtype last_modified: str + :keyword e_tag: + :paramtype e_tag: str + :keyword content_length: + :paramtype content_length: long + :keyword owner: + :paramtype owner: str + :keyword group: + :paramtype group: str + :keyword permissions: + :paramtype permissions: str + :keyword encryption_scope: The name of the encryption scope under which the blob is encrypted. + :paramtype encryption_scope: str + """ super(Path, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.is_directory = kwargs.get('is_directory', False) @@ -505,25 +669,25 @@ def __init__( class PathHTTPHeaders(msrest.serialization.Model): """Parameter group. - :param cache_control: Optional. Sets the blob's cache control. If specified, this property is + :ivar cache_control: Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request. - :type cache_control: str - :param content_encoding: Optional. Sets the blob's content encoding. If specified, this - property is stored with the blob and returned with a read request. - :type content_encoding: str - :param content_language: Optional. Set the blob's content language. If specified, this property + :vartype cache_control: str + :ivar content_encoding: Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request. - :type content_language: str - :param content_disposition: Optional. Sets the blob's Content-Disposition header. - :type content_disposition: str - :param content_type: Optional. Sets the blob's content type. If specified, this property is + :vartype content_encoding: str + :ivar content_language: Optional. Set the blob's content language. If specified, this property + is stored with the blob and returned with a read request. + :vartype content_language: str + :ivar content_disposition: Optional. Sets the blob's Content-Disposition header. + :vartype content_disposition: str + :ivar content_type: Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request. - :type content_type: str - :param content_md5: Specify the transactional md5 for the body, to be validated by the service. - :type content_md5: bytearray - :param transactional_content_hash: Specify the transactional md5 for the body, to be validated + :vartype content_type: str + :ivar content_md5: Specify the transactional md5 for the body, to be validated by the service. + :vartype content_md5: bytearray + :ivar transactional_content_hash: Specify the transactional md5 for the body, to be validated by the service. - :type transactional_content_hash: bytearray + :vartype transactional_content_hash: bytearray """ _attribute_map = { @@ -540,6 +704,28 @@ def __init__( self, **kwargs ): + """ + :keyword cache_control: Optional. Sets the blob's cache control. If specified, this property is + stored with the blob and returned with a read request. + :paramtype cache_control: str + :keyword content_encoding: Optional. Sets the blob's content encoding. If specified, this + property is stored with the blob and returned with a read request. + :paramtype content_encoding: str + :keyword content_language: Optional. Set the blob's content language. If specified, this + property is stored with the blob and returned with a read request. + :paramtype content_language: str + :keyword content_disposition: Optional. Sets the blob's Content-Disposition header. + :paramtype content_disposition: str + :keyword content_type: Optional. Sets the blob's content type. If specified, this property is + stored with the blob and returned with a read request. + :paramtype content_type: str + :keyword content_md5: Specify the transactional md5 for the body, to be validated by the + service. + :paramtype content_md5: bytearray + :keyword transactional_content_hash: Specify the transactional md5 for the body, to be + validated by the service. + :paramtype transactional_content_hash: bytearray + """ super(PathHTTPHeaders, self).__init__(**kwargs) self.cache_control = kwargs.get('cache_control', None) self.content_encoding = kwargs.get('content_encoding', None) @@ -553,8 +739,8 @@ def __init__( class PathList(msrest.serialization.Model): """PathList. - :param paths: - :type paths: list[~azure.storage.filedatalake.models.Path] + :ivar paths: + :vartype paths: list[~azure.storage.filedatalake.models.Path] """ _attribute_map = { @@ -565,6 +751,10 @@ def __init__( self, **kwargs ): + """ + :keyword paths: + :paramtype paths: list[~azure.storage.filedatalake.models.Path] + """ super(PathList, self).__init__(**kwargs) self.paths = kwargs.get('paths', None) @@ -572,14 +762,14 @@ def __init__( class SetAccessControlRecursiveResponse(msrest.serialization.Model): """SetAccessControlRecursiveResponse. - :param directories_successful: - :type directories_successful: int - :param files_successful: - :type files_successful: int - :param failure_count: - :type failure_count: int - :param failed_entries: - :type failed_entries: list[~azure.storage.filedatalake.models.AclFailedEntry] + :ivar directories_successful: + :vartype directories_successful: int + :ivar files_successful: + :vartype files_successful: int + :ivar failure_count: + :vartype failure_count: int + :ivar failed_entries: + :vartype failed_entries: list[~azure.storage.filedatalake.models.AclFailedEntry] """ _attribute_map = { @@ -593,6 +783,16 @@ def __init__( self, **kwargs ): + """ + :keyword directories_successful: + :paramtype directories_successful: int + :keyword files_successful: + :paramtype files_successful: int + :keyword failure_count: + :paramtype failure_count: int + :keyword failed_entries: + :paramtype failed_entries: list[~azure.storage.filedatalake.models.AclFailedEntry] + """ super(SetAccessControlRecursiveResponse, self).__init__(**kwargs) self.directories_successful = kwargs.get('directories_successful', None) self.files_successful = kwargs.get('files_successful', None) @@ -603,17 +803,17 @@ def __init__( class SourceModifiedAccessConditions(msrest.serialization.Model): """Parameter group. - :param source_if_match: Specify an ETag value to operate only on blobs with a matching value. - :type source_if_match: str - :param source_if_none_match: Specify an ETag value to operate only on blobs without a matching + :ivar source_if_match: Specify an ETag value to operate only on blobs with a matching value. + :vartype source_if_match: str + :ivar source_if_none_match: Specify an ETag value to operate only on blobs without a matching value. - :type source_if_none_match: str - :param source_if_modified_since: Specify this header value to operate only on a blob if it has + :vartype source_if_none_match: str + :ivar source_if_modified_since: Specify this header value to operate only on a blob if it has been modified since the specified date/time. - :type source_if_modified_since: ~datetime.datetime - :param source_if_unmodified_since: Specify this header value to operate only on a blob if it - has not been modified since the specified date/time. - :type source_if_unmodified_since: ~datetime.datetime + :vartype source_if_modified_since: ~datetime.datetime + :ivar source_if_unmodified_since: Specify this header value to operate only on a blob if it has + not been modified since the specified date/time. + :vartype source_if_unmodified_since: ~datetime.datetime """ _attribute_map = { @@ -627,6 +827,19 @@ def __init__( self, **kwargs ): + """ + :keyword source_if_match: Specify an ETag value to operate only on blobs with a matching value. + :paramtype source_if_match: str + :keyword source_if_none_match: Specify an ETag value to operate only on blobs without a + matching value. + :paramtype source_if_none_match: str + :keyword source_if_modified_since: Specify this header value to operate only on a blob if it + has been modified since the specified date/time. + :paramtype source_if_modified_since: ~datetime.datetime + :keyword source_if_unmodified_since: Specify this header value to operate only on a blob if it + has not been modified since the specified date/time. + :paramtype source_if_unmodified_since: ~datetime.datetime + """ super(SourceModifiedAccessConditions, self).__init__(**kwargs) self.source_if_match = kwargs.get('source_if_match', None) self.source_if_none_match = kwargs.get('source_if_none_match', None) @@ -637,8 +850,8 @@ def __init__( class StorageError(msrest.serialization.Model): """StorageError. - :param error: The service error response object. - :type error: ~azure.storage.filedatalake.models.StorageErrorError + :ivar error: The service error response object. + :vartype error: ~azure.storage.filedatalake.models.StorageErrorError """ _attribute_map = { @@ -649,6 +862,10 @@ def __init__( self, **kwargs ): + """ + :keyword error: The service error response object. + :paramtype error: ~azure.storage.filedatalake.models.StorageErrorError + """ super(StorageError, self).__init__(**kwargs) self.error = kwargs.get('error', None) @@ -656,10 +873,10 @@ def __init__( class StorageErrorError(msrest.serialization.Model): """The service error response object. - :param code: The service error code. - :type code: str - :param message: The service error message. - :type message: str + :ivar code: The service error code. + :vartype code: str + :ivar message: The service error message. + :vartype message: str """ _attribute_map = { @@ -671,6 +888,12 @@ def __init__( self, **kwargs ): + """ + :keyword code: The service error code. + :paramtype code: str + :keyword message: The service error message. + :paramtype message: str + """ super(StorageErrorError, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_models_py3.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_models_py3.py index df254785feef..b3cb3ffabb60 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/models/_models_py3.py @@ -16,12 +16,12 @@ class AclFailedEntry(msrest.serialization.Model): """AclFailedEntry. - :param name: - :type name: str - :param type: - :type type: str - :param error_message: - :type error_message: str + :ivar name: + :vartype name: str + :ivar type: + :vartype type: str + :ivar error_message: + :vartype error_message: str """ _attribute_map = { @@ -38,6 +38,14 @@ def __init__( error_message: Optional[str] = None, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword type: + :paramtype type: str + :keyword error_message: + :paramtype error_message: str + """ super(AclFailedEntry, self).__init__(**kwargs) self.name = name self.type = type @@ -49,10 +57,10 @@ class BlobHierarchyListSegment(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param blob_prefixes: - :type blob_prefixes: list[~azure.storage.filedatalake.models.BlobPrefix] - :param blob_items: Required. - :type blob_items: list[~azure.storage.filedatalake.models.BlobItemInternal] + :ivar blob_prefixes: + :vartype blob_prefixes: list[~azure.storage.filedatalake.models.BlobPrefix] + :ivar blob_items: Required. + :vartype blob_items: list[~azure.storage.filedatalake.models.BlobItemInternal] """ _validation = { @@ -74,6 +82,12 @@ def __init__( blob_prefixes: Optional[List["BlobPrefix"]] = None, **kwargs ): + """ + :keyword blob_prefixes: + :paramtype blob_prefixes: list[~azure.storage.filedatalake.models.BlobPrefix] + :keyword blob_items: Required. + :paramtype blob_items: list[~azure.storage.filedatalake.models.BlobItemInternal] + """ super(BlobHierarchyListSegment, self).__init__(**kwargs) self.blob_prefixes = blob_prefixes self.blob_items = blob_items @@ -84,20 +98,20 @@ class BlobItemInternal(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param deleted: Required. - :type deleted: bool - :param snapshot: Required. - :type snapshot: str - :param version_id: - :type version_id: str - :param is_current_version: - :type is_current_version: bool - :param properties: Required. Properties of a blob. - :type properties: ~azure.storage.filedatalake.models.BlobPropertiesInternal - :param deletion_id: - :type deletion_id: str + :ivar name: Required. + :vartype name: str + :ivar deleted: Required. + :vartype deleted: bool + :ivar snapshot: Required. + :vartype snapshot: str + :ivar version_id: + :vartype version_id: str + :ivar is_current_version: + :vartype is_current_version: bool + :ivar properties: Required. Properties of a blob. + :vartype properties: ~azure.storage.filedatalake.models.BlobPropertiesInternal + :ivar deletion_id: + :vartype deletion_id: str """ _validation = { @@ -132,6 +146,22 @@ def __init__( deletion_id: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword deleted: Required. + :paramtype deleted: bool + :keyword snapshot: Required. + :paramtype snapshot: str + :keyword version_id: + :paramtype version_id: str + :keyword is_current_version: + :paramtype is_current_version: bool + :keyword properties: Required. Properties of a blob. + :paramtype properties: ~azure.storage.filedatalake.models.BlobPropertiesInternal + :keyword deletion_id: + :paramtype deletion_id: str + """ super(BlobItemInternal, self).__init__(**kwargs) self.name = name self.deleted = deleted @@ -147,8 +177,8 @@ class BlobPrefix(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str + :ivar name: Required. + :vartype name: str """ _validation = { @@ -165,6 +195,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + """ super(BlobPrefix, self).__init__(**kwargs) self.name = name @@ -174,66 +208,66 @@ class BlobPropertiesInternal(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param creation_time: - :type creation_time: ~datetime.datetime - :param last_modified: Required. - :type last_modified: ~datetime.datetime - :param etag: Required. - :type etag: str - :param content_length: Size in bytes. - :type content_length: long - :param content_type: - :type content_type: str - :param content_encoding: - :type content_encoding: str - :param content_language: - :type content_language: str - :param content_md5: - :type content_md5: bytearray - :param content_disposition: - :type content_disposition: str - :param cache_control: - :type cache_control: str - :param blob_sequence_number: - :type blob_sequence_number: long - :param copy_id: - :type copy_id: str - :param copy_source: - :type copy_source: str - :param copy_progress: - :type copy_progress: str - :param copy_completion_time: - :type copy_completion_time: ~datetime.datetime - :param copy_status_description: - :type copy_status_description: str - :param server_encrypted: - :type server_encrypted: bool - :param incremental_copy: - :type incremental_copy: bool - :param destination_snapshot: - :type destination_snapshot: str - :param deleted_time: - :type deleted_time: ~datetime.datetime - :param remaining_retention_days: - :type remaining_retention_days: int - :param access_tier_inferred: - :type access_tier_inferred: bool - :param customer_provided_key_sha256: - :type customer_provided_key_sha256: str - :param encryption_scope: The name of the encryption scope under which the blob is encrypted. - :type encryption_scope: str - :param access_tier_change_time: - :type access_tier_change_time: ~datetime.datetime - :param tag_count: - :type tag_count: int - :param expires_on: - :type expires_on: ~datetime.datetime - :param is_sealed: - :type is_sealed: bool - :param last_accessed_on: - :type last_accessed_on: ~datetime.datetime - :param delete_time: - :type delete_time: ~datetime.datetime + :ivar creation_time: + :vartype creation_time: ~datetime.datetime + :ivar last_modified: Required. + :vartype last_modified: ~datetime.datetime + :ivar etag: Required. + :vartype etag: str + :ivar content_length: Size in bytes. + :vartype content_length: long + :ivar content_type: + :vartype content_type: str + :ivar content_encoding: + :vartype content_encoding: str + :ivar content_language: + :vartype content_language: str + :ivar content_md5: + :vartype content_md5: bytearray + :ivar content_disposition: + :vartype content_disposition: str + :ivar cache_control: + :vartype cache_control: str + :ivar blob_sequence_number: + :vartype blob_sequence_number: long + :ivar copy_id: + :vartype copy_id: str + :ivar copy_source: + :vartype copy_source: str + :ivar copy_progress: + :vartype copy_progress: str + :ivar copy_completion_time: + :vartype copy_completion_time: ~datetime.datetime + :ivar copy_status_description: + :vartype copy_status_description: str + :ivar server_encrypted: + :vartype server_encrypted: bool + :ivar incremental_copy: + :vartype incremental_copy: bool + :ivar destination_snapshot: + :vartype destination_snapshot: str + :ivar deleted_time: + :vartype deleted_time: ~datetime.datetime + :ivar remaining_retention_days: + :vartype remaining_retention_days: int + :ivar access_tier_inferred: + :vartype access_tier_inferred: bool + :ivar customer_provided_key_sha256: + :vartype customer_provided_key_sha256: str + :ivar encryption_scope: The name of the encryption scope under which the blob is encrypted. + :vartype encryption_scope: str + :ivar access_tier_change_time: + :vartype access_tier_change_time: ~datetime.datetime + :ivar tag_count: + :vartype tag_count: int + :ivar expires_on: + :vartype expires_on: ~datetime.datetime + :ivar is_sealed: + :vartype is_sealed: bool + :ivar last_accessed_on: + :vartype last_accessed_on: ~datetime.datetime + :ivar delete_time: + :vartype delete_time: ~datetime.datetime """ _validation = { @@ -312,6 +346,68 @@ def __init__( delete_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword creation_time: + :paramtype creation_time: ~datetime.datetime + :keyword last_modified: Required. + :paramtype last_modified: ~datetime.datetime + :keyword etag: Required. + :paramtype etag: str + :keyword content_length: Size in bytes. + :paramtype content_length: long + :keyword content_type: + :paramtype content_type: str + :keyword content_encoding: + :paramtype content_encoding: str + :keyword content_language: + :paramtype content_language: str + :keyword content_md5: + :paramtype content_md5: bytearray + :keyword content_disposition: + :paramtype content_disposition: str + :keyword cache_control: + :paramtype cache_control: str + :keyword blob_sequence_number: + :paramtype blob_sequence_number: long + :keyword copy_id: + :paramtype copy_id: str + :keyword copy_source: + :paramtype copy_source: str + :keyword copy_progress: + :paramtype copy_progress: str + :keyword copy_completion_time: + :paramtype copy_completion_time: ~datetime.datetime + :keyword copy_status_description: + :paramtype copy_status_description: str + :keyword server_encrypted: + :paramtype server_encrypted: bool + :keyword incremental_copy: + :paramtype incremental_copy: bool + :keyword destination_snapshot: + :paramtype destination_snapshot: str + :keyword deleted_time: + :paramtype deleted_time: ~datetime.datetime + :keyword remaining_retention_days: + :paramtype remaining_retention_days: int + :keyword access_tier_inferred: + :paramtype access_tier_inferred: bool + :keyword customer_provided_key_sha256: + :paramtype customer_provided_key_sha256: str + :keyword encryption_scope: The name of the encryption scope under which the blob is encrypted. + :paramtype encryption_scope: str + :keyword access_tier_change_time: + :paramtype access_tier_change_time: ~datetime.datetime + :keyword tag_count: + :paramtype tag_count: int + :keyword expires_on: + :paramtype expires_on: ~datetime.datetime + :keyword is_sealed: + :paramtype is_sealed: bool + :keyword last_accessed_on: + :paramtype last_accessed_on: ~datetime.datetime + :keyword delete_time: + :paramtype delete_time: ~datetime.datetime + """ super(BlobPropertiesInternal, self).__init__(**kwargs) self.creation_time = creation_time self.last_modified = last_modified @@ -348,12 +444,12 @@ def __init__( class FileSystem(msrest.serialization.Model): """FileSystem. - :param name: - :type name: str - :param last_modified: - :type last_modified: str - :param e_tag: - :type e_tag: str + :ivar name: + :vartype name: str + :ivar last_modified: + :vartype last_modified: str + :ivar e_tag: + :vartype e_tag: str """ _attribute_map = { @@ -370,6 +466,14 @@ def __init__( e_tag: Optional[str] = None, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword last_modified: + :paramtype last_modified: str + :keyword e_tag: + :paramtype e_tag: str + """ super(FileSystem, self).__init__(**kwargs) self.name = name self.last_modified = last_modified @@ -379,8 +483,8 @@ def __init__( class FileSystemList(msrest.serialization.Model): """FileSystemList. - :param filesystems: - :type filesystems: list[~azure.storage.filedatalake.models.FileSystem] + :ivar filesystems: + :vartype filesystems: list[~azure.storage.filedatalake.models.FileSystem] """ _attribute_map = { @@ -393,6 +497,10 @@ def __init__( filesystems: Optional[List["FileSystem"]] = None, **kwargs ): + """ + :keyword filesystems: + :paramtype filesystems: list[~azure.storage.filedatalake.models.FileSystem] + """ super(FileSystemList, self).__init__(**kwargs) self.filesystems = filesystems @@ -400,9 +508,9 @@ def __init__( class LeaseAccessConditions(msrest.serialization.Model): """Parameter group. - :param lease_id: If specified, the operation only succeeds if the resource's lease is active - and matches this ID. - :type lease_id: str + :ivar lease_id: If specified, the operation only succeeds if the resource's lease is active and + matches this ID. + :vartype lease_id: str """ _attribute_map = { @@ -415,6 +523,11 @@ def __init__( lease_id: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: If specified, the operation only succeeds if the resource's lease is active + and matches this ID. + :paramtype lease_id: str + """ super(LeaseAccessConditions, self).__init__(**kwargs) self.lease_id = lease_id @@ -424,22 +537,22 @@ class ListBlobsHierarchySegmentResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param container_name: Required. - :type container_name: str - :param prefix: - :type prefix: str - :param marker: - :type marker: str - :param max_results: - :type max_results: int - :param delimiter: - :type delimiter: str - :param segment: Required. - :type segment: ~azure.storage.filedatalake.models.BlobHierarchyListSegment - :param next_marker: - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar container_name: Required. + :vartype container_name: str + :ivar prefix: + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: + :vartype max_results: int + :ivar delimiter: + :vartype delimiter: str + :ivar segment: Required. + :vartype segment: ~azure.storage.filedatalake.models.BlobHierarchyListSegment + :ivar next_marker: + :vartype next_marker: str """ _validation = { @@ -475,6 +588,24 @@ def __init__( next_marker: Optional[str] = None, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword container_name: Required. + :paramtype container_name: str + :keyword prefix: + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: + :paramtype max_results: int + :keyword delimiter: + :paramtype delimiter: str + :keyword segment: Required. + :paramtype segment: ~azure.storage.filedatalake.models.BlobHierarchyListSegment + :keyword next_marker: + :paramtype next_marker: str + """ super(ListBlobsHierarchySegmentResponse, self).__init__(**kwargs) self.service_endpoint = service_endpoint self.container_name = container_name @@ -489,16 +620,16 @@ def __init__( class ModifiedAccessConditions(msrest.serialization.Model): """Parameter group. - :param if_modified_since: Specify this header value to operate only on a blob if it has been + :ivar if_modified_since: Specify this header value to operate only on a blob if it has been modified since the specified date/time. - :type if_modified_since: ~datetime.datetime - :param if_unmodified_since: Specify this header value to operate only on a blob if it has not + :vartype if_modified_since: ~datetime.datetime + :ivar if_unmodified_since: Specify this header value to operate only on a blob if it has not been modified since the specified date/time. - :type if_unmodified_since: ~datetime.datetime - :param if_match: Specify an ETag value to operate only on blobs with a matching value. - :type if_match: str - :param if_none_match: Specify an ETag value to operate only on blobs without a matching value. - :type if_none_match: str + :vartype if_unmodified_since: ~datetime.datetime + :ivar if_match: Specify an ETag value to operate only on blobs with a matching value. + :vartype if_match: str + :ivar if_none_match: Specify an ETag value to operate only on blobs without a matching value. + :vartype if_none_match: str """ _attribute_map = { @@ -517,6 +648,19 @@ def __init__( if_none_match: Optional[str] = None, **kwargs ): + """ + :keyword if_modified_since: Specify this header value to operate only on a blob if it has been + modified since the specified date/time. + :paramtype if_modified_since: ~datetime.datetime + :keyword if_unmodified_since: Specify this header value to operate only on a blob if it has not + been modified since the specified date/time. + :paramtype if_unmodified_since: ~datetime.datetime + :keyword if_match: Specify an ETag value to operate only on blobs with a matching value. + :paramtype if_match: str + :keyword if_none_match: Specify an ETag value to operate only on blobs without a matching + value. + :paramtype if_none_match: str + """ super(ModifiedAccessConditions, self).__init__(**kwargs) self.if_modified_since = if_modified_since self.if_unmodified_since = if_unmodified_since @@ -527,24 +671,24 @@ def __init__( class Path(msrest.serialization.Model): """Path. - :param name: - :type name: str - :param is_directory: - :type is_directory: bool - :param last_modified: - :type last_modified: str - :param e_tag: - :type e_tag: str - :param content_length: - :type content_length: long - :param owner: - :type owner: str - :param group: - :type group: str - :param permissions: - :type permissions: str - :param encryption_scope: The name of the encryption scope under which the blob is encrypted. - :type encryption_scope: str + :ivar name: + :vartype name: str + :ivar is_directory: + :vartype is_directory: bool + :ivar last_modified: + :vartype last_modified: str + :ivar e_tag: + :vartype e_tag: str + :ivar content_length: + :vartype content_length: long + :ivar owner: + :vartype owner: str + :ivar group: + :vartype group: str + :ivar permissions: + :vartype permissions: str + :ivar encryption_scope: The name of the encryption scope under which the blob is encrypted. + :vartype encryption_scope: str """ _attribute_map = { @@ -573,6 +717,26 @@ def __init__( encryption_scope: Optional[str] = None, **kwargs ): + """ + :keyword name: + :paramtype name: str + :keyword is_directory: + :paramtype is_directory: bool + :keyword last_modified: + :paramtype last_modified: str + :keyword e_tag: + :paramtype e_tag: str + :keyword content_length: + :paramtype content_length: long + :keyword owner: + :paramtype owner: str + :keyword group: + :paramtype group: str + :keyword permissions: + :paramtype permissions: str + :keyword encryption_scope: The name of the encryption scope under which the blob is encrypted. + :paramtype encryption_scope: str + """ super(Path, self).__init__(**kwargs) self.name = name self.is_directory = is_directory @@ -588,25 +752,25 @@ def __init__( class PathHTTPHeaders(msrest.serialization.Model): """Parameter group. - :param cache_control: Optional. Sets the blob's cache control. If specified, this property is + :ivar cache_control: Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request. - :type cache_control: str - :param content_encoding: Optional. Sets the blob's content encoding. If specified, this - property is stored with the blob and returned with a read request. - :type content_encoding: str - :param content_language: Optional. Set the blob's content language. If specified, this property + :vartype cache_control: str + :ivar content_encoding: Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request. - :type content_language: str - :param content_disposition: Optional. Sets the blob's Content-Disposition header. - :type content_disposition: str - :param content_type: Optional. Sets the blob's content type. If specified, this property is + :vartype content_encoding: str + :ivar content_language: Optional. Set the blob's content language. If specified, this property + is stored with the blob and returned with a read request. + :vartype content_language: str + :ivar content_disposition: Optional. Sets the blob's Content-Disposition header. + :vartype content_disposition: str + :ivar content_type: Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request. - :type content_type: str - :param content_md5: Specify the transactional md5 for the body, to be validated by the service. - :type content_md5: bytearray - :param transactional_content_hash: Specify the transactional md5 for the body, to be validated + :vartype content_type: str + :ivar content_md5: Specify the transactional md5 for the body, to be validated by the service. + :vartype content_md5: bytearray + :ivar transactional_content_hash: Specify the transactional md5 for the body, to be validated by the service. - :type transactional_content_hash: bytearray + :vartype transactional_content_hash: bytearray """ _attribute_map = { @@ -631,6 +795,28 @@ def __init__( transactional_content_hash: Optional[bytearray] = None, **kwargs ): + """ + :keyword cache_control: Optional. Sets the blob's cache control. If specified, this property is + stored with the blob and returned with a read request. + :paramtype cache_control: str + :keyword content_encoding: Optional. Sets the blob's content encoding. If specified, this + property is stored with the blob and returned with a read request. + :paramtype content_encoding: str + :keyword content_language: Optional. Set the blob's content language. If specified, this + property is stored with the blob and returned with a read request. + :paramtype content_language: str + :keyword content_disposition: Optional. Sets the blob's Content-Disposition header. + :paramtype content_disposition: str + :keyword content_type: Optional. Sets the blob's content type. If specified, this property is + stored with the blob and returned with a read request. + :paramtype content_type: str + :keyword content_md5: Specify the transactional md5 for the body, to be validated by the + service. + :paramtype content_md5: bytearray + :keyword transactional_content_hash: Specify the transactional md5 for the body, to be + validated by the service. + :paramtype transactional_content_hash: bytearray + """ super(PathHTTPHeaders, self).__init__(**kwargs) self.cache_control = cache_control self.content_encoding = content_encoding @@ -644,8 +830,8 @@ def __init__( class PathList(msrest.serialization.Model): """PathList. - :param paths: - :type paths: list[~azure.storage.filedatalake.models.Path] + :ivar paths: + :vartype paths: list[~azure.storage.filedatalake.models.Path] """ _attribute_map = { @@ -658,6 +844,10 @@ def __init__( paths: Optional[List["Path"]] = None, **kwargs ): + """ + :keyword paths: + :paramtype paths: list[~azure.storage.filedatalake.models.Path] + """ super(PathList, self).__init__(**kwargs) self.paths = paths @@ -665,14 +855,14 @@ def __init__( class SetAccessControlRecursiveResponse(msrest.serialization.Model): """SetAccessControlRecursiveResponse. - :param directories_successful: - :type directories_successful: int - :param files_successful: - :type files_successful: int - :param failure_count: - :type failure_count: int - :param failed_entries: - :type failed_entries: list[~azure.storage.filedatalake.models.AclFailedEntry] + :ivar directories_successful: + :vartype directories_successful: int + :ivar files_successful: + :vartype files_successful: int + :ivar failure_count: + :vartype failure_count: int + :ivar failed_entries: + :vartype failed_entries: list[~azure.storage.filedatalake.models.AclFailedEntry] """ _attribute_map = { @@ -691,6 +881,16 @@ def __init__( failed_entries: Optional[List["AclFailedEntry"]] = None, **kwargs ): + """ + :keyword directories_successful: + :paramtype directories_successful: int + :keyword files_successful: + :paramtype files_successful: int + :keyword failure_count: + :paramtype failure_count: int + :keyword failed_entries: + :paramtype failed_entries: list[~azure.storage.filedatalake.models.AclFailedEntry] + """ super(SetAccessControlRecursiveResponse, self).__init__(**kwargs) self.directories_successful = directories_successful self.files_successful = files_successful @@ -701,17 +901,17 @@ def __init__( class SourceModifiedAccessConditions(msrest.serialization.Model): """Parameter group. - :param source_if_match: Specify an ETag value to operate only on blobs with a matching value. - :type source_if_match: str - :param source_if_none_match: Specify an ETag value to operate only on blobs without a matching + :ivar source_if_match: Specify an ETag value to operate only on blobs with a matching value. + :vartype source_if_match: str + :ivar source_if_none_match: Specify an ETag value to operate only on blobs without a matching value. - :type source_if_none_match: str - :param source_if_modified_since: Specify this header value to operate only on a blob if it has + :vartype source_if_none_match: str + :ivar source_if_modified_since: Specify this header value to operate only on a blob if it has been modified since the specified date/time. - :type source_if_modified_since: ~datetime.datetime - :param source_if_unmodified_since: Specify this header value to operate only on a blob if it - has not been modified since the specified date/time. - :type source_if_unmodified_since: ~datetime.datetime + :vartype source_if_modified_since: ~datetime.datetime + :ivar source_if_unmodified_since: Specify this header value to operate only on a blob if it has + not been modified since the specified date/time. + :vartype source_if_unmodified_since: ~datetime.datetime """ _attribute_map = { @@ -730,6 +930,19 @@ def __init__( source_if_unmodified_since: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword source_if_match: Specify an ETag value to operate only on blobs with a matching value. + :paramtype source_if_match: str + :keyword source_if_none_match: Specify an ETag value to operate only on blobs without a + matching value. + :paramtype source_if_none_match: str + :keyword source_if_modified_since: Specify this header value to operate only on a blob if it + has been modified since the specified date/time. + :paramtype source_if_modified_since: ~datetime.datetime + :keyword source_if_unmodified_since: Specify this header value to operate only on a blob if it + has not been modified since the specified date/time. + :paramtype source_if_unmodified_since: ~datetime.datetime + """ super(SourceModifiedAccessConditions, self).__init__(**kwargs) self.source_if_match = source_if_match self.source_if_none_match = source_if_none_match @@ -740,8 +953,8 @@ def __init__( class StorageError(msrest.serialization.Model): """StorageError. - :param error: The service error response object. - :type error: ~azure.storage.filedatalake.models.StorageErrorError + :ivar error: The service error response object. + :vartype error: ~azure.storage.filedatalake.models.StorageErrorError """ _attribute_map = { @@ -754,6 +967,10 @@ def __init__( error: Optional["StorageErrorError"] = None, **kwargs ): + """ + :keyword error: The service error response object. + :paramtype error: ~azure.storage.filedatalake.models.StorageErrorError + """ super(StorageError, self).__init__(**kwargs) self.error = error @@ -761,10 +978,10 @@ def __init__( class StorageErrorError(msrest.serialization.Model): """The service error response object. - :param code: The service error code. - :type code: str - :param message: The service error message. - :type message: str + :ivar code: The service error code. + :vartype code: str + :ivar message: The service error message. + :vartype message: str """ _attribute_map = { @@ -779,6 +996,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The service error code. + :paramtype code: str + :keyword message: The service error message. + :paramtype message: str + """ super(StorageErrorError, self).__init__(**kwargs) self.code = code self.message = message diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_file_system_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_file_system_operations.py index 8f1c7fb37a15..2df91bc33e27 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_file_system_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_file_system_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,21 +8,326 @@ # -------------------------------------------------------------------------- import datetime from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - + from typing import Any, Callable, Dict, List, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + resource = kwargs.pop('resource', "filesystem") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + properties = kwargs.pop('properties', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['resource'] = _SERIALIZER.query("resource", resource, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if properties is not None: + _header_parameters['x-ms-properties'] = _SERIALIZER.header("properties", properties, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + resource = kwargs.pop('resource', "filesystem") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + properties = kwargs.pop('properties', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['resource'] = _SERIALIZER.query("resource", resource, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if properties is not None: + _header_parameters['x-ms-properties'] = _SERIALIZER.header("properties", properties, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + resource = kwargs.pop('resource', "filesystem") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['resource'] = _SERIALIZER.query("resource", resource, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + resource = kwargs.pop('resource', "filesystem") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['resource'] = _SERIALIZER.query("resource", resource, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_paths_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + resource = kwargs.pop('resource', "filesystem") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + recursive = kwargs.pop('recursive') # type: bool + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + continuation = kwargs.pop('continuation', None) # type: Optional[str] + path = kwargs.pop('path', None) # type: Optional[str] + max_results = kwargs.pop('max_results', None) # type: Optional[int] + upn = kwargs.pop('upn', None) # type: Optional[bool] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['resource'] = _SERIALIZER.query("resource", resource, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if continuation is not None: + _query_parameters['continuation'] = _SERIALIZER.query("continuation", continuation, 'str') + if path is not None: + _query_parameters['directory'] = _SERIALIZER.query("path", path, 'str') + _query_parameters['recursive'] = _SERIALIZER.query("recursive", recursive, 'bool') + if max_results is not None: + _query_parameters['maxResults'] = _SERIALIZER.query("max_results", max_results, 'int', minimum=1) + if upn is not None: + _query_parameters['upn'] = _SERIALIZER.query("upn", upn, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_blob_hierarchy_segment_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "container") # type: str + comp = kwargs.pop('comp', "list") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + prefix = kwargs.pop('prefix', None) # type: Optional[str] + delimiter = kwargs.pop('delimiter', None) # type: Optional[str] + marker = kwargs.pop('marker', None) # type: Optional[str] + max_results = kwargs.pop('max_results', None) # type: Optional[int] + include = kwargs.pop('include', None) # type: Optional[List[Union[str, "_models.ListBlobsIncludeItem"]]] + showonly = kwargs.pop('showonly', "deleted") # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if prefix is not None: + _query_parameters['prefix'] = _SERIALIZER.query("prefix", prefix, 'str') + if delimiter is not None: + _query_parameters['delimiter'] = _SERIALIZER.query("delimiter", delimiter, 'str') + if marker is not None: + _query_parameters['marker'] = _SERIALIZER.query("marker", marker, 'str') + if max_results is not None: + _query_parameters['maxResults'] = _SERIALIZER.query("max_results", max_results, 'int', minimum=1) + if include is not None: + _query_parameters['include'] = _SERIALIZER.query("include", include, '[str]', div=',') + if showonly is not None: + _query_parameters['showonly'] = _SERIALIZER.query("showonly", showonly, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class FileSystemOperations(object): """FileSystemOperations operations. @@ -44,7 +350,8 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def create( + @distributed_trace + def create( # pylint: disable=inconsistent-return-statements self, request_id_parameter=None, # type: Optional[str] timeout=None, # type: Optional[int] @@ -83,37 +390,30 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/json" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['resource'] = self._serialize.query("self._config.resource", self._config.resource, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if properties is not None: - header_parameters['x-ms-properties'] = self._serialize.header("properties", properties, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_create_request( + url=self._config.url, + resource=self._config.resource, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + properties=properties, + template_url=self.create.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -124,12 +424,15 @@ def create( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['x-ms-namespace-enabled']=self._deserialize('str', response.headers.get('x-ms-namespace-enabled')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{filesystem}'} # type: ignore + create.metadata = {'url': "{url}/{filesystem}"} # type: ignore - def set_properties( + + @distributed_trace + def set_properties( # pylint: disable=inconsistent-return-statements self, request_id_parameter=None, # type: Optional[str] timeout=None, # type: Optional[int] @@ -172,47 +475,37 @@ def set_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - accept = "application/json" - # Construct URL - url = self.set_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['resource'] = self._serialize.query("self._config.resource", self._config.resource, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if properties is not None: - header_parameters['x-ms-properties'] = self._serialize.header("properties", properties, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.patch(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_properties_request( + url=self._config.url, + resource=self._config.resource, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + properties=properties, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.set_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -222,12 +515,15 @@ def set_properties( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {'url': '/{filesystem}'} # type: ignore + set_properties.metadata = {'url': "{url}/{filesystem}"} # type: ignore + - def get_properties( + @distributed_trace + def get_properties( # pylint: disable=inconsistent-return-statements self, request_id_parameter=None, # type: Optional[str] timeout=None, # type: Optional[int] @@ -256,35 +552,29 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/json" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['resource'] = self._serialize.query("self._config.resource", self._config.resource, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_get_properties_request( + url=self._config.url, + resource=self._config.resource, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -296,12 +586,15 @@ def get_properties( response_headers['x-ms-properties']=self._deserialize('str', response.headers.get('x-ms-properties')) response_headers['x-ms-namespace-enabled']=self._deserialize('str', response.headers.get('x-ms-namespace-enabled')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{filesystem}'} # type: ignore + get_properties.metadata = {'url': "{url}/{filesystem}"} # type: ignore + - def delete( + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, request_id_parameter=None, # type: Optional[str] timeout=None, # type: Optional[int] @@ -341,45 +634,36 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _if_modified_since = None _if_unmodified_since = None if modified_access_conditions is not None: _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - accept = "application/json" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['resource'] = self._serialize.query("self._config.resource", self._config.resource, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_delete_request( + url=self._config.url, + resource=self._config.resource, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.delete.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -387,11 +671,14 @@ def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{filesystem}'} # type: ignore + delete.metadata = {'url': "{url}/{filesystem}"} # type: ignore + + @distributed_trace def list_paths( self, recursive, # type: bool @@ -447,44 +734,34 @@ def list_paths( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/json" - # Construct URL - url = self.list_paths.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['resource'] = self._serialize.query("self._config.resource", self._config.resource, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if continuation is not None: - query_parameters['continuation'] = self._serialize.query("continuation", continuation, 'str') - if path is not None: - query_parameters['directory'] = self._serialize.query("path", path, 'str') - query_parameters['recursive'] = self._serialize.query("recursive", recursive, 'bool') - if max_results is not None: - query_parameters['maxResults'] = self._serialize.query("max_results", max_results, 'int', minimum=1) - if upn is not None: - query_parameters['upn'] = self._serialize.query("upn", upn, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_list_paths_request( + url=self._config.url, + resource=self._config.resource, + version=self._config.version, + recursive=recursive, + request_id_parameter=request_id_parameter, + timeout=timeout, + continuation=continuation, + path=path, + max_results=max_results, + upn=upn, + template_url=self.list_paths.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -494,14 +771,18 @@ def list_paths( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['x-ms-continuation']=self._deserialize('str', response.headers.get('x-ms-continuation')) + deserialized = self._deserialize('PathList', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_paths.metadata = {'url': '/{filesystem}'} # type: ignore + list_paths.metadata = {'url': "{url}/{filesystem}"} # type: ignore + + + @distributed_trace def list_blob_hierarchy_segment( self, prefix=None, # type: Optional[str] @@ -538,7 +819,7 @@ def list_blob_hierarchy_segment( response. :type include: list[str or ~azure.storage.filedatalake.models.ListBlobsIncludeItem] :param showonly: Include this parameter to specify one or more datasets to include in the - response. + response. The default value is "deleted". :type showonly: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:` HttpRequest + version = kwargs.pop('version', "2020-10-02") # type: str + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + resource = kwargs.pop('resource', None) # type: Optional[Union[str, "_models.PathResourceType"]] + continuation = kwargs.pop('continuation', None) # type: Optional[str] + mode = kwargs.pop('mode', None) # type: Optional[Union[str, "_models.PathRenameMode"]] + cache_control = kwargs.pop('cache_control', None) # type: Optional[str] + content_encoding = kwargs.pop('content_encoding', None) # type: Optional[str] + content_language = kwargs.pop('content_language', None) # type: Optional[str] + content_disposition = kwargs.pop('content_disposition', None) # type: Optional[str] + content_type_parameter = kwargs.pop('content_type_parameter', None) # type: Optional[str] + rename_source = kwargs.pop('rename_source', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + source_lease_id = kwargs.pop('source_lease_id', None) # type: Optional[str] + properties = kwargs.pop('properties', None) # type: Optional[str] + permissions = kwargs.pop('permissions', None) # type: Optional[str] + umask = kwargs.pop('umask', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + source_if_match = kwargs.pop('source_if_match', None) # type: Optional[str] + source_if_none_match = kwargs.pop('source_if_none_match', None) # type: Optional[str] + source_if_modified_since = kwargs.pop('source_if_modified_since', None) # type: Optional[datetime.datetime] + source_if_unmodified_since = kwargs.pop('source_if_unmodified_since', None) # type: Optional[datetime.datetime] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}/{path}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if resource is not None: + _query_parameters['resource'] = _SERIALIZER.query("resource", resource, 'str') + if continuation is not None: + _query_parameters['continuation'] = _SERIALIZER.query("continuation", continuation, 'str') + if mode is not None: + _query_parameters['mode'] = _SERIALIZER.query("mode", mode, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if cache_control is not None: + _header_parameters['x-ms-cache-control'] = _SERIALIZER.header("cache_control", cache_control, 'str') + if content_encoding is not None: + _header_parameters['x-ms-content-encoding'] = _SERIALIZER.header("content_encoding", content_encoding, 'str') + if content_language is not None: + _header_parameters['x-ms-content-language'] = _SERIALIZER.header("content_language", content_language, 'str') + if content_disposition is not None: + _header_parameters['x-ms-content-disposition'] = _SERIALIZER.header("content_disposition", content_disposition, 'str') + if content_type_parameter is not None: + _header_parameters['x-ms-content-type'] = _SERIALIZER.header("content_type_parameter", content_type_parameter, 'str') + if rename_source is not None: + _header_parameters['x-ms-rename-source'] = _SERIALIZER.header("rename_source", rename_source, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if source_lease_id is not None: + _header_parameters['x-ms-source-lease-id'] = _SERIALIZER.header("source_lease_id", source_lease_id, 'str') + if properties is not None: + _header_parameters['x-ms-properties'] = _SERIALIZER.header("properties", properties, 'str') + if permissions is not None: + _header_parameters['x-ms-permissions'] = _SERIALIZER.header("permissions", permissions, 'str') + if umask is not None: + _header_parameters['x-ms-umask'] = _SERIALIZER.header("umask", umask, 'str') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if source_if_match is not None: + _header_parameters['x-ms-source-if-match'] = _SERIALIZER.header("source_if_match", source_if_match, 'str') + if source_if_none_match is not None: + _header_parameters['x-ms-source-if-none-match'] = _SERIALIZER.header("source_if_none_match", source_if_none_match, 'str') + if source_if_modified_since is not None: + _header_parameters['x-ms-source-if-modified-since'] = _SERIALIZER.header("source_if_modified_since", source_if_modified_since, 'rfc-1123') + if source_if_unmodified_since is not None: + _header_parameters['x-ms-source-if-unmodified-since'] = _SERIALIZER.header("source_if_unmodified_since", source_if_unmodified_since, 'rfc-1123') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2020-10-02") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + action = kwargs.pop('action') # type: Union[str, "_models.PathUpdateAction"] + mode = kwargs.pop('mode') # type: Union[str, "_models.PathSetAccessControlRecursiveMode"] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + max_records = kwargs.pop('max_records', None) # type: Optional[int] + continuation = kwargs.pop('continuation', None) # type: Optional[str] + force_flag = kwargs.pop('force_flag', None) # type: Optional[bool] + position = kwargs.pop('position', None) # type: Optional[int] + retain_uncommitted_data = kwargs.pop('retain_uncommitted_data', None) # type: Optional[bool] + close = kwargs.pop('close', None) # type: Optional[bool] + content_length = kwargs.pop('content_length', None) # type: Optional[int] + content_md5 = kwargs.pop('content_md5', None) # type: Optional[bytearray] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + cache_control = kwargs.pop('cache_control', None) # type: Optional[str] + content_type_parameter = kwargs.pop('content_type_parameter', None) # type: Optional[str] + content_disposition = kwargs.pop('content_disposition', None) # type: Optional[str] + content_encoding = kwargs.pop('content_encoding', None) # type: Optional[str] + content_language = kwargs.pop('content_language', None) # type: Optional[str] + properties = kwargs.pop('properties', None) # type: Optional[str] + owner = kwargs.pop('owner', None) # type: Optional[str] + group = kwargs.pop('group', None) # type: Optional[str] + permissions = kwargs.pop('permissions', None) # type: Optional[str] + acl = kwargs.pop('acl', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}/{path}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + _query_parameters['action'] = _SERIALIZER.query("action", action, 'str') + if max_records is not None: + _query_parameters['maxRecords'] = _SERIALIZER.query("max_records", max_records, 'int', minimum=1) + if continuation is not None: + _query_parameters['continuation'] = _SERIALIZER.query("continuation", continuation, 'str') + _query_parameters['mode'] = _SERIALIZER.query("mode", mode, 'str') + if force_flag is not None: + _query_parameters['forceFlag'] = _SERIALIZER.query("force_flag", force_flag, 'bool') + if position is not None: + _query_parameters['position'] = _SERIALIZER.query("position", position, 'long') + if retain_uncommitted_data is not None: + _query_parameters['retainUncommittedData'] = _SERIALIZER.query("retain_uncommitted_data", retain_uncommitted_data, 'bool') + if close is not None: + _query_parameters['close'] = _SERIALIZER.query("close", close, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if content_length is not None: + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long', minimum=0) + if content_md5 is not None: + _header_parameters['x-ms-content-md5'] = _SERIALIZER.header("content_md5", content_md5, 'bytearray') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if cache_control is not None: + _header_parameters['x-ms-cache-control'] = _SERIALIZER.header("cache_control", cache_control, 'str') + if content_type_parameter is not None: + _header_parameters['x-ms-content-type'] = _SERIALIZER.header("content_type_parameter", content_type_parameter, 'str') + if content_disposition is not None: + _header_parameters['x-ms-content-disposition'] = _SERIALIZER.header("content_disposition", content_disposition, 'str') + if content_encoding is not None: + _header_parameters['x-ms-content-encoding'] = _SERIALIZER.header("content_encoding", content_encoding, 'str') + if content_language is not None: + _header_parameters['x-ms-content-language'] = _SERIALIZER.header("content_language", content_language, 'str') + if properties is not None: + _header_parameters['x-ms-properties'] = _SERIALIZER.header("properties", properties, 'str') + if owner is not None: + _header_parameters['x-ms-owner'] = _SERIALIZER.header("owner", owner, 'str') + if group is not None: + _header_parameters['x-ms-group'] = _SERIALIZER.header("group", group, 'str') + if permissions is not None: + _header_parameters['x-ms-permissions'] = _SERIALIZER.header("permissions", permissions, 'str') + if acl is not None: + _header_parameters['x-ms-acl'] = _SERIALIZER.header("acl", acl, 'str') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2020-10-02") # type: str + x_ms_lease_action = kwargs.pop('x_ms_lease_action') # type: Union[str, "_models.PathLeaseAction"] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + x_ms_lease_duration = kwargs.pop('x_ms_lease_duration', None) # type: Optional[int] + x_ms_lease_break_period = kwargs.pop('x_ms_lease_break_period', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + proposed_lease_id = kwargs.pop('proposed_lease_id', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}/{path}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("x_ms_lease_action", x_ms_lease_action, 'str') + if x_ms_lease_duration is not None: + _header_parameters['x-ms-lease-duration'] = _SERIALIZER.header("x_ms_lease_duration", x_ms_lease_duration, 'int') + if x_ms_lease_break_period is not None: + _header_parameters['x-ms-lease-break-period'] = _SERIALIZER.header("x_ms_lease_break_period", x_ms_lease_break_period, 'int') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if proposed_lease_id is not None: + _header_parameters['x-ms-proposed-lease-id'] = _SERIALIZER.header("proposed_lease_id", proposed_lease_id, 'str') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_read_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2020-10-02") # type: str + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + range = kwargs.pop('range', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + x_ms_range_get_content_md5 = kwargs.pop('x_ms_range_get_content_md5', None) # type: Optional[bool] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}/{path}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if range is not None: + _header_parameters['Range'] = _SERIALIZER.header("range", range, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if x_ms_range_get_content_md5 is not None: + _header_parameters['x-ms-range-get-content-md5'] = _SERIALIZER.header("x_ms_range_get_content_md5", x_ms_range_get_content_md5, 'bool') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2020-10-02") # type: str + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + action = kwargs.pop('action', None) # type: Optional[Union[str, "_models.PathGetPropertiesAction"]] + upn = kwargs.pop('upn', None) # type: Optional[bool] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}/{path}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if action is not None: + _query_parameters['action'] = _SERIALIZER.query("action", action, 'str') + if upn is not None: + _query_parameters['upn'] = _SERIALIZER.query("upn", upn, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2020-10-02") # type: str + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + recursive = kwargs.pop('recursive', None) # type: Optional[bool] + continuation = kwargs.pop('continuation', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}/{path}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if recursive is not None: + _query_parameters['recursive'] = _SERIALIZER.query("recursive", recursive, 'bool') + if continuation is not None: + _query_parameters['continuation'] = _SERIALIZER.query("continuation", continuation, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_access_control_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + action = kwargs.pop('action', "setAccessControl") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + owner = kwargs.pop('owner', None) # type: Optional[str] + group = kwargs.pop('group', None) # type: Optional[str] + permissions = kwargs.pop('permissions', None) # type: Optional[str] + acl = kwargs.pop('acl', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}/{path}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['action'] = _SERIALIZER.query("action", action, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if owner is not None: + _header_parameters['x-ms-owner'] = _SERIALIZER.header("owner", owner, 'str') + if group is not None: + _header_parameters['x-ms-group'] = _SERIALIZER.header("group", group, 'str') + if permissions is not None: + _header_parameters['x-ms-permissions'] = _SERIALIZER.header("permissions", permissions, 'str') + if acl is not None: + _header_parameters['x-ms-acl'] = _SERIALIZER.header("acl", acl, 'str') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_access_control_recursive_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + action = kwargs.pop('action', "setAccessControlRecursive") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + mode = kwargs.pop('mode') # type: Union[str, "_models.PathSetAccessControlRecursiveMode"] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + continuation = kwargs.pop('continuation', None) # type: Optional[str] + force_flag = kwargs.pop('force_flag', None) # type: Optional[bool] + max_records = kwargs.pop('max_records', None) # type: Optional[int] + acl = kwargs.pop('acl', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}/{path}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['action'] = _SERIALIZER.query("action", action, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if continuation is not None: + _query_parameters['continuation'] = _SERIALIZER.query("continuation", continuation, 'str') + _query_parameters['mode'] = _SERIALIZER.query("mode", mode, 'str') + if force_flag is not None: + _query_parameters['forceFlag'] = _SERIALIZER.query("force_flag", force_flag, 'bool') + if max_records is not None: + _query_parameters['maxRecords'] = _SERIALIZER.query("max_records", max_records, 'int', minimum=1) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if acl is not None: + _header_parameters['x-ms-acl'] = _SERIALIZER.header("acl", acl, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_flush_data_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + action = kwargs.pop('action', "flush") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + position = kwargs.pop('position', None) # type: Optional[int] + retain_uncommitted_data = kwargs.pop('retain_uncommitted_data', None) # type: Optional[bool] + close = kwargs.pop('close', None) # type: Optional[bool] + content_length = kwargs.pop('content_length', None) # type: Optional[int] + content_md5 = kwargs.pop('content_md5', None) # type: Optional[bytearray] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + cache_control = kwargs.pop('cache_control', None) # type: Optional[str] + content_type_parameter = kwargs.pop('content_type_parameter', None) # type: Optional[str] + content_disposition = kwargs.pop('content_disposition', None) # type: Optional[str] + content_encoding = kwargs.pop('content_encoding', None) # type: Optional[str] + content_language = kwargs.pop('content_language', None) # type: Optional[str] + if_match = kwargs.pop('if_match', None) # type: Optional[str] + if_none_match = kwargs.pop('if_none_match', None) # type: Optional[str] + if_modified_since = kwargs.pop('if_modified_since', None) # type: Optional[datetime.datetime] + if_unmodified_since = kwargs.pop('if_unmodified_since', None) # type: Optional[datetime.datetime] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}/{path}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['action'] = _SERIALIZER.query("action", action, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if position is not None: + _query_parameters['position'] = _SERIALIZER.query("position", position, 'long') + if retain_uncommitted_data is not None: + _query_parameters['retainUncommittedData'] = _SERIALIZER.query("retain_uncommitted_data", retain_uncommitted_data, 'bool') + if close is not None: + _query_parameters['close'] = _SERIALIZER.query("close", close, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_length is not None: + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long', minimum=0) + if content_md5 is not None: + _header_parameters['x-ms-content-md5'] = _SERIALIZER.header("content_md5", content_md5, 'bytearray') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if cache_control is not None: + _header_parameters['x-ms-cache-control'] = _SERIALIZER.header("cache_control", cache_control, 'str') + if content_type_parameter is not None: + _header_parameters['x-ms-content-type'] = _SERIALIZER.header("content_type_parameter", content_type_parameter, 'str') + if content_disposition is not None: + _header_parameters['x-ms-content-disposition'] = _SERIALIZER.header("content_disposition", content_disposition, 'str') + if content_encoding is not None: + _header_parameters['x-ms-content-encoding'] = _SERIALIZER.header("content_encoding", content_encoding, 'str') + if content_language is not None: + _header_parameters['x-ms-content-language'] = _SERIALIZER.header("content_language", content_language, 'str') + if if_match is not None: + _header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + _header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if if_modified_since is not None: + _header_parameters['If-Modified-Since'] = _SERIALIZER.header("if_modified_since", if_modified_since, 'rfc-1123') + if if_unmodified_since is not None: + _header_parameters['If-Unmodified-Since'] = _SERIALIZER.header("if_unmodified_since", if_unmodified_since, 'rfc-1123') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_append_data_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + action = kwargs.pop('action', "append") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + position = kwargs.pop('position', None) # type: Optional[int] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + content_length = kwargs.pop('content_length', None) # type: Optional[int] + transactional_content_hash = kwargs.pop('transactional_content_hash', None) # type: Optional[bytearray] + transactional_content_crc64 = kwargs.pop('transactional_content_crc64', None) # type: Optional[bytearray] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}/{path}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['action'] = _SERIALIZER.query("action", action, 'str') + if position is not None: + _query_parameters['position'] = _SERIALIZER.query("position", position, 'long') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_length is not None: + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long', minimum=0) + if transactional_content_hash is not None: + _header_parameters['Content-MD5'] = _SERIALIZER.header("transactional_content_hash", transactional_content_hash, 'bytearray') + if transactional_content_crc64 is not None: + _header_parameters['x-ms-content-crc64'] = _SERIALIZER.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_expiry_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "expiry") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + expiry_options = kwargs.pop('expiry_options') # type: Union[str, "_models.PathExpiryOptions"] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + expires_on = kwargs.pop('expires_on', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}/{path}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-expiry-option'] = _SERIALIZER.header("expiry_options", expiry_options, 'str') + if expires_on is not None: + _header_parameters['x-ms-expiry-time'] = _SERIALIZER.header("expires_on", expires_on, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_undelete_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "undelete") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + undelete_source = kwargs.pop('undelete_source', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{filesystem}/{path}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if undelete_source is not None: + _header_parameters['x-ms-undelete-source'] = _SERIALIZER.header("undelete_source", undelete_source, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class PathOperations(object): """PathOperations operations. @@ -44,7 +875,8 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def create( + @distributed_trace + def create( # pylint: disable=inconsistent-return-statements self, request_id_parameter=None, # type: Optional[str] timeout=None, # type: Optional[int] @@ -130,7 +962,8 @@ def create( :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.filedatalake.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.filedatalake.models.SourceModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -141,12 +974,12 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _cache_control = None _content_encoding = None _content_language = None _content_disposition = None - _content_type = None + _content_type_parameter = None _lease_id = None _if_match = None _if_none_match = None @@ -156,6 +989,12 @@ def create( _source_if_none_match = None _source_if_modified_since = None _source_if_unmodified_since = None + if path_http_headers is not None: + _cache_control = path_http_headers.cache_control + _content_encoding = path_http_headers.content_encoding + _content_language = path_http_headers.content_language + _content_disposition = path_http_headers.content_disposition + _content_type_parameter = path_http_headers.content_type if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id if modified_access_conditions is not None: @@ -163,89 +1002,54 @@ def create( _if_none_match = modified_access_conditions.if_none_match _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - if path_http_headers is not None: - _cache_control = path_http_headers.cache_control - _content_encoding = path_http_headers.content_encoding - _content_language = path_http_headers.content_language - _content_disposition = path_http_headers.content_disposition - _content_type = path_http_headers.content_type if source_modified_access_conditions is not None: _source_if_match = source_modified_access_conditions.source_if_match _source_if_none_match = source_modified_access_conditions.source_if_none_match _source_if_modified_since = source_modified_access_conditions.source_if_modified_since _source_if_unmodified_since = source_modified_access_conditions.source_if_unmodified_since - accept = "application/json" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if resource is not None: - query_parameters['resource'] = self._serialize.query("resource", resource, 'str') - if continuation is not None: - query_parameters['continuation'] = self._serialize.query("continuation", continuation, 'str') - if mode is not None: - query_parameters['mode'] = self._serialize.query("mode", mode, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _cache_control is not None: - header_parameters['x-ms-cache-control'] = self._serialize.header("cache_control", _cache_control, 'str') - if _content_encoding is not None: - header_parameters['x-ms-content-encoding'] = self._serialize.header("content_encoding", _content_encoding, 'str') - if _content_language is not None: - header_parameters['x-ms-content-language'] = self._serialize.header("content_language", _content_language, 'str') - if _content_disposition is not None: - header_parameters['x-ms-content-disposition'] = self._serialize.header("content_disposition", _content_disposition, 'str') - if _content_type is not None: - header_parameters['x-ms-content-type'] = self._serialize.header("content_type", _content_type, 'str') - if rename_source is not None: - header_parameters['x-ms-rename-source'] = self._serialize.header("rename_source", rename_source, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if source_lease_id is not None: - header_parameters['x-ms-source-lease-id'] = self._serialize.header("source_lease_id", source_lease_id, 'str') - if properties is not None: - header_parameters['x-ms-properties'] = self._serialize.header("properties", properties, 'str') - if permissions is not None: - header_parameters['x-ms-permissions'] = self._serialize.header("permissions", permissions, 'str') - if umask is not None: - header_parameters['x-ms-umask'] = self._serialize.header("umask", umask, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if _source_if_match is not None: - header_parameters['x-ms-source-if-match'] = self._serialize.header("source_if_match", _source_if_match, 'str') - if _source_if_none_match is not None: - header_parameters['x-ms-source-if-none-match'] = self._serialize.header("source_if_none_match", _source_if_none_match, 'str') - if _source_if_modified_since is not None: - header_parameters['x-ms-source-if-modified-since'] = self._serialize.header("source_if_modified_since", _source_if_modified_since, 'rfc-1123') - if _source_if_unmodified_since is not None: - header_parameters['x-ms-source-if-unmodified-since'] = self._serialize.header("source_if_unmodified_since", _source_if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_create_request( + url=self._config.url, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + resource=resource, + continuation=continuation, + mode=mode, + cache_control=_cache_control, + content_encoding=_content_encoding, + content_language=_content_language, + content_disposition=_content_disposition, + content_type_parameter=_content_type_parameter, + rename_source=rename_source, + lease_id=_lease_id, + source_lease_id=source_lease_id, + properties=properties, + permissions=permissions, + umask=umask, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + source_if_match=_source_if_match, + source_if_none_match=_source_if_none_match, + source_if_modified_since=_source_if_modified_since, + source_if_unmodified_since=_source_if_unmodified_since, + template_url=self.create.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -257,11 +1061,14 @@ def create( response_headers['x-ms-continuation']=self._deserialize('str', response.headers.get('x-ms-continuation')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + create.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + + @distributed_trace def update( self, action, # type: Union[str, "_models.PathUpdateAction"] @@ -402,11 +1209,13 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] + _content_md5 = None _lease_id = None _cache_control = None - _content_type = None + _content_type_parameter = None _content_disposition = None _content_encoding = None _content_language = None @@ -414,104 +1223,74 @@ def update( _if_none_match = None _if_modified_since = None _if_unmodified_since = None + if path_http_headers is not None: + _content_md5 = path_http_headers.content_md5 if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - if modified_access_conditions is not None: - _if_match = modified_access_conditions.if_match - _if_none_match = modified_access_conditions.if_none_match - _if_modified_since = modified_access_conditions.if_modified_since - _if_unmodified_since = modified_access_conditions.if_unmodified_since if path_http_headers is not None: - _content_md5 = path_http_headers.content_md5 _cache_control = path_http_headers.cache_control - _content_type = path_http_headers.content_type + _content_type_parameter = path_http_headers.content_type _content_disposition = path_http_headers.content_disposition _content_encoding = path_http_headers.content_encoding _content_language = path_http_headers.content_language - content_type = kwargs.pop("content_type", "application/octet-stream") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - query_parameters['action'] = self._serialize.query("action", action, 'str') - if max_records is not None: - query_parameters['maxRecords'] = self._serialize.query("max_records", max_records, 'int', minimum=1) - if continuation is not None: - query_parameters['continuation'] = self._serialize.query("continuation", continuation, 'str') - query_parameters['mode'] = self._serialize.query("mode", mode, 'str') - if force_flag is not None: - query_parameters['forceFlag'] = self._serialize.query("force_flag", force_flag, 'bool') - if position is not None: - query_parameters['position'] = self._serialize.query("position", position, 'long') - if retain_uncommitted_data is not None: - query_parameters['retainUncommittedData'] = self._serialize.query("retain_uncommitted_data", retain_uncommitted_data, 'bool') - if close is not None: - query_parameters['close'] = self._serialize.query("close", close, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if content_length is not None: - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long', minimum=0) - if _content_md5 is not None: - header_parameters['x-ms-content-md5'] = self._serialize.header("content_md5", _content_md5, 'bytearray') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _cache_control is not None: - header_parameters['x-ms-cache-control'] = self._serialize.header("cache_control", _cache_control, 'str') - if _content_type is not None: - header_parameters['x-ms-content-type'] = self._serialize.header("content_type", _content_type, 'str') - if _content_disposition is not None: - header_parameters['x-ms-content-disposition'] = self._serialize.header("content_disposition", _content_disposition, 'str') - if _content_encoding is not None: - header_parameters['x-ms-content-encoding'] = self._serialize.header("content_encoding", _content_encoding, 'str') - if _content_language is not None: - header_parameters['x-ms-content-language'] = self._serialize.header("content_language", _content_language, 'str') - if properties is not None: - header_parameters['x-ms-properties'] = self._serialize.header("properties", properties, 'str') - if owner is not None: - header_parameters['x-ms-owner'] = self._serialize.header("owner", owner, 'str') - if group is not None: - header_parameters['x-ms-group'] = self._serialize.header("group", group, 'str') - if permissions is not None: - header_parameters['x-ms-permissions'] = self._serialize.header("permissions", permissions, 'str') - if acl is not None: - header_parameters['x-ms-acl'] = self._serialize.header("acl", acl, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = body - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + if modified_access_conditions is not None: + _if_match = modified_access_conditions.if_match + _if_none_match = modified_access_conditions.if_none_match + _if_modified_since = modified_access_conditions.if_modified_since + _if_unmodified_since = modified_access_conditions.if_unmodified_since + _content = body + + request = build_update_request( + url=self._config.url, + version=self._config.version, + content_type=content_type, + content=_content, + action=action, + mode=mode, + request_id_parameter=request_id_parameter, + timeout=timeout, + max_records=max_records, + continuation=continuation, + force_flag=force_flag, + position=position, + retain_uncommitted_data=retain_uncommitted_data, + close=close, + content_length=content_length, + content_md5=_content_md5, + lease_id=_lease_id, + cache_control=_cache_control, + content_type_parameter=_content_type_parameter, + content_disposition=_content_disposition, + content_encoding=_content_encoding, + content_language=_content_language, + properties=properties, + owner=owner, + group=group, + permissions=permissions, + acl=acl, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.update.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 [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) @@ -529,6 +1308,7 @@ def update( response_headers['x-ms-continuation']=self._deserialize('str', response.headers.get('x-ms-continuation')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('SetAccessControlRecursiveResponse', pipeline_response) if response.status_code == 202: @@ -536,14 +1316,18 @@ def update( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - update.metadata = {'url': '/{filesystem}/{path}'} # type: ignore - def lease( + update.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + + + @distributed_trace + def lease( # pylint: disable=inconsistent-return-statements self, x_ms_lease_action, # type: Union[str, "_models.PathLeaseAction"] request_id_parameter=None, # type: Optional[str] @@ -607,7 +1391,7 @@ def lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _if_match = None _if_none_match = None @@ -620,51 +1404,36 @@ def lease( _if_none_match = modified_access_conditions.if_none_match _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - accept = "application/json" - # Construct URL - url = self.lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['x-ms-lease-action'] = self._serialize.header("x_ms_lease_action", x_ms_lease_action, 'str') - if x_ms_lease_duration is not None: - header_parameters['x-ms-lease-duration'] = self._serialize.header("x_ms_lease_duration", x_ms_lease_duration, 'int') - if x_ms_lease_break_period is not None: - header_parameters['x-ms-lease-break-period'] = self._serialize.header("x_ms_lease_break_period", x_ms_lease_break_period, 'int') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_lease_request( + url=self._config.url, + version=self._config.version, + x_ms_lease_action=x_ms_lease_action, + request_id_parameter=request_id_parameter, + timeout=timeout, + x_ms_lease_duration=x_ms_lease_duration, + x_ms_lease_break_period=x_ms_lease_break_period, + lease_id=_lease_id, + proposed_lease_id=proposed_lease_id, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.lease.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 [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -675,6 +1444,7 @@ def lease( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id')) + if response.status_code == 201: response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) @@ -683,6 +1453,7 @@ def lease( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['x-ms-lease-id']=self._deserialize('str', response.headers.get('x-ms-lease-id')) + if response.status_code == 202: response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) @@ -690,12 +1461,15 @@ def lease( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['x-ms-lease-time']=self._deserialize('str', response.headers.get('x-ms-lease-time')) + if cls: return cls(pipeline_response, None, response_headers) - lease.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + lease.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + + @distributed_trace def read( self, request_id_parameter=None, # type: Optional[str] @@ -745,7 +1519,7 @@ def read( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _if_match = None _if_none_match = None @@ -758,48 +1532,34 @@ def read( _if_none_match = modified_access_conditions.if_none_match _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - accept = "application/json" - # Construct URL - url = self.read.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if range is not None: - header_parameters['Range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if x_ms_range_get_content_md5 is not None: - header_parameters['x-ms-range-get-content-md5'] = self._serialize.header("x_ms_range_get_content_md5", x_ms_range_get_content_md5, 'bool') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + request = build_read_request( + url=self._config.url, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + range=range, + lease_id=_lease_id, + x_ms_range_get_content_md5=x_ms_range_get_content_md5, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.read.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=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 206]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -823,6 +1583,7 @@ def read( response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration')) response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state')) response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status')) + deserialized = response.stream_download(self._client._pipeline) if response.status_code == 206: @@ -846,15 +1607,19 @@ def read( response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration')) response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state')) response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status')) + deserialized = response.stream_download(self._client._pipeline) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - read.metadata = {'url': '/{filesystem}/{path}'} # type: ignore - def get_properties( + read.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + + + @distributed_trace + def get_properties( # pylint: disable=inconsistent-return-statements self, request_id_parameter=None, # type: Optional[str] timeout=None, # type: Optional[int] @@ -907,7 +1672,7 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _if_match = None _if_none_match = None @@ -920,48 +1685,34 @@ def get_properties( _if_none_match = modified_access_conditions.if_none_match _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - accept = "application/json" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if action is not None: - query_parameters['action'] = self._serialize.query("action", action, 'str') - if upn is not None: - query_parameters['upn'] = self._serialize.query("upn", upn, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_properties_request( + url=self._config.url, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + action=action, + upn=upn, + lease_id=_lease_id, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -989,12 +1740,15 @@ def get_properties( response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state')) response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + get_properties.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore - def delete( + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, request_id_parameter=None, # type: Optional[str] timeout=None, # type: Optional[int] @@ -1041,7 +1795,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None _if_match = None _if_none_match = None @@ -1054,48 +1808,34 @@ def delete( _if_none_match = modified_access_conditions.if_none_match _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - accept = "application/json" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if recursive is not None: - query_parameters['recursive'] = self._serialize.query("recursive", recursive, 'bool') - if continuation is not None: - query_parameters['continuation'] = self._serialize.query("continuation", continuation, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_delete_request( + url=self._config.url, + version=self._config.version, + request_id_parameter=request_id_parameter, + timeout=timeout, + recursive=recursive, + continuation=continuation, + lease_id=_lease_id, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + template_url=self.delete.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1105,12 +1845,15 @@ def delete( response_headers['x-ms-continuation']=self._deserialize('str', response.headers.get('x-ms-continuation')) response_headers['x-ms-deletion-id']=self._deserialize('str', response.headers.get('x-ms-deletion-id')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + delete.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore - def set_access_control( + + @distributed_trace + def set_access_control( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] owner=None, # type: Optional[str] @@ -1151,6 +1894,9 @@ def set_access_control( :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions + :keyword action: action. The default value is "setAccessControl". Note that overriding this + default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1161,7 +1907,9 @@ def set_access_control( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + action = kwargs.pop('action', "setAccessControl") # type: str + _lease_id = None _if_match = None _if_none_match = None @@ -1174,54 +1922,37 @@ def set_access_control( _if_none_match = modified_access_conditions.if_none_match _if_modified_since = modified_access_conditions.if_modified_since _if_unmodified_since = modified_access_conditions.if_unmodified_since - action = "setAccessControl" - accept = "application/json" - # Construct URL - url = self.set_access_control.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['action'] = self._serialize.query("action", action, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if owner is not None: - header_parameters['x-ms-owner'] = self._serialize.header("owner", owner, 'str') - if group is not None: - header_parameters['x-ms-group'] = self._serialize.header("group", group, 'str') - if permissions is not None: - header_parameters['x-ms-permissions'] = self._serialize.header("permissions", permissions, 'str') - if acl is not None: - header_parameters['x-ms-acl'] = self._serialize.header("acl", acl, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.patch(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_access_control_request( + url=self._config.url, + action=action, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + owner=owner, + group=group, + permissions=permissions, + acl=acl, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.set_access_control.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1232,11 +1963,14 @@ def set_access_control( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - set_access_control.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + set_access_control.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + + @distributed_trace def set_access_control_recursive( self, mode, # type: Union[str, "_models.PathSetAccessControlRecursiveMode"] @@ -1285,6 +2019,9 @@ def set_access_control_recursive( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword action: action. The default value is "setAccessControlRecursive". Note that overriding + this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SetAccessControlRecursiveResponse, or the result of cls(response) :rtype: ~azure.storage.filedatalake.models.SetAccessControlRecursiveResponse @@ -1295,45 +2032,36 @@ def set_access_control_recursive( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - action = "setAccessControlRecursive" - accept = "application/json" - # Construct URL - url = self.set_access_control_recursive.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['action'] = self._serialize.query("action", action, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if continuation is not None: - query_parameters['continuation'] = self._serialize.query("continuation", continuation, 'str') - query_parameters['mode'] = self._serialize.query("mode", mode, 'str') - if force_flag is not None: - query_parameters['forceFlag'] = self._serialize.query("force_flag", force_flag, 'bool') - if max_records is not None: - query_parameters['maxRecords'] = self._serialize.query("max_records", max_records, 'int', minimum=1) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if acl is not None: - header_parameters['x-ms-acl'] = self._serialize.header("acl", acl, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.patch(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + action = kwargs.pop('action', "setAccessControlRecursive") # type: str + + + request = build_set_access_control_recursive_request( + url=self._config.url, + action=action, + version=self._config.version, + mode=mode, + timeout=timeout, + continuation=continuation, + force_flag=force_flag, + max_records=max_records, + acl=acl, + request_id_parameter=request_id_parameter, + template_url=self.set_access_control_recursive.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1342,15 +2070,19 @@ def set_access_control_recursive( response_headers['x-ms-continuation']=self._deserialize('str', response.headers.get('x-ms-continuation')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('SetAccessControlRecursiveResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - set_access_control_recursive.metadata = {'url': '/{filesystem}/{path}'} # type: ignore - def flush_data( + set_access_control_recursive.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + + + @distributed_trace + def flush_data( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] position=None, # type: Optional[int] @@ -1408,6 +2140,9 @@ def flush_data( :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions :param modified_access_conditions: Parameter group. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions + :keyword action: action. The default value is "flush". Note that overriding this default value + may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1418,11 +2153,13 @@ def flush_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + action = kwargs.pop('action', "flush") # type: str + _content_md5 = None _lease_id = None _cache_control = None - _content_type = None + _content_type_parameter = None _content_disposition = None _content_encoding = None _content_language = None @@ -1430,80 +2167,58 @@ def flush_data( _if_none_match = None _if_modified_since = None _if_unmodified_since = None + if path_http_headers is not None: + _content_md5 = path_http_headers.content_md5 if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - if modified_access_conditions is not None: - _if_match = modified_access_conditions.if_match - _if_none_match = modified_access_conditions.if_none_match - _if_modified_since = modified_access_conditions.if_modified_since - _if_unmodified_since = modified_access_conditions.if_unmodified_since if path_http_headers is not None: - _content_md5 = path_http_headers.content_md5 _cache_control = path_http_headers.cache_control - _content_type = path_http_headers.content_type + _content_type_parameter = path_http_headers.content_type _content_disposition = path_http_headers.content_disposition _content_encoding = path_http_headers.content_encoding _content_language = path_http_headers.content_language - action = "flush" - accept = "application/json" + if modified_access_conditions is not None: + _if_match = modified_access_conditions.if_match + _if_none_match = modified_access_conditions.if_none_match + _if_modified_since = modified_access_conditions.if_modified_since + _if_unmodified_since = modified_access_conditions.if_unmodified_since - # Construct URL - url = self.flush_data.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['action'] = self._serialize.query("action", action, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if position is not None: - query_parameters['position'] = self._serialize.query("position", position, 'long') - if retain_uncommitted_data is not None: - query_parameters['retainUncommittedData'] = self._serialize.query("retain_uncommitted_data", retain_uncommitted_data, 'bool') - if close is not None: - query_parameters['close'] = self._serialize.query("close", close, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if content_length is not None: - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long', minimum=0) - if _content_md5 is not None: - header_parameters['x-ms-content-md5'] = self._serialize.header("content_md5", _content_md5, 'bytearray') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if _cache_control is not None: - header_parameters['x-ms-cache-control'] = self._serialize.header("cache_control", _cache_control, 'str') - if _content_type is not None: - header_parameters['x-ms-content-type'] = self._serialize.header("content_type", _content_type, 'str') - if _content_disposition is not None: - header_parameters['x-ms-content-disposition'] = self._serialize.header("content_disposition", _content_disposition, 'str') - if _content_encoding is not None: - header_parameters['x-ms-content-encoding'] = self._serialize.header("content_encoding", _content_encoding, 'str') - if _content_language is not None: - header_parameters['x-ms-content-language'] = self._serialize.header("content_language", _content_language, 'str') - if _if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", _if_match, 'str') - if _if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", _if_none_match, 'str') - if _if_modified_since is not None: - header_parameters['If-Modified-Since'] = self._serialize.header("if_modified_since", _if_modified_since, 'rfc-1123') - if _if_unmodified_since is not None: - header_parameters['If-Unmodified-Since'] = self._serialize.header("if_unmodified_since", _if_unmodified_since, 'rfc-1123') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.patch(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_flush_data_request( + url=self._config.url, + action=action, + version=self._config.version, + timeout=timeout, + position=position, + retain_uncommitted_data=retain_uncommitted_data, + close=close, + content_length=content_length, + content_md5=_content_md5, + lease_id=_lease_id, + cache_control=_cache_control, + content_type_parameter=_content_type_parameter, + content_disposition=_content_disposition, + content_encoding=_content_encoding, + content_language=_content_language, + if_match=_if_match, + if_none_match=_if_none_match, + if_modified_since=_if_modified_since, + if_unmodified_since=_if_unmodified_since, + request_id_parameter=request_id_parameter, + template_url=self.flush_data.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1515,12 +2230,15 @@ def flush_data( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - flush_data.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + flush_data.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + - def append_data( + @distributed_trace + def append_data( # pylint: disable=inconsistent-return-statements self, body, # type: IO position=None, # type: Optional[int] @@ -1563,6 +2281,9 @@ def append_data( :type path_http_headers: ~azure.storage.filedatalake.models.PathHTTPHeaders :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions + :keyword action: action. The default value is "append". Note that overriding this default value + may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1573,57 +2294,46 @@ def append_data( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + action = kwargs.pop('action', "append") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _transactional_content_hash = None _lease_id = None - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if path_http_headers is not None: _transactional_content_hash = path_http_headers.transactional_content_hash - action = "append" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.append_data.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['action'] = self._serialize.query("action", action, 'str') - if position is not None: - query_parameters['position'] = self._serialize.query("position", position, 'long') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if content_length is not None: - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long', minimum=0) - if _transactional_content_hash is not None: - header_parameters['Content-MD5'] = self._serialize.header("transactional_content_hash", _transactional_content_hash, 'bytearray') - if transactional_content_crc64 is not None: - header_parameters['x-ms-content-crc64'] = self._serialize.header("transactional_content_crc64", transactional_content_crc64, 'bytearray') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = body - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id + _content = body + + request = build_append_data_request( + url=self._config.url, + action=action, + version=self._config.version, + content_type=content_type, + content=_content, + position=position, + timeout=timeout, + content_length=content_length, + transactional_content_hash=_transactional_content_hash, + transactional_content_crc64=transactional_content_crc64, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.append_data.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1636,12 +2346,15 @@ def append_data( response_headers['x-ms-content-crc64']=self._deserialize('bytearray', response.headers.get('x-ms-content-crc64')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - append_data.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + append_data.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore - def set_expiry( + + @distributed_trace + def set_expiry( # pylint: disable=inconsistent-return-statements self, expiry_options, # type: Union[str, "_models.PathExpiryOptions"] timeout=None, # type: Optional[int] @@ -1664,6 +2377,9 @@ def set_expiry( :type request_id_parameter: str :param expires_on: The time to set the blob to expiry. :type expires_on: str + :keyword comp: comp. The default value is "expiry". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1674,39 +2390,33 @@ def set_expiry( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "expiry" - accept = "application/json" - # Construct URL - url = self.set_expiry.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-expiry-option'] = self._serialize.header("expiry_options", expiry_options, 'str') - if expires_on is not None: - header_parameters['x-ms-expiry-time'] = self._serialize.header("expires_on", expires_on, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "expiry") # type: str + + + request = build_set_expiry_request( + url=self._config.url, + comp=comp, + version=self._config.version, + expiry_options=expiry_options, + timeout=timeout, + request_id_parameter=request_id_parameter, + expires_on=expires_on, + template_url=self.set_expiry.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1717,12 +2427,15 @@ def set_expiry( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_expiry.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + set_expiry.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore - def undelete( + + @distributed_trace + def undelete( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] undelete_source=None, # type: Optional[str] @@ -1743,6 +2456,9 @@ def undelete( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "undelete". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1753,38 +2469,32 @@ def undelete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "undelete" - accept = "application/json" - # Construct URL - url = self.undelete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if undelete_source is not None: - header_parameters['x-ms-undelete-source'] = self._serialize.header("undelete_source", undelete_source, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "undelete") # type: str + + + request = build_undelete_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + undelete_source=undelete_source, + request_id_parameter=request_id_parameter, + template_url=self.undelete.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1794,7 +2504,9 @@ def undelete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - undelete.metadata = {'url': '/{filesystem}/{path}'} # type: ignore + undelete.metadata = {'url': "{url}/{filesystem}/{path}"} # type: ignore + diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_service_operations.py index fd5af5c4c8c7..dd973179fe97 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +7,79 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - + from typing import Any, Callable, Dict, Iterable, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_file_systems_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + resource = kwargs.pop('resource', "account") # type: str + version = kwargs.pop('version', "2020-10-02") # type: str + prefix = kwargs.pop('prefix', None) # type: Optional[str] + continuation = kwargs.pop('continuation', None) # type: Optional[str] + max_results = kwargs.pop('max_results', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['resource'] = _SERIALIZER.query("resource", resource, 'str') + if prefix is not None: + _query_parameters['prefix'] = _SERIALIZER.query("prefix", prefix, 'str') + if continuation is not None: + _query_parameters['continuation'] = _SERIALIZER.query("continuation", continuation, 'str') + if max_results is not None: + _query_parameters['maxResults'] = _SERIALIZER.query("max_results", max_results, 'int', minimum=1) + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class ServiceOperations(object): """ServiceOperations operations. @@ -44,6 +102,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_file_systems( self, prefix=None, # type: Optional[str] @@ -77,59 +136,58 @@ def list_file_systems( href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.`. :type timeout: int + :keyword resource: The value must be "account" for all account operations. The default value is + "account". Note that overriding this default value may result in unsupported behavior. + :paramtype resource: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileSystemList or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.storage.filedatalake.models.FileSystemList] :raises: ~azure.core.exceptions.HttpResponseError """ + resource = kwargs.pop('resource', "account") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.FileSystemList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - resource = "account" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_file_systems.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['resource'] = self._serialize.query("resource", resource, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - if continuation is not None: - query_parameters['continuation'] = self._serialize.query("continuation", continuation, 'str') - if max_results is not None: - query_parameters['maxResults'] = self._serialize.query("max_results", max_results, 'int', minimum=1) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_file_systems_request( + url=self._config.url, + resource=resource, + version=self._config.version, + prefix=prefix, + continuation=continuation, + max_results=max_results, + request_id_parameter=request_id_parameter, + timeout=timeout, + template_url=self.list_file_systems.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_file_systems_request( + url=self._config.url, + resource=resource, + version=self._config.version, + prefix=prefix, + continuation=continuation, + max_results=max_results, + request_id_parameter=request_id_parameter, + timeout=timeout, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('FileSystemList', pipeline_response) + deserialized = self._deserialize("FileSystemList", pipeline_response) list_of_elem = deserialized.filesystems if cls: list_of_elem = cls(list_of_elem) @@ -138,17 +196,22 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) return pipeline_response + return ItemPaged( get_next, extract_data ) - list_file_systems.metadata = {'url': '/'} # type: ignore + list_file_systems.metadata = {'url': "{url}/"} # type: ignore diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_path_client.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_path_client.py index 5b3efe4c0660..9e88c98c73e4 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_path_client.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_path_client.py @@ -84,12 +84,13 @@ def __init__( self._hosts[LocationMode.SECONDARY] = "" api_version = get_api_version(kwargs) - self._client = AzureDataLakeStorageRESTAPI(self.url, file_system=file_system_name, path=path_name, - pipeline=self._pipeline) + self._client = AzureDataLakeStorageRESTAPI(self.url, base_url=self.url, file_system=file_system_name, + path=path_name, pipeline=self._pipeline) self._client._config.version = api_version # pylint: disable=protected-access self._datalake_client_for_blob_operation = AzureDataLakeStorageRESTAPI( self._blob_client.url, + base_url=self._blob_client.url, file_system=file_system_name, path=path_name, pipeline=self._pipeline) diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_service_client_async.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_service_client_async.py index 6e7a169d3cc8..96ac5a99eb20 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_service_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_service_client_async.py @@ -80,7 +80,7 @@ def __init__( ) self._blob_service_client = BlobServiceClient(self._blob_account_url, credential, **kwargs) self._blob_service_client._hosts[LocationMode.SECONDARY] = "" #pylint: disable=protected-access - self._client = AzureDataLakeStorageRESTAPI(self.url, pipeline=self._pipeline) + self._client = AzureDataLakeStorageRESTAPI(self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) #pylint: disable=protected-access self._loop = kwargs.get('loop', None) diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_file_system_client_async.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_file_system_client_async.py index bd375e942c81..edb8068b7fb7 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_file_system_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_file_system_client_async.py @@ -96,8 +96,10 @@ def __init__( credential=credential, _hosts=self._container_client._hosts,# pylint: disable=protected-access **kwargs) # type: ignore # pylint: disable=protected-access - self._client = AzureDataLakeStorageRESTAPI(self.url, file_system=file_system_name, pipeline=self._pipeline) + self._client = AzureDataLakeStorageRESTAPI(self.url, base_url=self.url, + file_system=file_system_name, pipeline=self._pipeline) self._datalake_client_for_blob_operation = AzureDataLakeStorageRESTAPI(self._container_client.url, + base_url=self._container_client.url, file_system=file_system_name, pipeline=self._pipeline) api_version = get_api_version(kwargs) diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_path_client_async.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_path_client_async.py index 42d783c4350d..3502aeba6c7c 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_path_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_path_client_async.py @@ -48,9 +48,10 @@ def __init__( _hosts=self._blob_client._hosts, # pylint: disable=protected-access **kwargs) - self._client = AzureDataLakeStorageRESTAPI(self.url, file_system=file_system_name, path=path_name, - pipeline=self._pipeline) + self._client = AzureDataLakeStorageRESTAPI(self.url, base_url=self.url, file_system=file_system_name, + path=path_name, pipeline=self._pipeline) self._datalake_client_for_blob_operation = AzureDataLakeStorageRESTAPI(self._blob_client.url, + base_url=self._blob_client.url, file_system=file_system_name, path=path_name, pipeline=self._pipeline) diff --git a/sdk/storage/azure-storage-file-datalake/setup.py b/sdk/storage/azure-storage-file-datalake/setup.py index 098af74cdd77..e5e1e40e271a 100644 --- a/sdk/storage/azure-storage-file-datalake/setup.py +++ b/sdk/storage/azure-storage-file-datalake/setup.py @@ -75,7 +75,7 @@ ]), python_requires=">=3.6", install_requires=[ - "azure-core<2.0.0,>=1.15.0", + "azure-core<2.0.0,>=1.20.1", "msrest>=0.6.21", "azure-storage-blob<13.0.0,>=12.10.0b2" ], diff --git a/sdk/storage/azure-storage-file-datalake/swagger/README.md b/sdk/storage/azure-storage-file-datalake/swagger/README.md index e404a97d668e..dd48cc0452d1 100644 --- a/sdk/storage/azure-storage-file-datalake/swagger/README.md +++ b/sdk/storage/azure-storage-file-datalake/swagger/README.md @@ -64,4 +64,34 @@ directive: where: $["x-ms-paths"]["/{filesystem}?resource=filesystem"].get transform: > delete $["x-ms-pageable"]; -``` \ No newline at end of file +``` + +### Remove x-ms-parameterized-host +``` yaml +directive: +- from: swagger-document + where: $ + transform: > + $["x-ms-parameterized-host"] = undefined; +``` + +### Add url parameter to each operation and add it to the url +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + for (const property in $) + { + if ($[property]["parameters"] === undefined) + { + $[property]["parameters"] = [] + } + $[property]["parameters"].push({"$ref": "#/parameters/Url"}); + + var oldName = property; + var newName = '{url}' + property; + $[newName] = $[oldName]; + delete $[oldName]; + } +``` diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py index b46389a0ae6d..26c72d15f588 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_directory_client.py @@ -117,7 +117,7 @@ def __init__( # type: ignore self._query_str, credential = self._format_query_string( sas_token, credential, share_snapshot=self.snapshot) super(ShareDirectoryClient, self).__init__(parsed_url, service='file-share', credential=credential, **kwargs) - self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline) + self._client = AzureFileStorage(url=self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access @classmethod diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py index bdba757530c1..cd0add530362 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_file_client.py @@ -178,7 +178,7 @@ def __init__( # type: ignore self._query_str, credential = self._format_query_string( sas_token, credential, share_snapshot=self.snapshot) super(ShareFileClient, self).__init__(parsed_url, service='file-share', credential=credential, **kwargs) - self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline) + self._client = AzureFileStorage(url=self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access @classmethod diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/__init__.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/__init__.py index 34ce526ebfe1..853b8e3d554c 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/__init__.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/__init__.py @@ -9,8 +9,7 @@ from ._azure_file_storage import AzureFileStorage __all__ = ['AzureFileStorage'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py index 6275ae4fb4ee..4c686e9ba00a 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py @@ -6,24 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING -from azure.core import PipelineClient from msrest import Deserializer, Serializer +from azure.core import PipelineClient + +from . import models +from ._configuration import AzureFileStorageConfiguration +from .operations import DirectoryOperations, FileOperations, ServiceOperations, ShareOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import AzureFileStorageConfiguration -from .operations import ServiceOperations -from .operations import ShareOperations -from .operations import DirectoryOperations -from .operations import FileOperations -from . import models - + from azure.core.rest import HttpRequest, HttpResponse class AzureFileStorage(object): """AzureFileStorage. @@ -36,51 +34,67 @@ class AzureFileStorage(object): :vartype directory: azure.storage.fileshare.operations.DirectoryOperations :ivar file: FileOperations operations :vartype file: azure.storage.fileshare.operations.FileOperations - :param url: The URL of the service account, share, directory or file that is the target of the desired operation. + :param url: The URL of the service account, share, directory or file that is the target of the + desired operation. :type url: str + :param base_url: Service URL. Default value is ''. + :type base_url: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2021-04-10". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str + :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes + downloaded from the source url into the specified range. The default value is "update". Note + that overriding this default value may result in unsupported behavior. + :paramtype file_range_write_from_url: str """ def __init__( self, url, # type: str + base_url="", # type: str **kwargs # type: Any ): # type: (...) -> None - base_url = '{url}' - self._config = AzureFileStorageConfiguration(url, **kwargs) + self._config = AzureFileStorageConfiguration(url=url, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.share = ShareOperations(self._client, self._config, self._serialize, self._deserialize) + self.directory = DirectoryOperations(self._client, self._config, self._serialize, self._deserialize) + self.file = FileOperations(self._client, self._config, self._serialize, self._deserialize) + - self.service = ServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.share = ShareOperations( - self._client, self._config, self._serialize, self._deserialize) - self.directory = DirectoryOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file = FileOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py index d5000a6b35d0..14c5ef371c15 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py @@ -17,14 +17,23 @@ VERSION = "unknown" -class AzureFileStorageConfiguration(Configuration): +class AzureFileStorageConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureFileStorage. Note that all parameters used to create this instance are saved as instance attributes. - :param url: The URL of the service account, share, directory or file that is the target of the desired operation. + :param url: The URL of the service account, share, directory or file that is the target of the + desired operation. :type url: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2021-04-10". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str + :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes + downloaded from the source url into the specified range. The default value is "update". Note + that overriding this default value may result in unsupported behavior. + :paramtype file_range_write_from_url: str """ def __init__( @@ -33,13 +42,16 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(AzureFileStorageConfiguration, self).__init__(**kwargs) + version = kwargs.pop('version', "2021-04-10") # type: str + file_range_write_from_url = kwargs.pop('file_range_write_from_url', "update") # type: str + if url is None: raise ValueError("Parameter 'url' must not be None.") - super(AzureFileStorageConfiguration, self).__init__(**kwargs) self.url = url - self.version = "2021-04-10" - self.file_range_write_from_url = "update" + self.version = version + self.file_range_write_from_url = file_range_write_from_url kwargs.setdefault('sdk_moniker', 'azurefilestorage/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_vendor.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/__init__.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/__init__.py index f306ba079795..853b8e3d554c 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/__init__.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/__init__.py @@ -8,3 +8,8 @@ from ._azure_file_storage import AzureFileStorage __all__ = ['AzureFileStorage'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py index 7453a46f5bd5..f376dc49fdb5 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py @@ -6,21 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from copy import deepcopy +from typing import Any, Awaitable -from azure.core import AsyncPipelineClient -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from msrest import Deserializer, Serializer -from ._configuration import AzureFileStorageConfiguration -from .operations import ServiceOperations -from .operations import ShareOperations -from .operations import DirectoryOperations -from .operations import FileOperations -from .. import models +from azure.core import AsyncPipelineClient +from azure.core.rest import AsyncHttpResponse, HttpRequest +from .. import models +from ._configuration import AzureFileStorageConfiguration +from .operations import DirectoryOperations, FileOperations, ServiceOperations, ShareOperations -class AzureFileStorage(object): +class AzureFileStorage: """AzureFileStorage. :ivar service: ServiceOperations operations @@ -31,49 +29,65 @@ class AzureFileStorage(object): :vartype directory: azure.storage.fileshare.aio.operations.DirectoryOperations :ivar file: FileOperations operations :vartype file: azure.storage.fileshare.aio.operations.FileOperations - :param url: The URL of the service account, share, directory or file that is the target of the desired operation. + :param url: The URL of the service account, share, directory or file that is the target of the + desired operation. :type url: str + :param base_url: Service URL. Default value is ''. + :type base_url: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2021-04-10". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str + :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes + downloaded from the source url into the specified range. The default value is "update". Note + that overriding this default value may result in unsupported behavior. + :paramtype file_range_write_from_url: str """ def __init__( self, url: str, + base_url: str = "", **kwargs: Any ) -> None: - base_url = '{url}' - self._config = AzureFileStorageConfiguration(url, **kwargs) + self._config = AzureFileStorageConfiguration(url=url, **kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.share = ShareOperations(self._client, self._config, self._serialize, self._deserialize) + self.directory = DirectoryOperations(self._client, self._config, self._serialize, self._deserialize) + self.file = FileOperations(self._client, self._config, self._serialize, self._deserialize) - self.service = ServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.share = ShareOperations( - self._client, self._config, self._serialize, self._deserialize) - self.directory = DirectoryOperations( - self._client, self._config, self._serialize, self._deserialize) - self.file = FileOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py index 737d0fb51569..0e9cc80e336f 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py @@ -13,14 +13,23 @@ VERSION = "unknown" -class AzureFileStorageConfiguration(Configuration): +class AzureFileStorageConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureFileStorage. Note that all parameters used to create this instance are saved as instance attributes. - :param url: The URL of the service account, share, directory or file that is the target of the desired operation. + :param url: The URL of the service account, share, directory or file that is the target of the + desired operation. :type url: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2021-04-10". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str + :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes + downloaded from the source url into the specified range. The default value is "update". Note + that overriding this default value may result in unsupported behavior. + :paramtype file_range_write_from_url: str """ def __init__( @@ -28,13 +37,16 @@ def __init__( url: str, **kwargs: Any ) -> None: + super(AzureFileStorageConfiguration, self).__init__(**kwargs) + version = kwargs.pop('version', "2021-04-10") # type: str + file_range_write_from_url = kwargs.pop('file_range_write_from_url', "update") # type: str + if url is None: raise ValueError("Parameter 'url' must not be None.") - super(AzureFileStorageConfiguration, self).__init__(**kwargs) self.url = url - self.version = "2021-04-10" - self.file_range_write_from_url = "update" + self.version = version + self.file_range_write_from_url = file_range_write_from_url kwargs.setdefault('sdk_moniker', 'azurefilestorage/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py index 8e99a7327a80..c804e27c8718 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._directory_operations import build_create_request, build_delete_request, build_force_close_handles_request, build_get_properties_request, build_list_files_and_directories_segment_request, build_list_handles_request, build_rename_request, build_set_metadata_request, build_set_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,10 +42,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def create( + @distributed_trace_async + async def create( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, file_permission: Optional[str] = "inherit", file_permission_key: Optional[str] = None, file_attributes: str = "none", @@ -58,7 +62,7 @@ async def create( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as @@ -75,6 +79,9 @@ async def create( :type file_creation_time: str :param file_last_write_time: Last write time for the file/directory. Default value: Now. :type file_last_write_time: str + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -85,43 +92,36 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "directory" - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str') - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str') - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + restype = kwargs.pop('restype', "directory") # type: str + + + request = build_create_request( + url=self._config.url, + restype=restype, + version=self._config.version, + timeout=timeout, + metadata=metadata, + file_permission=file_permission, + file_permission_key=file_permission_key, + file_attributes=file_attributes, + file_creation_time=file_creation_time, + file_last_write_time=file_last_write_time, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -139,12 +139,15 @@ async def create( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + create.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + - async def get_properties( + @distributed_trace_async + async def get_properties( # pylint: disable=inconsistent-return-statements self, sharesnapshot: Optional[str] = None, timeout: Optional[int] = None, @@ -162,6 +165,9 @@ async def get_properties( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -172,40 +178,35 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "directory" - accept = "application/xml" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + restype = kwargs.pop('restype', "directory") # type: str + + + request = build_get_properties_request( + url=self._config.url, + restype=restype, + version=self._config.version, + sharesnapshot=sharesnapshot, + timeout=timeout, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) @@ -220,12 +221,15 @@ async def get_properties( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + get_properties.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore - async def delete( + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, **kwargs: Any @@ -238,6 +242,9 @@ async def delete( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -248,34 +255,30 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "directory" - accept = "application/xml" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + restype = kwargs.pop('restype', "directory") # type: str - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_delete_request( + url=self._config.url, + restype=restype, + version=self._config.version, + timeout=timeout, + template_url=self.delete.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -283,12 +286,15 @@ async def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + delete.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore - async def set_properties( + + @distributed_trace_async + async def set_properties( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, file_permission: Optional[str] = "inherit", @@ -321,6 +327,12 @@ async def set_properties( :type file_creation_time: str :param file_last_write_time: Last write time for the file/directory. Default value: Now. :type file_last_write_time: str + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -331,43 +343,37 @@ async def set_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "directory" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.set_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str') - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str') - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "directory") # type: str + comp = kwargs.pop('comp', "properties") # type: str + + + request = build_set_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + file_permission=file_permission, + file_permission_key=file_permission_key, + file_attributes=file_attributes, + file_creation_time=file_creation_time, + file_last_write_time=file_last_write_time, + template_url=self.set_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -385,15 +391,18 @@ async def set_properties( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + set_properties.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore - async def set_metadata( + + @distributed_trace_async + async def set_metadata( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, **kwargs: Any ) -> None: """Updates user defined metadata for the specified directory. @@ -404,7 +413,13 @@ async def set_metadata( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -415,38 +430,33 @@ async def set_metadata( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "directory" - comp = "metadata" - accept = "application/xml" - - # Construct URL - url = self.set_metadata.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "directory") # type: str + comp = kwargs.pop('comp', "metadata") # type: str + + + request = build_set_metadata_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + template_url=self.set_metadata.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -456,11 +466,14 @@ async def set_metadata( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + set_metadata.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + + @distributed_trace_async async def list_files_and_directories_segment( self, prefix: Optional[str] = None, @@ -500,6 +513,12 @@ async def list_files_and_directories_segment( :type include: list[str or ~azure.storage.fileshare.models.ListFilesIncludeType] :param include_extended_info: Include extended information. :type include_extended_info: bool + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListFilesAndDirectoriesSegmentResponse, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.ListFilesAndDirectoriesSegmentResponse @@ -510,48 +529,38 @@ async def list_files_and_directories_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "directory" - comp = "list" - accept = "application/xml" - - # Construct URL - url = self.list_files_and_directories_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if include is not None: - query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if include_extended_info is not None: - header_parameters['x-ms-file-extended-info'] = self._serialize.header("include_extended_info", include_extended_info, 'bool') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "directory") # type: str + comp = kwargs.pop('comp', "list") # type: str + + + request = build_list_files_and_directories_segment_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + prefix=prefix, + sharesnapshot=sharesnapshot, + marker=marker, + maxresults=maxresults, + timeout=timeout, + include=include, + include_extended_info=include_extended_info, + template_url=self.list_files_and_directories_segment.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -559,14 +568,18 @@ async def list_files_and_directories_segment( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ListFilesAndDirectoriesSegmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_files_and_directories_segment.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + list_files_and_directories_segment.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + + + @distributed_trace_async async def list_handles( self, marker: Optional[str] = None, @@ -598,6 +611,9 @@ async def list_handles( :param recursive: Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. :type recursive: bool + :keyword comp: comp. The default value is "listhandles". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListHandlesResponse, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.ListHandlesResponse @@ -608,42 +624,34 @@ async def list_handles( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "listhandles" - accept = "application/xml" - # Construct URL - url = self.list_handles.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if recursive is not None: - header_parameters['x-ms-recursive'] = self._serialize.header("recursive", recursive, 'bool') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "listhandles") # type: str + + + request = build_list_handles_request( + url=self._config.url, + comp=comp, + version=self._config.version, + marker=marker, + maxresults=maxresults, + timeout=timeout, + sharesnapshot=sharesnapshot, + recursive=recursive, + template_url=self.list_handles.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -651,15 +659,19 @@ async def list_handles( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ListHandlesResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_handles.metadata = {'url': '/{shareName}/{directory}'} # type: ignore - async def force_close_handles( + list_handles.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + + + @distributed_trace_async + async def force_close_handles( # pylint: disable=inconsistent-return-statements self, handle_id: str, timeout: Optional[int] = None, @@ -689,6 +701,9 @@ async def force_close_handles( :param recursive: Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. :type recursive: bool + :keyword comp: comp. The default value is "forceclosehandles". Note that overriding this + default value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -699,41 +714,34 @@ async def force_close_handles( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "forceclosehandles" - accept = "application/xml" - # Construct URL - url = self.force_close_handles.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-handle-id'] = self._serialize.header("handle_id", handle_id, 'str') - if recursive is not None: - header_parameters['x-ms-recursive'] = self._serialize.header("recursive", recursive, 'bool') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "forceclosehandles") # type: str + + + request = build_force_close_handles_request( + url=self._config.url, + comp=comp, + version=self._config.version, + handle_id=handle_id, + timeout=timeout, + marker=marker, + sharesnapshot=sharesnapshot, + recursive=recursive, + template_url=self.force_close_handles.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -744,12 +752,15 @@ async def force_close_handles( response_headers['x-ms-number-of-handles-closed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-closed')) response_headers['x-ms-number-of-handles-failed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-failed')) + if cls: return cls(pipeline_response, None, response_headers) - force_close_handles.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + force_close_handles.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + - async def rename( + @distributed_trace_async + async def rename( # pylint: disable=inconsistent-return-statements self, rename_source: str, timeout: Optional[int] = None, @@ -757,7 +768,7 @@ async def rename( ignore_read_only: Optional[bool] = None, file_permission: Optional[str] = "inherit", file_permission_key: Optional[str] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, source_lease_access_conditions: Optional["_models.SourceLeaseAccessConditions"] = None, destination_lease_access_conditions: Optional["_models.DestinationLeaseAccessConditions"] = None, copy_file_smb_info: Optional["_models.CopyFileSmbInfo"] = None, @@ -795,13 +806,21 @@ async def rename( one of the x-ms-file-permission or x-ms-file-permission-key should be specified. :type file_permission_key: str :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param source_lease_access_conditions: Parameter group. - :type source_lease_access_conditions: ~azure.storage.fileshare.models.SourceLeaseAccessConditions + :type source_lease_access_conditions: + ~azure.storage.fileshare.models.SourceLeaseAccessConditions :param destination_lease_access_conditions: Parameter group. - :type destination_lease_access_conditions: ~azure.storage.fileshare.models.DestinationLeaseAccessConditions + :type destination_lease_access_conditions: + ~azure.storage.fileshare.models.DestinationLeaseAccessConditions :param copy_file_smb_info: Parameter group. :type copy_file_smb_info: ~azure.storage.fileshare.models.CopyFileSmbInfo + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "rename". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -812,71 +831,56 @@ async def rename( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "directory") # type: str + comp = kwargs.pop('comp', "rename") # type: str + _source_lease_id = None _destination_lease_id = None _file_attributes = None _file_creation_time = None _file_last_write_time = None + if source_lease_access_conditions is not None: + _source_lease_id = source_lease_access_conditions.source_lease_id + if destination_lease_access_conditions is not None: + _destination_lease_id = destination_lease_access_conditions.destination_lease_id if copy_file_smb_info is not None: _file_attributes = copy_file_smb_info.file_attributes _file_creation_time = copy_file_smb_info.file_creation_time _file_last_write_time = copy_file_smb_info.file_last_write_time - if destination_lease_access_conditions is not None: - _destination_lease_id = destination_lease_access_conditions.destination_lease_id - if source_lease_access_conditions is not None: - _source_lease_id = source_lease_access_conditions.source_lease_id - restype = "directory" - comp = "rename" - accept = "application/xml" - - # Construct URL - url = self.rename.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['x-ms-file-rename-source'] = self._serialize.header("rename_source", rename_source, 'str') - if replace_if_exists is not None: - header_parameters['x-ms-file-rename-replace-if-exists'] = self._serialize.header("replace_if_exists", replace_if_exists, 'bool') - if ignore_read_only is not None: - header_parameters['x-ms-file-rename-ignore-readonly'] = self._serialize.header("ignore_read_only", ignore_read_only, 'bool') - if _source_lease_id is not None: - header_parameters['x-ms-source-lease-id'] = self._serialize.header("source_lease_id", _source_lease_id, 'str') - if _destination_lease_id is not None: - header_parameters['x-ms-destination-lease-id'] = self._serialize.header("destination_lease_id", _destination_lease_id, 'str') - if _file_attributes is not None: - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", _file_attributes, 'str') - if _file_creation_time is not None: - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", _file_creation_time, 'str') - if _file_last_write_time is not None: - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", _file_last_write_time, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_rename_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + rename_source=rename_source, + timeout=timeout, + replace_if_exists=replace_if_exists, + ignore_read_only=ignore_read_only, + source_lease_id=_source_lease_id, + destination_lease_id=_destination_lease_id, + file_attributes=_file_attributes, + file_creation_time=_file_creation_time, + file_last_write_time=_file_last_write_time, + file_permission=file_permission, + file_permission_key=file_permission_key, + metadata=metadata, + template_url=self.rename.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -894,7 +898,9 @@ async def rename( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - rename.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + rename.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py index aea2b3343156..97a5a50cceac 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._file_operations import build_abort_copy_request, build_acquire_lease_request, build_break_lease_request, build_change_lease_request, build_create_request, build_delete_request, build_download_request, build_force_close_handles_request, build_get_properties_request, build_get_range_list_request, build_list_handles_request, build_release_lease_request, build_rename_request, build_set_http_headers_request, build_set_metadata_request, build_start_copy_request, build_upload_range_from_url_request, build_upload_range_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,11 +42,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def create( + @distributed_trace_async + async def create( # pylint: disable=inconsistent-return-statements self, file_content_length: int, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, file_permission: Optional[str] = "inherit", file_permission_key: Optional[str] = None, file_attributes: str = "none", @@ -63,7 +67,7 @@ async def create( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as @@ -84,6 +88,9 @@ async def create( :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword file_type_constant: Dummy constant parameter, file type can only be file. The default + value is "file". Note that overriding this default value may result in unsupported behavior. + :paramtype file_type_constant: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -94,7 +101,9 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + file_type_constant = kwargs.pop('file_type_constant', "file") # type: str + _file_content_type = None _file_content_encoding = None _file_content_language = None @@ -111,58 +120,41 @@ async def create( _file_content_disposition = file_http_headers.file_content_disposition if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - file_type_constant = "file" - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['x-ms-content-length'] = self._serialize.header("file_content_length", file_content_length, 'long') - header_parameters['x-ms-type'] = self._serialize.header("file_type_constant", file_type_constant, 'str') - if _file_content_type is not None: - header_parameters['x-ms-content-type'] = self._serialize.header("file_content_type", _file_content_type, 'str') - if _file_content_encoding is not None: - header_parameters['x-ms-content-encoding'] = self._serialize.header("file_content_encoding", _file_content_encoding, 'str') - if _file_content_language is not None: - header_parameters['x-ms-content-language'] = self._serialize.header("file_content_language", _file_content_language, 'str') - if _file_cache_control is not None: - header_parameters['x-ms-cache-control'] = self._serialize.header("file_cache_control", _file_cache_control, 'str') - if _file_content_md5 is not None: - header_parameters['x-ms-content-md5'] = self._serialize.header("file_content_md5", _file_content_md5, 'bytearray') - if _file_content_disposition is not None: - header_parameters['x-ms-content-disposition'] = self._serialize.header("file_content_disposition", _file_content_disposition, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str') - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str') - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_create_request( + url=self._config.url, + version=self._config.version, + file_type_constant=file_type_constant, + file_content_length=file_content_length, + timeout=timeout, + file_content_type=_file_content_type, + file_content_encoding=_file_content_encoding, + file_content_language=_file_content_language, + file_cache_control=_file_cache_control, + file_content_md5=_file_content_md5, + file_content_disposition=_file_content_disposition, + metadata=metadata, + file_permission=file_permission, + file_permission_key=file_permission_key, + file_attributes=file_attributes, + file_creation_time=file_creation_time, + file_last_write_time=file_last_write_time, + lease_id=_lease_id, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -180,11 +172,14 @@ async def create( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + create.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + + @distributed_trace_async async def download( self, timeout: Optional[int] = None, @@ -218,48 +213,39 @@ async def download( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - accept = "application/xml" - # Construct URL - url = self.download.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if range_get_content_md5 is not None: - header_parameters['x-ms-range-get-content-md5'] = self._serialize.header("range_get_content_md5", range_get_content_md5, 'bool') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + request = build_download_request( + url=self._config.url, + version=self._config.version, + timeout=timeout, + range=range, + range_get_content_md5=range_get_content_md5, + lease_id=_lease_id, + template_url=self.download.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=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 206]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} if response.status_code == 200: response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range')) @@ -291,11 +277,12 @@ async def download( response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration')) response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state')) response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status')) + deserialized = response.stream_download(self._client._pipeline) if response.status_code == 206: response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range')) @@ -327,15 +314,19 @@ async def download( response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration')) response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state')) response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status')) + deserialized = response.stream_download(self._client._pipeline) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - download.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore - async def get_properties( + download.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + + + @distributed_trace_async + async def get_properties( # pylint: disable=inconsistent-return-statements self, sharesnapshot: Optional[str] = None, timeout: Optional[int] = None, @@ -365,45 +356,37 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - accept = "application/xml" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_properties_request( + url=self._config.url, + version=self._config.version, + sharesnapshot=sharesnapshot, + timeout=timeout, + lease_id=_lease_id, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['x-ms-type']=self._deserialize('str', response.headers.get('x-ms-type')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) @@ -434,12 +417,15 @@ async def get_properties( response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state')) response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + get_properties.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + - async def delete( + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None, @@ -464,38 +450,31 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - accept = "application/xml" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_delete_request( + url=self._config.url, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + template_url=self.delete.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -503,12 +482,15 @@ async def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + delete.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore - async def set_http_headers( + + @distributed_trace_async + async def set_http_headers( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, file_content_length: Optional[int] = None, @@ -552,6 +534,9 @@ async def set_http_headers( :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -562,7 +547,9 @@ async def set_http_headers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "properties") # type: str + _file_content_type = None _file_content_encoding = None _file_content_language = None @@ -579,57 +566,40 @@ async def set_http_headers( _file_content_disposition = file_http_headers.file_content_disposition if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "properties" - accept = "application/xml" - # Construct URL - url = self.set_http_headers.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if file_content_length is not None: - header_parameters['x-ms-content-length'] = self._serialize.header("file_content_length", file_content_length, 'long') - if _file_content_type is not None: - header_parameters['x-ms-content-type'] = self._serialize.header("file_content_type", _file_content_type, 'str') - if _file_content_encoding is not None: - header_parameters['x-ms-content-encoding'] = self._serialize.header("file_content_encoding", _file_content_encoding, 'str') - if _file_content_language is not None: - header_parameters['x-ms-content-language'] = self._serialize.header("file_content_language", _file_content_language, 'str') - if _file_cache_control is not None: - header_parameters['x-ms-cache-control'] = self._serialize.header("file_cache_control", _file_cache_control, 'str') - if _file_content_md5 is not None: - header_parameters['x-ms-content-md5'] = self._serialize.header("file_content_md5", _file_content_md5, 'bytearray') - if _file_content_disposition is not None: - header_parameters['x-ms-content-disposition'] = self._serialize.header("file_content_disposition", _file_content_disposition, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str') - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str') - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_http_headers_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + file_content_length=file_content_length, + file_content_type=_file_content_type, + file_content_encoding=_file_content_encoding, + file_content_language=_file_content_language, + file_cache_control=_file_cache_control, + file_content_md5=_file_content_md5, + file_content_disposition=_file_content_disposition, + file_permission=file_permission, + file_permission_key=file_permission_key, + file_attributes=file_attributes, + file_creation_time=file_creation_time, + file_last_write_time=file_last_write_time, + lease_id=_lease_id, + template_url=self.set_http_headers.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -647,15 +617,18 @@ async def set_http_headers( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - set_http_headers.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + set_http_headers.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore - async def set_metadata( + + @distributed_trace_async + async def set_metadata( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None, **kwargs: Any ) -> None: @@ -667,9 +640,12 @@ async def set_metadata( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -680,42 +656,35 @@ async def set_metadata( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "metadata") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "metadata" - accept = "application/xml" - # Construct URL - url = self.set_metadata.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_metadata_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + lease_id=_lease_id, + template_url=self.set_metadata.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -725,12 +694,15 @@ async def set_metadata( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + set_metadata.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + - async def acquire_lease( + @distributed_trace_async + async def acquire_lease( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, duration: Optional[int] = None, @@ -757,6 +729,12 @@ async def acquire_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "acquire". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -767,42 +745,35 @@ async def acquire_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "acquire" - accept = "application/xml" - - # Construct URL - url = self.acquire_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if duration is not None: - header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "acquire") # type: str + + + request = build_acquire_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + timeout=timeout, + duration=duration, + proposed_lease_id=proposed_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.acquire_lease.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -814,12 +785,15 @@ async def acquire_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + acquire_lease.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + - async def release_lease( + @distributed_trace_async + async def release_lease( # pylint: disable=inconsistent-return-statements self, lease_id: str, timeout: Optional[int] = None, @@ -839,6 +813,12 @@ async def release_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "release". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -849,39 +829,34 @@ async def release_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "release" - accept = "application/xml" - - # Construct URL - url = self.release_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "release") # type: str + + + request = build_release_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.release_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -892,12 +867,15 @@ async def release_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + release_lease.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore - async def change_lease( + + @distributed_trace_async + async def change_lease( # pylint: disable=inconsistent-return-statements self, lease_id: str, timeout: Optional[int] = None, @@ -922,6 +900,12 @@ async def change_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "change". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -932,41 +916,35 @@ async def change_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "change" - accept = "application/xml" - - # Construct URL - url = self.change_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "change") # type: str + + + request = build_change_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + proposed_lease_id=proposed_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.change_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -978,12 +956,15 @@ async def change_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + change_lease.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore - async def break_lease( + + @distributed_trace_async + async def break_lease( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1003,6 +984,12 @@ async def break_lease( :type request_id_parameter: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "break". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1013,44 +1000,37 @@ async def break_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "break") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "lease" - action = "break" - accept = "application/xml" - - # Construct URL - url = self.break_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_break_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.break_lease.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1062,12 +1042,15 @@ async def break_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + break_lease.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + - async def upload_range( + @distributed_trace_async + async def upload_range( # pylint: disable=inconsistent-return-statements self, range: str, content_length: int, @@ -1109,6 +1092,9 @@ async def upload_range( :type optionalbody: IO :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "range". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1119,49 +1105,42 @@ async def upload_range( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "range") # type: str + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "range" - content_type = kwargs.pop("content_type", "application/octet-stream") - accept = "application/xml" - - # Construct URL - url = self.upload_range.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - header_parameters['x-ms-write'] = self._serialize.header("file_range_write", file_range_write, 'str') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("content_md5", content_md5, 'bytearray') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = optionalbody - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _content = optionalbody + + request = build_upload_range_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + range=range, + content_length=content_length, + content=_content, + timeout=timeout, + file_range_write=file_range_write, + content_md5=content_md5, + lease_id=_lease_id, + template_url=self.upload_range.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1173,12 +1152,15 @@ async def upload_range( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - upload_range.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + upload_range.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore - async def upload_range_from_url( + + @distributed_trace_async + async def upload_range_from_url( # pylint: disable=inconsistent-return-statements self, range: str, copy_source: str, @@ -1220,9 +1202,13 @@ async def upload_range_from_url( OAuth access token to copy source. :type copy_source_authorization: str :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.fileshare.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.fileshare.models.SourceModifiedAccessConditions :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "range". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1233,59 +1219,48 @@ async def upload_range_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "range") # type: str + _source_if_match_crc64 = None _source_if_none_match_crc64 = None _lease_id = None - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if source_modified_access_conditions is not None: _source_if_match_crc64 = source_modified_access_conditions.source_if_match_crc64 _source_if_none_match_crc64 = source_modified_access_conditions.source_if_none_match_crc64 - comp = "range" - accept = "application/xml" + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id - # Construct URL - url = self.upload_range_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') - if source_range is not None: - header_parameters['x-ms-source-range'] = self._serialize.header("source_range", source_range, 'str') - header_parameters['x-ms-write'] = self._serialize.header("self._config.file_range_write_from_url", self._config.file_range_write_from_url, 'str') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if source_content_crc64 is not None: - header_parameters['x-ms-source-content-crc64'] = self._serialize.header("source_content_crc64", source_content_crc64, 'bytearray') - if _source_if_match_crc64 is not None: - header_parameters['x-ms-source-if-match-crc64'] = self._serialize.header("source_if_match_crc64", _source_if_match_crc64, 'bytearray') - if _source_if_none_match_crc64 is not None: - header_parameters['x-ms-source-if-none-match-crc64'] = self._serialize.header("source_if_none_match_crc64", _source_if_none_match_crc64, 'bytearray') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if copy_source_authorization is not None: - header_parameters['x-ms-copy-source-authorization'] = self._serialize.header("copy_source_authorization", copy_source_authorization, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_upload_range_from_url_request( + url=self._config.url, + comp=comp, + file_range_write_from_url=self._config.file_range_write_from_url, + version=self._config.version, + range=range, + copy_source=copy_source, + content_length=content_length, + timeout=timeout, + source_range=source_range, + source_content_crc64=source_content_crc64, + source_if_match_crc64=_source_if_match_crc64, + source_if_none_match_crc64=_source_if_none_match_crc64, + lease_id=_lease_id, + copy_source_authorization=copy_source_authorization, + template_url=self.upload_range_from_url.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1297,11 +1272,14 @@ async def upload_range_from_url( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - upload_range_from_url.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + upload_range_from_url.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + + @distributed_trace_async async def get_range_list( self, sharesnapshot: Optional[str] = None, @@ -1328,6 +1306,9 @@ async def get_range_list( :type range: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "rangelist". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ShareFileRangeList, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.ShareFileRangeList @@ -1338,46 +1319,37 @@ async def get_range_list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "rangelist") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "rangelist" - accept = "application/xml" - # Construct URL - url = self.get_range_list.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - if prevsharesnapshot is not None: - query_parameters['prevsharesnapshot'] = self._serialize.query("prevsharesnapshot", prevsharesnapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_range_list_request( + url=self._config.url, + comp=comp, + version=self._config.version, + sharesnapshot=sharesnapshot, + prevsharesnapshot=prevsharesnapshot, + timeout=timeout, + range=range, + lease_id=_lease_id, + template_url=self.get_range_list.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1387,19 +1359,23 @@ async def get_range_list( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ShareFileRangeList', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_range_list.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore - async def start_copy( + get_range_list.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + + + @distributed_trace_async + async def start_copy( # pylint: disable=inconsistent-return-statements self, copy_source: str, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, file_permission: Optional[str] = "inherit", file_permission_key: Optional[str] = None, copy_file_smb_info: Optional["_models.CopyFileSmbInfo"] = None, @@ -1422,7 +1398,7 @@ async def start_copy( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as @@ -1446,7 +1422,7 @@ async def start_copy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _file_permission_copy_mode = None _ignore_read_only = None _file_attributes = None @@ -1463,53 +1439,37 @@ async def start_copy( _set_archive_attribute = copy_file_smb_info.set_archive_attribute if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - accept = "application/xml" - # Construct URL - url = self.start_copy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - if _file_permission_copy_mode is not None: - header_parameters['x-ms-file-permission-copy-mode'] = self._serialize.header("file_permission_copy_mode", _file_permission_copy_mode, 'str') - if _ignore_read_only is not None: - header_parameters['x-ms-file-copy-ignore-read-only'] = self._serialize.header("ignore_read_only", _ignore_read_only, 'bool') - if _file_attributes is not None: - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", _file_attributes, 'str') - if _file_creation_time is not None: - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", _file_creation_time, 'str') - if _file_last_write_time is not None: - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", _file_last_write_time, 'str') - if _set_archive_attribute is not None: - header_parameters['x-ms-file-copy-set-archive'] = self._serialize.header("set_archive_attribute", _set_archive_attribute, 'bool') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_start_copy_request( + url=self._config.url, + version=self._config.version, + copy_source=copy_source, + timeout=timeout, + metadata=metadata, + file_permission=file_permission, + file_permission_key=file_permission_key, + file_permission_copy_mode=_file_permission_copy_mode, + ignore_read_only=_ignore_read_only, + file_attributes=_file_attributes, + file_creation_time=_file_creation_time, + file_last_write_time=_file_last_write_time, + set_archive_attribute=_set_archive_attribute, + lease_id=_lease_id, + template_url=self.start_copy.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1521,12 +1481,15 @@ async def start_copy( response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id')) response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status')) + if cls: return cls(pipeline_response, None, response_headers) - start_copy.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + start_copy.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + - async def abort_copy( + @distributed_trace_async + async def abort_copy( # pylint: disable=inconsistent-return-statements self, copy_id: str, timeout: Optional[int] = None, @@ -1546,6 +1509,12 @@ async def abort_copy( :type timeout: int :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "copy". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword copy_action_abort_constant: Abort. The default value is "abort". Note that overriding + this default value may result in unsupported behavior. + :paramtype copy_action_abort_constant: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1556,43 +1525,37 @@ async def abort_copy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "copy") # type: str + copy_action_abort_constant = kwargs.pop('copy_action_abort_constant', "abort") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "copy" - copy_action_abort_constant = "abort" - accept = "application/xml" - - # Construct URL - url = self.abort_copy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['copyid'] = self._serialize.query("copy_id", copy_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-copy-action'] = self._serialize.header("copy_action_abort_constant", copy_action_abort_constant, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_abort_copy_request( + url=self._config.url, + comp=comp, + copy_action_abort_constant=copy_action_abort_constant, + version=self._config.version, + copy_id=copy_id, + timeout=timeout, + lease_id=_lease_id, + template_url=self.abort_copy.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1600,11 +1563,14 @@ async def abort_copy( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - abort_copy.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + abort_copy.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + + @distributed_trace_async async def list_handles( self, marker: Optional[str] = None, @@ -1632,6 +1598,9 @@ async def list_handles( :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. :type sharesnapshot: str + :keyword comp: comp. The default value is "listhandles". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListHandlesResponse, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.ListHandlesResponse @@ -1642,40 +1611,33 @@ async def list_handles( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "listhandles" - accept = "application/xml" - # Construct URL - url = self.list_handles.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "listhandles") # type: str + + + request = build_list_handles_request( + url=self._config.url, + comp=comp, + version=self._config.version, + marker=marker, + maxresults=maxresults, + timeout=timeout, + sharesnapshot=sharesnapshot, + template_url=self.list_handles.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1683,15 +1645,19 @@ async def list_handles( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ListHandlesResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_handles.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore - async def force_close_handles( + list_handles.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + + + @distributed_trace_async + async def force_close_handles( # pylint: disable=inconsistent-return-statements self, handle_id: str, timeout: Optional[int] = None, @@ -1717,6 +1683,9 @@ async def force_close_handles( :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. :type sharesnapshot: str + :keyword comp: comp. The default value is "forceclosehandles". Note that overriding this + default value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1727,39 +1696,33 @@ async def force_close_handles( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "forceclosehandles" - accept = "application/xml" - # Construct URL - url = self.force_close_handles.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-handle-id'] = self._serialize.header("handle_id", handle_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "forceclosehandles") # type: str + + + request = build_force_close_handles_request( + url=self._config.url, + comp=comp, + version=self._config.version, + handle_id=handle_id, + timeout=timeout, + marker=marker, + sharesnapshot=sharesnapshot, + template_url=self.force_close_handles.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1770,12 +1733,15 @@ async def force_close_handles( response_headers['x-ms-number-of-handles-closed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-closed')) response_headers['x-ms-number-of-handles-failed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-failed')) + if cls: return cls(pipeline_response, None, response_headers) - force_close_handles.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + force_close_handles.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + - async def rename( + @distributed_trace_async + async def rename( # pylint: disable=inconsistent-return-statements self, rename_source: str, timeout: Optional[int] = None, @@ -1783,7 +1749,7 @@ async def rename( ignore_read_only: Optional[bool] = None, file_permission: Optional[str] = "inherit", file_permission_key: Optional[str] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, source_lease_access_conditions: Optional["_models.SourceLeaseAccessConditions"] = None, destination_lease_access_conditions: Optional["_models.DestinationLeaseAccessConditions"] = None, copy_file_smb_info: Optional["_models.CopyFileSmbInfo"] = None, @@ -1821,13 +1787,18 @@ async def rename( one of the x-ms-file-permission or x-ms-file-permission-key should be specified. :type file_permission_key: str :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param source_lease_access_conditions: Parameter group. - :type source_lease_access_conditions: ~azure.storage.fileshare.models.SourceLeaseAccessConditions + :type source_lease_access_conditions: + ~azure.storage.fileshare.models.SourceLeaseAccessConditions :param destination_lease_access_conditions: Parameter group. - :type destination_lease_access_conditions: ~azure.storage.fileshare.models.DestinationLeaseAccessConditions + :type destination_lease_access_conditions: + ~azure.storage.fileshare.models.DestinationLeaseAccessConditions :param copy_file_smb_info: Parameter group. :type copy_file_smb_info: ~azure.storage.fileshare.models.CopyFileSmbInfo + :keyword comp: comp. The default value is "rename". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1838,69 +1809,54 @@ async def rename( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "rename") # type: str + _source_lease_id = None _destination_lease_id = None _file_attributes = None _file_creation_time = None _file_last_write_time = None + if source_lease_access_conditions is not None: + _source_lease_id = source_lease_access_conditions.source_lease_id + if destination_lease_access_conditions is not None: + _destination_lease_id = destination_lease_access_conditions.destination_lease_id if copy_file_smb_info is not None: _file_attributes = copy_file_smb_info.file_attributes _file_creation_time = copy_file_smb_info.file_creation_time _file_last_write_time = copy_file_smb_info.file_last_write_time - if destination_lease_access_conditions is not None: - _destination_lease_id = destination_lease_access_conditions.destination_lease_id - if source_lease_access_conditions is not None: - _source_lease_id = source_lease_access_conditions.source_lease_id - comp = "rename" - accept = "application/xml" - # Construct URL - url = self.rename.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['x-ms-file-rename-source'] = self._serialize.header("rename_source", rename_source, 'str') - if replace_if_exists is not None: - header_parameters['x-ms-file-rename-replace-if-exists'] = self._serialize.header("replace_if_exists", replace_if_exists, 'bool') - if ignore_read_only is not None: - header_parameters['x-ms-file-rename-ignore-readonly'] = self._serialize.header("ignore_read_only", ignore_read_only, 'bool') - if _source_lease_id is not None: - header_parameters['x-ms-source-lease-id'] = self._serialize.header("source_lease_id", _source_lease_id, 'str') - if _destination_lease_id is not None: - header_parameters['x-ms-destination-lease-id'] = self._serialize.header("destination_lease_id", _destination_lease_id, 'str') - if _file_attributes is not None: - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", _file_attributes, 'str') - if _file_creation_time is not None: - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", _file_creation_time, 'str') - if _file_last_write_time is not None: - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", _file_last_write_time, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_rename_request( + url=self._config.url, + comp=comp, + version=self._config.version, + rename_source=rename_source, + timeout=timeout, + replace_if_exists=replace_if_exists, + ignore_read_only=ignore_read_only, + source_lease_id=_source_lease_id, + destination_lease_id=_destination_lease_id, + file_attributes=_file_attributes, + file_creation_time=_file_creation_time, + file_last_write_time=_file_last_write_time, + file_permission=file_permission, + file_permission_key=file_permission_key, + metadata=metadata, + template_url=self.rename.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1918,7 +1874,9 @@ async def rename( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - rename.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + rename.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py index f413f2977968..5e6883053dde 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._service_operations import build_get_properties_request, build_list_shares_segment_request, build_set_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,7 +42,8 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def set_properties( + @distributed_trace_async + async def set_properties( # pylint: disable=inconsistent-return-statements self, storage_service_properties: "_models.StorageServiceProperties", timeout: Optional[int] = None, @@ -55,6 +59,12 @@ async def set_properties( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -65,52 +75,50 @@ async def set_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "properties" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + + _content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True) + + request = build_set_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + template_url=self.set_properties.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {'url': '/'} # type: ignore + set_properties.metadata = {'url': "{url}/"} # type: ignore + + @distributed_trace_async async def get_properties( self, timeout: Optional[int] = None, @@ -124,6 +132,12 @@ async def get_properties( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.StorageServiceProperties @@ -134,49 +148,49 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + + + request = build_get_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('StorageServiceProperties', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_properties.metadata = {'url': '/'} # type: ignore + get_properties.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace_async async def list_shares_segment( self, prefix: Optional[str] = None, @@ -209,6 +223,9 @@ async def list_shares_segment( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword comp: comp. The default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListSharesResponse, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.ListSharesResponse @@ -219,51 +236,46 @@ async def list_shares_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "list" - accept = "application/xml" - # Construct URL - url = self.list_shares_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if include is not None: - query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "list") # type: str + + + request = build_list_shares_segment_request( + url=self._config.url, + comp=comp, + version=self._config.version, + prefix=prefix, + marker=marker, + maxresults=maxresults, + include=include, + timeout=timeout, + template_url=self.list_shares_segment.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('ListSharesResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_shares_segment.metadata = {'url': '/'} # type: ignore + + list_shares_segment.metadata = {'url': "{url}/"} # type: ignore + diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py index de90e4eb5d7e..6b4f2621763c 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._share_operations import build_acquire_lease_request, build_break_lease_request, build_change_lease_request, build_create_permission_request, build_create_request, build_create_snapshot_request, build_delete_request, build_get_access_policy_request, build_get_permission_request, build_get_properties_request, build_get_statistics_request, build_release_lease_request, build_renew_lease_request, build_restore_request, build_set_access_policy_request, build_set_metadata_request, build_set_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,10 +42,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def create( + @distributed_trace_async + async def create( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, quota: Optional[int] = None, access_tier: Optional[Union[str, "_models.ShareAccessTier"]] = None, enabled_protocols: Optional[str] = None, @@ -58,7 +62,7 @@ async def create( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param quota: Specifies the maximum size of the share, in gigabytes. :type quota: int :param access_tier: Specifies the access tier of the share. @@ -67,6 +71,9 @@ async def create( :type enabled_protocols: str :param root_squash: Root squash to set on the share. Only valid for NFS shares. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -77,44 +84,35 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "share" - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if quota is not None: - header_parameters['x-ms-share-quota'] = self._serialize.header("quota", quota, 'int', minimum=1) - if access_tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("access_tier", access_tier, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if enabled_protocols is not None: - header_parameters['x-ms-enabled-protocols'] = self._serialize.header("enabled_protocols", enabled_protocols, 'str') - if root_squash is not None: - header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + restype = kwargs.pop('restype', "share") # type: str + + + request = build_create_request( + url=self._config.url, + restype=restype, + version=self._config.version, + timeout=timeout, + metadata=metadata, + quota=quota, + access_tier=access_tier, + enabled_protocols=enabled_protocols, + root_squash=root_squash, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -124,12 +122,15 @@ async def create( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{shareName}'} # type: ignore + create.metadata = {'url': "{url}/{shareName}"} # type: ignore + - async def get_properties( + @distributed_trace_async + async def get_properties( # pylint: disable=inconsistent-return-statements self, sharesnapshot: Optional[str] = None, timeout: Optional[int] = None, @@ -149,6 +150,9 @@ async def get_properties( :type timeout: int :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -159,46 +163,39 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - accept = "application/xml" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_properties_request( + url=self._config.url, + restype=restype, + version=self._config.version, + sharesnapshot=sharesnapshot, + timeout=timeout, + lease_id=_lease_id, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) @@ -219,12 +216,15 @@ async def get_properties( response_headers['x-ms-enabled-protocols']=self._deserialize('str', response.headers.get('x-ms-enabled-protocols')) response_headers['x-ms-root-squash']=self._deserialize('str', response.headers.get('x-ms-root-squash')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{shareName}'} # type: ignore + get_properties.metadata = {'url': "{url}/{shareName}"} # type: ignore - async def delete( + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, sharesnapshot: Optional[str] = None, timeout: Optional[int] = None, @@ -248,6 +248,9 @@ async def delete( :type delete_snapshots: str or ~azure.storage.fileshare.models.DeleteSnapshotsOptionType :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -258,44 +261,36 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - accept = "application/xml" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if delete_snapshots is not None: - header_parameters['x-ms-delete-snapshots'] = self._serialize.header("delete_snapshots", delete_snapshots, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + request = build_delete_request( + url=self._config.url, + restype=restype, + version=self._config.version, + sharesnapshot=sharesnapshot, + timeout=timeout, + delete_snapshots=delete_snapshots, + lease_id=_lease_id, + template_url=self.delete.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -303,12 +298,15 @@ async def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{shareName}'} # type: ignore + delete.metadata = {'url': "{url}/{shareName}"} # type: ignore + - async def acquire_lease( + @distributed_trace_async + async def acquire_lease( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, duration: Optional[int] = None, @@ -339,6 +337,15 @@ async def acquire_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "acquire". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -349,46 +356,38 @@ async def acquire_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "acquire" - restype = "share" - accept = "application/xml" - - # Construct URL - url = self.acquire_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if duration is not None: - header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "acquire") # type: str + restype = kwargs.pop('restype', "share") # type: str + + + request = build_acquire_lease_request( + url=self._config.url, + comp=comp, + action=action, + restype=restype, + version=self._config.version, + timeout=timeout, + duration=duration, + proposed_lease_id=proposed_lease_id, + sharesnapshot=sharesnapshot, + request_id_parameter=request_id_parameter, + template_url=self.acquire_lease.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -400,12 +399,15 @@ async def acquire_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {'url': '/{shareName}'} # type: ignore + acquire_lease.metadata = {'url': "{url}/{shareName}"} # type: ignore + - async def release_lease( + @distributed_trace_async + async def release_lease( # pylint: disable=inconsistent-return-statements self, lease_id: str, timeout: Optional[int] = None, @@ -429,6 +431,15 @@ async def release_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "release". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -439,43 +450,37 @@ async def release_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "release" - restype = "share" - accept = "application/xml" - - # Construct URL - url = self.release_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "release") # type: str + restype = kwargs.pop('restype', "share") # type: str + + + request = build_release_lease_request( + url=self._config.url, + comp=comp, + action=action, + restype=restype, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + sharesnapshot=sharesnapshot, + request_id_parameter=request_id_parameter, + template_url=self.release_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -486,12 +491,15 @@ async def release_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {'url': '/{shareName}'} # type: ignore + release_lease.metadata = {'url': "{url}/{shareName}"} # type: ignore - async def change_lease( + + @distributed_trace_async + async def change_lease( # pylint: disable=inconsistent-return-statements self, lease_id: str, timeout: Optional[int] = None, @@ -520,6 +528,15 @@ async def change_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "change". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -530,45 +547,38 @@ async def change_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "change" - restype = "share" - accept = "application/xml" - - # Construct URL - url = self.change_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "change") # type: str + restype = kwargs.pop('restype', "share") # type: str + + + request = build_change_lease_request( + url=self._config.url, + comp=comp, + action=action, + restype=restype, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + proposed_lease_id=proposed_lease_id, + sharesnapshot=sharesnapshot, + request_id_parameter=request_id_parameter, + template_url=self.change_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -580,12 +590,15 @@ async def change_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {'url': '/{shareName}'} # type: ignore + change_lease.metadata = {'url': "{url}/{shareName}"} # type: ignore + - async def renew_lease( + @distributed_trace_async + async def renew_lease( # pylint: disable=inconsistent-return-statements self, lease_id: str, timeout: Optional[int] = None, @@ -609,6 +622,15 @@ async def renew_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "renew". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -619,43 +641,37 @@ async def renew_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "renew" - restype = "share" - accept = "application/xml" - - # Construct URL - url = self.renew_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "renew") # type: str + restype = kwargs.pop('restype', "share") # type: str + + + request = build_renew_lease_request( + url=self._config.url, + comp=comp, + action=action, + restype=restype, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + sharesnapshot=sharesnapshot, + request_id_parameter=request_id_parameter, + template_url=self.renew_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -667,12 +683,15 @@ async def renew_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {'url': '/{shareName}'} # type: ignore + renew_lease.metadata = {'url': "{url}/{shareName}"} # type: ignore - async def break_lease( + + @distributed_trace_async + async def break_lease( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, break_period: Optional[int] = None, @@ -705,6 +724,15 @@ async def break_lease( :type sharesnapshot: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "break". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -715,50 +743,41 @@ async def break_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "break") # type: str + restype = kwargs.pop('restype', "share") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "lease" - action = "break" - restype = "share" - accept = "application/xml" - - # Construct URL - url = self.break_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if break_period is not None: - header_parameters['x-ms-lease-break-period'] = self._serialize.header("break_period", break_period, 'int') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_break_lease_request( + url=self._config.url, + comp=comp, + action=action, + restype=restype, + version=self._config.version, + timeout=timeout, + break_period=break_period, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + sharesnapshot=sharesnapshot, + template_url=self.break_lease.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -771,15 +790,18 @@ async def break_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {'url': '/{shareName}'} # type: ignore + break_lease.metadata = {'url': "{url}/{shareName}"} # type: ignore - async def create_snapshot( + + @distributed_trace_async + async def create_snapshot( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, **kwargs: Any ) -> None: """Creates a read-only snapshot of a share. @@ -790,7 +812,13 @@ async def create_snapshot( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "snapshot". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -801,38 +829,33 @@ async def create_snapshot( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "share" - comp = "snapshot" - accept = "application/xml" - - # Construct URL - url = self.create_snapshot.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "snapshot") # type: str + + + request = build_create_snapshot_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + template_url=self.create_snapshot.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -843,12 +866,15 @@ async def create_snapshot( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - create_snapshot.metadata = {'url': '/{shareName}'} # type: ignore + create_snapshot.metadata = {'url': "{url}/{shareName}"} # type: ignore - async def create_permission( + + @distributed_trace_async + async def create_permission( # pylint: disable=inconsistent-return-statements self, share_permission: "_models.SharePermission", timeout: Optional[int] = None, @@ -863,6 +889,12 @@ async def create_permission( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "filepermission". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -873,41 +905,36 @@ async def create_permission( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "share" - comp = "filepermission" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/xml" - - # Construct URL - url = self.create_permission.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share_permission, 'SharePermission') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "filepermission") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(share_permission, 'SharePermission') + + request = build_create_permission_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + json=_json, + timeout=timeout, + template_url=self.create_permission.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -916,11 +943,14 @@ async def create_permission( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key')) + if cls: return cls(pipeline_response, None, response_headers) - create_permission.metadata = {'url': '/{shareName}'} # type: ignore + create_permission.metadata = {'url': "{url}/{shareName}"} # type: ignore + + @distributed_trace_async async def get_permission( self, file_permission_key: str, @@ -936,6 +966,12 @@ async def get_permission( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "filepermission". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharePermission, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.SharePermission @@ -946,52 +982,52 @@ async def get_permission( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "share" - comp = "filepermission" - accept = "application/json" - - # Construct URL - url = self.get_permission.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "filepermission") # type: str + + + request = build_get_permission_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + file_permission_key=file_permission_key, + timeout=timeout, + template_url=self.get_permission.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('SharePermission', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_permission.metadata = {'url': '/{shareName}'} # type: ignore - async def set_properties( + get_permission.metadata = {'url': "{url}/{shareName}"} # type: ignore + + + @distributed_trace_async + async def set_properties( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, quota: Optional[int] = None, @@ -1015,6 +1051,12 @@ async def set_properties( :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1025,48 +1067,39 @@ async def set_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "properties") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.set_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if quota is not None: - header_parameters['x-ms-share-quota'] = self._serialize.header("quota", quota, 'int', minimum=1) - if access_tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("access_tier", access_tier, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if root_squash is not None: - header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_set_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + quota=quota, + access_tier=access_tier, + lease_id=_lease_id, + root_squash=root_squash, + template_url=self.set_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1076,15 +1109,18 @@ async def set_properties( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {'url': '/{shareName}'} # type: ignore + set_properties.metadata = {'url': "{url}/{shareName}"} # type: ignore - async def set_metadata( + + @distributed_trace_async + async def set_metadata( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, lease_access_conditions: Optional["_models.LeaseAccessConditions"] = None, **kwargs: Any ) -> None: @@ -1096,9 +1132,15 @@ async def set_metadata( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1109,44 +1151,37 @@ async def set_metadata( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "metadata") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - comp = "metadata" - accept = "application/xml" - - # Construct URL - url = self.set_metadata.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_set_metadata_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + lease_id=_lease_id, + template_url=self.set_metadata.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1156,11 +1191,14 @@ async def set_metadata( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {'url': '/{shareName}'} # type: ignore + set_metadata.metadata = {'url': "{url}/{shareName}"} # type: ignore + + @distributed_trace_async async def get_access_policy( self, timeout: Optional[int] = None, @@ -1176,6 +1214,12 @@ async def get_access_policy( :type timeout: int :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "acl". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier, or the result of cls(response) :rtype: list[~azure.storage.fileshare.models.SignedIdentifier] @@ -1186,42 +1230,36 @@ async def get_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "acl") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - comp = "acl" - accept = "application/xml" - - # Construct URL - url = self.get_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_get_access_policy_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + template_url=self.get_access_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1230,15 +1268,19 @@ async def get_access_policy( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[SignedIdentifier]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_access_policy.metadata = {'url': '/{shareName}'} # type: ignore - async def set_access_policy( + get_access_policy.metadata = {'url': "{url}/{shareName}"} # type: ignore + + + @distributed_trace_async + async def set_access_policy( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, share_acl: Optional[List["_models.SignedIdentifier"]] = None, @@ -1256,6 +1298,12 @@ async def set_access_policy( :type share_acl: list[~azure.storage.fileshare.models.SignedIdentifier] :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "acl". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1266,51 +1314,44 @@ async def set_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "acl") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - comp = "acl" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'wrapped': True}} + serialization_ctxt = {"xml": {'name': 'SignedIdentifiers', 'wrapped': True}} if share_acl is not None: - body_content = self._serialize.body(share_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) + _content = self._serialize.body(share_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _content = None + + request = build_set_access_policy_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + lease_id=_lease_id, + template_url=self.set_access_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1320,11 +1361,14 @@ async def set_access_policy( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_access_policy.metadata = {'url': '/{shareName}'} # type: ignore + set_access_policy.metadata = {'url': "{url}/{shareName}"} # type: ignore + + @distributed_trace_async async def get_statistics( self, timeout: Optional[int] = None, @@ -1340,6 +1384,12 @@ async def get_statistics( :type timeout: int :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "stats". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ShareStats, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.ShareStats @@ -1350,42 +1400,36 @@ async def get_statistics( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "stats") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - comp = "stats" - accept = "application/xml" - - # Construct URL - url = self.get_statistics.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_get_statistics_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + template_url=self.get_statistics.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1394,15 +1438,19 @@ async def get_statistics( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ShareStats', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_statistics.metadata = {'url': '/{shareName}'} # type: ignore - async def restore( + get_statistics.metadata = {'url': "{url}/{shareName}"} # type: ignore + + + @distributed_trace_async + async def restore( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, @@ -1424,6 +1472,12 @@ async def restore( :type deleted_share_name: str :param deleted_share_version: Specifies the version of the previously-deleted share. :type deleted_share_version: str + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "undelete". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1434,42 +1488,35 @@ async def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "share" - comp = "undelete" - accept = "application/xml" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if deleted_share_name is not None: - header_parameters['x-ms-deleted-share-name'] = self._serialize.header("deleted_share_name", deleted_share_name, 'str') - if deleted_share_version is not None: - header_parameters['x-ms-deleted-share-version'] = self._serialize.header("deleted_share_version", deleted_share_version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "undelete") # type: str + + + request = build_restore_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + deleted_share_name=deleted_share_name, + deleted_share_version=deleted_share_version, + template_url=self.restore.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1480,7 +1527,9 @@ async def restore( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - restore.metadata = {'url': '/{shareName}'} # type: ignore + restore.metadata = {'url': "{url}/{shareName}"} # type: ignore + diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py index 1c8b35163df6..7cdb2b6466a1 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py @@ -6,51 +6,36 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class CopyStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CopyStatusType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PENDING = "pending" SUCCESS = "success" ABORTED = "aborted" FAILED = "failed" -class DeleteSnapshotsOptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeleteSnapshotsOptionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INCLUDE = "include" INCLUDE_LEASED = "include-leased" -class FileRangeWriteType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FileRangeWriteType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UPDATE = "update" CLEAR = "clear" -class LeaseDurationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseDurationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """When a share is leased, specifies whether the lease is of infinite or fixed duration. """ INFINITE = "infinite" FIXED = "fixed" -class LeaseStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Lease state of the share. """ @@ -60,44 +45,44 @@ class LeaseStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BREAKING = "breaking" BROKEN = "broken" -class LeaseStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LeaseStatusType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current lease status of the share. """ LOCKED = "locked" UNLOCKED = "unlocked" -class ListFilesIncludeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListFilesIncludeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): TIMESTAMPS = "Timestamps" ETAG = "Etag" ATTRIBUTES = "Attributes" PERMISSION_KEY = "PermissionKey" -class ListSharesIncludeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ListSharesIncludeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SNAPSHOTS = "snapshots" METADATA = "metadata" DELETED = "deleted" -class PermissionCopyModeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PermissionCopyModeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SOURCE = "source" OVERRIDE = "override" -class ShareAccessTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareAccessTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): TRANSACTION_OPTIMIZED = "TransactionOptimized" HOT = "Hot" COOL = "Cool" -class ShareRootSquash(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ShareRootSquash(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NO_ROOT_SQUASH = "NoRootSquash" ROOT_SQUASH = "RootSquash" ALL_SQUASH = "AllSquash" -class StorageErrorCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageErrorCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Error codes returned by the service """ diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models.py index 46433c13b15e..87c248789b85 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models.py @@ -13,12 +13,12 @@ class AccessPolicy(msrest.serialization.Model): """An Access policy. - :param start: The date-time the policy is active. - :type start: str - :param expiry: The date-time the policy expires. - :type expiry: str - :param permission: The permissions for the ACL policy. - :type permission: str + :ivar start: The date-time the policy is active. + :vartype start: str + :ivar expiry: The date-time the policy expires. + :vartype expiry: str + :ivar permission: The permissions for the ACL policy. + :vartype permission: str """ _attribute_map = { @@ -31,6 +31,14 @@ def __init__( self, **kwargs ): + """ + :keyword start: The date-time the policy is active. + :paramtype start: str + :keyword expiry: The date-time the policy expires. + :paramtype expiry: str + :keyword permission: The permissions for the ACL policy. + :paramtype permission: str + """ super(AccessPolicy, self).__init__(**kwargs) self.start = kwargs.get('start', None) self.expiry = kwargs.get('expiry', None) @@ -42,10 +50,10 @@ class ClearRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start: Required. - :type start: long - :param end: Required. - :type end: long + :ivar start: Required. + :vartype start: long + :ivar end: Required. + :vartype end: long """ _validation = { @@ -65,6 +73,12 @@ def __init__( self, **kwargs ): + """ + :keyword start: Required. + :paramtype start: long + :keyword end: Required. + :paramtype end: long + """ super(ClearRange, self).__init__(**kwargs) self.start = kwargs['start'] self.end = kwargs['end'] @@ -73,29 +87,30 @@ def __init__( class CopyFileSmbInfo(msrest.serialization.Model): """Parameter group. - :param file_attributes: Specifies either the option to copy file attributes from a source + :ivar file_attributes: Specifies either the option to copy file attributes from a source file(source) to a target file or a list of attributes to set on a target file. - :type file_attributes: str - :param file_creation_time: Specifies either the option to copy file creation time from a source + :vartype file_attributes: str + :ivar file_creation_time: Specifies either the option to copy file creation time from a source file(source) to a target file or a time value in ISO 8601 format to set as creation time on a target file. - :type file_creation_time: str - :param file_last_write_time: Specifies either the option to copy file last write time from a + :vartype file_creation_time: str + :ivar file_last_write_time: Specifies either the option to copy file last write time from a source file(source) to a target file or a time value in ISO 8601 format to set as last write time on a target file. - :type file_last_write_time: str - :param file_permission_copy_mode: Specifies the option to copy file security descriptor from + :vartype file_last_write_time: str + :ivar file_permission_copy_mode: Specifies the option to copy file security descriptor from source file or to set it using the value which is defined by the header value of x-ms-file-permission or x-ms-file-permission-key. Possible values include: "source", "override". - :type file_permission_copy_mode: str or ~azure.storage.fileshare.models.PermissionCopyModeType - :param ignore_read_only: Specifies the option to overwrite the target file if it already exists + :vartype file_permission_copy_mode: str or + ~azure.storage.fileshare.models.PermissionCopyModeType + :ivar ignore_read_only: Specifies the option to overwrite the target file if it already exists and has read-only attribute set. - :type ignore_read_only: bool - :param set_archive_attribute: Specifies the option to set archive attribute on a target file. + :vartype ignore_read_only: bool + :ivar set_archive_attribute: Specifies the option to set archive attribute on a target file. True means archive attribute will be set on a target file despite attribute overrides or a source file state. - :type set_archive_attribute: bool + :vartype set_archive_attribute: bool """ _attribute_map = { @@ -111,6 +126,32 @@ def __init__( self, **kwargs ): + """ + :keyword file_attributes: Specifies either the option to copy file attributes from a source + file(source) to a target file or a list of attributes to set on a target file. + :paramtype file_attributes: str + :keyword file_creation_time: Specifies either the option to copy file creation time from a + source file(source) to a target file or a time value in ISO 8601 format to set as creation time + on a target file. + :paramtype file_creation_time: str + :keyword file_last_write_time: Specifies either the option to copy file last write time from a + source file(source) to a target file or a time value in ISO 8601 format to set as last write + time on a target file. + :paramtype file_last_write_time: str + :keyword file_permission_copy_mode: Specifies the option to copy file security descriptor from + source file or to set it using the value which is defined by the header value of + x-ms-file-permission or x-ms-file-permission-key. Possible values include: "source", + "override". + :paramtype file_permission_copy_mode: str or + ~azure.storage.fileshare.models.PermissionCopyModeType + :keyword ignore_read_only: Specifies the option to overwrite the target file if it already + exists and has read-only attribute set. + :paramtype ignore_read_only: bool + :keyword set_archive_attribute: Specifies the option to set archive attribute on a target file. + True means archive attribute will be set on a target file despite attribute overrides or a + source file state. + :paramtype set_archive_attribute: bool + """ super(CopyFileSmbInfo, self).__init__(**kwargs) self.file_attributes = kwargs.get('file_attributes', None) self.file_creation_time = kwargs.get('file_creation_time', None) @@ -125,24 +166,24 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. The origin domains that are permitted to make a request + :ivar allowed_origins: Required. The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS. - :type allowed_origins: str - :param allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + :vartype allowed_origins: str + :ivar allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated). - :type allowed_methods: str - :param allowed_headers: Required. The request headers that the origin domain may specify on the + :vartype allowed_methods: str + :ivar allowed_headers: Required. The request headers that the origin domain may specify on the CORS request. - :type allowed_headers: str - :param exposed_headers: Required. The response headers that may be sent in the response to the + :vartype allowed_headers: str + :ivar exposed_headers: Required. The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. - :type exposed_headers: str - :param max_age_in_seconds: Required. The maximum amount time that a browser should cache the + :vartype exposed_headers: str + :ivar max_age_in_seconds: Required. The maximum amount time that a browser should cache the preflight OPTIONS request. - :type max_age_in_seconds: int + :vartype max_age_in_seconds: int """ _validation = { @@ -165,6 +206,26 @@ def __init__( self, **kwargs ): + """ + :keyword allowed_origins: Required. The origin domains that are permitted to make a request + against the storage service via CORS. The origin domain is the domain from which the request + originates. Note that the origin must be an exact case-sensitive match with the origin that the + user age sends to the service. You can also use the wildcard character '*' to allow all origin + domains to make requests via CORS. + :paramtype allowed_origins: str + :keyword allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + use for a CORS request. (comma separated). + :paramtype allowed_methods: str + :keyword allowed_headers: Required. The request headers that the origin domain may specify on + the CORS request. + :paramtype allowed_headers: str + :keyword exposed_headers: Required. The response headers that may be sent in the response to + the CORS request and exposed by the browser to the request issuer. + :paramtype exposed_headers: str + :keyword max_age_in_seconds: Required. The maximum amount time that a browser should cache the + preflight OPTIONS request. + :paramtype max_age_in_seconds: int + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = kwargs['allowed_origins'] self.allowed_methods = kwargs['allowed_methods'] @@ -176,13 +237,13 @@ def __init__( class DestinationLeaseAccessConditions(msrest.serialization.Model): """Parameter group. - :param destination_lease_id: Required if the destination file has an active infinite lease. The + :ivar destination_lease_id: Required if the destination file has an active infinite lease. The lease ID specified for this header must match the lease ID of the destination file. If the request does not include the lease ID or it is not valid, the operation fails with status code 412 (Precondition Failed). If this header is specified and the destination file does not currently have an active lease, the operation will also fail with status code 412 (Precondition Failed). - :type destination_lease_id: str + :vartype destination_lease_id: str """ _attribute_map = { @@ -193,6 +254,15 @@ def __init__( self, **kwargs ): + """ + :keyword destination_lease_id: Required if the destination file has an active infinite lease. + The lease ID specified for this header must match the lease ID of the destination file. If the + request does not include the lease ID or it is not valid, the operation fails with status code + 412 (Precondition Failed). If this header is specified and the destination file does not + currently have an active lease, the operation will also fail with status code 412 (Precondition + Failed). + :paramtype destination_lease_id: str + """ super(DestinationLeaseAccessConditions, self).__init__(**kwargs) self.destination_lease_id = kwargs.get('destination_lease_id', None) @@ -202,16 +272,16 @@ class DirectoryItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param file_id: - :type file_id: str - :param properties: File properties. - :type properties: ~azure.storage.fileshare.models.FileProperty - :param attributes: - :type attributes: str - :param permission_key: - :type permission_key: str + :ivar name: Required. + :vartype name: str + :ivar file_id: + :vartype file_id: str + :ivar properties: File properties. + :vartype properties: ~azure.storage.fileshare.models.FileProperty + :ivar attributes: + :vartype attributes: str + :ivar permission_key: + :vartype permission_key: str """ _validation = { @@ -233,6 +303,18 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword file_id: + :paramtype file_id: str + :keyword properties: File properties. + :paramtype properties: ~azure.storage.fileshare.models.FileProperty + :keyword attributes: + :paramtype attributes: str + :keyword permission_key: + :paramtype permission_key: str + """ super(DirectoryItem, self).__init__(**kwargs) self.name = kwargs['name'] self.file_id = kwargs.get('file_id', None) @@ -244,20 +326,20 @@ def __init__( class FileHTTPHeaders(msrest.serialization.Model): """Parameter group. - :param file_content_type: Sets the MIME content type of the file. The default type is + :ivar file_content_type: Sets the MIME content type of the file. The default type is 'application/octet-stream'. - :type file_content_type: str - :param file_content_encoding: Specifies which content encodings have been applied to the file. - :type file_content_encoding: str - :param file_content_language: Specifies the natural languages used by this resource. - :type file_content_language: str - :param file_cache_control: Sets the file's cache control. The File service stores this value - but does not use or modify it. - :type file_cache_control: str - :param file_content_md5: Sets the file's MD5 hash. - :type file_content_md5: bytearray - :param file_content_disposition: Sets the file's Content-Disposition header. - :type file_content_disposition: str + :vartype file_content_type: str + :ivar file_content_encoding: Specifies which content encodings have been applied to the file. + :vartype file_content_encoding: str + :ivar file_content_language: Specifies the natural languages used by this resource. + :vartype file_content_language: str + :ivar file_cache_control: Sets the file's cache control. The File service stores this value but + does not use or modify it. + :vartype file_cache_control: str + :ivar file_content_md5: Sets the file's MD5 hash. + :vartype file_content_md5: bytearray + :ivar file_content_disposition: Sets the file's Content-Disposition header. + :vartype file_content_disposition: str """ _attribute_map = { @@ -273,6 +355,23 @@ def __init__( self, **kwargs ): + """ + :keyword file_content_type: Sets the MIME content type of the file. The default type is + 'application/octet-stream'. + :paramtype file_content_type: str + :keyword file_content_encoding: Specifies which content encodings have been applied to the + file. + :paramtype file_content_encoding: str + :keyword file_content_language: Specifies the natural languages used by this resource. + :paramtype file_content_language: str + :keyword file_cache_control: Sets the file's cache control. The File service stores this value + but does not use or modify it. + :paramtype file_cache_control: str + :keyword file_content_md5: Sets the file's MD5 hash. + :paramtype file_content_md5: bytearray + :keyword file_content_disposition: Sets the file's Content-Disposition header. + :paramtype file_content_disposition: str + """ super(FileHTTPHeaders, self).__init__(**kwargs) self.file_content_type = kwargs.get('file_content_type', None) self.file_content_encoding = kwargs.get('file_content_encoding', None) @@ -287,16 +386,16 @@ class FileItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param file_id: - :type file_id: str - :param properties: Required. File properties. - :type properties: ~azure.storage.fileshare.models.FileProperty - :param attributes: - :type attributes: str - :param permission_key: - :type permission_key: str + :ivar name: Required. + :vartype name: str + :ivar file_id: + :vartype file_id: str + :ivar properties: Required. File properties. + :vartype properties: ~azure.storage.fileshare.models.FileProperty + :ivar attributes: + :vartype attributes: str + :ivar permission_key: + :vartype permission_key: str """ _validation = { @@ -319,6 +418,18 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword file_id: + :paramtype file_id: str + :keyword properties: Required. File properties. + :paramtype properties: ~azure.storage.fileshare.models.FileProperty + :keyword attributes: + :paramtype attributes: str + :keyword permission_key: + :paramtype permission_key: str + """ super(FileItem, self).__init__(**kwargs) self.name = kwargs['name'] self.file_id = kwargs.get('file_id', None) @@ -332,23 +443,23 @@ class FileProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param content_length: Required. Content length of the file. This value may not be up-to-date + :ivar content_length: Required. Content length of the file. This value may not be up-to-date since an SMB client may have modified the file locally. The value of Content-Length may not reflect that fact until the handle is closed or the op-lock is broken. To retrieve current property values, call Get File Properties. - :type content_length: long - :param creation_time: - :type creation_time: ~datetime.datetime - :param last_access_time: - :type last_access_time: ~datetime.datetime - :param last_write_time: - :type last_write_time: ~datetime.datetime - :param change_time: - :type change_time: ~datetime.datetime - :param last_modified: - :type last_modified: ~datetime.datetime - :param etag: - :type etag: str + :vartype content_length: long + :ivar creation_time: + :vartype creation_time: ~datetime.datetime + :ivar last_access_time: + :vartype last_access_time: ~datetime.datetime + :ivar last_write_time: + :vartype last_write_time: ~datetime.datetime + :ivar change_time: + :vartype change_time: ~datetime.datetime + :ivar last_modified: + :vartype last_modified: ~datetime.datetime + :ivar etag: + :vartype etag: str """ _validation = { @@ -369,6 +480,25 @@ def __init__( self, **kwargs ): + """ + :keyword content_length: Required. Content length of the file. This value may not be up-to-date + since an SMB client may have modified the file locally. The value of Content-Length may not + reflect that fact until the handle is closed or the op-lock is broken. To retrieve current + property values, call Get File Properties. + :paramtype content_length: long + :keyword creation_time: + :paramtype creation_time: ~datetime.datetime + :keyword last_access_time: + :paramtype last_access_time: ~datetime.datetime + :keyword last_write_time: + :paramtype last_write_time: ~datetime.datetime + :keyword change_time: + :paramtype change_time: ~datetime.datetime + :keyword last_modified: + :paramtype last_modified: ~datetime.datetime + :keyword etag: + :paramtype etag: str + """ super(FileProperty, self).__init__(**kwargs) self.content_length = kwargs['content_length'] self.creation_time = kwargs.get('creation_time', None) @@ -384,10 +514,10 @@ class FileRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start: Required. Start of the range. - :type start: long - :param end: Required. End of the range. - :type end: long + :ivar start: Required. Start of the range. + :vartype start: long + :ivar end: Required. End of the range. + :vartype end: long """ _validation = { @@ -407,6 +537,12 @@ def __init__( self, **kwargs ): + """ + :keyword start: Required. Start of the range. + :paramtype start: long + :keyword end: Required. End of the range. + :paramtype end: long + """ super(FileRange, self).__init__(**kwargs) self.start = kwargs['start'] self.end = kwargs['end'] @@ -417,10 +553,10 @@ class FilesAndDirectoriesListSegment(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param directory_items: Required. - :type directory_items: list[~azure.storage.fileshare.models.DirectoryItem] - :param file_items: Required. - :type file_items: list[~azure.storage.fileshare.models.FileItem] + :ivar directory_items: Required. + :vartype directory_items: list[~azure.storage.fileshare.models.DirectoryItem] + :ivar file_items: Required. + :vartype file_items: list[~azure.storage.fileshare.models.FileItem] """ _validation = { @@ -440,6 +576,12 @@ def __init__( self, **kwargs ): + """ + :keyword directory_items: Required. + :paramtype directory_items: list[~azure.storage.fileshare.models.DirectoryItem] + :keyword file_items: Required. + :paramtype file_items: list[~azure.storage.fileshare.models.FileItem] + """ super(FilesAndDirectoriesListSegment, self).__init__(**kwargs) self.directory_items = kwargs['directory_items'] self.file_items = kwargs['file_items'] @@ -450,23 +592,23 @@ class HandleItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param handle_id: Required. XSMB service handle ID. - :type handle_id: str - :param path: Required. File or directory name including full path starting from share root. - :type path: str - :param file_id: Required. FileId uniquely identifies the file or directory. - :type file_id: str - :param parent_id: ParentId uniquely identifies the parent directory of the object. - :type parent_id: str - :param session_id: Required. SMB session ID in context of which the file handle was opened. - :type session_id: str - :param client_ip: Required. Client IP that opened the handle. - :type client_ip: str - :param open_time: Required. Time when the session that previously opened the handle has last + :ivar handle_id: Required. XSMB service handle ID. + :vartype handle_id: str + :ivar path: Required. File or directory name including full path starting from share root. + :vartype path: str + :ivar file_id: Required. FileId uniquely identifies the file or directory. + :vartype file_id: str + :ivar parent_id: ParentId uniquely identifies the parent directory of the object. + :vartype parent_id: str + :ivar session_id: Required. SMB session ID in context of which the file handle was opened. + :vartype session_id: str + :ivar client_ip: Required. Client IP that opened the handle. + :vartype client_ip: str + :ivar open_time: Required. Time when the session that previously opened the handle has last been reconnected. (UTC). - :type open_time: ~datetime.datetime - :param last_reconnect_time: Time handle was last connected to (UTC). - :type last_reconnect_time: ~datetime.datetime + :vartype open_time: ~datetime.datetime + :ivar last_reconnect_time: Time handle was last connected to (UTC). + :vartype last_reconnect_time: ~datetime.datetime """ _validation = { @@ -496,6 +638,25 @@ def __init__( self, **kwargs ): + """ + :keyword handle_id: Required. XSMB service handle ID. + :paramtype handle_id: str + :keyword path: Required. File or directory name including full path starting from share root. + :paramtype path: str + :keyword file_id: Required. FileId uniquely identifies the file or directory. + :paramtype file_id: str + :keyword parent_id: ParentId uniquely identifies the parent directory of the object. + :paramtype parent_id: str + :keyword session_id: Required. SMB session ID in context of which the file handle was opened. + :paramtype session_id: str + :keyword client_ip: Required. Client IP that opened the handle. + :paramtype client_ip: str + :keyword open_time: Required. Time when the session that previously opened the handle has last + been reconnected. (UTC). + :paramtype open_time: ~datetime.datetime + :keyword last_reconnect_time: Time handle was last connected to (UTC). + :paramtype last_reconnect_time: ~datetime.datetime + """ super(HandleItem, self).__init__(**kwargs) self.handle_id = kwargs['handle_id'] self.path = kwargs['path'] @@ -510,9 +671,9 @@ def __init__( class LeaseAccessConditions(msrest.serialization.Model): """Parameter group. - :param lease_id: If specified, the operation only succeeds if the resource's lease is active - and matches this ID. - :type lease_id: str + :ivar lease_id: If specified, the operation only succeeds if the resource's lease is active and + matches this ID. + :vartype lease_id: str """ _attribute_map = { @@ -523,6 +684,11 @@ def __init__( self, **kwargs ): + """ + :keyword lease_id: If specified, the operation only succeeds if the resource's lease is active + and matches this ID. + :paramtype lease_id: str + """ super(LeaseAccessConditions, self).__init__(**kwargs) self.lease_id = kwargs.get('lease_id', None) @@ -532,26 +698,26 @@ class ListFilesAndDirectoriesSegmentResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param share_name: Required. - :type share_name: str - :param share_snapshot: - :type share_snapshot: str - :param directory_path: Required. - :type directory_path: str - :param prefix: Required. - :type prefix: str - :param marker: - :type marker: str - :param max_results: - :type max_results: int - :param segment: Required. Abstract for entries that can be listed from Directory. - :type segment: ~azure.storage.fileshare.models.FilesAndDirectoriesListSegment - :param next_marker: Required. - :type next_marker: str - :param directory_id: - :type directory_id: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar share_name: Required. + :vartype share_name: str + :ivar share_snapshot: + :vartype share_snapshot: str + :ivar directory_path: Required. + :vartype directory_path: str + :ivar prefix: Required. + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: + :vartype max_results: int + :ivar segment: Required. Abstract for entries that can be listed from Directory. + :vartype segment: ~azure.storage.fileshare.models.FilesAndDirectoriesListSegment + :ivar next_marker: Required. + :vartype next_marker: str + :ivar directory_id: + :vartype directory_id: str """ _validation = { @@ -583,6 +749,28 @@ def __init__( self, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword share_name: Required. + :paramtype share_name: str + :keyword share_snapshot: + :paramtype share_snapshot: str + :keyword directory_path: Required. + :paramtype directory_path: str + :keyword prefix: Required. + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: + :paramtype max_results: int + :keyword segment: Required. Abstract for entries that can be listed from Directory. + :paramtype segment: ~azure.storage.fileshare.models.FilesAndDirectoriesListSegment + :keyword next_marker: Required. + :paramtype next_marker: str + :keyword directory_id: + :paramtype directory_id: str + """ super(ListFilesAndDirectoriesSegmentResponse, self).__init__(**kwargs) self.service_endpoint = kwargs['service_endpoint'] self.share_name = kwargs['share_name'] @@ -601,10 +789,10 @@ class ListHandlesResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param handle_list: - :type handle_list: list[~azure.storage.fileshare.models.HandleItem] - :param next_marker: Required. - :type next_marker: str + :ivar handle_list: + :vartype handle_list: list[~azure.storage.fileshare.models.HandleItem] + :ivar next_marker: Required. + :vartype next_marker: str """ _validation = { @@ -623,6 +811,12 @@ def __init__( self, **kwargs ): + """ + :keyword handle_list: + :paramtype handle_list: list[~azure.storage.fileshare.models.HandleItem] + :keyword next_marker: Required. + :paramtype next_marker: str + """ super(ListHandlesResponse, self).__init__(**kwargs) self.handle_list = kwargs.get('handle_list', None) self.next_marker = kwargs['next_marker'] @@ -633,18 +827,18 @@ class ListSharesResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param prefix: - :type prefix: str - :param marker: - :type marker: str - :param max_results: - :type max_results: int - :param share_items: - :type share_items: list[~azure.storage.fileshare.models.ShareItemInternal] - :param next_marker: Required. - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar prefix: + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: + :vartype max_results: int + :ivar share_items: + :vartype share_items: list[~azure.storage.fileshare.models.ShareItemInternal] + :ivar next_marker: Required. + :vartype next_marker: str """ _validation = { @@ -668,6 +862,20 @@ def __init__( self, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword prefix: + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: + :paramtype max_results: int + :keyword share_items: + :paramtype share_items: list[~azure.storage.fileshare.models.ShareItemInternal] + :keyword next_marker: Required. + :paramtype next_marker: str + """ super(ListSharesResponse, self).__init__(**kwargs) self.service_endpoint = kwargs['service_endpoint'] self.prefix = kwargs.get('prefix', None) @@ -682,15 +890,15 @@ class Metrics(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param version: Required. The version of Storage Analytics to configure. - :type version: str - :param enabled: Required. Indicates whether metrics are enabled for the File service. - :type enabled: bool - :param include_apis: Indicates whether metrics should generate summary statistics for called - API operations. - :type include_apis: bool - :param retention_policy: The retention policy. - :type retention_policy: ~azure.storage.fileshare.models.RetentionPolicy + :ivar version: Required. The version of Storage Analytics to configure. + :vartype version: str + :ivar enabled: Required. Indicates whether metrics are enabled for the File service. + :vartype enabled: bool + :ivar include_apis: Indicates whether metrics should generate summary statistics for called API + operations. + :vartype include_apis: bool + :ivar retention_policy: The retention policy. + :vartype retention_policy: ~azure.storage.fileshare.models.RetentionPolicy """ _validation = { @@ -709,6 +917,17 @@ def __init__( self, **kwargs ): + """ + :keyword version: Required. The version of Storage Analytics to configure. + :paramtype version: str + :keyword enabled: Required. Indicates whether metrics are enabled for the File service. + :paramtype enabled: bool + :keyword include_apis: Indicates whether metrics should generate summary statistics for called + API operations. + :paramtype include_apis: bool + :keyword retention_policy: The retention policy. + :paramtype retention_policy: ~azure.storage.fileshare.models.RetentionPolicy + """ super(Metrics, self).__init__(**kwargs) self.version = kwargs['version'] self.enabled = kwargs['enabled'] @@ -721,13 +940,13 @@ class RetentionPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Indicates whether a retention policy is enabled for the File service. + :ivar enabled: Required. Indicates whether a retention policy is enabled for the File service. If false, metrics data is retained, and the user is responsible for deleting it. - :type enabled: bool - :param days: Indicates the number of days that metrics data should be retained. All data older + :vartype enabled: bool + :ivar days: Indicates the number of days that metrics data should be retained. All data older than this value will be deleted. Metrics data is deleted on a best-effort basis after the retention period expires. - :type days: int + :vartype days: int """ _validation = { @@ -744,6 +963,15 @@ def __init__( self, **kwargs ): + """ + :keyword enabled: Required. Indicates whether a retention policy is enabled for the File + service. If false, metrics data is retained, and the user is responsible for deleting it. + :paramtype enabled: bool + :keyword days: Indicates the number of days that metrics data should be retained. All data + older than this value will be deleted. Metrics data is deleted on a best-effort basis after the + retention period expires. + :paramtype days: int + """ super(RetentionPolicy, self).__init__(**kwargs) self.enabled = kwargs['enabled'] self.days = kwargs.get('days', None) @@ -752,10 +980,10 @@ def __init__( class ShareFileRangeList(msrest.serialization.Model): """The list of file ranges. - :param ranges: - :type ranges: list[~azure.storage.fileshare.models.FileRange] - :param clear_ranges: - :type clear_ranges: list[~azure.storage.fileshare.models.ClearRange] + :ivar ranges: + :vartype ranges: list[~azure.storage.fileshare.models.FileRange] + :ivar clear_ranges: + :vartype clear_ranges: list[~azure.storage.fileshare.models.ClearRange] """ _attribute_map = { @@ -767,6 +995,12 @@ def __init__( self, **kwargs ): + """ + :keyword ranges: + :paramtype ranges: list[~azure.storage.fileshare.models.FileRange] + :keyword clear_ranges: + :paramtype clear_ranges: list[~azure.storage.fileshare.models.ClearRange] + """ super(ShareFileRangeList, self).__init__(**kwargs) self.ranges = kwargs.get('ranges', None) self.clear_ranges = kwargs.get('clear_ranges', None) @@ -777,18 +1011,18 @@ class ShareItemInternal(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param snapshot: - :type snapshot: str - :param deleted: - :type deleted: bool - :param version: - :type version: str - :param properties: Required. Properties of a share. - :type properties: ~azure.storage.fileshare.models.SharePropertiesInternal - :param metadata: Dictionary of :code:``. - :type metadata: dict[str, str] + :ivar name: Required. + :vartype name: str + :ivar snapshot: + :vartype snapshot: str + :ivar deleted: + :vartype deleted: bool + :ivar version: + :vartype version: str + :ivar properties: Required. Properties of a share. + :vartype properties: ~azure.storage.fileshare.models.SharePropertiesInternal + :ivar metadata: Dictionary of :code:``. + :vartype metadata: dict[str, str] """ _validation = { @@ -812,6 +1046,20 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword snapshot: + :paramtype snapshot: str + :keyword deleted: + :paramtype deleted: bool + :keyword version: + :paramtype version: str + :keyword properties: Required. Properties of a share. + :paramtype properties: ~azure.storage.fileshare.models.SharePropertiesInternal + :keyword metadata: Dictionary of :code:``. + :paramtype metadata: dict[str, str] + """ super(ShareItemInternal, self).__init__(**kwargs) self.name = kwargs['name'] self.snapshot = kwargs.get('snapshot', None) @@ -826,9 +1074,9 @@ class SharePermission(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param permission: Required. The permission in the Security Descriptor Definition Language + :ivar permission: Required. The permission in the Security Descriptor Definition Language (SDDL). - :type permission: str + :vartype permission: str """ _validation = { @@ -843,6 +1091,11 @@ def __init__( self, **kwargs ): + """ + :keyword permission: Required. The permission in the Security Descriptor Definition Language + (SDDL). + :paramtype permission: str + """ super(SharePermission, self).__init__(**kwargs) self.permission = kwargs['permission'] @@ -852,45 +1105,45 @@ class SharePropertiesInternal(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param last_modified: Required. - :type last_modified: ~datetime.datetime - :param etag: Required. - :type etag: str - :param quota: Required. - :type quota: int - :param provisioned_iops: - :type provisioned_iops: int - :param provisioned_ingress_m_bps: - :type provisioned_ingress_m_bps: int - :param provisioned_egress_m_bps: - :type provisioned_egress_m_bps: int - :param provisioned_bandwidth_mi_bps: - :type provisioned_bandwidth_mi_bps: int - :param next_allowed_quota_downgrade_time: - :type next_allowed_quota_downgrade_time: ~datetime.datetime - :param deleted_time: - :type deleted_time: ~datetime.datetime - :param remaining_retention_days: - :type remaining_retention_days: int - :param access_tier: - :type access_tier: str - :param access_tier_change_time: - :type access_tier_change_time: ~datetime.datetime - :param access_tier_transition_state: - :type access_tier_transition_state: str - :param lease_status: The current lease status of the share. Possible values include: "locked", + :ivar last_modified: Required. + :vartype last_modified: ~datetime.datetime + :ivar etag: Required. + :vartype etag: str + :ivar quota: Required. + :vartype quota: int + :ivar provisioned_iops: + :vartype provisioned_iops: int + :ivar provisioned_ingress_m_bps: + :vartype provisioned_ingress_m_bps: int + :ivar provisioned_egress_m_bps: + :vartype provisioned_egress_m_bps: int + :ivar provisioned_bandwidth_mi_bps: + :vartype provisioned_bandwidth_mi_bps: int + :ivar next_allowed_quota_downgrade_time: + :vartype next_allowed_quota_downgrade_time: ~datetime.datetime + :ivar deleted_time: + :vartype deleted_time: ~datetime.datetime + :ivar remaining_retention_days: + :vartype remaining_retention_days: int + :ivar access_tier: + :vartype access_tier: str + :ivar access_tier_change_time: + :vartype access_tier_change_time: ~datetime.datetime + :ivar access_tier_transition_state: + :vartype access_tier_transition_state: str + :ivar lease_status: The current lease status of the share. Possible values include: "locked", "unlocked". - :type lease_status: str or ~azure.storage.fileshare.models.LeaseStatusType - :param lease_state: Lease state of the share. Possible values include: "available", "leased", + :vartype lease_status: str or ~azure.storage.fileshare.models.LeaseStatusType + :ivar lease_state: Lease state of the share. Possible values include: "available", "leased", "expired", "breaking", "broken". - :type lease_state: str or ~azure.storage.fileshare.models.LeaseStateType - :param lease_duration: When a share is leased, specifies whether the lease is of infinite or + :vartype lease_state: str or ~azure.storage.fileshare.models.LeaseStateType + :ivar lease_duration: When a share is leased, specifies whether the lease is of infinite or fixed duration. Possible values include: "infinite", "fixed". - :type lease_duration: str or ~azure.storage.fileshare.models.LeaseDurationType - :param enabled_protocols: - :type enabled_protocols: str - :param root_squash: Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :vartype lease_duration: str or ~azure.storage.fileshare.models.LeaseDurationType + :ivar enabled_protocols: + :vartype enabled_protocols: str + :ivar root_squash: Possible values include: "NoRootSquash", "RootSquash", "AllSquash". + :vartype root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash """ _validation = { @@ -924,6 +1177,47 @@ def __init__( self, **kwargs ): + """ + :keyword last_modified: Required. + :paramtype last_modified: ~datetime.datetime + :keyword etag: Required. + :paramtype etag: str + :keyword quota: Required. + :paramtype quota: int + :keyword provisioned_iops: + :paramtype provisioned_iops: int + :keyword provisioned_ingress_m_bps: + :paramtype provisioned_ingress_m_bps: int + :keyword provisioned_egress_m_bps: + :paramtype provisioned_egress_m_bps: int + :keyword provisioned_bandwidth_mi_bps: + :paramtype provisioned_bandwidth_mi_bps: int + :keyword next_allowed_quota_downgrade_time: + :paramtype next_allowed_quota_downgrade_time: ~datetime.datetime + :keyword deleted_time: + :paramtype deleted_time: ~datetime.datetime + :keyword remaining_retention_days: + :paramtype remaining_retention_days: int + :keyword access_tier: + :paramtype access_tier: str + :keyword access_tier_change_time: + :paramtype access_tier_change_time: ~datetime.datetime + :keyword access_tier_transition_state: + :paramtype access_tier_transition_state: str + :keyword lease_status: The current lease status of the share. Possible values include: + "locked", "unlocked". + :paramtype lease_status: str or ~azure.storage.fileshare.models.LeaseStatusType + :keyword lease_state: Lease state of the share. Possible values include: "available", "leased", + "expired", "breaking", "broken". + :paramtype lease_state: str or ~azure.storage.fileshare.models.LeaseStateType + :keyword lease_duration: When a share is leased, specifies whether the lease is of infinite or + fixed duration. Possible values include: "infinite", "fixed". + :paramtype lease_duration: str or ~azure.storage.fileshare.models.LeaseDurationType + :keyword enabled_protocols: + :paramtype enabled_protocols: str + :keyword root_squash: Possible values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + """ super(SharePropertiesInternal, self).__init__(**kwargs) self.last_modified = kwargs['last_modified'] self.etag = kwargs['etag'] @@ -948,8 +1242,8 @@ def __init__( class ShareProtocolSettings(msrest.serialization.Model): """Protocol settings. - :param smb: Settings for SMB protocol. - :type smb: ~azure.storage.fileshare.models.ShareSmbSettings + :ivar smb: Settings for SMB protocol. + :vartype smb: ~azure.storage.fileshare.models.ShareSmbSettings """ _attribute_map = { @@ -963,6 +1257,10 @@ def __init__( self, **kwargs ): + """ + :keyword smb: Settings for SMB protocol. + :paramtype smb: ~azure.storage.fileshare.models.ShareSmbSettings + """ super(ShareProtocolSettings, self).__init__(**kwargs) self.smb = kwargs.get('smb', None) @@ -970,8 +1268,8 @@ def __init__( class ShareSmbSettings(msrest.serialization.Model): """Settings for SMB protocol. - :param multichannel: Settings for SMB Multichannel. - :type multichannel: ~azure.storage.fileshare.models.SmbMultichannel + :ivar multichannel: Settings for SMB Multichannel. + :vartype multichannel: ~azure.storage.fileshare.models.SmbMultichannel """ _attribute_map = { @@ -985,6 +1283,10 @@ def __init__( self, **kwargs ): + """ + :keyword multichannel: Settings for SMB Multichannel. + :paramtype multichannel: ~azure.storage.fileshare.models.SmbMultichannel + """ super(ShareSmbSettings, self).__init__(**kwargs) self.multichannel = kwargs.get('multichannel', None) @@ -994,9 +1296,9 @@ class ShareStats(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_usage_bytes: Required. The approximate size of the data stored in bytes. Note that + :ivar share_usage_bytes: Required. The approximate size of the data stored in bytes. Note that this value may not include all recently created or recently resized files. - :type share_usage_bytes: int + :vartype share_usage_bytes: int """ _validation = { @@ -1011,6 +1313,11 @@ def __init__( self, **kwargs ): + """ + :keyword share_usage_bytes: Required. The approximate size of the data stored in bytes. Note + that this value may not include all recently created or recently resized files. + :paramtype share_usage_bytes: int + """ super(ShareStats, self).__init__(**kwargs) self.share_usage_bytes = kwargs['share_usage_bytes'] @@ -1020,10 +1327,10 @@ class SignedIdentifier(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A unique id. - :type id: str - :param access_policy: The access policy. - :type access_policy: ~azure.storage.fileshare.models.AccessPolicy + :ivar id: Required. A unique id. + :vartype id: str + :ivar access_policy: The access policy. + :vartype access_policy: ~azure.storage.fileshare.models.AccessPolicy """ _validation = { @@ -1039,6 +1346,12 @@ def __init__( self, **kwargs ): + """ + :keyword id: Required. A unique id. + :paramtype id: str + :keyword access_policy: The access policy. + :paramtype access_policy: ~azure.storage.fileshare.models.AccessPolicy + """ super(SignedIdentifier, self).__init__(**kwargs) self.id = kwargs['id'] self.access_policy = kwargs.get('access_policy', None) @@ -1047,8 +1360,8 @@ def __init__( class SmbMultichannel(msrest.serialization.Model): """Settings for SMB multichannel. - :param enabled: If SMB multichannel is enabled. - :type enabled: bool + :ivar enabled: If SMB multichannel is enabled. + :vartype enabled: bool """ _attribute_map = { @@ -1062,6 +1375,10 @@ def __init__( self, **kwargs ): + """ + :keyword enabled: If SMB multichannel is enabled. + :paramtype enabled: bool + """ super(SmbMultichannel, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) @@ -1069,8 +1386,8 @@ def __init__( class SourceLeaseAccessConditions(msrest.serialization.Model): """Parameter group. - :param source_lease_id: Required if the source file has an active infinite lease. - :type source_lease_id: str + :ivar source_lease_id: Required if the source file has an active infinite lease. + :vartype source_lease_id: str """ _attribute_map = { @@ -1081,6 +1398,10 @@ def __init__( self, **kwargs ): + """ + :keyword source_lease_id: Required if the source file has an active infinite lease. + :paramtype source_lease_id: str + """ super(SourceLeaseAccessConditions, self).__init__(**kwargs) self.source_lease_id = kwargs.get('source_lease_id', None) @@ -1088,12 +1409,12 @@ def __init__( class SourceModifiedAccessConditions(msrest.serialization.Model): """Parameter group. - :param source_if_match_crc64: Specify the crc64 value to operate only on range with a matching + :ivar source_if_match_crc64: Specify the crc64 value to operate only on range with a matching crc64 checksum. - :type source_if_match_crc64: bytearray - :param source_if_none_match_crc64: Specify the crc64 value to operate only on range without a + :vartype source_if_match_crc64: bytearray + :ivar source_if_none_match_crc64: Specify the crc64 value to operate only on range without a matching crc64 checksum. - :type source_if_none_match_crc64: bytearray + :vartype source_if_none_match_crc64: bytearray """ _attribute_map = { @@ -1105,6 +1426,14 @@ def __init__( self, **kwargs ): + """ + :keyword source_if_match_crc64: Specify the crc64 value to operate only on range with a + matching crc64 checksum. + :paramtype source_if_match_crc64: bytearray + :keyword source_if_none_match_crc64: Specify the crc64 value to operate only on range without a + matching crc64 checksum. + :paramtype source_if_none_match_crc64: bytearray + """ super(SourceModifiedAccessConditions, self).__init__(**kwargs) self.source_if_match_crc64 = kwargs.get('source_if_match_crc64', None) self.source_if_none_match_crc64 = kwargs.get('source_if_none_match_crc64', None) @@ -1113,8 +1442,8 @@ def __init__( class StorageError(msrest.serialization.Model): """StorageError. - :param message: - :type message: str + :ivar message: + :vartype message: str """ _attribute_map = { @@ -1125,6 +1454,10 @@ def __init__( self, **kwargs ): + """ + :keyword message: + :paramtype message: str + """ super(StorageError, self).__init__(**kwargs) self.message = kwargs.get('message', None) @@ -1132,16 +1465,16 @@ def __init__( class StorageServiceProperties(msrest.serialization.Model): """Storage service properties. - :param hour_metrics: A summary of request statistics grouped by API in hourly aggregates for + :ivar hour_metrics: A summary of request statistics grouped by API in hourly aggregates for files. - :type hour_metrics: ~azure.storage.fileshare.models.Metrics - :param minute_metrics: A summary of request statistics grouped by API in minute aggregates for + :vartype hour_metrics: ~azure.storage.fileshare.models.Metrics + :ivar minute_metrics: A summary of request statistics grouped by API in minute aggregates for files. - :type minute_metrics: ~azure.storage.fileshare.models.Metrics - :param cors: The set of CORS rules. - :type cors: list[~azure.storage.fileshare.models.CorsRule] - :param protocol: Protocol settings. - :type protocol: ~azure.storage.fileshare.models.ShareProtocolSettings + :vartype minute_metrics: ~azure.storage.fileshare.models.Metrics + :ivar cors: The set of CORS rules. + :vartype cors: list[~azure.storage.fileshare.models.CorsRule] + :ivar protocol: Protocol settings. + :vartype protocol: ~azure.storage.fileshare.models.ShareProtocolSettings """ _attribute_map = { @@ -1155,6 +1488,18 @@ def __init__( self, **kwargs ): + """ + :keyword hour_metrics: A summary of request statistics grouped by API in hourly aggregates for + files. + :paramtype hour_metrics: ~azure.storage.fileshare.models.Metrics + :keyword minute_metrics: A summary of request statistics grouped by API in minute aggregates + for files. + :paramtype minute_metrics: ~azure.storage.fileshare.models.Metrics + :keyword cors: The set of CORS rules. + :paramtype cors: list[~azure.storage.fileshare.models.CorsRule] + :keyword protocol: Protocol settings. + :paramtype protocol: ~azure.storage.fileshare.models.ShareProtocolSettings + """ super(StorageServiceProperties, self).__init__(**kwargs) self.hour_metrics = kwargs.get('hour_metrics', None) self.minute_metrics = kwargs.get('minute_metrics', None) diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py index 1620eda83942..bac436dca0d2 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py @@ -18,12 +18,12 @@ class AccessPolicy(msrest.serialization.Model): """An Access policy. - :param start: The date-time the policy is active. - :type start: str - :param expiry: The date-time the policy expires. - :type expiry: str - :param permission: The permissions for the ACL policy. - :type permission: str + :ivar start: The date-time the policy is active. + :vartype start: str + :ivar expiry: The date-time the policy expires. + :vartype expiry: str + :ivar permission: The permissions for the ACL policy. + :vartype permission: str """ _attribute_map = { @@ -40,6 +40,14 @@ def __init__( permission: Optional[str] = None, **kwargs ): + """ + :keyword start: The date-time the policy is active. + :paramtype start: str + :keyword expiry: The date-time the policy expires. + :paramtype expiry: str + :keyword permission: The permissions for the ACL policy. + :paramtype permission: str + """ super(AccessPolicy, self).__init__(**kwargs) self.start = start self.expiry = expiry @@ -51,10 +59,10 @@ class ClearRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start: Required. - :type start: long - :param end: Required. - :type end: long + :ivar start: Required. + :vartype start: long + :ivar end: Required. + :vartype end: long """ _validation = { @@ -77,6 +85,12 @@ def __init__( end: int, **kwargs ): + """ + :keyword start: Required. + :paramtype start: long + :keyword end: Required. + :paramtype end: long + """ super(ClearRange, self).__init__(**kwargs) self.start = start self.end = end @@ -85,29 +99,30 @@ def __init__( class CopyFileSmbInfo(msrest.serialization.Model): """Parameter group. - :param file_attributes: Specifies either the option to copy file attributes from a source + :ivar file_attributes: Specifies either the option to copy file attributes from a source file(source) to a target file or a list of attributes to set on a target file. - :type file_attributes: str - :param file_creation_time: Specifies either the option to copy file creation time from a source + :vartype file_attributes: str + :ivar file_creation_time: Specifies either the option to copy file creation time from a source file(source) to a target file or a time value in ISO 8601 format to set as creation time on a target file. - :type file_creation_time: str - :param file_last_write_time: Specifies either the option to copy file last write time from a + :vartype file_creation_time: str + :ivar file_last_write_time: Specifies either the option to copy file last write time from a source file(source) to a target file or a time value in ISO 8601 format to set as last write time on a target file. - :type file_last_write_time: str - :param file_permission_copy_mode: Specifies the option to copy file security descriptor from + :vartype file_last_write_time: str + :ivar file_permission_copy_mode: Specifies the option to copy file security descriptor from source file or to set it using the value which is defined by the header value of x-ms-file-permission or x-ms-file-permission-key. Possible values include: "source", "override". - :type file_permission_copy_mode: str or ~azure.storage.fileshare.models.PermissionCopyModeType - :param ignore_read_only: Specifies the option to overwrite the target file if it already exists + :vartype file_permission_copy_mode: str or + ~azure.storage.fileshare.models.PermissionCopyModeType + :ivar ignore_read_only: Specifies the option to overwrite the target file if it already exists and has read-only attribute set. - :type ignore_read_only: bool - :param set_archive_attribute: Specifies the option to set archive attribute on a target file. + :vartype ignore_read_only: bool + :ivar set_archive_attribute: Specifies the option to set archive attribute on a target file. True means archive attribute will be set on a target file despite attribute overrides or a source file state. - :type set_archive_attribute: bool + :vartype set_archive_attribute: bool """ _attribute_map = { @@ -130,6 +145,32 @@ def __init__( set_archive_attribute: Optional[bool] = None, **kwargs ): + """ + :keyword file_attributes: Specifies either the option to copy file attributes from a source + file(source) to a target file or a list of attributes to set on a target file. + :paramtype file_attributes: str + :keyword file_creation_time: Specifies either the option to copy file creation time from a + source file(source) to a target file or a time value in ISO 8601 format to set as creation time + on a target file. + :paramtype file_creation_time: str + :keyword file_last_write_time: Specifies either the option to copy file last write time from a + source file(source) to a target file or a time value in ISO 8601 format to set as last write + time on a target file. + :paramtype file_last_write_time: str + :keyword file_permission_copy_mode: Specifies the option to copy file security descriptor from + source file or to set it using the value which is defined by the header value of + x-ms-file-permission or x-ms-file-permission-key. Possible values include: "source", + "override". + :paramtype file_permission_copy_mode: str or + ~azure.storage.fileshare.models.PermissionCopyModeType + :keyword ignore_read_only: Specifies the option to overwrite the target file if it already + exists and has read-only attribute set. + :paramtype ignore_read_only: bool + :keyword set_archive_attribute: Specifies the option to set archive attribute on a target file. + True means archive attribute will be set on a target file despite attribute overrides or a + source file state. + :paramtype set_archive_attribute: bool + """ super(CopyFileSmbInfo, self).__init__(**kwargs) self.file_attributes = file_attributes self.file_creation_time = file_creation_time @@ -144,24 +185,24 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. The origin domains that are permitted to make a request + :ivar allowed_origins: Required. The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS. - :type allowed_origins: str - :param allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + :vartype allowed_origins: str + :ivar allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated). - :type allowed_methods: str - :param allowed_headers: Required. The request headers that the origin domain may specify on the + :vartype allowed_methods: str + :ivar allowed_headers: Required. The request headers that the origin domain may specify on the CORS request. - :type allowed_headers: str - :param exposed_headers: Required. The response headers that may be sent in the response to the + :vartype allowed_headers: str + :ivar exposed_headers: Required. The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. - :type exposed_headers: str - :param max_age_in_seconds: Required. The maximum amount time that a browser should cache the + :vartype exposed_headers: str + :ivar max_age_in_seconds: Required. The maximum amount time that a browser should cache the preflight OPTIONS request. - :type max_age_in_seconds: int + :vartype max_age_in_seconds: int """ _validation = { @@ -190,6 +231,26 @@ def __init__( max_age_in_seconds: int, **kwargs ): + """ + :keyword allowed_origins: Required. The origin domains that are permitted to make a request + against the storage service via CORS. The origin domain is the domain from which the request + originates. Note that the origin must be an exact case-sensitive match with the origin that the + user age sends to the service. You can also use the wildcard character '*' to allow all origin + domains to make requests via CORS. + :paramtype allowed_origins: str + :keyword allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + use for a CORS request. (comma separated). + :paramtype allowed_methods: str + :keyword allowed_headers: Required. The request headers that the origin domain may specify on + the CORS request. + :paramtype allowed_headers: str + :keyword exposed_headers: Required. The response headers that may be sent in the response to + the CORS request and exposed by the browser to the request issuer. + :paramtype exposed_headers: str + :keyword max_age_in_seconds: Required. The maximum amount time that a browser should cache the + preflight OPTIONS request. + :paramtype max_age_in_seconds: int + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -201,13 +262,13 @@ def __init__( class DestinationLeaseAccessConditions(msrest.serialization.Model): """Parameter group. - :param destination_lease_id: Required if the destination file has an active infinite lease. The + :ivar destination_lease_id: Required if the destination file has an active infinite lease. The lease ID specified for this header must match the lease ID of the destination file. If the request does not include the lease ID or it is not valid, the operation fails with status code 412 (Precondition Failed). If this header is specified and the destination file does not currently have an active lease, the operation will also fail with status code 412 (Precondition Failed). - :type destination_lease_id: str + :vartype destination_lease_id: str """ _attribute_map = { @@ -220,6 +281,15 @@ def __init__( destination_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword destination_lease_id: Required if the destination file has an active infinite lease. + The lease ID specified for this header must match the lease ID of the destination file. If the + request does not include the lease ID or it is not valid, the operation fails with status code + 412 (Precondition Failed). If this header is specified and the destination file does not + currently have an active lease, the operation will also fail with status code 412 (Precondition + Failed). + :paramtype destination_lease_id: str + """ super(DestinationLeaseAccessConditions, self).__init__(**kwargs) self.destination_lease_id = destination_lease_id @@ -229,16 +299,16 @@ class DirectoryItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param file_id: - :type file_id: str - :param properties: File properties. - :type properties: ~azure.storage.fileshare.models.FileProperty - :param attributes: - :type attributes: str - :param permission_key: - :type permission_key: str + :ivar name: Required. + :vartype name: str + :ivar file_id: + :vartype file_id: str + :ivar properties: File properties. + :vartype properties: ~azure.storage.fileshare.models.FileProperty + :ivar attributes: + :vartype attributes: str + :ivar permission_key: + :vartype permission_key: str """ _validation = { @@ -266,6 +336,18 @@ def __init__( permission_key: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword file_id: + :paramtype file_id: str + :keyword properties: File properties. + :paramtype properties: ~azure.storage.fileshare.models.FileProperty + :keyword attributes: + :paramtype attributes: str + :keyword permission_key: + :paramtype permission_key: str + """ super(DirectoryItem, self).__init__(**kwargs) self.name = name self.file_id = file_id @@ -277,20 +359,20 @@ def __init__( class FileHTTPHeaders(msrest.serialization.Model): """Parameter group. - :param file_content_type: Sets the MIME content type of the file. The default type is + :ivar file_content_type: Sets the MIME content type of the file. The default type is 'application/octet-stream'. - :type file_content_type: str - :param file_content_encoding: Specifies which content encodings have been applied to the file. - :type file_content_encoding: str - :param file_content_language: Specifies the natural languages used by this resource. - :type file_content_language: str - :param file_cache_control: Sets the file's cache control. The File service stores this value - but does not use or modify it. - :type file_cache_control: str - :param file_content_md5: Sets the file's MD5 hash. - :type file_content_md5: bytearray - :param file_content_disposition: Sets the file's Content-Disposition header. - :type file_content_disposition: str + :vartype file_content_type: str + :ivar file_content_encoding: Specifies which content encodings have been applied to the file. + :vartype file_content_encoding: str + :ivar file_content_language: Specifies the natural languages used by this resource. + :vartype file_content_language: str + :ivar file_cache_control: Sets the file's cache control. The File service stores this value but + does not use or modify it. + :vartype file_cache_control: str + :ivar file_content_md5: Sets the file's MD5 hash. + :vartype file_content_md5: bytearray + :ivar file_content_disposition: Sets the file's Content-Disposition header. + :vartype file_content_disposition: str """ _attribute_map = { @@ -313,6 +395,23 @@ def __init__( file_content_disposition: Optional[str] = None, **kwargs ): + """ + :keyword file_content_type: Sets the MIME content type of the file. The default type is + 'application/octet-stream'. + :paramtype file_content_type: str + :keyword file_content_encoding: Specifies which content encodings have been applied to the + file. + :paramtype file_content_encoding: str + :keyword file_content_language: Specifies the natural languages used by this resource. + :paramtype file_content_language: str + :keyword file_cache_control: Sets the file's cache control. The File service stores this value + but does not use or modify it. + :paramtype file_cache_control: str + :keyword file_content_md5: Sets the file's MD5 hash. + :paramtype file_content_md5: bytearray + :keyword file_content_disposition: Sets the file's Content-Disposition header. + :paramtype file_content_disposition: str + """ super(FileHTTPHeaders, self).__init__(**kwargs) self.file_content_type = file_content_type self.file_content_encoding = file_content_encoding @@ -327,16 +426,16 @@ class FileItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param file_id: - :type file_id: str - :param properties: Required. File properties. - :type properties: ~azure.storage.fileshare.models.FileProperty - :param attributes: - :type attributes: str - :param permission_key: - :type permission_key: str + :ivar name: Required. + :vartype name: str + :ivar file_id: + :vartype file_id: str + :ivar properties: Required. File properties. + :vartype properties: ~azure.storage.fileshare.models.FileProperty + :ivar attributes: + :vartype attributes: str + :ivar permission_key: + :vartype permission_key: str """ _validation = { @@ -365,6 +464,18 @@ def __init__( permission_key: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword file_id: + :paramtype file_id: str + :keyword properties: Required. File properties. + :paramtype properties: ~azure.storage.fileshare.models.FileProperty + :keyword attributes: + :paramtype attributes: str + :keyword permission_key: + :paramtype permission_key: str + """ super(FileItem, self).__init__(**kwargs) self.name = name self.file_id = file_id @@ -378,23 +489,23 @@ class FileProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param content_length: Required. Content length of the file. This value may not be up-to-date + :ivar content_length: Required. Content length of the file. This value may not be up-to-date since an SMB client may have modified the file locally. The value of Content-Length may not reflect that fact until the handle is closed or the op-lock is broken. To retrieve current property values, call Get File Properties. - :type content_length: long - :param creation_time: - :type creation_time: ~datetime.datetime - :param last_access_time: - :type last_access_time: ~datetime.datetime - :param last_write_time: - :type last_write_time: ~datetime.datetime - :param change_time: - :type change_time: ~datetime.datetime - :param last_modified: - :type last_modified: ~datetime.datetime - :param etag: - :type etag: str + :vartype content_length: long + :ivar creation_time: + :vartype creation_time: ~datetime.datetime + :ivar last_access_time: + :vartype last_access_time: ~datetime.datetime + :ivar last_write_time: + :vartype last_write_time: ~datetime.datetime + :ivar change_time: + :vartype change_time: ~datetime.datetime + :ivar last_modified: + :vartype last_modified: ~datetime.datetime + :ivar etag: + :vartype etag: str """ _validation = { @@ -423,6 +534,25 @@ def __init__( etag: Optional[str] = None, **kwargs ): + """ + :keyword content_length: Required. Content length of the file. This value may not be up-to-date + since an SMB client may have modified the file locally. The value of Content-Length may not + reflect that fact until the handle is closed or the op-lock is broken. To retrieve current + property values, call Get File Properties. + :paramtype content_length: long + :keyword creation_time: + :paramtype creation_time: ~datetime.datetime + :keyword last_access_time: + :paramtype last_access_time: ~datetime.datetime + :keyword last_write_time: + :paramtype last_write_time: ~datetime.datetime + :keyword change_time: + :paramtype change_time: ~datetime.datetime + :keyword last_modified: + :paramtype last_modified: ~datetime.datetime + :keyword etag: + :paramtype etag: str + """ super(FileProperty, self).__init__(**kwargs) self.content_length = content_length self.creation_time = creation_time @@ -438,10 +568,10 @@ class FileRange(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start: Required. Start of the range. - :type start: long - :param end: Required. End of the range. - :type end: long + :ivar start: Required. Start of the range. + :vartype start: long + :ivar end: Required. End of the range. + :vartype end: long """ _validation = { @@ -464,6 +594,12 @@ def __init__( end: int, **kwargs ): + """ + :keyword start: Required. Start of the range. + :paramtype start: long + :keyword end: Required. End of the range. + :paramtype end: long + """ super(FileRange, self).__init__(**kwargs) self.start = start self.end = end @@ -474,10 +610,10 @@ class FilesAndDirectoriesListSegment(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param directory_items: Required. - :type directory_items: list[~azure.storage.fileshare.models.DirectoryItem] - :param file_items: Required. - :type file_items: list[~azure.storage.fileshare.models.FileItem] + :ivar directory_items: Required. + :vartype directory_items: list[~azure.storage.fileshare.models.DirectoryItem] + :ivar file_items: Required. + :vartype file_items: list[~azure.storage.fileshare.models.FileItem] """ _validation = { @@ -500,6 +636,12 @@ def __init__( file_items: List["FileItem"], **kwargs ): + """ + :keyword directory_items: Required. + :paramtype directory_items: list[~azure.storage.fileshare.models.DirectoryItem] + :keyword file_items: Required. + :paramtype file_items: list[~azure.storage.fileshare.models.FileItem] + """ super(FilesAndDirectoriesListSegment, self).__init__(**kwargs) self.directory_items = directory_items self.file_items = file_items @@ -510,23 +652,23 @@ class HandleItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param handle_id: Required. XSMB service handle ID. - :type handle_id: str - :param path: Required. File or directory name including full path starting from share root. - :type path: str - :param file_id: Required. FileId uniquely identifies the file or directory. - :type file_id: str - :param parent_id: ParentId uniquely identifies the parent directory of the object. - :type parent_id: str - :param session_id: Required. SMB session ID in context of which the file handle was opened. - :type session_id: str - :param client_ip: Required. Client IP that opened the handle. - :type client_ip: str - :param open_time: Required. Time when the session that previously opened the handle has last + :ivar handle_id: Required. XSMB service handle ID. + :vartype handle_id: str + :ivar path: Required. File or directory name including full path starting from share root. + :vartype path: str + :ivar file_id: Required. FileId uniquely identifies the file or directory. + :vartype file_id: str + :ivar parent_id: ParentId uniquely identifies the parent directory of the object. + :vartype parent_id: str + :ivar session_id: Required. SMB session ID in context of which the file handle was opened. + :vartype session_id: str + :ivar client_ip: Required. Client IP that opened the handle. + :vartype client_ip: str + :ivar open_time: Required. Time when the session that previously opened the handle has last been reconnected. (UTC). - :type open_time: ~datetime.datetime - :param last_reconnect_time: Time handle was last connected to (UTC). - :type last_reconnect_time: ~datetime.datetime + :vartype open_time: ~datetime.datetime + :ivar last_reconnect_time: Time handle was last connected to (UTC). + :vartype last_reconnect_time: ~datetime.datetime """ _validation = { @@ -565,6 +707,25 @@ def __init__( last_reconnect_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword handle_id: Required. XSMB service handle ID. + :paramtype handle_id: str + :keyword path: Required. File or directory name including full path starting from share root. + :paramtype path: str + :keyword file_id: Required. FileId uniquely identifies the file or directory. + :paramtype file_id: str + :keyword parent_id: ParentId uniquely identifies the parent directory of the object. + :paramtype parent_id: str + :keyword session_id: Required. SMB session ID in context of which the file handle was opened. + :paramtype session_id: str + :keyword client_ip: Required. Client IP that opened the handle. + :paramtype client_ip: str + :keyword open_time: Required. Time when the session that previously opened the handle has last + been reconnected. (UTC). + :paramtype open_time: ~datetime.datetime + :keyword last_reconnect_time: Time handle was last connected to (UTC). + :paramtype last_reconnect_time: ~datetime.datetime + """ super(HandleItem, self).__init__(**kwargs) self.handle_id = handle_id self.path = path @@ -579,9 +740,9 @@ def __init__( class LeaseAccessConditions(msrest.serialization.Model): """Parameter group. - :param lease_id: If specified, the operation only succeeds if the resource's lease is active - and matches this ID. - :type lease_id: str + :ivar lease_id: If specified, the operation only succeeds if the resource's lease is active and + matches this ID. + :vartype lease_id: str """ _attribute_map = { @@ -594,6 +755,11 @@ def __init__( lease_id: Optional[str] = None, **kwargs ): + """ + :keyword lease_id: If specified, the operation only succeeds if the resource's lease is active + and matches this ID. + :paramtype lease_id: str + """ super(LeaseAccessConditions, self).__init__(**kwargs) self.lease_id = lease_id @@ -603,26 +769,26 @@ class ListFilesAndDirectoriesSegmentResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param share_name: Required. - :type share_name: str - :param share_snapshot: - :type share_snapshot: str - :param directory_path: Required. - :type directory_path: str - :param prefix: Required. - :type prefix: str - :param marker: - :type marker: str - :param max_results: - :type max_results: int - :param segment: Required. Abstract for entries that can be listed from Directory. - :type segment: ~azure.storage.fileshare.models.FilesAndDirectoriesListSegment - :param next_marker: Required. - :type next_marker: str - :param directory_id: - :type directory_id: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar share_name: Required. + :vartype share_name: str + :ivar share_snapshot: + :vartype share_snapshot: str + :ivar directory_path: Required. + :vartype directory_path: str + :ivar prefix: Required. + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: + :vartype max_results: int + :ivar segment: Required. Abstract for entries that can be listed from Directory. + :vartype segment: ~azure.storage.fileshare.models.FilesAndDirectoriesListSegment + :ivar next_marker: Required. + :vartype next_marker: str + :ivar directory_id: + :vartype directory_id: str """ _validation = { @@ -665,6 +831,28 @@ def __init__( directory_id: Optional[str] = None, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword share_name: Required. + :paramtype share_name: str + :keyword share_snapshot: + :paramtype share_snapshot: str + :keyword directory_path: Required. + :paramtype directory_path: str + :keyword prefix: Required. + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: + :paramtype max_results: int + :keyword segment: Required. Abstract for entries that can be listed from Directory. + :paramtype segment: ~azure.storage.fileshare.models.FilesAndDirectoriesListSegment + :keyword next_marker: Required. + :paramtype next_marker: str + :keyword directory_id: + :paramtype directory_id: str + """ super(ListFilesAndDirectoriesSegmentResponse, self).__init__(**kwargs) self.service_endpoint = service_endpoint self.share_name = share_name @@ -683,10 +871,10 @@ class ListHandlesResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param handle_list: - :type handle_list: list[~azure.storage.fileshare.models.HandleItem] - :param next_marker: Required. - :type next_marker: str + :ivar handle_list: + :vartype handle_list: list[~azure.storage.fileshare.models.HandleItem] + :ivar next_marker: Required. + :vartype next_marker: str """ _validation = { @@ -708,6 +896,12 @@ def __init__( handle_list: Optional[List["HandleItem"]] = None, **kwargs ): + """ + :keyword handle_list: + :paramtype handle_list: list[~azure.storage.fileshare.models.HandleItem] + :keyword next_marker: Required. + :paramtype next_marker: str + """ super(ListHandlesResponse, self).__init__(**kwargs) self.handle_list = handle_list self.next_marker = next_marker @@ -718,18 +912,18 @@ class ListSharesResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param prefix: - :type prefix: str - :param marker: - :type marker: str - :param max_results: - :type max_results: int - :param share_items: - :type share_items: list[~azure.storage.fileshare.models.ShareItemInternal] - :param next_marker: Required. - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar prefix: + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: + :vartype max_results: int + :ivar share_items: + :vartype share_items: list[~azure.storage.fileshare.models.ShareItemInternal] + :ivar next_marker: Required. + :vartype next_marker: str """ _validation = { @@ -760,6 +954,20 @@ def __init__( share_items: Optional[List["ShareItemInternal"]] = None, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword prefix: + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: + :paramtype max_results: int + :keyword share_items: + :paramtype share_items: list[~azure.storage.fileshare.models.ShareItemInternal] + :keyword next_marker: Required. + :paramtype next_marker: str + """ super(ListSharesResponse, self).__init__(**kwargs) self.service_endpoint = service_endpoint self.prefix = prefix @@ -774,15 +982,15 @@ class Metrics(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param version: Required. The version of Storage Analytics to configure. - :type version: str - :param enabled: Required. Indicates whether metrics are enabled for the File service. - :type enabled: bool - :param include_apis: Indicates whether metrics should generate summary statistics for called - API operations. - :type include_apis: bool - :param retention_policy: The retention policy. - :type retention_policy: ~azure.storage.fileshare.models.RetentionPolicy + :ivar version: Required. The version of Storage Analytics to configure. + :vartype version: str + :ivar enabled: Required. Indicates whether metrics are enabled for the File service. + :vartype enabled: bool + :ivar include_apis: Indicates whether metrics should generate summary statistics for called API + operations. + :vartype include_apis: bool + :ivar retention_policy: The retention policy. + :vartype retention_policy: ~azure.storage.fileshare.models.RetentionPolicy """ _validation = { @@ -806,6 +1014,17 @@ def __init__( retention_policy: Optional["RetentionPolicy"] = None, **kwargs ): + """ + :keyword version: Required. The version of Storage Analytics to configure. + :paramtype version: str + :keyword enabled: Required. Indicates whether metrics are enabled for the File service. + :paramtype enabled: bool + :keyword include_apis: Indicates whether metrics should generate summary statistics for called + API operations. + :paramtype include_apis: bool + :keyword retention_policy: The retention policy. + :paramtype retention_policy: ~azure.storage.fileshare.models.RetentionPolicy + """ super(Metrics, self).__init__(**kwargs) self.version = version self.enabled = enabled @@ -818,13 +1037,13 @@ class RetentionPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Indicates whether a retention policy is enabled for the File service. + :ivar enabled: Required. Indicates whether a retention policy is enabled for the File service. If false, metrics data is retained, and the user is responsible for deleting it. - :type enabled: bool - :param days: Indicates the number of days that metrics data should be retained. All data older + :vartype enabled: bool + :ivar days: Indicates the number of days that metrics data should be retained. All data older than this value will be deleted. Metrics data is deleted on a best-effort basis after the retention period expires. - :type days: int + :vartype days: int """ _validation = { @@ -844,6 +1063,15 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Required. Indicates whether a retention policy is enabled for the File + service. If false, metrics data is retained, and the user is responsible for deleting it. + :paramtype enabled: bool + :keyword days: Indicates the number of days that metrics data should be retained. All data + older than this value will be deleted. Metrics data is deleted on a best-effort basis after the + retention period expires. + :paramtype days: int + """ super(RetentionPolicy, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -852,10 +1080,10 @@ def __init__( class ShareFileRangeList(msrest.serialization.Model): """The list of file ranges. - :param ranges: - :type ranges: list[~azure.storage.fileshare.models.FileRange] - :param clear_ranges: - :type clear_ranges: list[~azure.storage.fileshare.models.ClearRange] + :ivar ranges: + :vartype ranges: list[~azure.storage.fileshare.models.FileRange] + :ivar clear_ranges: + :vartype clear_ranges: list[~azure.storage.fileshare.models.ClearRange] """ _attribute_map = { @@ -870,6 +1098,12 @@ def __init__( clear_ranges: Optional[List["ClearRange"]] = None, **kwargs ): + """ + :keyword ranges: + :paramtype ranges: list[~azure.storage.fileshare.models.FileRange] + :keyword clear_ranges: + :paramtype clear_ranges: list[~azure.storage.fileshare.models.ClearRange] + """ super(ShareFileRangeList, self).__init__(**kwargs) self.ranges = ranges self.clear_ranges = clear_ranges @@ -880,18 +1114,18 @@ class ShareItemInternal(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. - :type name: str - :param snapshot: - :type snapshot: str - :param deleted: - :type deleted: bool - :param version: - :type version: str - :param properties: Required. Properties of a share. - :type properties: ~azure.storage.fileshare.models.SharePropertiesInternal - :param metadata: Dictionary of :code:``. - :type metadata: dict[str, str] + :ivar name: Required. + :vartype name: str + :ivar snapshot: + :vartype snapshot: str + :ivar deleted: + :vartype deleted: bool + :ivar version: + :vartype version: str + :ivar properties: Required. Properties of a share. + :vartype properties: ~azure.storage.fileshare.models.SharePropertiesInternal + :ivar metadata: Dictionary of :code:``. + :vartype metadata: dict[str, str] """ _validation = { @@ -922,6 +1156,20 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword snapshot: + :paramtype snapshot: str + :keyword deleted: + :paramtype deleted: bool + :keyword version: + :paramtype version: str + :keyword properties: Required. Properties of a share. + :paramtype properties: ~azure.storage.fileshare.models.SharePropertiesInternal + :keyword metadata: Dictionary of :code:``. + :paramtype metadata: dict[str, str] + """ super(ShareItemInternal, self).__init__(**kwargs) self.name = name self.snapshot = snapshot @@ -936,9 +1184,9 @@ class SharePermission(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param permission: Required. The permission in the Security Descriptor Definition Language + :ivar permission: Required. The permission in the Security Descriptor Definition Language (SDDL). - :type permission: str + :vartype permission: str """ _validation = { @@ -955,6 +1203,11 @@ def __init__( permission: str, **kwargs ): + """ + :keyword permission: Required. The permission in the Security Descriptor Definition Language + (SDDL). + :paramtype permission: str + """ super(SharePermission, self).__init__(**kwargs) self.permission = permission @@ -964,45 +1217,45 @@ class SharePropertiesInternal(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param last_modified: Required. - :type last_modified: ~datetime.datetime - :param etag: Required. - :type etag: str - :param quota: Required. - :type quota: int - :param provisioned_iops: - :type provisioned_iops: int - :param provisioned_ingress_m_bps: - :type provisioned_ingress_m_bps: int - :param provisioned_egress_m_bps: - :type provisioned_egress_m_bps: int - :param provisioned_bandwidth_mi_bps: - :type provisioned_bandwidth_mi_bps: int - :param next_allowed_quota_downgrade_time: - :type next_allowed_quota_downgrade_time: ~datetime.datetime - :param deleted_time: - :type deleted_time: ~datetime.datetime - :param remaining_retention_days: - :type remaining_retention_days: int - :param access_tier: - :type access_tier: str - :param access_tier_change_time: - :type access_tier_change_time: ~datetime.datetime - :param access_tier_transition_state: - :type access_tier_transition_state: str - :param lease_status: The current lease status of the share. Possible values include: "locked", + :ivar last_modified: Required. + :vartype last_modified: ~datetime.datetime + :ivar etag: Required. + :vartype etag: str + :ivar quota: Required. + :vartype quota: int + :ivar provisioned_iops: + :vartype provisioned_iops: int + :ivar provisioned_ingress_m_bps: + :vartype provisioned_ingress_m_bps: int + :ivar provisioned_egress_m_bps: + :vartype provisioned_egress_m_bps: int + :ivar provisioned_bandwidth_mi_bps: + :vartype provisioned_bandwidth_mi_bps: int + :ivar next_allowed_quota_downgrade_time: + :vartype next_allowed_quota_downgrade_time: ~datetime.datetime + :ivar deleted_time: + :vartype deleted_time: ~datetime.datetime + :ivar remaining_retention_days: + :vartype remaining_retention_days: int + :ivar access_tier: + :vartype access_tier: str + :ivar access_tier_change_time: + :vartype access_tier_change_time: ~datetime.datetime + :ivar access_tier_transition_state: + :vartype access_tier_transition_state: str + :ivar lease_status: The current lease status of the share. Possible values include: "locked", "unlocked". - :type lease_status: str or ~azure.storage.fileshare.models.LeaseStatusType - :param lease_state: Lease state of the share. Possible values include: "available", "leased", + :vartype lease_status: str or ~azure.storage.fileshare.models.LeaseStatusType + :ivar lease_state: Lease state of the share. Possible values include: "available", "leased", "expired", "breaking", "broken". - :type lease_state: str or ~azure.storage.fileshare.models.LeaseStateType - :param lease_duration: When a share is leased, specifies whether the lease is of infinite or + :vartype lease_state: str or ~azure.storage.fileshare.models.LeaseStateType + :ivar lease_duration: When a share is leased, specifies whether the lease is of infinite or fixed duration. Possible values include: "infinite", "fixed". - :type lease_duration: str or ~azure.storage.fileshare.models.LeaseDurationType - :param enabled_protocols: - :type enabled_protocols: str - :param root_squash: Possible values include: "NoRootSquash", "RootSquash", "AllSquash". - :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :vartype lease_duration: str or ~azure.storage.fileshare.models.LeaseDurationType + :ivar enabled_protocols: + :vartype enabled_protocols: str + :ivar root_squash: Possible values include: "NoRootSquash", "RootSquash", "AllSquash". + :vartype root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash """ _validation = { @@ -1055,6 +1308,47 @@ def __init__( root_squash: Optional[Union[str, "ShareRootSquash"]] = None, **kwargs ): + """ + :keyword last_modified: Required. + :paramtype last_modified: ~datetime.datetime + :keyword etag: Required. + :paramtype etag: str + :keyword quota: Required. + :paramtype quota: int + :keyword provisioned_iops: + :paramtype provisioned_iops: int + :keyword provisioned_ingress_m_bps: + :paramtype provisioned_ingress_m_bps: int + :keyword provisioned_egress_m_bps: + :paramtype provisioned_egress_m_bps: int + :keyword provisioned_bandwidth_mi_bps: + :paramtype provisioned_bandwidth_mi_bps: int + :keyword next_allowed_quota_downgrade_time: + :paramtype next_allowed_quota_downgrade_time: ~datetime.datetime + :keyword deleted_time: + :paramtype deleted_time: ~datetime.datetime + :keyword remaining_retention_days: + :paramtype remaining_retention_days: int + :keyword access_tier: + :paramtype access_tier: str + :keyword access_tier_change_time: + :paramtype access_tier_change_time: ~datetime.datetime + :keyword access_tier_transition_state: + :paramtype access_tier_transition_state: str + :keyword lease_status: The current lease status of the share. Possible values include: + "locked", "unlocked". + :paramtype lease_status: str or ~azure.storage.fileshare.models.LeaseStatusType + :keyword lease_state: Lease state of the share. Possible values include: "available", "leased", + "expired", "breaking", "broken". + :paramtype lease_state: str or ~azure.storage.fileshare.models.LeaseStateType + :keyword lease_duration: When a share is leased, specifies whether the lease is of infinite or + fixed duration. Possible values include: "infinite", "fixed". + :paramtype lease_duration: str or ~azure.storage.fileshare.models.LeaseDurationType + :keyword enabled_protocols: + :paramtype enabled_protocols: str + :keyword root_squash: Possible values include: "NoRootSquash", "RootSquash", "AllSquash". + :paramtype root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + """ super(SharePropertiesInternal, self).__init__(**kwargs) self.last_modified = last_modified self.etag = etag @@ -1079,8 +1373,8 @@ def __init__( class ShareProtocolSettings(msrest.serialization.Model): """Protocol settings. - :param smb: Settings for SMB protocol. - :type smb: ~azure.storage.fileshare.models.ShareSmbSettings + :ivar smb: Settings for SMB protocol. + :vartype smb: ~azure.storage.fileshare.models.ShareSmbSettings """ _attribute_map = { @@ -1096,6 +1390,10 @@ def __init__( smb: Optional["ShareSmbSettings"] = None, **kwargs ): + """ + :keyword smb: Settings for SMB protocol. + :paramtype smb: ~azure.storage.fileshare.models.ShareSmbSettings + """ super(ShareProtocolSettings, self).__init__(**kwargs) self.smb = smb @@ -1103,8 +1401,8 @@ def __init__( class ShareSmbSettings(msrest.serialization.Model): """Settings for SMB protocol. - :param multichannel: Settings for SMB Multichannel. - :type multichannel: ~azure.storage.fileshare.models.SmbMultichannel + :ivar multichannel: Settings for SMB Multichannel. + :vartype multichannel: ~azure.storage.fileshare.models.SmbMultichannel """ _attribute_map = { @@ -1120,6 +1418,10 @@ def __init__( multichannel: Optional["SmbMultichannel"] = None, **kwargs ): + """ + :keyword multichannel: Settings for SMB Multichannel. + :paramtype multichannel: ~azure.storage.fileshare.models.SmbMultichannel + """ super(ShareSmbSettings, self).__init__(**kwargs) self.multichannel = multichannel @@ -1129,9 +1431,9 @@ class ShareStats(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param share_usage_bytes: Required. The approximate size of the data stored in bytes. Note that + :ivar share_usage_bytes: Required. The approximate size of the data stored in bytes. Note that this value may not include all recently created or recently resized files. - :type share_usage_bytes: int + :vartype share_usage_bytes: int """ _validation = { @@ -1148,6 +1450,11 @@ def __init__( share_usage_bytes: int, **kwargs ): + """ + :keyword share_usage_bytes: Required. The approximate size of the data stored in bytes. Note + that this value may not include all recently created or recently resized files. + :paramtype share_usage_bytes: int + """ super(ShareStats, self).__init__(**kwargs) self.share_usage_bytes = share_usage_bytes @@ -1157,10 +1464,10 @@ class SignedIdentifier(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. A unique id. - :type id: str - :param access_policy: The access policy. - :type access_policy: ~azure.storage.fileshare.models.AccessPolicy + :ivar id: Required. A unique id. + :vartype id: str + :ivar access_policy: The access policy. + :vartype access_policy: ~azure.storage.fileshare.models.AccessPolicy """ _validation = { @@ -1179,6 +1486,12 @@ def __init__( access_policy: Optional["AccessPolicy"] = None, **kwargs ): + """ + :keyword id: Required. A unique id. + :paramtype id: str + :keyword access_policy: The access policy. + :paramtype access_policy: ~azure.storage.fileshare.models.AccessPolicy + """ super(SignedIdentifier, self).__init__(**kwargs) self.id = id self.access_policy = access_policy @@ -1187,8 +1500,8 @@ def __init__( class SmbMultichannel(msrest.serialization.Model): """Settings for SMB multichannel. - :param enabled: If SMB multichannel is enabled. - :type enabled: bool + :ivar enabled: If SMB multichannel is enabled. + :vartype enabled: bool """ _attribute_map = { @@ -1204,6 +1517,10 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: If SMB multichannel is enabled. + :paramtype enabled: bool + """ super(SmbMultichannel, self).__init__(**kwargs) self.enabled = enabled @@ -1211,8 +1528,8 @@ def __init__( class SourceLeaseAccessConditions(msrest.serialization.Model): """Parameter group. - :param source_lease_id: Required if the source file has an active infinite lease. - :type source_lease_id: str + :ivar source_lease_id: Required if the source file has an active infinite lease. + :vartype source_lease_id: str """ _attribute_map = { @@ -1225,6 +1542,10 @@ def __init__( source_lease_id: Optional[str] = None, **kwargs ): + """ + :keyword source_lease_id: Required if the source file has an active infinite lease. + :paramtype source_lease_id: str + """ super(SourceLeaseAccessConditions, self).__init__(**kwargs) self.source_lease_id = source_lease_id @@ -1232,12 +1553,12 @@ def __init__( class SourceModifiedAccessConditions(msrest.serialization.Model): """Parameter group. - :param source_if_match_crc64: Specify the crc64 value to operate only on range with a matching + :ivar source_if_match_crc64: Specify the crc64 value to operate only on range with a matching crc64 checksum. - :type source_if_match_crc64: bytearray - :param source_if_none_match_crc64: Specify the crc64 value to operate only on range without a + :vartype source_if_match_crc64: bytearray + :ivar source_if_none_match_crc64: Specify the crc64 value to operate only on range without a matching crc64 checksum. - :type source_if_none_match_crc64: bytearray + :vartype source_if_none_match_crc64: bytearray """ _attribute_map = { @@ -1252,6 +1573,14 @@ def __init__( source_if_none_match_crc64: Optional[bytearray] = None, **kwargs ): + """ + :keyword source_if_match_crc64: Specify the crc64 value to operate only on range with a + matching crc64 checksum. + :paramtype source_if_match_crc64: bytearray + :keyword source_if_none_match_crc64: Specify the crc64 value to operate only on range without a + matching crc64 checksum. + :paramtype source_if_none_match_crc64: bytearray + """ super(SourceModifiedAccessConditions, self).__init__(**kwargs) self.source_if_match_crc64 = source_if_match_crc64 self.source_if_none_match_crc64 = source_if_none_match_crc64 @@ -1260,8 +1589,8 @@ def __init__( class StorageError(msrest.serialization.Model): """StorageError. - :param message: - :type message: str + :ivar message: + :vartype message: str """ _attribute_map = { @@ -1274,6 +1603,10 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword message: + :paramtype message: str + """ super(StorageError, self).__init__(**kwargs) self.message = message @@ -1281,16 +1614,16 @@ def __init__( class StorageServiceProperties(msrest.serialization.Model): """Storage service properties. - :param hour_metrics: A summary of request statistics grouped by API in hourly aggregates for + :ivar hour_metrics: A summary of request statistics grouped by API in hourly aggregates for files. - :type hour_metrics: ~azure.storage.fileshare.models.Metrics - :param minute_metrics: A summary of request statistics grouped by API in minute aggregates for + :vartype hour_metrics: ~azure.storage.fileshare.models.Metrics + :ivar minute_metrics: A summary of request statistics grouped by API in minute aggregates for files. - :type minute_metrics: ~azure.storage.fileshare.models.Metrics - :param cors: The set of CORS rules. - :type cors: list[~azure.storage.fileshare.models.CorsRule] - :param protocol: Protocol settings. - :type protocol: ~azure.storage.fileshare.models.ShareProtocolSettings + :vartype minute_metrics: ~azure.storage.fileshare.models.Metrics + :ivar cors: The set of CORS rules. + :vartype cors: list[~azure.storage.fileshare.models.CorsRule] + :ivar protocol: Protocol settings. + :vartype protocol: ~azure.storage.fileshare.models.ShareProtocolSettings """ _attribute_map = { @@ -1309,6 +1642,18 @@ def __init__( protocol: Optional["ShareProtocolSettings"] = None, **kwargs ): + """ + :keyword hour_metrics: A summary of request statistics grouped by API in hourly aggregates for + files. + :paramtype hour_metrics: ~azure.storage.fileshare.models.Metrics + :keyword minute_metrics: A summary of request statistics grouped by API in minute aggregates + for files. + :paramtype minute_metrics: ~azure.storage.fileshare.models.Metrics + :keyword cors: The set of CORS rules. + :paramtype cors: list[~azure.storage.fileshare.models.CorsRule] + :keyword protocol: Protocol settings. + :paramtype protocol: ~azure.storage.fileshare.models.ShareProtocolSettings + """ super(StorageServiceProperties, self).__init__(**kwargs) self.hour_metrics = hour_metrics self.minute_metrics = minute_metrics diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py index d6f42d00b684..011e76856e1b 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,21 +7,484 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - + from typing import Any, Callable, Dict, List, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "directory") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + file_permission = kwargs.pop('file_permission', "inherit") # type: Optional[str] + file_permission_key = kwargs.pop('file_permission_key', None) # type: Optional[str] + file_attributes = kwargs.pop('file_attributes', "none") # type: str + file_creation_time = kwargs.pop('file_creation_time', "now") # type: str + file_last_write_time = kwargs.pop('file_last_write_time', "now") # type: str + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if file_permission is not None: + _header_parameters['x-ms-file-permission'] = _SERIALIZER.header("file_permission", file_permission, 'str') + if file_permission_key is not None: + _header_parameters['x-ms-file-permission-key'] = _SERIALIZER.header("file_permission_key", file_permission_key, 'str') + _header_parameters['x-ms-file-attributes'] = _SERIALIZER.header("file_attributes", file_attributes, 'str') + _header_parameters['x-ms-file-creation-time'] = _SERIALIZER.header("file_creation_time", file_creation_time, 'str') + _header_parameters['x-ms-file-last-write-time'] = _SERIALIZER.header("file_last_write_time", file_last_write_time, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "directory") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "directory") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "directory") # type: str + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + file_permission = kwargs.pop('file_permission', "inherit") # type: Optional[str] + file_permission_key = kwargs.pop('file_permission_key', None) # type: Optional[str] + file_attributes = kwargs.pop('file_attributes', "none") # type: str + file_creation_time = kwargs.pop('file_creation_time', "now") # type: str + file_last_write_time = kwargs.pop('file_last_write_time', "now") # type: str + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if file_permission is not None: + _header_parameters['x-ms-file-permission'] = _SERIALIZER.header("file_permission", file_permission, 'str') + if file_permission_key is not None: + _header_parameters['x-ms-file-permission-key'] = _SERIALIZER.header("file_permission_key", file_permission_key, 'str') + _header_parameters['x-ms-file-attributes'] = _SERIALIZER.header("file_attributes", file_attributes, 'str') + _header_parameters['x-ms-file-creation-time'] = _SERIALIZER.header("file_creation_time", file_creation_time, 'str') + _header_parameters['x-ms-file-last-write-time'] = _SERIALIZER.header("file_last_write_time", file_last_write_time, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_metadata_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "directory") # type: str + comp = kwargs.pop('comp', "metadata") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_files_and_directories_segment_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "directory") # type: str + comp = kwargs.pop('comp', "list") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + prefix = kwargs.pop('prefix', None) # type: Optional[str] + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + marker = kwargs.pop('marker', None) # type: Optional[str] + maxresults = kwargs.pop('maxresults', None) # type: Optional[int] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + include = kwargs.pop('include', None) # type: Optional[List[Union[str, "_models.ListFilesIncludeType"]]] + include_extended_info = kwargs.pop('include_extended_info', None) # type: Optional[bool] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if prefix is not None: + _query_parameters['prefix'] = _SERIALIZER.query("prefix", prefix, 'str') + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + if marker is not None: + _query_parameters['marker'] = _SERIALIZER.query("marker", marker, 'str') + if maxresults is not None: + _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', minimum=1) + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if include is not None: + _query_parameters['include'] = _SERIALIZER.query("include", include, '[str]', div=',') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if include_extended_info is not None: + _header_parameters['x-ms-file-extended-info'] = _SERIALIZER.header("include_extended_info", include_extended_info, 'bool') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_handles_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "listhandles") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + marker = kwargs.pop('marker', None) # type: Optional[str] + maxresults = kwargs.pop('maxresults', None) # type: Optional[int] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + recursive = kwargs.pop('recursive', None) # type: Optional[bool] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if marker is not None: + _query_parameters['marker'] = _SERIALIZER.query("marker", marker, 'str') + if maxresults is not None: + _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', minimum=1) + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if recursive is not None: + _header_parameters['x-ms-recursive'] = _SERIALIZER.header("recursive", recursive, 'bool') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_force_close_handles_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "forceclosehandles") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + handle_id = kwargs.pop('handle_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + marker = kwargs.pop('marker', None) # type: Optional[str] + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + recursive = kwargs.pop('recursive', None) # type: Optional[bool] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if marker is not None: + _query_parameters['marker'] = _SERIALIZER.query("marker", marker, 'str') + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-handle-id'] = _SERIALIZER.header("handle_id", handle_id, 'str') + if recursive is not None: + _header_parameters['x-ms-recursive'] = _SERIALIZER.header("recursive", recursive, 'bool') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_rename_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "directory") # type: str + comp = kwargs.pop('comp', "rename") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + rename_source = kwargs.pop('rename_source') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + replace_if_exists = kwargs.pop('replace_if_exists', None) # type: Optional[bool] + ignore_read_only = kwargs.pop('ignore_read_only', None) # type: Optional[bool] + source_lease_id = kwargs.pop('source_lease_id', None) # type: Optional[str] + destination_lease_id = kwargs.pop('destination_lease_id', None) # type: Optional[str] + file_attributes = kwargs.pop('file_attributes', None) # type: Optional[str] + file_creation_time = kwargs.pop('file_creation_time', None) # type: Optional[str] + file_last_write_time = kwargs.pop('file_last_write_time', None) # type: Optional[str] + file_permission = kwargs.pop('file_permission', "inherit") # type: Optional[str] + file_permission_key = kwargs.pop('file_permission_key', None) # type: Optional[str] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['x-ms-file-rename-source'] = _SERIALIZER.header("rename_source", rename_source, 'str') + if replace_if_exists is not None: + _header_parameters['x-ms-file-rename-replace-if-exists'] = _SERIALIZER.header("replace_if_exists", replace_if_exists, 'bool') + if ignore_read_only is not None: + _header_parameters['x-ms-file-rename-ignore-readonly'] = _SERIALIZER.header("ignore_read_only", ignore_read_only, 'bool') + if source_lease_id is not None: + _header_parameters['x-ms-source-lease-id'] = _SERIALIZER.header("source_lease_id", source_lease_id, 'str') + if destination_lease_id is not None: + _header_parameters['x-ms-destination-lease-id'] = _SERIALIZER.header("destination_lease_id", destination_lease_id, 'str') + if file_attributes is not None: + _header_parameters['x-ms-file-attributes'] = _SERIALIZER.header("file_attributes", file_attributes, 'str') + if file_creation_time is not None: + _header_parameters['x-ms-file-creation-time'] = _SERIALIZER.header("file_creation_time", file_creation_time, 'str') + if file_last_write_time is not None: + _header_parameters['x-ms-file-last-write-time'] = _SERIALIZER.header("file_last_write_time", file_last_write_time, 'str') + if file_permission is not None: + _header_parameters['x-ms-file-permission'] = _SERIALIZER.header("file_permission", file_permission, 'str') + if file_permission_key is not None: + _header_parameters['x-ms-file-permission-key'] = _SERIALIZER.header("file_permission_key", file_permission_key, 'str') + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class DirectoryOperations(object): """DirectoryOperations operations. @@ -43,10 +507,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def create( + @distributed_trace + def create( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] file_permission="inherit", # type: Optional[str] file_permission_key=None, # type: Optional[str] file_attributes="none", # type: str @@ -63,7 +528,7 @@ def create( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as @@ -80,6 +545,9 @@ def create( :type file_creation_time: str :param file_last_write_time: Last write time for the file/directory. Default value: Now. :type file_last_write_time: str + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -90,43 +558,36 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "directory" - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str') - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str') - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + restype = kwargs.pop('restype', "directory") # type: str + + + request = build_create_request( + url=self._config.url, + restype=restype, + version=self._config.version, + timeout=timeout, + metadata=metadata, + file_permission=file_permission, + file_permission_key=file_permission_key, + file_attributes=file_attributes, + file_creation_time=file_creation_time, + file_last_write_time=file_last_write_time, + template_url=self.create.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -144,12 +605,15 @@ def create( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + create.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore - def get_properties( + + @distributed_trace + def get_properties( # pylint: disable=inconsistent-return-statements self, sharesnapshot=None, # type: Optional[str] timeout=None, # type: Optional[int] @@ -168,6 +632,9 @@ def get_properties( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -178,40 +645,35 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "directory" - accept = "application/xml" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + restype = kwargs.pop('restype', "directory") # type: str + + + request = build_get_properties_request( + url=self._config.url, + restype=restype, + version=self._config.version, + sharesnapshot=sharesnapshot, + timeout=timeout, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) @@ -226,12 +688,15 @@ def get_properties( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + get_properties.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + - def delete( + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] **kwargs # type: Any @@ -245,6 +710,9 @@ def delete( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -255,34 +723,30 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "directory" - accept = "application/xml" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) + restype = kwargs.pop('restype', "directory") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_delete_request( + url=self._config.url, + restype=restype, + version=self._config.version, + timeout=timeout, + template_url=self.delete.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -290,12 +754,15 @@ def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + delete.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + - def set_properties( + @distributed_trace + def set_properties( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] file_permission="inherit", # type: Optional[str] @@ -329,6 +796,12 @@ def set_properties( :type file_creation_time: str :param file_last_write_time: Last write time for the file/directory. Default value: Now. :type file_last_write_time: str + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -339,43 +812,37 @@ def set_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "directory" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.set_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str') - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str') - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "directory") # type: str + comp = kwargs.pop('comp', "properties") # type: str + + + request = build_set_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + file_permission=file_permission, + file_permission_key=file_permission_key, + file_attributes=file_attributes, + file_creation_time=file_creation_time, + file_last_write_time=file_last_write_time, + template_url=self.set_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -393,15 +860,18 @@ def set_properties( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + set_properties.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + - def set_metadata( + @distributed_trace + def set_metadata( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] **kwargs # type: Any ): # type: (...) -> None @@ -413,7 +883,13 @@ def set_metadata( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -424,38 +900,33 @@ def set_metadata( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "directory" - comp = "metadata" - accept = "application/xml" - - # Construct URL - url = self.set_metadata.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "directory") # type: str + comp = kwargs.pop('comp', "metadata") # type: str + + + request = build_set_metadata_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + template_url=self.set_metadata.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -465,11 +936,14 @@ def set_metadata( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + set_metadata.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + + @distributed_trace def list_files_and_directories_segment( self, prefix=None, # type: Optional[str] @@ -510,6 +984,12 @@ def list_files_and_directories_segment( :type include: list[str or ~azure.storage.fileshare.models.ListFilesIncludeType] :param include_extended_info: Include extended information. :type include_extended_info: bool + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListFilesAndDirectoriesSegmentResponse, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.ListFilesAndDirectoriesSegmentResponse @@ -520,48 +1000,38 @@ def list_files_and_directories_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "directory" - comp = "list" - accept = "application/xml" - - # Construct URL - url = self.list_files_and_directories_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if include is not None: - query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if include_extended_info is not None: - header_parameters['x-ms-file-extended-info'] = self._serialize.header("include_extended_info", include_extended_info, 'bool') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "directory") # type: str + comp = kwargs.pop('comp', "list") # type: str + + + request = build_list_files_and_directories_segment_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + prefix=prefix, + sharesnapshot=sharesnapshot, + marker=marker, + maxresults=maxresults, + timeout=timeout, + include=include, + include_extended_info=include_extended_info, + template_url=self.list_files_and_directories_segment.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -569,14 +1039,18 @@ def list_files_and_directories_segment( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ListFilesAndDirectoriesSegmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_files_and_directories_segment.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + list_files_and_directories_segment.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + + + @distributed_trace def list_handles( self, marker=None, # type: Optional[str] @@ -609,6 +1083,9 @@ def list_handles( :param recursive: Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. :type recursive: bool + :keyword comp: comp. The default value is "listhandles". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListHandlesResponse, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.ListHandlesResponse @@ -619,42 +1096,34 @@ def list_handles( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "listhandles" - accept = "application/xml" - # Construct URL - url = self.list_handles.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if recursive is not None: - header_parameters['x-ms-recursive'] = self._serialize.header("recursive", recursive, 'bool') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "listhandles") # type: str + + + request = build_list_handles_request( + url=self._config.url, + comp=comp, + version=self._config.version, + marker=marker, + maxresults=maxresults, + timeout=timeout, + sharesnapshot=sharesnapshot, + recursive=recursive, + template_url=self.list_handles.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -662,15 +1131,19 @@ def list_handles( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ListHandlesResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_handles.metadata = {'url': '/{shareName}/{directory}'} # type: ignore - def force_close_handles( + list_handles.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + + + @distributed_trace + def force_close_handles( # pylint: disable=inconsistent-return-statements self, handle_id, # type: str timeout=None, # type: Optional[int] @@ -701,6 +1174,9 @@ def force_close_handles( :param recursive: Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. :type recursive: bool + :keyword comp: comp. The default value is "forceclosehandles". Note that overriding this + default value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -711,41 +1187,34 @@ def force_close_handles( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "forceclosehandles" - accept = "application/xml" - # Construct URL - url = self.force_close_handles.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-handle-id'] = self._serialize.header("handle_id", handle_id, 'str') - if recursive is not None: - header_parameters['x-ms-recursive'] = self._serialize.header("recursive", recursive, 'bool') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "forceclosehandles") # type: str + + + request = build_force_close_handles_request( + url=self._config.url, + comp=comp, + version=self._config.version, + handle_id=handle_id, + timeout=timeout, + marker=marker, + sharesnapshot=sharesnapshot, + recursive=recursive, + template_url=self.force_close_handles.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -756,12 +1225,15 @@ def force_close_handles( response_headers['x-ms-number-of-handles-closed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-closed')) response_headers['x-ms-number-of-handles-failed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-failed')) + if cls: return cls(pipeline_response, None, response_headers) - force_close_handles.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + force_close_handles.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + - def rename( + @distributed_trace + def rename( # pylint: disable=inconsistent-return-statements self, rename_source, # type: str timeout=None, # type: Optional[int] @@ -769,7 +1241,7 @@ def rename( ignore_read_only=None, # type: Optional[bool] file_permission="inherit", # type: Optional[str] file_permission_key=None, # type: Optional[str] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] source_lease_access_conditions=None, # type: Optional["_models.SourceLeaseAccessConditions"] destination_lease_access_conditions=None, # type: Optional["_models.DestinationLeaseAccessConditions"] copy_file_smb_info=None, # type: Optional["_models.CopyFileSmbInfo"] @@ -808,13 +1280,21 @@ def rename( one of the x-ms-file-permission or x-ms-file-permission-key should be specified. :type file_permission_key: str :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param source_lease_access_conditions: Parameter group. - :type source_lease_access_conditions: ~azure.storage.fileshare.models.SourceLeaseAccessConditions + :type source_lease_access_conditions: + ~azure.storage.fileshare.models.SourceLeaseAccessConditions :param destination_lease_access_conditions: Parameter group. - :type destination_lease_access_conditions: ~azure.storage.fileshare.models.DestinationLeaseAccessConditions + :type destination_lease_access_conditions: + ~azure.storage.fileshare.models.DestinationLeaseAccessConditions :param copy_file_smb_info: Parameter group. :type copy_file_smb_info: ~azure.storage.fileshare.models.CopyFileSmbInfo + :keyword restype: restype. The default value is "directory". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "rename". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -825,71 +1305,56 @@ def rename( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "directory") # type: str + comp = kwargs.pop('comp', "rename") # type: str + _source_lease_id = None _destination_lease_id = None _file_attributes = None _file_creation_time = None _file_last_write_time = None + if source_lease_access_conditions is not None: + _source_lease_id = source_lease_access_conditions.source_lease_id + if destination_lease_access_conditions is not None: + _destination_lease_id = destination_lease_access_conditions.destination_lease_id if copy_file_smb_info is not None: _file_attributes = copy_file_smb_info.file_attributes _file_creation_time = copy_file_smb_info.file_creation_time _file_last_write_time = copy_file_smb_info.file_last_write_time - if destination_lease_access_conditions is not None: - _destination_lease_id = destination_lease_access_conditions.destination_lease_id - if source_lease_access_conditions is not None: - _source_lease_id = source_lease_access_conditions.source_lease_id - restype = "directory" - comp = "rename" - accept = "application/xml" - - # Construct URL - url = self.rename.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['x-ms-file-rename-source'] = self._serialize.header("rename_source", rename_source, 'str') - if replace_if_exists is not None: - header_parameters['x-ms-file-rename-replace-if-exists'] = self._serialize.header("replace_if_exists", replace_if_exists, 'bool') - if ignore_read_only is not None: - header_parameters['x-ms-file-rename-ignore-readonly'] = self._serialize.header("ignore_read_only", ignore_read_only, 'bool') - if _source_lease_id is not None: - header_parameters['x-ms-source-lease-id'] = self._serialize.header("source_lease_id", _source_lease_id, 'str') - if _destination_lease_id is not None: - header_parameters['x-ms-destination-lease-id'] = self._serialize.header("destination_lease_id", _destination_lease_id, 'str') - if _file_attributes is not None: - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", _file_attributes, 'str') - if _file_creation_time is not None: - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", _file_creation_time, 'str') - if _file_last_write_time is not None: - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", _file_last_write_time, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_rename_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + rename_source=rename_source, + timeout=timeout, + replace_if_exists=replace_if_exists, + ignore_read_only=ignore_read_only, + source_lease_id=_source_lease_id, + destination_lease_id=_destination_lease_id, + file_attributes=_file_attributes, + file_creation_time=_file_creation_time, + file_last_write_time=_file_last_write_time, + file_permission=file_permission, + file_permission_key=file_permission_key, + metadata=metadata, + template_url=self.rename.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -907,7 +1372,9 @@ def rename( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - rename.metadata = {'url': '/{shareName}/{directory}'} # type: ignore + rename.metadata = {'url': "{url}/{shareName}/{directory}"} # type: ignore + diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py index e40dff165c0a..f7ff6f71066c 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,21 +7,979 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union - + from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2021-04-10") # type: str + file_type_constant = kwargs.pop('file_type_constant', "file") # type: str + file_content_length = kwargs.pop('file_content_length') # type: int + timeout = kwargs.pop('timeout', None) # type: Optional[int] + file_content_type = kwargs.pop('file_content_type', None) # type: Optional[str] + file_content_encoding = kwargs.pop('file_content_encoding', None) # type: Optional[str] + file_content_language = kwargs.pop('file_content_language', None) # type: Optional[str] + file_cache_control = kwargs.pop('file_cache_control', None) # type: Optional[str] + file_content_md5 = kwargs.pop('file_content_md5', None) # type: Optional[bytearray] + file_content_disposition = kwargs.pop('file_content_disposition', None) # type: Optional[str] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + file_permission = kwargs.pop('file_permission', "inherit") # type: Optional[str] + file_permission_key = kwargs.pop('file_permission_key', None) # type: Optional[str] + file_attributes = kwargs.pop('file_attributes', "none") # type: str + file_creation_time = kwargs.pop('file_creation_time', "now") # type: str + file_last_write_time = kwargs.pop('file_last_write_time', "now") # type: str + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['x-ms-content-length'] = _SERIALIZER.header("file_content_length", file_content_length, 'long') + _header_parameters['x-ms-type'] = _SERIALIZER.header("file_type_constant", file_type_constant, 'str') + if file_content_type is not None: + _header_parameters['x-ms-content-type'] = _SERIALIZER.header("file_content_type", file_content_type, 'str') + if file_content_encoding is not None: + _header_parameters['x-ms-content-encoding'] = _SERIALIZER.header("file_content_encoding", file_content_encoding, 'str') + if file_content_language is not None: + _header_parameters['x-ms-content-language'] = _SERIALIZER.header("file_content_language", file_content_language, 'str') + if file_cache_control is not None: + _header_parameters['x-ms-cache-control'] = _SERIALIZER.header("file_cache_control", file_cache_control, 'str') + if file_content_md5 is not None: + _header_parameters['x-ms-content-md5'] = _SERIALIZER.header("file_content_md5", file_content_md5, 'bytearray') + if file_content_disposition is not None: + _header_parameters['x-ms-content-disposition'] = _SERIALIZER.header("file_content_disposition", file_content_disposition, 'str') + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + if file_permission is not None: + _header_parameters['x-ms-file-permission'] = _SERIALIZER.header("file_permission", file_permission, 'str') + if file_permission_key is not None: + _header_parameters['x-ms-file-permission-key'] = _SERIALIZER.header("file_permission_key", file_permission_key, 'str') + _header_parameters['x-ms-file-attributes'] = _SERIALIZER.header("file_attributes", file_attributes, 'str') + _header_parameters['x-ms-file-creation-time'] = _SERIALIZER.header("file_creation_time", file_creation_time, 'str') + _header_parameters['x-ms-file-last-write-time'] = _SERIALIZER.header("file_last_write_time", file_last_write_time, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_download_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + range = kwargs.pop('range', None) # type: Optional[str] + range_get_content_md5 = kwargs.pop('range_get_content_md5', None) # type: Optional[bool] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if range is not None: + _header_parameters['x-ms-range'] = _SERIALIZER.header("range", range, 'str') + if range_get_content_md5 is not None: + _header_parameters['x-ms-range-get-content-md5'] = _SERIALIZER.header("range_get_content_md5", range_get_content_md5, 'bool') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2021-04-10") # type: str + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="HEAD", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_http_headers_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + file_content_length = kwargs.pop('file_content_length', None) # type: Optional[int] + file_content_type = kwargs.pop('file_content_type', None) # type: Optional[str] + file_content_encoding = kwargs.pop('file_content_encoding', None) # type: Optional[str] + file_content_language = kwargs.pop('file_content_language', None) # type: Optional[str] + file_cache_control = kwargs.pop('file_cache_control', None) # type: Optional[str] + file_content_md5 = kwargs.pop('file_content_md5', None) # type: Optional[bytearray] + file_content_disposition = kwargs.pop('file_content_disposition', None) # type: Optional[str] + file_permission = kwargs.pop('file_permission', "inherit") # type: Optional[str] + file_permission_key = kwargs.pop('file_permission_key', None) # type: Optional[str] + file_attributes = kwargs.pop('file_attributes', "none") # type: str + file_creation_time = kwargs.pop('file_creation_time', "now") # type: str + file_last_write_time = kwargs.pop('file_last_write_time', "now") # type: str + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if file_content_length is not None: + _header_parameters['x-ms-content-length'] = _SERIALIZER.header("file_content_length", file_content_length, 'long') + if file_content_type is not None: + _header_parameters['x-ms-content-type'] = _SERIALIZER.header("file_content_type", file_content_type, 'str') + if file_content_encoding is not None: + _header_parameters['x-ms-content-encoding'] = _SERIALIZER.header("file_content_encoding", file_content_encoding, 'str') + if file_content_language is not None: + _header_parameters['x-ms-content-language'] = _SERIALIZER.header("file_content_language", file_content_language, 'str') + if file_cache_control is not None: + _header_parameters['x-ms-cache-control'] = _SERIALIZER.header("file_cache_control", file_cache_control, 'str') + if file_content_md5 is not None: + _header_parameters['x-ms-content-md5'] = _SERIALIZER.header("file_content_md5", file_content_md5, 'bytearray') + if file_content_disposition is not None: + _header_parameters['x-ms-content-disposition'] = _SERIALIZER.header("file_content_disposition", file_content_disposition, 'str') + if file_permission is not None: + _header_parameters['x-ms-file-permission'] = _SERIALIZER.header("file_permission", file_permission, 'str') + if file_permission_key is not None: + _header_parameters['x-ms-file-permission-key'] = _SERIALIZER.header("file_permission_key", file_permission_key, 'str') + _header_parameters['x-ms-file-attributes'] = _SERIALIZER.header("file_attributes", file_attributes, 'str') + _header_parameters['x-ms-file-creation-time'] = _SERIALIZER.header("file_creation_time", file_creation_time, 'str') + _header_parameters['x-ms-file-last-write-time'] = _SERIALIZER.header("file_last_write_time", file_last_write_time, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_metadata_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "metadata") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_acquire_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "acquire") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + duration = kwargs.pop('duration', None) # type: Optional[int] + proposed_lease_id = kwargs.pop('proposed_lease_id', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + if duration is not None: + _header_parameters['x-ms-lease-duration'] = _SERIALIZER.header("duration", duration, 'int') + if proposed_lease_id is not None: + _header_parameters['x-ms-proposed-lease-id'] = _SERIALIZER.header("proposed_lease_id", proposed_lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_release_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "release") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + lease_id = kwargs.pop('lease_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_change_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "change") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + lease_id = kwargs.pop('lease_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + proposed_lease_id = kwargs.pop('proposed_lease_id', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if proposed_lease_id is not None: + _header_parameters['x-ms-proposed-lease-id'] = _SERIALIZER.header("proposed_lease_id", proposed_lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_break_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "break") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_upload_range_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "range") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + range = kwargs.pop('range') # type: str + content_length = kwargs.pop('content_length') # type: int + timeout = kwargs.pop('timeout', None) # type: Optional[int] + file_range_write = kwargs.pop('file_range_write', "update") # type: Union[str, "_models.FileRangeWriteType"] + content_md5 = kwargs.pop('content_md5', None) # type: Optional[bytearray] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-range'] = _SERIALIZER.header("range", range, 'str') + _header_parameters['x-ms-write'] = _SERIALIZER.header("file_range_write", file_range_write, 'str') + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + if content_md5 is not None: + _header_parameters['Content-MD5'] = _SERIALIZER.header("content_md5", content_md5, 'bytearray') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_upload_range_from_url_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "range") # type: str + file_range_write_from_url = kwargs.pop('file_range_write_from_url', "update") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + range = kwargs.pop('range') # type: str + copy_source = kwargs.pop('copy_source') # type: str + content_length = kwargs.pop('content_length') # type: int + timeout = kwargs.pop('timeout', None) # type: Optional[int] + source_range = kwargs.pop('source_range', None) # type: Optional[str] + source_content_crc64 = kwargs.pop('source_content_crc64', None) # type: Optional[bytearray] + source_if_match_crc64 = kwargs.pop('source_if_match_crc64', None) # type: Optional[bytearray] + source_if_none_match_crc64 = kwargs.pop('source_if_none_match_crc64', None) # type: Optional[bytearray] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + copy_source_authorization = kwargs.pop('copy_source_authorization', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-range'] = _SERIALIZER.header("range", range, 'str') + _header_parameters['x-ms-copy-source'] = _SERIALIZER.header("copy_source", copy_source, 'str') + if source_range is not None: + _header_parameters['x-ms-source-range'] = _SERIALIZER.header("source_range", source_range, 'str') + _header_parameters['x-ms-write'] = _SERIALIZER.header("file_range_write_from_url", file_range_write_from_url, 'str') + _header_parameters['Content-Length'] = _SERIALIZER.header("content_length", content_length, 'long') + if source_content_crc64 is not None: + _header_parameters['x-ms-source-content-crc64'] = _SERIALIZER.header("source_content_crc64", source_content_crc64, 'bytearray') + if source_if_match_crc64 is not None: + _header_parameters['x-ms-source-if-match-crc64'] = _SERIALIZER.header("source_if_match_crc64", source_if_match_crc64, 'bytearray') + if source_if_none_match_crc64 is not None: + _header_parameters['x-ms-source-if-none-match-crc64'] = _SERIALIZER.header("source_if_none_match_crc64", source_if_none_match_crc64, 'bytearray') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if copy_source_authorization is not None: + _header_parameters['x-ms-copy-source-authorization'] = _SERIALIZER.header("copy_source_authorization", copy_source_authorization, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_range_list_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "rangelist") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + prevsharesnapshot = kwargs.pop('prevsharesnapshot', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + range = kwargs.pop('range', None) # type: Optional[str] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + if prevsharesnapshot is not None: + _query_parameters['prevsharesnapshot'] = _SERIALIZER.query("prevsharesnapshot", prevsharesnapshot, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if range is not None: + _header_parameters['x-ms-range'] = _SERIALIZER.header("range", range, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_copy_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2021-04-10") # type: str + copy_source = kwargs.pop('copy_source') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + file_permission = kwargs.pop('file_permission', "inherit") # type: Optional[str] + file_permission_key = kwargs.pop('file_permission_key', None) # type: Optional[str] + file_permission_copy_mode = kwargs.pop('file_permission_copy_mode', None) # type: Optional[Union[str, "_models.PermissionCopyModeType"]] + ignore_read_only = kwargs.pop('ignore_read_only', None) # type: Optional[bool] + file_attributes = kwargs.pop('file_attributes', None) # type: Optional[str] + file_creation_time = kwargs.pop('file_creation_time', None) # type: Optional[str] + file_last_write_time = kwargs.pop('file_last_write_time', None) # type: Optional[str] + set_archive_attribute = kwargs.pop('set_archive_attribute', None) # type: Optional[bool] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + _header_parameters['x-ms-copy-source'] = _SERIALIZER.header("copy_source", copy_source, 'str') + if file_permission is not None: + _header_parameters['x-ms-file-permission'] = _SERIALIZER.header("file_permission", file_permission, 'str') + if file_permission_key is not None: + _header_parameters['x-ms-file-permission-key'] = _SERIALIZER.header("file_permission_key", file_permission_key, 'str') + if file_permission_copy_mode is not None: + _header_parameters['x-ms-file-permission-copy-mode'] = _SERIALIZER.header("file_permission_copy_mode", file_permission_copy_mode, 'str') + if ignore_read_only is not None: + _header_parameters['x-ms-file-copy-ignore-read-only'] = _SERIALIZER.header("ignore_read_only", ignore_read_only, 'bool') + if file_attributes is not None: + _header_parameters['x-ms-file-attributes'] = _SERIALIZER.header("file_attributes", file_attributes, 'str') + if file_creation_time is not None: + _header_parameters['x-ms-file-creation-time'] = _SERIALIZER.header("file_creation_time", file_creation_time, 'str') + if file_last_write_time is not None: + _header_parameters['x-ms-file-last-write-time'] = _SERIALIZER.header("file_last_write_time", file_last_write_time, 'str') + if set_archive_attribute is not None: + _header_parameters['x-ms-file-copy-set-archive'] = _SERIALIZER.header("set_archive_attribute", set_archive_attribute, 'bool') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_abort_copy_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "copy") # type: str + copy_action_abort_constant = kwargs.pop('copy_action_abort_constant', "abort") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + copy_id = kwargs.pop('copy_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['copyid'] = _SERIALIZER.query("copy_id", copy_id, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-copy-action'] = _SERIALIZER.header("copy_action_abort_constant", copy_action_abort_constant, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_handles_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "listhandles") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + marker = kwargs.pop('marker', None) # type: Optional[str] + maxresults = kwargs.pop('maxresults', None) # type: Optional[int] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if marker is not None: + _query_parameters['marker'] = _SERIALIZER.query("marker", marker, 'str') + if maxresults is not None: + _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', minimum=1) + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_force_close_handles_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "forceclosehandles") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + handle_id = kwargs.pop('handle_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + marker = kwargs.pop('marker', None) # type: Optional[str] + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if marker is not None: + _query_parameters['marker'] = _SERIALIZER.query("marker", marker, 'str') + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-handle-id'] = _SERIALIZER.header("handle_id", handle_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_rename_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "rename") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + rename_source = kwargs.pop('rename_source') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + replace_if_exists = kwargs.pop('replace_if_exists', None) # type: Optional[bool] + ignore_read_only = kwargs.pop('ignore_read_only', None) # type: Optional[bool] + source_lease_id = kwargs.pop('source_lease_id', None) # type: Optional[str] + destination_lease_id = kwargs.pop('destination_lease_id', None) # type: Optional[str] + file_attributes = kwargs.pop('file_attributes', None) # type: Optional[str] + file_creation_time = kwargs.pop('file_creation_time', None) # type: Optional[str] + file_last_write_time = kwargs.pop('file_last_write_time', None) # type: Optional[str] + file_permission = kwargs.pop('file_permission', "inherit") # type: Optional[str] + file_permission_key = kwargs.pop('file_permission_key', None) # type: Optional[str] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}/{directory}/{fileName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['x-ms-file-rename-source'] = _SERIALIZER.header("rename_source", rename_source, 'str') + if replace_if_exists is not None: + _header_parameters['x-ms-file-rename-replace-if-exists'] = _SERIALIZER.header("replace_if_exists", replace_if_exists, 'bool') + if ignore_read_only is not None: + _header_parameters['x-ms-file-rename-ignore-readonly'] = _SERIALIZER.header("ignore_read_only", ignore_read_only, 'bool') + if source_lease_id is not None: + _header_parameters['x-ms-source-lease-id'] = _SERIALIZER.header("source_lease_id", source_lease_id, 'str') + if destination_lease_id is not None: + _header_parameters['x-ms-destination-lease-id'] = _SERIALIZER.header("destination_lease_id", destination_lease_id, 'str') + if file_attributes is not None: + _header_parameters['x-ms-file-attributes'] = _SERIALIZER.header("file_attributes", file_attributes, 'str') + if file_creation_time is not None: + _header_parameters['x-ms-file-creation-time'] = _SERIALIZER.header("file_creation_time", file_creation_time, 'str') + if file_last_write_time is not None: + _header_parameters['x-ms-file-last-write-time'] = _SERIALIZER.header("file_last_write_time", file_last_write_time, 'str') + if file_permission is not None: + _header_parameters['x-ms-file-permission'] = _SERIALIZER.header("file_permission", file_permission, 'str') + if file_permission_key is not None: + _header_parameters['x-ms-file-permission-key'] = _SERIALIZER.header("file_permission_key", file_permission_key, 'str') + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class FileOperations(object): """FileOperations operations. @@ -43,11 +1002,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def create( + @distributed_trace + def create( # pylint: disable=inconsistent-return-statements self, file_content_length, # type: int timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] file_permission="inherit", # type: Optional[str] file_permission_key=None, # type: Optional[str] file_attributes="none", # type: str @@ -68,7 +1028,7 @@ def create( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as @@ -89,6 +1049,9 @@ def create( :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword file_type_constant: Dummy constant parameter, file type can only be file. The default + value is "file". Note that overriding this default value may result in unsupported behavior. + :paramtype file_type_constant: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -99,7 +1062,9 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + file_type_constant = kwargs.pop('file_type_constant', "file") # type: str + _file_content_type = None _file_content_encoding = None _file_content_language = None @@ -116,58 +1081,41 @@ def create( _file_content_disposition = file_http_headers.file_content_disposition if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - file_type_constant = "file" - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['x-ms-content-length'] = self._serialize.header("file_content_length", file_content_length, 'long') - header_parameters['x-ms-type'] = self._serialize.header("file_type_constant", file_type_constant, 'str') - if _file_content_type is not None: - header_parameters['x-ms-content-type'] = self._serialize.header("file_content_type", _file_content_type, 'str') - if _file_content_encoding is not None: - header_parameters['x-ms-content-encoding'] = self._serialize.header("file_content_encoding", _file_content_encoding, 'str') - if _file_content_language is not None: - header_parameters['x-ms-content-language'] = self._serialize.header("file_content_language", _file_content_language, 'str') - if _file_cache_control is not None: - header_parameters['x-ms-cache-control'] = self._serialize.header("file_cache_control", _file_cache_control, 'str') - if _file_content_md5 is not None: - header_parameters['x-ms-content-md5'] = self._serialize.header("file_content_md5", _file_content_md5, 'bytearray') - if _file_content_disposition is not None: - header_parameters['x-ms-content-disposition'] = self._serialize.header("file_content_disposition", _file_content_disposition, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str') - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str') - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_create_request( + url=self._config.url, + version=self._config.version, + file_type_constant=file_type_constant, + file_content_length=file_content_length, + timeout=timeout, + file_content_type=_file_content_type, + file_content_encoding=_file_content_encoding, + file_content_language=_file_content_language, + file_cache_control=_file_cache_control, + file_content_md5=_file_content_md5, + file_content_disposition=_file_content_disposition, + metadata=metadata, + file_permission=file_permission, + file_permission_key=file_permission_key, + file_attributes=file_attributes, + file_creation_time=file_creation_time, + file_last_write_time=file_last_write_time, + lease_id=_lease_id, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -185,11 +1133,14 @@ def create( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + create.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + + @distributed_trace def download( self, timeout=None, # type: Optional[int] @@ -224,48 +1175,39 @@ def download( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - accept = "application/xml" - # Construct URL - url = self.download.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if range_get_content_md5 is not None: - header_parameters['x-ms-range-get-content-md5'] = self._serialize.header("range_get_content_md5", range_get_content_md5, 'bool') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + request = build_download_request( + url=self._config.url, + version=self._config.version, + timeout=timeout, + range=range, + range_get_content_md5=range_get_content_md5, + lease_id=_lease_id, + template_url=self.download.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=True, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 206]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} if response.status_code == 200: response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range')) @@ -297,11 +1239,12 @@ def download( response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration')) response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state')) response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status')) + deserialized = response.stream_download(self._client._pipeline) if response.status_code == 206: response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) response_headers['Content-Range']=self._deserialize('str', response.headers.get('Content-Range')) @@ -333,15 +1276,19 @@ def download( response_headers['x-ms-lease-duration']=self._deserialize('str', response.headers.get('x-ms-lease-duration')) response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state')) response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status')) + deserialized = response.stream_download(self._client._pipeline) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - download.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore - def get_properties( + download.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + + + @distributed_trace + def get_properties( # pylint: disable=inconsistent-return-statements self, sharesnapshot=None, # type: Optional[str] timeout=None, # type: Optional[int] @@ -372,45 +1319,37 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - accept = "application/xml" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.head(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_properties_request( + url=self._config.url, + version=self._config.version, + sharesnapshot=sharesnapshot, + timeout=timeout, + lease_id=_lease_id, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['x-ms-type']=self._deserialize('str', response.headers.get('x-ms-type')) response_headers['Content-Length']=self._deserialize('long', response.headers.get('Content-Length')) response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) @@ -441,12 +1380,15 @@ def get_properties( response_headers['x-ms-lease-state']=self._deserialize('str', response.headers.get('x-ms-lease-state')) response_headers['x-ms-lease-status']=self._deserialize('str', response.headers.get('x-ms-lease-status')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + get_properties.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore - def delete( + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"] @@ -472,38 +1414,31 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - accept = "application/xml" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_delete_request( + url=self._config.url, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + template_url=self.delete.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -511,12 +1446,15 @@ def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + delete.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + - def set_http_headers( + @distributed_trace + def set_http_headers( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] file_content_length=None, # type: Optional[int] @@ -561,6 +1499,9 @@ def set_http_headers( :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -571,7 +1512,9 @@ def set_http_headers( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "properties") # type: str + _file_content_type = None _file_content_encoding = None _file_content_language = None @@ -588,57 +1531,40 @@ def set_http_headers( _file_content_disposition = file_http_headers.file_content_disposition if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "properties" - accept = "application/xml" - # Construct URL - url = self.set_http_headers.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if file_content_length is not None: - header_parameters['x-ms-content-length'] = self._serialize.header("file_content_length", file_content_length, 'long') - if _file_content_type is not None: - header_parameters['x-ms-content-type'] = self._serialize.header("file_content_type", _file_content_type, 'str') - if _file_content_encoding is not None: - header_parameters['x-ms-content-encoding'] = self._serialize.header("file_content_encoding", _file_content_encoding, 'str') - if _file_content_language is not None: - header_parameters['x-ms-content-language'] = self._serialize.header("file_content_language", _file_content_language, 'str') - if _file_cache_control is not None: - header_parameters['x-ms-cache-control'] = self._serialize.header("file_cache_control", _file_cache_control, 'str') - if _file_content_md5 is not None: - header_parameters['x-ms-content-md5'] = self._serialize.header("file_content_md5", _file_content_md5, 'bytearray') - if _file_content_disposition is not None: - header_parameters['x-ms-content-disposition'] = self._serialize.header("file_content_disposition", _file_content_disposition, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", file_attributes, 'str') - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", file_creation_time, 'str') - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", file_last_write_time, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_http_headers_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + file_content_length=file_content_length, + file_content_type=_file_content_type, + file_content_encoding=_file_content_encoding, + file_content_language=_file_content_language, + file_cache_control=_file_cache_control, + file_content_md5=_file_content_md5, + file_content_disposition=_file_content_disposition, + file_permission=file_permission, + file_permission_key=file_permission_key, + file_attributes=file_attributes, + file_creation_time=file_creation_time, + file_last_write_time=file_last_write_time, + lease_id=_lease_id, + template_url=self.set_http_headers.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -656,15 +1582,18 @@ def set_http_headers( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - set_http_headers.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + set_http_headers.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + - def set_metadata( + @distributed_trace + def set_metadata( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"] **kwargs # type: Any ): @@ -677,9 +1606,12 @@ def set_metadata( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -690,42 +1622,35 @@ def set_metadata( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "metadata") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "metadata" - accept = "application/xml" - # Construct URL - url = self.set_metadata.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_set_metadata_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + lease_id=_lease_id, + template_url=self.set_metadata.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -735,12 +1660,15 @@ def set_metadata( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + set_metadata.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore - def acquire_lease( + + @distributed_trace + def acquire_lease( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] duration=None, # type: Optional[int] @@ -768,6 +1696,12 @@ def acquire_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "acquire". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -778,42 +1712,35 @@ def acquire_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "acquire" - accept = "application/xml" - - # Construct URL - url = self.acquire_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if duration is not None: - header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "acquire") # type: str + + + request = build_acquire_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + timeout=timeout, + duration=duration, + proposed_lease_id=proposed_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.acquire_lease.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -825,12 +1752,15 @@ def acquire_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + acquire_lease.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore - def release_lease( + + @distributed_trace + def release_lease( # pylint: disable=inconsistent-return-statements self, lease_id, # type: str timeout=None, # type: Optional[int] @@ -851,6 +1781,12 @@ def release_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "release". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -861,39 +1797,34 @@ def release_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "release" - accept = "application/xml" - - # Construct URL - url = self.release_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "release") # type: str + + + request = build_release_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.release_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -904,12 +1835,15 @@ def release_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + release_lease.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + - def change_lease( + @distributed_trace + def change_lease( # pylint: disable=inconsistent-return-statements self, lease_id, # type: str timeout=None, # type: Optional[int] @@ -935,6 +1869,12 @@ def change_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "change". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -945,41 +1885,35 @@ def change_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "change" - accept = "application/xml" - - # Construct URL - url = self.change_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "change") # type: str + + + request = build_change_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + proposed_lease_id=proposed_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.change_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -991,12 +1925,15 @@ def change_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + change_lease.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + - def break_lease( + @distributed_trace + def break_lease( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -1017,6 +1954,12 @@ def break_lease( :type request_id_parameter: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "break". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1027,44 +1970,37 @@ def break_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "break") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "lease" - action = "break" - accept = "application/xml" - - # Construct URL - url = self.break_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_break_lease_request( + url=self._config.url, + comp=comp, + action=action, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + template_url=self.break_lease.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1076,12 +2012,15 @@ def break_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + break_lease.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + - def upload_range( + @distributed_trace + def upload_range( # pylint: disable=inconsistent-return-statements self, range, # type: str content_length, # type: int @@ -1124,6 +2063,9 @@ def upload_range( :type optionalbody: IO :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "range". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1134,49 +2076,42 @@ def upload_range( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "range") # type: str + content_type = kwargs.pop('content_type', "application/octet-stream") # type: Optional[str] + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "range" - content_type = kwargs.pop("content_type", "application/octet-stream") - accept = "application/xml" - - # Construct URL - url = self.upload_range.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - header_parameters['x-ms-write'] = self._serialize.header("file_range_write", file_range_write, 'str') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if content_md5 is not None: - header_parameters['Content-MD5'] = self._serialize.header("content_md5", content_md5, 'bytearray') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content_kwargs['stream_content'] = optionalbody - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _content = optionalbody + + request = build_upload_range_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + range=range, + content_length=content_length, + content=_content, + timeout=timeout, + file_range_write=file_range_write, + content_md5=content_md5, + lease_id=_lease_id, + template_url=self.upload_range.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1188,12 +2123,15 @@ def upload_range( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - upload_range.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + upload_range.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + - def upload_range_from_url( + @distributed_trace + def upload_range_from_url( # pylint: disable=inconsistent-return-statements self, range, # type: str copy_source, # type: str @@ -1236,9 +2174,13 @@ def upload_range_from_url( OAuth access token to copy source. :type copy_source_authorization: str :param source_modified_access_conditions: Parameter group. - :type source_modified_access_conditions: ~azure.storage.fileshare.models.SourceModifiedAccessConditions + :type source_modified_access_conditions: + ~azure.storage.fileshare.models.SourceModifiedAccessConditions :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "range". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1249,59 +2191,48 @@ def upload_range_from_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "range") # type: str + _source_if_match_crc64 = None _source_if_none_match_crc64 = None _lease_id = None - if lease_access_conditions is not None: - _lease_id = lease_access_conditions.lease_id if source_modified_access_conditions is not None: _source_if_match_crc64 = source_modified_access_conditions.source_if_match_crc64 _source_if_none_match_crc64 = source_modified_access_conditions.source_if_none_match_crc64 - comp = "range" - accept = "application/xml" + if lease_access_conditions is not None: + _lease_id = lease_access_conditions.lease_id - # Construct URL - url = self.upload_range_from_url.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') - if source_range is not None: - header_parameters['x-ms-source-range'] = self._serialize.header("source_range", source_range, 'str') - header_parameters['x-ms-write'] = self._serialize.header("self._config.file_range_write_from_url", self._config.file_range_write_from_url, 'str') - header_parameters['Content-Length'] = self._serialize.header("content_length", content_length, 'long') - if source_content_crc64 is not None: - header_parameters['x-ms-source-content-crc64'] = self._serialize.header("source_content_crc64", source_content_crc64, 'bytearray') - if _source_if_match_crc64 is not None: - header_parameters['x-ms-source-if-match-crc64'] = self._serialize.header("source_if_match_crc64", _source_if_match_crc64, 'bytearray') - if _source_if_none_match_crc64 is not None: - header_parameters['x-ms-source-if-none-match-crc64'] = self._serialize.header("source_if_none_match_crc64", _source_if_none_match_crc64, 'bytearray') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if copy_source_authorization is not None: - header_parameters['x-ms-copy-source-authorization'] = self._serialize.header("copy_source_authorization", copy_source_authorization, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_upload_range_from_url_request( + url=self._config.url, + comp=comp, + file_range_write_from_url=self._config.file_range_write_from_url, + version=self._config.version, + range=range, + copy_source=copy_source, + content_length=content_length, + timeout=timeout, + source_range=source_range, + source_content_crc64=source_content_crc64, + source_if_match_crc64=_source_if_match_crc64, + source_if_none_match_crc64=_source_if_none_match_crc64, + lease_id=_lease_id, + copy_source_authorization=copy_source_authorization, + template_url=self.upload_range_from_url.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1313,11 +2244,14 @@ def upload_range_from_url( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-request-server-encrypted']=self._deserialize('bool', response.headers.get('x-ms-request-server-encrypted')) + if cls: return cls(pipeline_response, None, response_headers) - upload_range_from_url.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + upload_range_from_url.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + + @distributed_trace def get_range_list( self, sharesnapshot=None, # type: Optional[str] @@ -1345,6 +2279,9 @@ def get_range_list( :type range: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "rangelist". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ShareFileRangeList, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.ShareFileRangeList @@ -1355,46 +2292,37 @@ def get_range_list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "rangelist") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "rangelist" - accept = "application/xml" - # Construct URL - url = self.get_range_list.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - if prevsharesnapshot is not None: - query_parameters['prevsharesnapshot'] = self._serialize.query("prevsharesnapshot", prevsharesnapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if range is not None: - header_parameters['x-ms-range'] = self._serialize.header("range", range, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_range_list_request( + url=self._config.url, + comp=comp, + version=self._config.version, + sharesnapshot=sharesnapshot, + prevsharesnapshot=prevsharesnapshot, + timeout=timeout, + range=range, + lease_id=_lease_id, + template_url=self.get_range_list.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1404,19 +2332,23 @@ def get_range_list( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ShareFileRangeList', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_range_list.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore - def start_copy( + get_range_list.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + + + @distributed_trace + def start_copy( # pylint: disable=inconsistent-return-statements self, copy_source, # type: str timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] file_permission="inherit", # type: Optional[str] file_permission_key=None, # type: Optional[str] copy_file_smb_info=None, # type: Optional["_models.CopyFileSmbInfo"] @@ -1440,7 +2372,7 @@ def start_copy( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as @@ -1464,7 +2396,7 @@ def start_copy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + _file_permission_copy_mode = None _ignore_read_only = None _file_attributes = None @@ -1481,53 +2413,37 @@ def start_copy( _set_archive_attribute = copy_file_smb_info.set_archive_attribute if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - accept = "application/xml" - # Construct URL - url = self.start_copy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-copy-source'] = self._serialize.header("copy_source", copy_source, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - if _file_permission_copy_mode is not None: - header_parameters['x-ms-file-permission-copy-mode'] = self._serialize.header("file_permission_copy_mode", _file_permission_copy_mode, 'str') - if _ignore_read_only is not None: - header_parameters['x-ms-file-copy-ignore-read-only'] = self._serialize.header("ignore_read_only", _ignore_read_only, 'bool') - if _file_attributes is not None: - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", _file_attributes, 'str') - if _file_creation_time is not None: - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", _file_creation_time, 'str') - if _file_last_write_time is not None: - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", _file_last_write_time, 'str') - if _set_archive_attribute is not None: - header_parameters['x-ms-file-copy-set-archive'] = self._serialize.header("set_archive_attribute", _set_archive_attribute, 'bool') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_start_copy_request( + url=self._config.url, + version=self._config.version, + copy_source=copy_source, + timeout=timeout, + metadata=metadata, + file_permission=file_permission, + file_permission_key=file_permission_key, + file_permission_copy_mode=_file_permission_copy_mode, + ignore_read_only=_ignore_read_only, + file_attributes=_file_attributes, + file_creation_time=_file_creation_time, + file_last_write_time=_file_last_write_time, + set_archive_attribute=_set_archive_attribute, + lease_id=_lease_id, + template_url=self.start_copy.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1539,12 +2455,15 @@ def start_copy( response_headers['x-ms-copy-id']=self._deserialize('str', response.headers.get('x-ms-copy-id')) response_headers['x-ms-copy-status']=self._deserialize('str', response.headers.get('x-ms-copy-status')) + if cls: return cls(pipeline_response, None, response_headers) - start_copy.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + start_copy.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore - def abort_copy( + + @distributed_trace + def abort_copy( # pylint: disable=inconsistent-return-statements self, copy_id, # type: str timeout=None, # type: Optional[int] @@ -1565,6 +2484,12 @@ def abort_copy( :type timeout: int :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "copy". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword copy_action_abort_constant: Abort. The default value is "abort". Note that overriding + this default value may result in unsupported behavior. + :paramtype copy_action_abort_constant: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1575,43 +2500,37 @@ def abort_copy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "copy") # type: str + copy_action_abort_constant = kwargs.pop('copy_action_abort_constant', "abort") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "copy" - copy_action_abort_constant = "abort" - accept = "application/xml" - - # Construct URL - url = self.abort_copy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['copyid'] = self._serialize.query("copy_id", copy_id, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-copy-action'] = self._serialize.header("copy_action_abort_constant", copy_action_abort_constant, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_abort_copy_request( + url=self._config.url, + comp=comp, + copy_action_abort_constant=copy_action_abort_constant, + version=self._config.version, + copy_id=copy_id, + timeout=timeout, + lease_id=_lease_id, + template_url=self.abort_copy.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1619,11 +2538,14 @@ def abort_copy( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - abort_copy.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + abort_copy.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + + @distributed_trace def list_handles( self, marker=None, # type: Optional[str] @@ -1652,6 +2574,9 @@ def list_handles( :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. :type sharesnapshot: str + :keyword comp: comp. The default value is "listhandles". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListHandlesResponse, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.ListHandlesResponse @@ -1662,40 +2587,33 @@ def list_handles( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "listhandles" - accept = "application/xml" - # Construct URL - url = self.list_handles.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "listhandles") # type: str + + + request = build_list_handles_request( + url=self._config.url, + comp=comp, + version=self._config.version, + marker=marker, + maxresults=maxresults, + timeout=timeout, + sharesnapshot=sharesnapshot, + template_url=self.list_handles.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1703,15 +2621,19 @@ def list_handles( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ListHandlesResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_handles.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore - def force_close_handles( + list_handles.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + + + @distributed_trace + def force_close_handles( # pylint: disable=inconsistent-return-statements self, handle_id, # type: str timeout=None, # type: Optional[int] @@ -1738,6 +2660,9 @@ def force_close_handles( :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. :type sharesnapshot: str + :keyword comp: comp. The default value is "forceclosehandles". Note that overriding this + default value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1748,39 +2673,33 @@ def force_close_handles( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "forceclosehandles" - accept = "application/xml" - # Construct URL - url = self.force_close_handles.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-handle-id'] = self._serialize.header("handle_id", handle_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "forceclosehandles") # type: str + + + request = build_force_close_handles_request( + url=self._config.url, + comp=comp, + version=self._config.version, + handle_id=handle_id, + timeout=timeout, + marker=marker, + sharesnapshot=sharesnapshot, + template_url=self.force_close_handles.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1791,12 +2710,15 @@ def force_close_handles( response_headers['x-ms-number-of-handles-closed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-closed')) response_headers['x-ms-number-of-handles-failed']=self._deserialize('int', response.headers.get('x-ms-number-of-handles-failed')) + if cls: return cls(pipeline_response, None, response_headers) - force_close_handles.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + force_close_handles.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore - def rename( + + @distributed_trace + def rename( # pylint: disable=inconsistent-return-statements self, rename_source, # type: str timeout=None, # type: Optional[int] @@ -1804,7 +2726,7 @@ def rename( ignore_read_only=None, # type: Optional[bool] file_permission="inherit", # type: Optional[str] file_permission_key=None, # type: Optional[str] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] source_lease_access_conditions=None, # type: Optional["_models.SourceLeaseAccessConditions"] destination_lease_access_conditions=None, # type: Optional["_models.DestinationLeaseAccessConditions"] copy_file_smb_info=None, # type: Optional["_models.CopyFileSmbInfo"] @@ -1843,13 +2765,18 @@ def rename( one of the x-ms-file-permission or x-ms-file-permission-key should be specified. :type file_permission_key: str :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param source_lease_access_conditions: Parameter group. - :type source_lease_access_conditions: ~azure.storage.fileshare.models.SourceLeaseAccessConditions + :type source_lease_access_conditions: + ~azure.storage.fileshare.models.SourceLeaseAccessConditions :param destination_lease_access_conditions: Parameter group. - :type destination_lease_access_conditions: ~azure.storage.fileshare.models.DestinationLeaseAccessConditions + :type destination_lease_access_conditions: + ~azure.storage.fileshare.models.DestinationLeaseAccessConditions :param copy_file_smb_info: Parameter group. :type copy_file_smb_info: ~azure.storage.fileshare.models.CopyFileSmbInfo + :keyword comp: comp. The default value is "rename". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1860,69 +2787,54 @@ def rename( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "rename") # type: str + _source_lease_id = None _destination_lease_id = None _file_attributes = None _file_creation_time = None _file_last_write_time = None + if source_lease_access_conditions is not None: + _source_lease_id = source_lease_access_conditions.source_lease_id + if destination_lease_access_conditions is not None: + _destination_lease_id = destination_lease_access_conditions.destination_lease_id if copy_file_smb_info is not None: _file_attributes = copy_file_smb_info.file_attributes _file_creation_time = copy_file_smb_info.file_creation_time _file_last_write_time = copy_file_smb_info.file_last_write_time - if destination_lease_access_conditions is not None: - _destination_lease_id = destination_lease_access_conditions.destination_lease_id - if source_lease_access_conditions is not None: - _source_lease_id = source_lease_access_conditions.source_lease_id - comp = "rename" - accept = "application/xml" - # Construct URL - url = self.rename.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['x-ms-file-rename-source'] = self._serialize.header("rename_source", rename_source, 'str') - if replace_if_exists is not None: - header_parameters['x-ms-file-rename-replace-if-exists'] = self._serialize.header("replace_if_exists", replace_if_exists, 'bool') - if ignore_read_only is not None: - header_parameters['x-ms-file-rename-ignore-readonly'] = self._serialize.header("ignore_read_only", ignore_read_only, 'bool') - if _source_lease_id is not None: - header_parameters['x-ms-source-lease-id'] = self._serialize.header("source_lease_id", _source_lease_id, 'str') - if _destination_lease_id is not None: - header_parameters['x-ms-destination-lease-id'] = self._serialize.header("destination_lease_id", _destination_lease_id, 'str') - if _file_attributes is not None: - header_parameters['x-ms-file-attributes'] = self._serialize.header("file_attributes", _file_attributes, 'str') - if _file_creation_time is not None: - header_parameters['x-ms-file-creation-time'] = self._serialize.header("file_creation_time", _file_creation_time, 'str') - if _file_last_write_time is not None: - header_parameters['x-ms-file-last-write-time'] = self._serialize.header("file_last_write_time", _file_last_write_time, 'str') - if file_permission is not None: - header_parameters['x-ms-file-permission'] = self._serialize.header("file_permission", file_permission, 'str') - if file_permission_key is not None: - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_rename_request( + url=self._config.url, + comp=comp, + version=self._config.version, + rename_source=rename_source, + timeout=timeout, + replace_if_exists=replace_if_exists, + ignore_read_only=ignore_read_only, + source_lease_id=_source_lease_id, + destination_lease_id=_destination_lease_id, + file_attributes=_file_attributes, + file_creation_time=_file_creation_time, + file_last_write_time=_file_last_write_time, + file_permission=file_permission, + file_permission_key=file_permission_key, + metadata=metadata, + template_url=self.rename.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1940,7 +2852,9 @@ def rename( response_headers['x-ms-file-id']=self._deserialize('str', response.headers.get('x-ms-file-id')) response_headers['x-ms-file-parent-id']=self._deserialize('str', response.headers.get('x-ms-file-parent-id')) + if cls: return cls(pipeline_response, None, response_headers) - rename.metadata = {'url': '/{shareName}/{directory}/{fileName}'} # type: ignore + rename.metadata = {'url': "{url}/{shareName}/{directory}/{fileName}"} # type: ignore + diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py index aaf67d303bd9..8b6c91ca74a7 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,21 +7,161 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - + from typing import Any, Callable, Dict, List, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_set_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_shares_segment_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "list") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + prefix = kwargs.pop('prefix', None) # type: Optional[str] + marker = kwargs.pop('marker', None) # type: Optional[str] + maxresults = kwargs.pop('maxresults', None) # type: Optional[int] + include = kwargs.pop('include', None) # type: Optional[List[Union[str, "_models.ListSharesIncludeType"]]] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if prefix is not None: + _query_parameters['prefix'] = _SERIALIZER.query("prefix", prefix, 'str') + if marker is not None: + _query_parameters['marker'] = _SERIALIZER.query("marker", marker, 'str') + if maxresults is not None: + _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', minimum=1) + if include is not None: + _query_parameters['include'] = _SERIALIZER.query("include", include, '[str]', div=',') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class ServiceOperations(object): """ServiceOperations operations. @@ -43,7 +184,8 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def set_properties( + @distributed_trace + def set_properties( # pylint: disable=inconsistent-return-statements self, storage_service_properties, # type: "_models.StorageServiceProperties" timeout=None, # type: Optional[int] @@ -60,6 +202,12 @@ def set_properties( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -70,52 +218,50 @@ def set_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "properties" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + + _content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True) + + request = build_set_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + template_url=self.set_properties.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {'url': '/'} # type: ignore + set_properties.metadata = {'url': "{url}/"} # type: ignore + + @distributed_trace def get_properties( self, timeout=None, # type: Optional[int] @@ -130,6 +276,12 @@ def get_properties( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.StorageServiceProperties @@ -140,49 +292,49 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + + + request = build_get_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('StorageServiceProperties', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_properties.metadata = {'url': '/'} # type: ignore + get_properties.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace def list_shares_segment( self, prefix=None, # type: Optional[str] @@ -216,6 +368,9 @@ def list_shares_segment( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword comp: comp. The default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListSharesResponse, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.ListSharesResponse @@ -226,51 +381,46 @@ def list_shares_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "list" - accept = "application/xml" - # Construct URL - url = self.list_shares_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if include is not None: - query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "list") # type: str + + + request = build_list_shares_segment_request( + url=self._config.url, + comp=comp, + version=self._config.version, + prefix=prefix, + marker=marker, + maxresults=maxresults, + include=include, + timeout=timeout, + template_url=self.list_shares_segment.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('ListSharesResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_shares_segment.metadata = {'url': '/'} # type: ignore + + list_shares_segment.metadata = {'url': "{url}/"} # type: ignore + diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py index 0f939937a7ab..0bc9902450f1 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,21 +7,840 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - + from typing import Any, Callable, Dict, List, Optional, TypeVar, Union T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "share") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + quota = kwargs.pop('quota', None) # type: Optional[int] + access_tier = kwargs.pop('access_tier', None) # type: Optional[Union[str, "_models.ShareAccessTier"]] + enabled_protocols = kwargs.pop('enabled_protocols', None) # type: Optional[str] + root_squash = kwargs.pop('root_squash', None) # type: Optional[Union[str, "_models.ShareRootSquash"]] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + if quota is not None: + _header_parameters['x-ms-share-quota'] = _SERIALIZER.header("quota", quota, 'int', minimum=1) + if access_tier is not None: + _header_parameters['x-ms-access-tier'] = _SERIALIZER.header("access_tier", access_tier, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if enabled_protocols is not None: + _header_parameters['x-ms-enabled-protocols'] = _SERIALIZER.header("enabled_protocols", enabled_protocols, 'str') + if root_squash is not None: + _header_parameters['x-ms-root-squash'] = _SERIALIZER.header("root_squash", root_squash, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "share") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "share") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + delete_snapshots = kwargs.pop('delete_snapshots', None) # type: Optional[Union[str, "_models.DeleteSnapshotsOptionType"]] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if delete_snapshots is not None: + _header_parameters['x-ms-delete-snapshots'] = _SERIALIZER.header("delete_snapshots", delete_snapshots, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_acquire_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "acquire") # type: str + restype = kwargs.pop('restype', "share") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + duration = kwargs.pop('duration', None) # type: Optional[int] + proposed_lease_id = kwargs.pop('proposed_lease_id', None) # type: Optional[str] + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + if duration is not None: + _header_parameters['x-ms-lease-duration'] = _SERIALIZER.header("duration", duration, 'int') + if proposed_lease_id is not None: + _header_parameters['x-ms-proposed-lease-id'] = _SERIALIZER.header("proposed_lease_id", proposed_lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_release_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "release") # type: str + restype = kwargs.pop('restype', "share") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + lease_id = kwargs.pop('lease_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_change_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "change") # type: str + restype = kwargs.pop('restype', "share") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + lease_id = kwargs.pop('lease_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + proposed_lease_id = kwargs.pop('proposed_lease_id', None) # type: Optional[str] + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if proposed_lease_id is not None: + _header_parameters['x-ms-proposed-lease-id'] = _SERIALIZER.header("proposed_lease_id", proposed_lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_renew_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "renew") # type: str + restype = kwargs.pop('restype', "share") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + lease_id = kwargs.pop('lease_id') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_break_lease_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "break") # type: str + restype = kwargs.pop('restype', "share") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + break_period = kwargs.pop('break_period', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + sharesnapshot = kwargs.pop('sharesnapshot', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + if sharesnapshot is not None: + _query_parameters['sharesnapshot'] = _SERIALIZER.query("sharesnapshot", sharesnapshot, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-lease-action'] = _SERIALIZER.header("action", action, 'str') + if break_period is not None: + _header_parameters['x-ms-lease-break-period'] = _SERIALIZER.header("break_period", break_period, 'int') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_snapshot_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "snapshot") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_permission_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "filepermission") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_permission_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "filepermission") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + file_permission_key = kwargs.pop('file_permission_key') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-file-permission-key'] = _SERIALIZER.header("file_permission_key", file_permission_key, 'str') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + quota = kwargs.pop('quota', None) # type: Optional[int] + access_tier = kwargs.pop('access_tier', None) # type: Optional[Union[str, "_models.ShareAccessTier"]] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + root_squash = kwargs.pop('root_squash', None) # type: Optional[Union[str, "_models.ShareRootSquash"]] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if quota is not None: + _header_parameters['x-ms-share-quota'] = _SERIALIZER.header("quota", quota, 'int', minimum=1) + if access_tier is not None: + _header_parameters['x-ms-access-tier'] = _SERIALIZER.header("access_tier", access_tier, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if root_squash is not None: + _header_parameters['x-ms-root-squash'] = _SERIALIZER.header("root_squash", root_squash, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_metadata_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "metadata") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_access_policy_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "acl") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_access_policy_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "acl") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_statistics_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "stats") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + lease_id = kwargs.pop('lease_id', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if lease_id is not None: + _header_parameters['x-ms-lease-id'] = _SERIALIZER.header("lease_id", lease_id, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_restore_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "undelete") # type: str + version = kwargs.pop('version', "2021-04-10") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + deleted_share_name = kwargs.pop('deleted_share_name', None) # type: Optional[str] + deleted_share_version = kwargs.pop('deleted_share_version', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{shareName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if deleted_share_name is not None: + _header_parameters['x-ms-deleted-share-name'] = _SERIALIZER.header("deleted_share_name", deleted_share_name, 'str') + if deleted_share_version is not None: + _header_parameters['x-ms-deleted-share-version'] = _SERIALIZER.header("deleted_share_version", deleted_share_version, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class ShareOperations(object): """ShareOperations operations. @@ -43,10 +863,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def create( + @distributed_trace + def create( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] quota=None, # type: Optional[int] access_tier=None, # type: Optional[Union[str, "_models.ShareAccessTier"]] enabled_protocols=None, # type: Optional[str] @@ -63,7 +884,7 @@ def create( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param quota: Specifies the maximum size of the share, in gigabytes. :type quota: int :param access_tier: Specifies the access tier of the share. @@ -72,6 +893,9 @@ def create( :type enabled_protocols: str :param root_squash: Root squash to set on the share. Only valid for NFS shares. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -82,44 +906,35 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "share" - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - if quota is not None: - header_parameters['x-ms-share-quota'] = self._serialize.header("quota", quota, 'int', minimum=1) - if access_tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("access_tier", access_tier, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if enabled_protocols is not None: - header_parameters['x-ms-enabled-protocols'] = self._serialize.header("enabled_protocols", enabled_protocols, 'str') - if root_squash is not None: - header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + restype = kwargs.pop('restype', "share") # type: str + + + request = build_create_request( + url=self._config.url, + restype=restype, + version=self._config.version, + timeout=timeout, + metadata=metadata, + quota=quota, + access_tier=access_tier, + enabled_protocols=enabled_protocols, + root_squash=root_squash, + template_url=self.create.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -129,12 +944,15 @@ def create( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{shareName}'} # type: ignore + create.metadata = {'url': "{url}/{shareName}"} # type: ignore + - def get_properties( + @distributed_trace + def get_properties( # pylint: disable=inconsistent-return-statements self, sharesnapshot=None, # type: Optional[str] timeout=None, # type: Optional[int] @@ -155,6 +973,9 @@ def get_properties( :type timeout: int :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -165,46 +986,39 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - accept = "application/xml" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_get_properties_request( + url=self._config.url, + restype=restype, + version=self._config.version, + sharesnapshot=sharesnapshot, + timeout=timeout, + lease_id=_lease_id, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['ETag']=self._deserialize('str', response.headers.get('ETag')) response_headers['Last-Modified']=self._deserialize('rfc-1123', response.headers.get('Last-Modified')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) @@ -225,12 +1039,15 @@ def get_properties( response_headers['x-ms-enabled-protocols']=self._deserialize('str', response.headers.get('x-ms-enabled-protocols')) response_headers['x-ms-root-squash']=self._deserialize('str', response.headers.get('x-ms-root-squash')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{shareName}'} # type: ignore + get_properties.metadata = {'url': "{url}/{shareName}"} # type: ignore + - def delete( + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, sharesnapshot=None, # type: Optional[str] timeout=None, # type: Optional[int] @@ -255,6 +1072,9 @@ def delete( :type delete_snapshots: str or ~azure.storage.fileshare.models.DeleteSnapshotsOptionType :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -265,44 +1085,36 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - accept = "application/xml" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if delete_snapshots is not None: - header_parameters['x-ms-delete-snapshots'] = self._serialize.header("delete_snapshots", delete_snapshots, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + request = build_delete_request( + url=self._config.url, + restype=restype, + version=self._config.version, + sharesnapshot=sharesnapshot, + timeout=timeout, + delete_snapshots=delete_snapshots, + lease_id=_lease_id, + template_url=self.delete.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -310,12 +1122,15 @@ def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{shareName}'} # type: ignore + delete.metadata = {'url': "{url}/{shareName}"} # type: ignore - def acquire_lease( + + @distributed_trace + def acquire_lease( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] duration=None, # type: Optional[int] @@ -347,6 +1162,15 @@ def acquire_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "acquire". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -357,46 +1181,38 @@ def acquire_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "acquire" - restype = "share" - accept = "application/xml" - - # Construct URL - url = self.acquire_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if duration is not None: - header_parameters['x-ms-lease-duration'] = self._serialize.header("duration", duration, 'int') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "acquire") # type: str + restype = kwargs.pop('restype', "share") # type: str + + + request = build_acquire_lease_request( + url=self._config.url, + comp=comp, + action=action, + restype=restype, + version=self._config.version, + timeout=timeout, + duration=duration, + proposed_lease_id=proposed_lease_id, + sharesnapshot=sharesnapshot, + request_id_parameter=request_id_parameter, + template_url=self.acquire_lease.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -408,12 +1224,15 @@ def acquire_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - acquire_lease.metadata = {'url': '/{shareName}'} # type: ignore + acquire_lease.metadata = {'url': "{url}/{shareName}"} # type: ignore + - def release_lease( + @distributed_trace + def release_lease( # pylint: disable=inconsistent-return-statements self, lease_id, # type: str timeout=None, # type: Optional[int] @@ -438,6 +1257,15 @@ def release_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "release". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -448,43 +1276,37 @@ def release_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "release" - restype = "share" - accept = "application/xml" - - # Construct URL - url = self.release_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "release") # type: str + restype = kwargs.pop('restype', "share") # type: str + + + request = build_release_lease_request( + url=self._config.url, + comp=comp, + action=action, + restype=restype, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + sharesnapshot=sharesnapshot, + request_id_parameter=request_id_parameter, + template_url=self.release_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -495,12 +1317,15 @@ def release_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - release_lease.metadata = {'url': '/{shareName}'} # type: ignore + release_lease.metadata = {'url': "{url}/{shareName}"} # type: ignore - def change_lease( + + @distributed_trace + def change_lease( # pylint: disable=inconsistent-return-statements self, lease_id, # type: str timeout=None, # type: Optional[int] @@ -530,6 +1355,15 @@ def change_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "change". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -540,45 +1374,38 @@ def change_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "change" - restype = "share" - accept = "application/xml" - - # Construct URL - url = self.change_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - if proposed_lease_id is not None: - header_parameters['x-ms-proposed-lease-id'] = self._serialize.header("proposed_lease_id", proposed_lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "change") # type: str + restype = kwargs.pop('restype', "share") # type: str + + + request = build_change_lease_request( + url=self._config.url, + comp=comp, + action=action, + restype=restype, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + proposed_lease_id=proposed_lease_id, + sharesnapshot=sharesnapshot, + request_id_parameter=request_id_parameter, + template_url=self.change_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -590,12 +1417,15 @@ def change_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - change_lease.metadata = {'url': '/{shareName}'} # type: ignore + change_lease.metadata = {'url': "{url}/{shareName}"} # type: ignore + - def renew_lease( + @distributed_trace + def renew_lease( # pylint: disable=inconsistent-return-statements self, lease_id, # type: str timeout=None, # type: Optional[int] @@ -620,6 +1450,15 @@ def renew_lease( :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "renew". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -630,43 +1469,37 @@ def renew_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "lease" - action = "renew" - restype = "share" - accept = "application/xml" - - # Construct URL - url = self.renew_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "renew") # type: str + restype = kwargs.pop('restype', "share") # type: str + + + request = build_renew_lease_request( + url=self._config.url, + comp=comp, + action=action, + restype=restype, + version=self._config.version, + lease_id=lease_id, + timeout=timeout, + sharesnapshot=sharesnapshot, + request_id_parameter=request_id_parameter, + template_url=self.renew_lease.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -678,12 +1511,15 @@ def renew_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - renew_lease.metadata = {'url': '/{shareName}'} # type: ignore + renew_lease.metadata = {'url': "{url}/{shareName}"} # type: ignore - def break_lease( + + @distributed_trace + def break_lease( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] break_period=None, # type: Optional[int] @@ -717,6 +1553,15 @@ def break_lease( :type sharesnapshot: str :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword comp: comp. The default value is "lease". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str + :keyword action: Describes what lease action to take. The default value is "break". Note that + overriding this default value may result in unsupported behavior. + :paramtype action: str + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -727,50 +1572,41 @@ def break_lease( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + comp = kwargs.pop('comp', "lease") # type: str + action = kwargs.pop('action', "break") # type: str + restype = kwargs.pop('restype', "share") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - comp = "lease" - action = "break" - restype = "share" - accept = "application/xml" - - # Construct URL - url = self.break_lease.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - if sharesnapshot is not None: - query_parameters['sharesnapshot'] = self._serialize.query("sharesnapshot", sharesnapshot, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-lease-action'] = self._serialize.header("action", action, 'str') - if break_period is not None: - header_parameters['x-ms-lease-break-period'] = self._serialize.header("break_period", break_period, 'int') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_break_lease_request( + url=self._config.url, + comp=comp, + action=action, + restype=restype, + version=self._config.version, + timeout=timeout, + break_period=break_period, + lease_id=_lease_id, + request_id_parameter=request_id_parameter, + sharesnapshot=sharesnapshot, + template_url=self.break_lease.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) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -783,15 +1619,18 @@ def break_lease( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - break_lease.metadata = {'url': '/{shareName}'} # type: ignore + break_lease.metadata = {'url': "{url}/{shareName}"} # type: ignore - def create_snapshot( + + @distributed_trace + def create_snapshot( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] **kwargs # type: Any ): # type: (...) -> None @@ -803,7 +1642,13 @@ def create_snapshot( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "snapshot". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -814,38 +1659,33 @@ def create_snapshot( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "share" - comp = "snapshot" - accept = "application/xml" - - # Construct URL - url = self.create_snapshot.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "snapshot") # type: str + + + request = build_create_snapshot_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + template_url=self.create_snapshot.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -856,12 +1696,15 @@ def create_snapshot( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - create_snapshot.metadata = {'url': '/{shareName}'} # type: ignore + create_snapshot.metadata = {'url': "{url}/{shareName}"} # type: ignore - def create_permission( + + @distributed_trace + def create_permission( # pylint: disable=inconsistent-return-statements self, share_permission, # type: "_models.SharePermission" timeout=None, # type: Optional[int] @@ -877,6 +1720,12 @@ def create_permission( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "filepermission". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -887,41 +1736,36 @@ def create_permission( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "share" - comp = "filepermission" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/xml" - - # Construct URL - url = self.create_permission.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(share_permission, 'SharePermission') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "filepermission") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(share_permission, 'SharePermission') + + request = build_create_permission_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + json=_json, + timeout=timeout, + template_url=self.create_permission.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -930,11 +1774,14 @@ def create_permission( response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) response_headers['x-ms-file-permission-key']=self._deserialize('str', response.headers.get('x-ms-file-permission-key')) + if cls: return cls(pipeline_response, None, response_headers) - create_permission.metadata = {'url': '/{shareName}'} # type: ignore + create_permission.metadata = {'url': "{url}/{shareName}"} # type: ignore + + @distributed_trace def get_permission( self, file_permission_key, # type: str @@ -951,6 +1798,12 @@ def get_permission( href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.`. :type timeout: int + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "filepermission". Note that overriding this default + value may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharePermission, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.SharePermission @@ -961,52 +1814,52 @@ def get_permission( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "share" - comp = "filepermission" - accept = "application/json" - - # Construct URL - url = self.get_permission.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-file-permission-key'] = self._serialize.header("file_permission_key", file_permission_key, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "filepermission") # type: str + + + request = build_get_permission_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + file_permission_key=file_permission_key, + timeout=timeout, + template_url=self.get_permission.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('SharePermission', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_permission.metadata = {'url': '/{shareName}'} # type: ignore - def set_properties( + get_permission.metadata = {'url': "{url}/{shareName}"} # type: ignore + + + @distributed_trace + def set_properties( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] quota=None, # type: Optional[int] @@ -1031,6 +1884,12 @@ def set_properties( :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1041,48 +1900,39 @@ def set_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "properties") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.set_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if quota is not None: - header_parameters['x-ms-share-quota'] = self._serialize.header("quota", quota, 'int', minimum=1) - if access_tier is not None: - header_parameters['x-ms-access-tier'] = self._serialize.header("access_tier", access_tier, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - if root_squash is not None: - header_parameters['x-ms-root-squash'] = self._serialize.header("root_squash", root_squash, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_set_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + quota=quota, + access_tier=access_tier, + lease_id=_lease_id, + root_squash=root_squash, + template_url=self.set_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1092,15 +1942,18 @@ def set_properties( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {'url': '/{shareName}'} # type: ignore + set_properties.metadata = {'url': "{url}/{shareName}"} # type: ignore - def set_metadata( + + @distributed_trace + def set_metadata( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] lease_access_conditions=None, # type: Optional["_models.LeaseAccessConditions"] **kwargs # type: Any ): @@ -1113,9 +1966,15 @@ def set_metadata( Timeouts for File Service Operations.`. :type timeout: int :param metadata: A name-value pair to associate with a file storage object. - :type metadata: str + :type metadata: dict[str, str] :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1126,44 +1985,37 @@ def set_metadata( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "metadata") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - comp = "metadata" - accept = "application/xml" - - # Construct URL - url = self.set_metadata.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_set_metadata_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + lease_id=_lease_id, + template_url=self.set_metadata.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1173,11 +2025,14 @@ def set_metadata( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {'url': '/{shareName}'} # type: ignore + set_metadata.metadata = {'url': "{url}/{shareName}"} # type: ignore + + @distributed_trace def get_access_policy( self, timeout=None, # type: Optional[int] @@ -1194,6 +2049,12 @@ def get_access_policy( :type timeout: int :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "acl". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier, or the result of cls(response) :rtype: list[~azure.storage.fileshare.models.SignedIdentifier] @@ -1204,42 +2065,36 @@ def get_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "acl") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - comp = "acl" - accept = "application/xml" - - # Construct URL - url = self.get_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_get_access_policy_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + template_url=self.get_access_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1248,15 +2103,19 @@ def get_access_policy( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[SignedIdentifier]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_access_policy.metadata = {'url': '/{shareName}'} # type: ignore - def set_access_policy( + get_access_policy.metadata = {'url': "{url}/{shareName}"} # type: ignore + + + @distributed_trace + def set_access_policy( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] share_acl=None, # type: Optional[List["_models.SignedIdentifier"]] @@ -1275,6 +2134,12 @@ def set_access_policy( :type share_acl: list[~azure.storage.fileshare.models.SignedIdentifier] :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "acl". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1285,51 +2150,44 @@ def set_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "acl") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - comp = "acl" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'wrapped': True}} + serialization_ctxt = {"xml": {'name': 'SignedIdentifiers', 'wrapped': True}} if share_acl is not None: - body_content = self._serialize.body(share_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) + _content = self._serialize.body(share_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _content = None + + request = build_set_access_policy_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + lease_id=_lease_id, + template_url=self.set_access_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1339,11 +2197,14 @@ def set_access_policy( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_access_policy.metadata = {'url': '/{shareName}'} # type: ignore + set_access_policy.metadata = {'url': "{url}/{shareName}"} # type: ignore + + @distributed_trace def get_statistics( self, timeout=None, # type: Optional[int] @@ -1360,6 +2221,12 @@ def get_statistics( :type timeout: int :param lease_access_conditions: Parameter group. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "stats". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ShareStats, or the result of cls(response) :rtype: ~azure.storage.fileshare.models.ShareStats @@ -1370,42 +2237,36 @@ def get_statistics( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "stats") # type: str + _lease_id = None if lease_access_conditions is not None: _lease_id = lease_access_conditions.lease_id - restype = "share" - comp = "stats" - accept = "application/xml" - - # Construct URL - url = self.get_statistics.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if _lease_id is not None: - header_parameters['x-ms-lease-id'] = self._serialize.header("lease_id", _lease_id, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_get_statistics_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + lease_id=_lease_id, + template_url=self.get_statistics.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1414,15 +2275,19 @@ def get_statistics( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ShareStats', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_statistics.metadata = {'url': '/{shareName}'} # type: ignore - def restore( + get_statistics.metadata = {'url': "{url}/{shareName}"} # type: ignore + + + @distributed_trace + def restore( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -1445,6 +2310,12 @@ def restore( :type deleted_share_name: str :param deleted_share_version: Specifies the version of the previously-deleted share. :type deleted_share_version: str + :keyword restype: restype. The default value is "share". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "undelete". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -1455,42 +2326,35 @@ def restore( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "share" - comp = "undelete" - accept = "application/xml" - - # Construct URL - url = self.restore.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - if deleted_share_name is not None: - header_parameters['x-ms-deleted-share-name'] = self._serialize.header("deleted_share_name", deleted_share_name, 'str') - if deleted_share_version is not None: - header_parameters['x-ms-deleted-share-version'] = self._serialize.header("deleted_share_version", deleted_share_version, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "share") # type: str + comp = kwargs.pop('comp', "undelete") # type: str + + + request = build_restore_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + deleted_share_name=deleted_share_name, + deleted_share_version=deleted_share_version, + template_url=self.restore.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -1501,7 +2365,9 @@ def restore( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - restore.metadata = {'url': '/{shareName}'} # type: ignore + restore.metadata = {'url': "{url}/{shareName}"} # type: ignore + diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py index f2189a1af167..9caa9c816703 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py @@ -114,7 +114,7 @@ def __init__( # type: ignore self._query_str, credential = self._format_query_string( sas_token, credential, share_snapshot=self.snapshot) super(ShareClient, self).__init__(parsed_url, service='file-share', credential=credential, **kwargs) - self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline) + self._client = AzureFileStorage(url=self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access @classmethod diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_service_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_service_client.py index 2b41ed0e6ff9..46721ee9ea86 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_service_client.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_service_client.py @@ -104,7 +104,7 @@ def __init__( 'You need to provide either an account shared key or SAS token when creating a storage service.') self._query_str, credential = self._format_query_string(sas_token, credential) super(ShareServiceClient, self).__init__(parsed_url, service='file-share', credential=credential, **kwargs) - self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline) + self._client = AzureFileStorage(url=self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access def _format_url(self, hostname): diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py index 7591dd13beab..de38948d2f0e 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_directory_client_async.py @@ -89,7 +89,7 @@ def __init__( # type: ignore credential=credential, loop=loop, **kwargs) - self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline, loop=loop) + self._client = AzureFileStorage(self.url, base_url=self.url, pipeline=self._pipeline, loop=loop) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access self._loop = loop diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py index f783a59ae0bb..4a03cd50f0de 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_file_client_async.py @@ -142,7 +142,7 @@ def __init__( # type: ignore account_url, share_name=share_name, file_path=file_path, snapshot=snapshot, credential=credential, loop=loop, **kwargs ) - self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline, loop=loop) + self._client = AzureFileStorage(self.url, base_url=self.url, pipeline=self._pipeline, loop=loop) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access self._loop = loop diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py index 7aaefbc77883..26e54b94a3a2 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py @@ -84,7 +84,7 @@ def __init__( # type: ignore credential=credential, loop=loop, **kwargs) - self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline, loop=loop) + self._client = AzureFileStorage(self.url, base_url=self.url, pipeline=self._pipeline, loop=loop) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access self._loop = loop diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py index cb88f0a15412..9cf53d32933b 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py @@ -89,7 +89,7 @@ def __init__( credential=credential, loop=loop, **kwargs) - self._client = AzureFileStorage(url=self.url, pipeline=self._pipeline, loop=loop) + self._client = AzureFileStorage(self.url, base_url=self.url, pipeline=self._pipeline, loop=loop) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access self._loop = loop diff --git a/sdk/storage/azure-storage-file-share/setup.py b/sdk/storage/azure-storage-file-share/setup.py index 61e9c8a23c79..2a51524f2f09 100644 --- a/sdk/storage/azure-storage-file-share/setup.py +++ b/sdk/storage/azure-storage-file-share/setup.py @@ -63,7 +63,7 @@ ]), python_requires=">=3.6", install_requires=[ - "azure-core<2.0.0,>=1.15.0", + "azure-core<2.0.0,>=1.20.1", "msrest>=0.6.21", "cryptography>=2.1.4" ], diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md index 042ecac5b2bc..67fbdbc83c7f 100644 --- a/sdk/storage/azure-storage-file-share/swagger/README.md +++ b/sdk/storage/azure-storage-file-share/swagger/README.md @@ -105,3 +105,29 @@ directive: } } ``` + +### Remove x-ms-parameterized-host +``` yaml +directive: +- from: swagger-document + where: $ + transform: > + $["x-ms-parameterized-host"] = undefined; +``` + +### Add url parameter to each operation and add it to the url +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + for (const property in $) + { + $[property]["parameters"].push({"$ref": "#/parameters/Url"}); + + var oldName = property; + var newName = '{url}' + property; + $[newName] = $[oldName]; + delete $[oldName]; + } +``` diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/__init__.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/__init__.py index 2519a661f749..bb6652564d85 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/__init__.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/__init__.py @@ -9,8 +9,7 @@ from ._azure_queue_storage import AzureQueueStorage __all__ = ['AzureQueueStorage'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_azure_queue_storage.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_azure_queue_storage.py index 1248b58b7add..ef213aa44564 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_azure_queue_storage.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_azure_queue_storage.py @@ -6,22 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING -from azure.core import PipelineClient from msrest import Deserializer, Serializer +from azure.core import PipelineClient + +from . import models +from ._configuration import AzureQueueStorageConfiguration +from .operations import MessageIdOperations, MessagesOperations, QueueOperations, ServiceOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any -from ._configuration import AzureQueueStorageConfiguration -from .operations import ServiceOperations -from .operations import QueueOperations -from .operations import MessagesOperations -from .operations import MessageIdOperations -from . import models - + from azure.core.rest import HttpRequest, HttpResponse class AzureQueueStorage(object): """AzureQueueStorage. @@ -34,33 +34,63 @@ class AzureQueueStorage(object): :vartype messages: azure.storage.queue.operations.MessagesOperations :ivar message_id: MessageIdOperations operations :vartype message_id: azure.storage.queue.operations.MessageIdOperations - :param url: The URL of the service account, queue or message that is the targe of the desired operation. + :param url: The URL of the service account, queue or message that is the target of the desired + operation. :type url: str + :param base_url: Service URL. Default value is ''. + :type base_url: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2018-03-28". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str """ def __init__( self, url, # type: str + base_url="", # type: str **kwargs # type: Any ): # type: (...) -> None - base_url = '{url}' - self._config = AzureQueueStorageConfiguration(url, **kwargs) + self._config = AzureQueueStorageConfiguration(url=url, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.messages = MessagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.message_id = MessageIdOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ - self.service = ServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.messages = MessagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.message_id = MessageIdOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_configuration.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_configuration.py index 530cb1caf1ed..1b8ffd3ca71d 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_configuration.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_configuration.py @@ -17,14 +17,19 @@ VERSION = "unknown" -class AzureQueueStorageConfiguration(Configuration): +class AzureQueueStorageConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureQueueStorage. Note that all parameters used to create this instance are saved as instance attributes. - :param url: The URL of the service account, queue or message that is the targe of the desired operation. + :param url: The URL of the service account, queue or message that is the target of the desired + operation. :type url: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2018-03-28". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str """ def __init__( @@ -33,12 +38,14 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(AzureQueueStorageConfiguration, self).__init__(**kwargs) + version = kwargs.pop('version', "2018-03-28") # type: str + if url is None: raise ValueError("Parameter 'url' must not be None.") - super(AzureQueueStorageConfiguration, self).__init__(**kwargs) self.url = url - self.version = "2018-03-28" + self.version = version kwargs.setdefault('sdk_moniker', 'azurequeuestorage/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_patch.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_vendor.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/__init__.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/__init__.py index c42c1a4002a7..bb6652564d85 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/__init__.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/__init__.py @@ -8,3 +8,8 @@ from ._azure_queue_storage import AzureQueueStorage __all__ = ['AzureQueueStorage'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage.py index 3b7bb2074356..fb7504d4a13c 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage.py @@ -6,20 +6,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any +from copy import deepcopy +from typing import Any, Awaitable -from azure.core import AsyncPipelineClient from msrest import Deserializer, Serializer -from ._configuration import AzureQueueStorageConfiguration -from .operations import ServiceOperations -from .operations import QueueOperations -from .operations import MessagesOperations -from .operations import MessageIdOperations -from .. import models +from azure.core import AsyncPipelineClient +from azure.core.rest import AsyncHttpResponse, HttpRequest +from .. import models +from ._configuration import AzureQueueStorageConfiguration +from .operations import MessageIdOperations, MessagesOperations, QueueOperations, ServiceOperations -class AzureQueueStorage(object): +class AzureQueueStorage: """AzureQueueStorage. :ivar service: ServiceOperations operations @@ -30,32 +29,61 @@ class AzureQueueStorage(object): :vartype messages: azure.storage.queue.aio.operations.MessagesOperations :ivar message_id: MessageIdOperations operations :vartype message_id: azure.storage.queue.aio.operations.MessageIdOperations - :param url: The URL of the service account, queue or message that is the targe of the desired operation. + :param url: The URL of the service account, queue or message that is the target of the desired + operation. :type url: str + :param base_url: Service URL. Default value is ''. + :type base_url: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2018-03-28". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str """ def __init__( self, url: str, + base_url: str = "", **kwargs: Any ) -> None: - base_url = '{url}' - self._config = AzureQueueStorageConfiguration(url, **kwargs) + self._config = AzureQueueStorageConfiguration(url=url, **kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.service = ServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.queue = QueueOperations(self._client, self._config, self._serialize, self._deserialize) + self.messages = MessagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.message_id = MessageIdOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ - self.service = ServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.queue = QueueOperations( - self._client, self._config, self._serialize, self._deserialize) - self.messages = MessagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.message_id = MessageIdOperations( - self._client, self._config, self._serialize, self._deserialize) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration.py index ecd33f8672be..3ed517526354 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration.py @@ -13,14 +13,19 @@ VERSION = "unknown" -class AzureQueueStorageConfiguration(Configuration): +class AzureQueueStorageConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureQueueStorage. Note that all parameters used to create this instance are saved as instance attributes. - :param url: The URL of the service account, queue or message that is the targe of the desired operation. + :param url: The URL of the service account, queue or message that is the target of the desired + operation. :type url: str + :keyword version: Specifies the version of the operation to use for this request. The default + value is "2018-03-28". Note that overriding this default value may result in unsupported + behavior. + :paramtype version: str """ def __init__( @@ -28,12 +33,14 @@ def __init__( url: str, **kwargs: Any ) -> None: + super(AzureQueueStorageConfiguration, self).__init__(**kwargs) + version = kwargs.pop('version', "2018-03-28") # type: str + if url is None: raise ValueError("Parameter 'url' must not be None.") - super(AzureQueueStorageConfiguration, self).__init__(**kwargs) self.url = url - self.version = "2018-03-28" + self.version = version kwargs.setdefault('sdk_moniker', 'azurequeuestorage/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_patch.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py index c84b04e8db5c..a077e9848c58 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -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 -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._message_id_operations import build_delete_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,14 +42,15 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def update( + @distributed_trace_async + async def update( # pylint: disable=inconsistent-return-statements self, pop_receipt: str, visibilitytimeout: int, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, queue_message: Optional["_models.QueueMessage"] = None, - **kwargs + **kwargs: Any ) -> None: """The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message operation updates the visibility timeout of a message. You can also use this @@ -64,8 +68,8 @@ async def update( later than the expiry time. :type visibilitytimeout: int :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -82,44 +86,38 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['popreceipt'] = self._serialize.query("pop_receipt", pop_receipt, 'str') - query_parameters['visibilitytimeout'] = self._serialize.query("visibilitytimeout", visibilitytimeout, 'int', maximum=604800, minimum=0) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + if queue_message is not None: - body_content = self._serialize.body(queue_message, 'QueueMessage', is_xml=True) + _content = self._serialize.body(queue_message, 'QueueMessage', is_xml=True) else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _content = None + + request = build_update_request( + url=self._config.url, + version=self._config.version, + content_type=content_type, + pop_receipt=pop_receipt, + visibilitytimeout=visibilitytimeout, + content=_content, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -129,17 +127,20 @@ async def update( response_headers['x-ms-popreceipt']=self._deserialize('str', response.headers.get('x-ms-popreceipt')) response_headers['x-ms-time-next-visible']=self._deserialize('rfc-1123', response.headers.get('x-ms-time-next-visible')) + if cls: return cls(pipeline_response, None, response_headers) - update.metadata = {'url': '/{queueName}/messages/{messageid}'} # type: ignore + update.metadata = {'url': "{url}/{queueName}/messages/{messageid}"} # type: ignore - async def delete( + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, pop_receipt: str, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> None: """The Delete operation deletes the specified message. @@ -147,8 +148,8 @@ async def delete( call to the Get Messages or Update Message operation. :type pop_receipt: str :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -163,35 +164,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/xml" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['popreceipt'] = self._serialize.query("pop_receipt", pop_receipt, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_delete_request( + url=self._config.url, + version=self._config.version, + pop_receipt=pop_receipt, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.delete.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -199,7 +194,9 @@ async def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{queueName}/messages/{messageid}'} # type: ignore + delete.metadata = {'url': "{url}/{queueName}/messages/{messageid}"} # type: ignore + diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py index b4fb03fe3c15..f9f1b3b7a21d 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._messages_operations import build_clear_request, build_dequeue_request, build_enqueue_request, build_peek_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,13 +42,14 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def dequeue( self, number_of_messages: Optional[int] = None, visibilitytimeout: Optional[int] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> List["_models.DequeuedMessageItem"]: """The Dequeue operation retrieves one or more messages from the front of the queue. @@ -61,8 +65,8 @@ async def dequeue( later than the expiry time. :type visibilitytimeout: int :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -77,63 +81,59 @@ async def dequeue( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/xml" - # Construct URL - url = self.dequeue.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if number_of_messages is not None: - query_parameters['numofmessages'] = self._serialize.query("number_of_messages", number_of_messages, 'int', minimum=1) - if visibilitytimeout is not None: - query_parameters['visibilitytimeout'] = self._serialize.query("visibilitytimeout", visibilitytimeout, 'int', maximum=604800, minimum=0) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_dequeue_request( + url=self._config.url, + version=self._config.version, + number_of_messages=number_of_messages, + visibilitytimeout=visibilitytimeout, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.dequeue.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[DequeuedMessageItem]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - dequeue.metadata = {'url': '/{queueName}/messages'} # type: ignore - async def clear( + dequeue.metadata = {'url': "{url}/{queueName}/messages"} # type: ignore + + + @distributed_trace_async + async def clear( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> None: """The Clear operation deletes all messages from the specified queue. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -148,34 +148,28 @@ async def clear( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/xml" - # Construct URL - url = self.clear.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_clear_request( + url=self._config.url, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.clear.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -183,11 +177,14 @@ async def clear( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - clear.metadata = {'url': '/{queueName}/messages'} # type: ignore + clear.metadata = {'url': "{url}/{queueName}/messages"} # type: ignore + + @distributed_trace_async async def enqueue( self, queue_message: "_models.QueueMessage", @@ -195,7 +192,7 @@ async def enqueue( message_time_to_live: Optional[int] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> List["_models.EnqueuedMessage"]: """The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be specified to make the message invisible until the visibility timeout expires. A @@ -205,9 +202,9 @@ async def enqueue( :param queue_message: A Message object which can be stored in a Queue. :type queue_message: ~azure.storage.queue.models.QueueMessage - :param visibilitytimeout: Optional. If specified, the request must be made using an x-ms- - version of 2011-08-18 or later. If not specified, the default value is 0. Specifies the new - visibility timeout value, in seconds, relative to server time. The new value must be larger + :param visibilitytimeout: Optional. If specified, the request must be made using an + x-ms-version of 2011-08-18 or later. If not specified, the default value is 0. Specifies the + new visibility timeout value, in seconds, relative to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility timeout of a message cannot be set to a value later than the expiry time. visibilitytimeout should be set to a value smaller than the time-to-live value. @@ -215,12 +212,12 @@ async def enqueue( :param message_time_to_live: Optional. Specifies the time-to-live interval for the message, in seconds. Prior to version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum time-to-live can be any positive number, as well as -1 - indicating that the message does not expire. If this parameter is omitted, the default time-to- - live is 7 days. + indicating that the message does not expire. If this parameter is omitted, the default + time-to-live is 7 days. :type message_time_to_live: int :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -235,63 +232,59 @@ async def enqueue( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - # Construct URL - url = self.enqueue.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if visibilitytimeout is not None: - query_parameters['visibilitytimeout'] = self._serialize.query("visibilitytimeout", visibilitytimeout, 'int', maximum=604800, minimum=0) - if message_time_to_live is not None: - query_parameters['messagettl'] = self._serialize.query("message_time_to_live", message_time_to_live, 'int', minimum=-1) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue_message, 'QueueMessage', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + + _content = self._serialize.body(queue_message, 'QueueMessage', is_xml=True) + + request = build_enqueue_request( + url=self._config.url, + version=self._config.version, + content_type=content_type, + content=_content, + visibilitytimeout=visibilitytimeout, + message_time_to_live=message_time_to_live, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.enqueue.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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[EnqueuedMessage]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - enqueue.metadata = {'url': '/{queueName}/messages'} # type: ignore + enqueue.metadata = {'url': "{url}/{queueName}/messages"} # type: ignore + + + @distributed_trace_async async def peek( self, number_of_messages: Optional[int] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> List["_models.PeekedMessageItem"]: """The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility of the message. @@ -302,12 +295,15 @@ async def peek( operation. :type number_of_messages: int :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword peekonly: Peek message(s). The default value is "true". Note that overriding this + default value may result in unsupported behavior. + :paramtype peekonly: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of PeekedMessageItem, or the result of cls(response) :rtype: list[~azure.storage.queue.models.PeekedMessageItem] @@ -318,48 +314,45 @@ async def peek( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - peekonly = "true" - accept = "application/xml" - # Construct URL - url = self.peek.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['peekonly'] = self._serialize.query("peekonly", peekonly, 'str') - if number_of_messages is not None: - query_parameters['numofmessages'] = self._serialize.query("number_of_messages", number_of_messages, 'int', minimum=1) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + peekonly = kwargs.pop('peekonly', "true") # type: str + + + request = build_peek_request( + url=self._config.url, + peekonly=peekonly, + version=self._config.version, + number_of_messages=number_of_messages, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.peek.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[PeekedMessageItem]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - peek.metadata = {'url': '/{queueName}/messages'} # type: ignore + + peek.metadata = {'url': "{url}/{queueName}/messages"} # type: ignore + diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py index bffadf17f31d..bad3912e7d4e 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._queue_operations import build_create_request, build_delete_request, build_get_access_policy_request, build_get_properties_request, build_set_access_policy_request, build_set_metadata_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,25 +42,26 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def create( + @distributed_trace_async + async def create( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> None: """creates a new queue under the given account. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param metadata: Optional. Include this parameter to specify that the queue's metadata be returned as part of the response body. Note that metadata requested with this parameter must be stored in accordance with the naming restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata names must adhere to the naming conventions for C# identifiers. - :type metadata: str + :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str @@ -71,36 +75,29 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_create_request( + url=self._config.url, + version=self._config.version, + timeout=timeout, + metadata=metadata, + request_id_parameter=request_id_parameter, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [201, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -108,28 +105,32 @@ async def create( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if response.status_code == 204: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{queueName}'} # type: ignore + create.metadata = {'url': "{url}/{queueName}"} # type: ignore + - async def delete( + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> None: """operation permanently deletes the specified queue. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -144,34 +145,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/xml" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_delete_request( + url=self._config.url, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.delete.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -179,27 +174,33 @@ async def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{queueName}'} # type: ignore + delete.metadata = {'url': "{url}/{queueName}"} # type: ignore + - async def get_properties( + @distributed_trace_async + async def get_properties( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> None: """Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-values pairs. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -210,73 +211,74 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "metadata" - accept = "application/xml" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "metadata") # type: str + + + request = build_get_properties_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['x-ms-approximate-messages-count']=self._deserialize('int', response.headers.get('x-ms-approximate-messages-count')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{queueName}'} # type: ignore + get_properties.metadata = {'url': "{url}/{queueName}"} # type: ignore + - async def set_metadata( + @distributed_trace_async + async def set_metadata( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, - metadata: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> None: """sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param metadata: Optional. Include this parameter to specify that the queue's metadata be returned as part of the response body. Note that metadata requested with this parameter must be stored in accordance with the naming restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata names must adhere to the naming conventions for C# identifiers. - :type metadata: str + :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -287,38 +289,32 @@ async def set_metadata( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "metadata" - accept = "application/xml" - # Construct URL - url = self.set_metadata.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "metadata") # type: str + + + request = build_set_metadata_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + request_id_parameter=request_id_parameter, + template_url=self.set_metadata.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -326,27 +322,33 @@ async def set_metadata( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {'url': '/{queueName}'} # type: ignore + set_metadata.metadata = {'url': "{url}/{queueName}"} # type: ignore + + @distributed_trace_async async def get_access_policy( self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> List["_models.SignedIdentifier"]: """returns details about any stored access policies specified on the queue that may be used with Shared Access Signatures. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "acl". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier, or the result of cls(response) :rtype: list[~azure.storage.queue.models.SignedIdentifier] @@ -357,68 +359,70 @@ async def get_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "acl" - accept = "application/xml" - # Construct URL - url = self.get_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "acl") # type: str + + + request = build_get_access_policy_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_access_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[SignedIdentifier]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_access_policy.metadata = {'url': '/{queueName}'} # type: ignore - async def set_access_policy( + get_access_policy.metadata = {'url': "{url}/{queueName}"} # type: ignore + + + @distributed_trace_async + async def set_access_policy( # pylint: disable=inconsistent-return-statements self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, queue_acl: Optional[List["_models.SignedIdentifier"]] = None, - **kwargs + **kwargs: Any ) -> None: """sets stored access policies for the queue that may be used with Shared Access Signatures. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str :param queue_acl: the acls for the queue. :type queue_acl: list[~azure.storage.queue.models.SignedIdentifier] + :keyword comp: comp. The default value is "acl". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -429,45 +433,39 @@ async def set_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "acl" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'wrapped': True}} + + comp = kwargs.pop('comp', "acl") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + + serialization_ctxt = {"xml": {'name': 'SignedIdentifiers', 'wrapped': True}} if queue_acl is not None: - body_content = self._serialize.body(queue_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) + _content = self._serialize.body(queue_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _content = None + + request = build_set_access_policy_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.set_access_policy.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -475,7 +473,9 @@ async def set_access_policy( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_access_policy.metadata = {'url': '/{queueName}'} # type: ignore + set_access_policy.metadata = {'url': "{url}/{queueName}"} # type: ignore + diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_service_operations.py index 777e1939eacb..e8e167237bc9 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,15 +6,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._service_operations import build_get_properties_request, build_get_statistics_request, build_list_queues_segment_request, build_set_properties_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -39,12 +42,13 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def set_properties( + @distributed_trace_async + async def set_properties( # pylint: disable=inconsistent-return-statements self, storage_service_properties: "_models.StorageServiceProperties", timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> None: """Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. @@ -52,12 +56,18 @@ async def set_properties( :param storage_service_properties: The StorageService properties. :type storage_service_properties: ~azure.storage.queue.models.StorageServiceProperties :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -68,70 +78,73 @@ async def set_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "properties" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + + _content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True) + + request = build_set_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.set_properties.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) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {'url': '/'} # type: ignore + set_properties.metadata = {'url': "{url}/"} # type: ignore + + @distributed_trace_async async def get_properties( self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.StorageServiceProperties": """gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties, or the result of cls(response) :rtype: ~azure.storage.queue.models.StorageServiceProperties @@ -142,68 +155,73 @@ async def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + + + request = build_get_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('StorageServiceProperties', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_properties.metadata = {'url': '/'} # type: ignore + get_properties.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace_async async def get_statistics( self, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.StorageServiceStats": """Retrieves statistics related to replication for the Queue service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "stats". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceStats, or the result of cls(response) :rtype: ~azure.storage.queue.models.StorageServiceStats @@ -214,52 +232,51 @@ async def get_statistics( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "stats" - accept = "application/xml" - - # Construct URL - url = self.get_statistics.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "stats") # type: str + + + request = build_get_statistics_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_statistics.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('StorageServiceStats', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_statistics.metadata = {'url': '/'} # type: ignore + get_statistics.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace_async async def list_queues_segment( self, prefix: Optional[str] = None, @@ -268,7 +285,7 @@ async def list_queues_segment( include: Optional[List[str]] = None, timeout: Optional[int] = None, request_id_parameter: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.ListQueuesSegmentResponse": """The List Queues Segment operation returns a list of the queues under the specified account. @@ -288,16 +305,19 @@ async def list_queues_segment( possible that the service will return fewer results than specified by maxresults, or than the default of 5000. :type maxresults: int - :param include: Include this parameter to specify that the queues's metadata be returned as - part of the response body. + :param include: Include this parameter to specify that the queues' metadata be returned as part + of the response body. :type include: list[str] :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListQueuesSegmentResponse, or the result of cls(response) :rtype: ~azure.storage.queue.models.ListQueuesSegmentResponse @@ -308,54 +328,48 @@ async def list_queues_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "list" - accept = "application/xml" - # Construct URL - url = self.list_queues_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if include is not None: - query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "list") # type: str + + + request = build_list_queues_segment_request( + url=self._config.url, + comp=comp, + version=self._config.version, + prefix=prefix, + marker=marker, + maxresults=maxresults, + include=include, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.list_queues_segment.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ListQueuesSegmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_queues_segment.metadata = {'url': '/'} # type: ignore + + list_queues_segment.metadata = {'url': "{url}/"} # type: ignore + diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_azure_queue_storage_enums.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_azure_queue_storage_enums.py index 90ef9930e957..d28690ef67fe 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_azure_queue_storage_enums.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_azure_queue_storage_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class GeoReplicationStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoReplicationStatusType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the secondary location """ @@ -34,7 +19,7 @@ class GeoReplicationStatusType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu BOOTSTRAP = "bootstrap" UNAVAILABLE = "unavailable" -class StorageErrorCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageErrorCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Error codes returned by the service """ diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models.py index 34a2c22165de..37e96fa77a99 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models.py @@ -13,12 +13,12 @@ class AccessPolicy(msrest.serialization.Model): """An Access policy. - :param start: the date-time the policy is active. - :type start: str - :param expiry: the date-time the policy expires. - :type expiry: str - :param permission: the permissions for the acl policy. - :type permission: str + :ivar start: the date-time the policy is active. + :vartype start: str + :ivar expiry: the date-time the policy expires. + :vartype expiry: str + :ivar permission: the permissions for the acl policy. + :vartype permission: str """ _attribute_map = { @@ -31,6 +31,14 @@ def __init__( self, **kwargs ): + """ + :keyword start: the date-time the policy is active. + :paramtype start: str + :keyword expiry: the date-time the policy expires. + :paramtype expiry: str + :keyword permission: the permissions for the acl policy. + :paramtype permission: str + """ super(AccessPolicy, self).__init__(**kwargs) self.start = kwargs.get('start', None) self.expiry = kwargs.get('expiry', None) @@ -42,24 +50,24 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. The origin domains that are permitted to make a request + :ivar allowed_origins: Required. The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS. - :type allowed_origins: str - :param allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + :vartype allowed_origins: str + :ivar allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated). - :type allowed_methods: str - :param allowed_headers: Required. the request headers that the origin domain may specify on the + :vartype allowed_methods: str + :ivar allowed_headers: Required. the request headers that the origin domain may specify on the CORS request. - :type allowed_headers: str - :param exposed_headers: Required. The response headers that may be sent in the response to the + :vartype allowed_headers: str + :ivar exposed_headers: Required. The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. - :type exposed_headers: str - :param max_age_in_seconds: Required. The maximum amount time that a browser should cache the + :vartype exposed_headers: str + :ivar max_age_in_seconds: Required. The maximum amount time that a browser should cache the preflight OPTIONS request. - :type max_age_in_seconds: int + :vartype max_age_in_seconds: int """ _validation = { @@ -82,6 +90,26 @@ def __init__( self, **kwargs ): + """ + :keyword allowed_origins: Required. The origin domains that are permitted to make a request + against the storage service via CORS. The origin domain is the domain from which the request + originates. Note that the origin must be an exact case-sensitive match with the origin that the + user age sends to the service. You can also use the wildcard character '*' to allow all origin + domains to make requests via CORS. + :paramtype allowed_origins: str + :keyword allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + use for a CORS request. (comma separated). + :paramtype allowed_methods: str + :keyword allowed_headers: Required. the request headers that the origin domain may specify on + the CORS request. + :paramtype allowed_headers: str + :keyword exposed_headers: Required. The response headers that may be sent in the response to + the CORS request and exposed by the browser to the request issuer. + :paramtype exposed_headers: str + :keyword max_age_in_seconds: Required. The maximum amount time that a browser should cache the + preflight OPTIONS request. + :paramtype max_age_in_seconds: int + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = kwargs['allowed_origins'] self.allowed_methods = kwargs['allowed_methods'] @@ -95,23 +123,23 @@ class DequeuedMessageItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param message_id: Required. The Id of the Message. - :type message_id: str - :param insertion_time: Required. The time the Message was inserted into the Queue. - :type insertion_time: ~datetime.datetime - :param expiration_time: Required. The time that the Message will expire and be automatically + :ivar message_id: Required. The Id of the Message. + :vartype message_id: str + :ivar insertion_time: Required. The time the Message was inserted into the Queue. + :vartype insertion_time: ~datetime.datetime + :ivar expiration_time: Required. The time that the Message will expire and be automatically deleted. - :type expiration_time: ~datetime.datetime - :param pop_receipt: Required. This value is required to delete the Message. If deletion fails + :vartype expiration_time: ~datetime.datetime + :ivar pop_receipt: Required. This value is required to delete the Message. If deletion fails using this popreceipt then the message has been dequeued by another client. - :type pop_receipt: str - :param time_next_visible: Required. The time that the message will again become visible in the + :vartype pop_receipt: str + :ivar time_next_visible: Required. The time that the message will again become visible in the Queue. - :type time_next_visible: ~datetime.datetime - :param dequeue_count: Required. The number of times the message has been dequeued. - :type dequeue_count: long - :param message_text: Required. The content of the Message. - :type message_text: str + :vartype time_next_visible: ~datetime.datetime + :ivar dequeue_count: Required. The number of times the message has been dequeued. + :vartype dequeue_count: long + :ivar message_text: Required. The content of the Message. + :vartype message_text: str """ _validation = { @@ -141,6 +169,25 @@ def __init__( self, **kwargs ): + """ + :keyword message_id: Required. The Id of the Message. + :paramtype message_id: str + :keyword insertion_time: Required. The time the Message was inserted into the Queue. + :paramtype insertion_time: ~datetime.datetime + :keyword expiration_time: Required. The time that the Message will expire and be automatically + deleted. + :paramtype expiration_time: ~datetime.datetime + :keyword pop_receipt: Required. This value is required to delete the Message. If deletion fails + using this popreceipt then the message has been dequeued by another client. + :paramtype pop_receipt: str + :keyword time_next_visible: Required. The time that the message will again become visible in + the Queue. + :paramtype time_next_visible: ~datetime.datetime + :keyword dequeue_count: Required. The number of times the message has been dequeued. + :paramtype dequeue_count: long + :keyword message_text: Required. The content of the Message. + :paramtype message_text: str + """ super(DequeuedMessageItem, self).__init__(**kwargs) self.message_id = kwargs['message_id'] self.insertion_time = kwargs['insertion_time'] @@ -156,19 +203,19 @@ class EnqueuedMessage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param message_id: Required. The Id of the Message. - :type message_id: str - :param insertion_time: Required. The time the Message was inserted into the Queue. - :type insertion_time: ~datetime.datetime - :param expiration_time: Required. The time that the Message will expire and be automatically + :ivar message_id: Required. The Id of the Message. + :vartype message_id: str + :ivar insertion_time: Required. The time the Message was inserted into the Queue. + :vartype insertion_time: ~datetime.datetime + :ivar expiration_time: Required. The time that the Message will expire and be automatically deleted. - :type expiration_time: ~datetime.datetime - :param pop_receipt: Required. This value is required to delete the Message. If deletion fails + :vartype expiration_time: ~datetime.datetime + :ivar pop_receipt: Required. This value is required to delete the Message. If deletion fails using this popreceipt then the message has been dequeued by another client. - :type pop_receipt: str - :param time_next_visible: Required. The time that the message will again become visible in the + :vartype pop_receipt: str + :ivar time_next_visible: Required. The time that the message will again become visible in the Queue. - :type time_next_visible: ~datetime.datetime + :vartype time_next_visible: ~datetime.datetime """ _validation = { @@ -194,6 +241,21 @@ def __init__( self, **kwargs ): + """ + :keyword message_id: Required. The Id of the Message. + :paramtype message_id: str + :keyword insertion_time: Required. The time the Message was inserted into the Queue. + :paramtype insertion_time: ~datetime.datetime + :keyword expiration_time: Required. The time that the Message will expire and be automatically + deleted. + :paramtype expiration_time: ~datetime.datetime + :keyword pop_receipt: Required. This value is required to delete the Message. If deletion fails + using this popreceipt then the message has been dequeued by another client. + :paramtype pop_receipt: str + :keyword time_next_visible: Required. The time that the message will again become visible in + the Queue. + :paramtype time_next_visible: ~datetime.datetime + """ super(EnqueuedMessage, self).__init__(**kwargs) self.message_id = kwargs['message_id'] self.insertion_time = kwargs['insertion_time'] @@ -207,13 +269,13 @@ class GeoReplication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. The status of the secondary location. Possible values include: "live", + :ivar status: Required. The status of the secondary location. Possible values include: "live", "bootstrap", "unavailable". - :type status: str or ~azure.storage.queue.models.GeoReplicationStatusType - :param last_sync_time: Required. A GMT date/time value, to the second. All primary writes + :vartype status: str or ~azure.storage.queue.models.GeoReplicationStatusType + :ivar last_sync_time: Required. A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads. - :type last_sync_time: ~datetime.datetime + :vartype last_sync_time: ~datetime.datetime """ _validation = { @@ -230,6 +292,15 @@ def __init__( self, **kwargs ): + """ + :keyword status: Required. The status of the secondary location. Possible values include: + "live", "bootstrap", "unavailable". + :paramtype status: str or ~azure.storage.queue.models.GeoReplicationStatusType + :keyword last_sync_time: Required. A GMT date/time value, to the second. All primary writes + preceding this value are guaranteed to be available for read operations at the secondary. + Primary writes after this point in time may or may not be available for reads. + :paramtype last_sync_time: ~datetime.datetime + """ super(GeoReplication, self).__init__(**kwargs) self.status = kwargs['status'] self.last_sync_time = kwargs['last_sync_time'] @@ -240,18 +311,18 @@ class ListQueuesSegmentResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param prefix: Required. - :type prefix: str - :param marker: - :type marker: str - :param max_results: Required. - :type max_results: int - :param queue_items: - :type queue_items: list[~azure.storage.queue.models.QueueItem] - :param next_marker: Required. - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar prefix: Required. + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: Required. + :vartype max_results: int + :ivar queue_items: + :vartype queue_items: list[~azure.storage.queue.models.QueueItem] + :ivar next_marker: Required. + :vartype next_marker: str """ _validation = { @@ -277,6 +348,20 @@ def __init__( self, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword prefix: Required. + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: Required. + :paramtype max_results: int + :keyword queue_items: + :paramtype queue_items: list[~azure.storage.queue.models.QueueItem] + :keyword next_marker: Required. + :paramtype next_marker: str + """ super(ListQueuesSegmentResponse, self).__init__(**kwargs) self.service_endpoint = kwargs['service_endpoint'] self.prefix = kwargs['prefix'] @@ -291,16 +376,16 @@ class Logging(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param version: Required. The version of Storage Analytics to configure. - :type version: str - :param delete: Required. Indicates whether all delete requests should be logged. - :type delete: bool - :param read: Required. Indicates whether all read requests should be logged. - :type read: bool - :param write: Required. Indicates whether all write requests should be logged. - :type write: bool - :param retention_policy: Required. the retention policy. - :type retention_policy: ~azure.storage.queue.models.RetentionPolicy + :ivar version: Required. The version of Storage Analytics to configure. + :vartype version: str + :ivar delete: Required. Indicates whether all delete requests should be logged. + :vartype delete: bool + :ivar read: Required. Indicates whether all read requests should be logged. + :vartype read: bool + :ivar write: Required. Indicates whether all write requests should be logged. + :vartype write: bool + :ivar retention_policy: Required. the retention policy. + :vartype retention_policy: ~azure.storage.queue.models.RetentionPolicy """ _validation = { @@ -323,6 +408,18 @@ def __init__( self, **kwargs ): + """ + :keyword version: Required. The version of Storage Analytics to configure. + :paramtype version: str + :keyword delete: Required. Indicates whether all delete requests should be logged. + :paramtype delete: bool + :keyword read: Required. Indicates whether all read requests should be logged. + :paramtype read: bool + :keyword write: Required. Indicates whether all write requests should be logged. + :paramtype write: bool + :keyword retention_policy: Required. the retention policy. + :paramtype retention_policy: ~azure.storage.queue.models.RetentionPolicy + """ super(Logging, self).__init__(**kwargs) self.version = kwargs['version'] self.delete = kwargs['delete'] @@ -332,19 +429,19 @@ def __init__( class Metrics(msrest.serialization.Model): - """Metrics. + """a summary of request statistics grouped by API in hour or minute aggregates for queues. All required parameters must be populated in order to send to Azure. - :param version: The version of Storage Analytics to configure. - :type version: str - :param enabled: Required. Indicates whether metrics are enabled for the Queue service. - :type enabled: bool - :param include_apis: Indicates whether metrics should generate summary statistics for called - API operations. - :type include_apis: bool - :param retention_policy: the retention policy. - :type retention_policy: ~azure.storage.queue.models.RetentionPolicy + :ivar version: The version of Storage Analytics to configure. + :vartype version: str + :ivar enabled: Required. Indicates whether metrics are enabled for the Queue service. + :vartype enabled: bool + :ivar include_apis: Indicates whether metrics should generate summary statistics for called API + operations. + :vartype include_apis: bool + :ivar retention_policy: the retention policy. + :vartype retention_policy: ~azure.storage.queue.models.RetentionPolicy """ _validation = { @@ -362,6 +459,17 @@ def __init__( self, **kwargs ): + """ + :keyword version: The version of Storage Analytics to configure. + :paramtype version: str + :keyword enabled: Required. Indicates whether metrics are enabled for the Queue service. + :paramtype enabled: bool + :keyword include_apis: Indicates whether metrics should generate summary statistics for called + API operations. + :paramtype include_apis: bool + :keyword retention_policy: the retention policy. + :paramtype retention_policy: ~azure.storage.queue.models.RetentionPolicy + """ super(Metrics, self).__init__(**kwargs) self.version = kwargs.get('version', None) self.enabled = kwargs['enabled'] @@ -374,17 +482,17 @@ class PeekedMessageItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param message_id: Required. The Id of the Message. - :type message_id: str - :param insertion_time: Required. The time the Message was inserted into the Queue. - :type insertion_time: ~datetime.datetime - :param expiration_time: Required. The time that the Message will expire and be automatically + :ivar message_id: Required. The Id of the Message. + :vartype message_id: str + :ivar insertion_time: Required. The time the Message was inserted into the Queue. + :vartype insertion_time: ~datetime.datetime + :ivar expiration_time: Required. The time that the Message will expire and be automatically deleted. - :type expiration_time: ~datetime.datetime - :param dequeue_count: Required. The number of times the message has been dequeued. - :type dequeue_count: long - :param message_text: Required. The content of the Message. - :type message_text: str + :vartype expiration_time: ~datetime.datetime + :ivar dequeue_count: Required. The number of times the message has been dequeued. + :vartype dequeue_count: long + :ivar message_text: Required. The content of the Message. + :vartype message_text: str """ _validation = { @@ -410,6 +518,19 @@ def __init__( self, **kwargs ): + """ + :keyword message_id: Required. The Id of the Message. + :paramtype message_id: str + :keyword insertion_time: Required. The time the Message was inserted into the Queue. + :paramtype insertion_time: ~datetime.datetime + :keyword expiration_time: Required. The time that the Message will expire and be automatically + deleted. + :paramtype expiration_time: ~datetime.datetime + :keyword dequeue_count: Required. The number of times the message has been dequeued. + :paramtype dequeue_count: long + :keyword message_text: Required. The content of the Message. + :paramtype message_text: str + """ super(PeekedMessageItem, self).__init__(**kwargs) self.message_id = kwargs['message_id'] self.insertion_time = kwargs['insertion_time'] @@ -423,10 +544,10 @@ class QueueItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the Queue. - :type name: str - :param metadata: Dictionary of :code:``. - :type metadata: dict[str, str] + :ivar name: Required. The name of the Queue. + :vartype name: str + :ivar metadata: Dictionary of :code:``. + :vartype metadata: dict[str, str] """ _validation = { @@ -445,6 +566,12 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The name of the Queue. + :paramtype name: str + :keyword metadata: Dictionary of :code:``. + :paramtype metadata: dict[str, str] + """ super(QueueItem, self).__init__(**kwargs) self.name = kwargs['name'] self.metadata = kwargs.get('metadata', None) @@ -455,8 +582,8 @@ class QueueMessage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param message_text: Required. The content of the message. - :type message_text: str + :ivar message_text: Required. The content of the message. + :vartype message_text: str """ _validation = { @@ -471,6 +598,10 @@ def __init__( self, **kwargs ): + """ + :keyword message_text: Required. The content of the message. + :paramtype message_text: str + """ super(QueueMessage, self).__init__(**kwargs) self.message_text = kwargs['message_text'] @@ -480,12 +611,12 @@ class RetentionPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Indicates whether a retention policy is enabled for the storage + :ivar enabled: Required. Indicates whether a retention policy is enabled for the storage service. - :type enabled: bool - :param days: Indicates the number of days that metrics or logging or soft-deleted data should - be retained. All data older than this value will be deleted. - :type days: int + :vartype enabled: bool + :ivar days: Indicates the number of days that metrics or logging or soft-deleted data should be + retained. All data older than this value will be deleted. + :vartype days: int """ _validation = { @@ -502,6 +633,14 @@ def __init__( self, **kwargs ): + """ + :keyword enabled: Required. Indicates whether a retention policy is enabled for the storage + service. + :paramtype enabled: bool + :keyword days: Indicates the number of days that metrics or logging or soft-deleted data should + be retained. All data older than this value will be deleted. + :paramtype days: int + """ super(RetentionPolicy, self).__init__(**kwargs) self.enabled = kwargs['enabled'] self.days = kwargs.get('days', None) @@ -512,10 +651,10 @@ class SignedIdentifier(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. a unique id. - :type id: str - :param access_policy: The access policy. - :type access_policy: ~azure.storage.queue.models.AccessPolicy + :ivar id: Required. a unique id. + :vartype id: str + :ivar access_policy: The access policy. + :vartype access_policy: ~azure.storage.queue.models.AccessPolicy """ _validation = { @@ -531,6 +670,12 @@ def __init__( self, **kwargs ): + """ + :keyword id: Required. a unique id. + :paramtype id: str + :keyword access_policy: The access policy. + :paramtype access_policy: ~azure.storage.queue.models.AccessPolicy + """ super(SignedIdentifier, self).__init__(**kwargs) self.id = kwargs['id'] self.access_policy = kwargs.get('access_policy', None) @@ -539,8 +684,8 @@ def __init__( class StorageError(msrest.serialization.Model): """StorageError. - :param message: - :type message: str + :ivar message: + :vartype message: str """ _attribute_map = { @@ -551,6 +696,10 @@ def __init__( self, **kwargs ): + """ + :keyword message: + :paramtype message: str + """ super(StorageError, self).__init__(**kwargs) self.message = kwargs.get('message', None) @@ -558,16 +707,16 @@ def __init__( class StorageServiceProperties(msrest.serialization.Model): """Storage Service Properties. - :param logging: Azure Analytics Logging settings. - :type logging: ~azure.storage.queue.models.Logging - :param hour_metrics: A summary of request statistics grouped by API in hourly aggregates for + :ivar logging: Azure Analytics Logging settings. + :vartype logging: ~azure.storage.queue.models.Logging + :ivar hour_metrics: A summary of request statistics grouped by API in hourly aggregates for queues. - :type hour_metrics: ~azure.storage.queue.models.Metrics - :param minute_metrics: a summary of request statistics grouped by API in minute aggregates for + :vartype hour_metrics: ~azure.storage.queue.models.Metrics + :ivar minute_metrics: a summary of request statistics grouped by API in minute aggregates for queues. - :type minute_metrics: ~azure.storage.queue.models.Metrics - :param cors: The set of CORS rules. - :type cors: list[~azure.storage.queue.models.CorsRule] + :vartype minute_metrics: ~azure.storage.queue.models.Metrics + :ivar cors: The set of CORS rules. + :vartype cors: list[~azure.storage.queue.models.CorsRule] """ _attribute_map = { @@ -581,6 +730,18 @@ def __init__( self, **kwargs ): + """ + :keyword logging: Azure Analytics Logging settings. + :paramtype logging: ~azure.storage.queue.models.Logging + :keyword hour_metrics: A summary of request statistics grouped by API in hourly aggregates for + queues. + :paramtype hour_metrics: ~azure.storage.queue.models.Metrics + :keyword minute_metrics: a summary of request statistics grouped by API in minute aggregates + for queues. + :paramtype minute_metrics: ~azure.storage.queue.models.Metrics + :keyword cors: The set of CORS rules. + :paramtype cors: list[~azure.storage.queue.models.CorsRule] + """ super(StorageServiceProperties, self).__init__(**kwargs) self.logging = kwargs.get('logging', None) self.hour_metrics = kwargs.get('hour_metrics', None) @@ -591,8 +752,8 @@ def __init__( class StorageServiceStats(msrest.serialization.Model): """Stats for the storage service. - :param geo_replication: Geo-Replication information for the Secondary Storage Service. - :type geo_replication: ~azure.storage.queue.models.GeoReplication + :ivar geo_replication: Geo-Replication information for the Secondary Storage Service. + :vartype geo_replication: ~azure.storage.queue.models.GeoReplication """ _attribute_map = { @@ -603,5 +764,9 @@ def __init__( self, **kwargs ): + """ + :keyword geo_replication: Geo-Replication information for the Secondary Storage Service. + :paramtype geo_replication: ~azure.storage.queue.models.GeoReplication + """ super(StorageServiceStats, self).__init__(**kwargs) self.geo_replication = kwargs.get('geo_replication', None) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models_py3.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models_py3.py index b4000bfdd284..698ad0dc0d08 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models_py3.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/models/_models_py3.py @@ -18,12 +18,12 @@ class AccessPolicy(msrest.serialization.Model): """An Access policy. - :param start: the date-time the policy is active. - :type start: str - :param expiry: the date-time the policy expires. - :type expiry: str - :param permission: the permissions for the acl policy. - :type permission: str + :ivar start: the date-time the policy is active. + :vartype start: str + :ivar expiry: the date-time the policy expires. + :vartype expiry: str + :ivar permission: the permissions for the acl policy. + :vartype permission: str """ _attribute_map = { @@ -40,6 +40,14 @@ def __init__( permission: Optional[str] = None, **kwargs ): + """ + :keyword start: the date-time the policy is active. + :paramtype start: str + :keyword expiry: the date-time the policy expires. + :paramtype expiry: str + :keyword permission: the permissions for the acl policy. + :paramtype permission: str + """ super(AccessPolicy, self).__init__(**kwargs) self.start = start self.expiry = expiry @@ -51,24 +59,24 @@ class CorsRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param allowed_origins: Required. The origin domains that are permitted to make a request + :ivar allowed_origins: Required. The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS. - :type allowed_origins: str - :param allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + :vartype allowed_origins: str + :ivar allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated). - :type allowed_methods: str - :param allowed_headers: Required. the request headers that the origin domain may specify on the + :vartype allowed_methods: str + :ivar allowed_headers: Required. the request headers that the origin domain may specify on the CORS request. - :type allowed_headers: str - :param exposed_headers: Required. The response headers that may be sent in the response to the + :vartype allowed_headers: str + :ivar exposed_headers: Required. The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. - :type exposed_headers: str - :param max_age_in_seconds: Required. The maximum amount time that a browser should cache the + :vartype exposed_headers: str + :ivar max_age_in_seconds: Required. The maximum amount time that a browser should cache the preflight OPTIONS request. - :type max_age_in_seconds: int + :vartype max_age_in_seconds: int """ _validation = { @@ -97,6 +105,26 @@ def __init__( max_age_in_seconds: int, **kwargs ): + """ + :keyword allowed_origins: Required. The origin domains that are permitted to make a request + against the storage service via CORS. The origin domain is the domain from which the request + originates. Note that the origin must be an exact case-sensitive match with the origin that the + user age sends to the service. You can also use the wildcard character '*' to allow all origin + domains to make requests via CORS. + :paramtype allowed_origins: str + :keyword allowed_methods: Required. The methods (HTTP request verbs) that the origin domain may + use for a CORS request. (comma separated). + :paramtype allowed_methods: str + :keyword allowed_headers: Required. the request headers that the origin domain may specify on + the CORS request. + :paramtype allowed_headers: str + :keyword exposed_headers: Required. The response headers that may be sent in the response to + the CORS request and exposed by the browser to the request issuer. + :paramtype exposed_headers: str + :keyword max_age_in_seconds: Required. The maximum amount time that a browser should cache the + preflight OPTIONS request. + :paramtype max_age_in_seconds: int + """ super(CorsRule, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -110,23 +138,23 @@ class DequeuedMessageItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param message_id: Required. The Id of the Message. - :type message_id: str - :param insertion_time: Required. The time the Message was inserted into the Queue. - :type insertion_time: ~datetime.datetime - :param expiration_time: Required. The time that the Message will expire and be automatically + :ivar message_id: Required. The Id of the Message. + :vartype message_id: str + :ivar insertion_time: Required. The time the Message was inserted into the Queue. + :vartype insertion_time: ~datetime.datetime + :ivar expiration_time: Required. The time that the Message will expire and be automatically deleted. - :type expiration_time: ~datetime.datetime - :param pop_receipt: Required. This value is required to delete the Message. If deletion fails + :vartype expiration_time: ~datetime.datetime + :ivar pop_receipt: Required. This value is required to delete the Message. If deletion fails using this popreceipt then the message has been dequeued by another client. - :type pop_receipt: str - :param time_next_visible: Required. The time that the message will again become visible in the + :vartype pop_receipt: str + :ivar time_next_visible: Required. The time that the message will again become visible in the Queue. - :type time_next_visible: ~datetime.datetime - :param dequeue_count: Required. The number of times the message has been dequeued. - :type dequeue_count: long - :param message_text: Required. The content of the Message. - :type message_text: str + :vartype time_next_visible: ~datetime.datetime + :ivar dequeue_count: Required. The number of times the message has been dequeued. + :vartype dequeue_count: long + :ivar message_text: Required. The content of the Message. + :vartype message_text: str """ _validation = { @@ -164,6 +192,25 @@ def __init__( message_text: str, **kwargs ): + """ + :keyword message_id: Required. The Id of the Message. + :paramtype message_id: str + :keyword insertion_time: Required. The time the Message was inserted into the Queue. + :paramtype insertion_time: ~datetime.datetime + :keyword expiration_time: Required. The time that the Message will expire and be automatically + deleted. + :paramtype expiration_time: ~datetime.datetime + :keyword pop_receipt: Required. This value is required to delete the Message. If deletion fails + using this popreceipt then the message has been dequeued by another client. + :paramtype pop_receipt: str + :keyword time_next_visible: Required. The time that the message will again become visible in + the Queue. + :paramtype time_next_visible: ~datetime.datetime + :keyword dequeue_count: Required. The number of times the message has been dequeued. + :paramtype dequeue_count: long + :keyword message_text: Required. The content of the Message. + :paramtype message_text: str + """ super(DequeuedMessageItem, self).__init__(**kwargs) self.message_id = message_id self.insertion_time = insertion_time @@ -179,19 +226,19 @@ class EnqueuedMessage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param message_id: Required. The Id of the Message. - :type message_id: str - :param insertion_time: Required. The time the Message was inserted into the Queue. - :type insertion_time: ~datetime.datetime - :param expiration_time: Required. The time that the Message will expire and be automatically + :ivar message_id: Required. The Id of the Message. + :vartype message_id: str + :ivar insertion_time: Required. The time the Message was inserted into the Queue. + :vartype insertion_time: ~datetime.datetime + :ivar expiration_time: Required. The time that the Message will expire and be automatically deleted. - :type expiration_time: ~datetime.datetime - :param pop_receipt: Required. This value is required to delete the Message. If deletion fails + :vartype expiration_time: ~datetime.datetime + :ivar pop_receipt: Required. This value is required to delete the Message. If deletion fails using this popreceipt then the message has been dequeued by another client. - :type pop_receipt: str - :param time_next_visible: Required. The time that the message will again become visible in the + :vartype pop_receipt: str + :ivar time_next_visible: Required. The time that the message will again become visible in the Queue. - :type time_next_visible: ~datetime.datetime + :vartype time_next_visible: ~datetime.datetime """ _validation = { @@ -223,6 +270,21 @@ def __init__( time_next_visible: datetime.datetime, **kwargs ): + """ + :keyword message_id: Required. The Id of the Message. + :paramtype message_id: str + :keyword insertion_time: Required. The time the Message was inserted into the Queue. + :paramtype insertion_time: ~datetime.datetime + :keyword expiration_time: Required. The time that the Message will expire and be automatically + deleted. + :paramtype expiration_time: ~datetime.datetime + :keyword pop_receipt: Required. This value is required to delete the Message. If deletion fails + using this popreceipt then the message has been dequeued by another client. + :paramtype pop_receipt: str + :keyword time_next_visible: Required. The time that the message will again become visible in + the Queue. + :paramtype time_next_visible: ~datetime.datetime + """ super(EnqueuedMessage, self).__init__(**kwargs) self.message_id = message_id self.insertion_time = insertion_time @@ -236,13 +298,13 @@ class GeoReplication(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. The status of the secondary location. Possible values include: "live", + :ivar status: Required. The status of the secondary location. Possible values include: "live", "bootstrap", "unavailable". - :type status: str or ~azure.storage.queue.models.GeoReplicationStatusType - :param last_sync_time: Required. A GMT date/time value, to the second. All primary writes + :vartype status: str or ~azure.storage.queue.models.GeoReplicationStatusType + :ivar last_sync_time: Required. A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads. - :type last_sync_time: ~datetime.datetime + :vartype last_sync_time: ~datetime.datetime """ _validation = { @@ -262,6 +324,15 @@ def __init__( last_sync_time: datetime.datetime, **kwargs ): + """ + :keyword status: Required. The status of the secondary location. Possible values include: + "live", "bootstrap", "unavailable". + :paramtype status: str or ~azure.storage.queue.models.GeoReplicationStatusType + :keyword last_sync_time: Required. A GMT date/time value, to the second. All primary writes + preceding this value are guaranteed to be available for read operations at the secondary. + Primary writes after this point in time may or may not be available for reads. + :paramtype last_sync_time: ~datetime.datetime + """ super(GeoReplication, self).__init__(**kwargs) self.status = status self.last_sync_time = last_sync_time @@ -272,18 +343,18 @@ class ListQueuesSegmentResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param service_endpoint: Required. - :type service_endpoint: str - :param prefix: Required. - :type prefix: str - :param marker: - :type marker: str - :param max_results: Required. - :type max_results: int - :param queue_items: - :type queue_items: list[~azure.storage.queue.models.QueueItem] - :param next_marker: Required. - :type next_marker: str + :ivar service_endpoint: Required. + :vartype service_endpoint: str + :ivar prefix: Required. + :vartype prefix: str + :ivar marker: + :vartype marker: str + :ivar max_results: Required. + :vartype max_results: int + :ivar queue_items: + :vartype queue_items: list[~azure.storage.queue.models.QueueItem] + :ivar next_marker: Required. + :vartype next_marker: str """ _validation = { @@ -316,6 +387,20 @@ def __init__( queue_items: Optional[List["QueueItem"]] = None, **kwargs ): + """ + :keyword service_endpoint: Required. + :paramtype service_endpoint: str + :keyword prefix: Required. + :paramtype prefix: str + :keyword marker: + :paramtype marker: str + :keyword max_results: Required. + :paramtype max_results: int + :keyword queue_items: + :paramtype queue_items: list[~azure.storage.queue.models.QueueItem] + :keyword next_marker: Required. + :paramtype next_marker: str + """ super(ListQueuesSegmentResponse, self).__init__(**kwargs) self.service_endpoint = service_endpoint self.prefix = prefix @@ -330,16 +415,16 @@ class Logging(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param version: Required. The version of Storage Analytics to configure. - :type version: str - :param delete: Required. Indicates whether all delete requests should be logged. - :type delete: bool - :param read: Required. Indicates whether all read requests should be logged. - :type read: bool - :param write: Required. Indicates whether all write requests should be logged. - :type write: bool - :param retention_policy: Required. the retention policy. - :type retention_policy: ~azure.storage.queue.models.RetentionPolicy + :ivar version: Required. The version of Storage Analytics to configure. + :vartype version: str + :ivar delete: Required. Indicates whether all delete requests should be logged. + :vartype delete: bool + :ivar read: Required. Indicates whether all read requests should be logged. + :vartype read: bool + :ivar write: Required. Indicates whether all write requests should be logged. + :vartype write: bool + :ivar retention_policy: Required. the retention policy. + :vartype retention_policy: ~azure.storage.queue.models.RetentionPolicy """ _validation = { @@ -368,6 +453,18 @@ def __init__( retention_policy: "RetentionPolicy", **kwargs ): + """ + :keyword version: Required. The version of Storage Analytics to configure. + :paramtype version: str + :keyword delete: Required. Indicates whether all delete requests should be logged. + :paramtype delete: bool + :keyword read: Required. Indicates whether all read requests should be logged. + :paramtype read: bool + :keyword write: Required. Indicates whether all write requests should be logged. + :paramtype write: bool + :keyword retention_policy: Required. the retention policy. + :paramtype retention_policy: ~azure.storage.queue.models.RetentionPolicy + """ super(Logging, self).__init__(**kwargs) self.version = version self.delete = delete @@ -377,19 +474,19 @@ def __init__( class Metrics(msrest.serialization.Model): - """Metrics. + """a summary of request statistics grouped by API in hour or minute aggregates for queues. All required parameters must be populated in order to send to Azure. - :param version: The version of Storage Analytics to configure. - :type version: str - :param enabled: Required. Indicates whether metrics are enabled for the Queue service. - :type enabled: bool - :param include_apis: Indicates whether metrics should generate summary statistics for called - API operations. - :type include_apis: bool - :param retention_policy: the retention policy. - :type retention_policy: ~azure.storage.queue.models.RetentionPolicy + :ivar version: The version of Storage Analytics to configure. + :vartype version: str + :ivar enabled: Required. Indicates whether metrics are enabled for the Queue service. + :vartype enabled: bool + :ivar include_apis: Indicates whether metrics should generate summary statistics for called API + operations. + :vartype include_apis: bool + :ivar retention_policy: the retention policy. + :vartype retention_policy: ~azure.storage.queue.models.RetentionPolicy """ _validation = { @@ -412,6 +509,17 @@ def __init__( retention_policy: Optional["RetentionPolicy"] = None, **kwargs ): + """ + :keyword version: The version of Storage Analytics to configure. + :paramtype version: str + :keyword enabled: Required. Indicates whether metrics are enabled for the Queue service. + :paramtype enabled: bool + :keyword include_apis: Indicates whether metrics should generate summary statistics for called + API operations. + :paramtype include_apis: bool + :keyword retention_policy: the retention policy. + :paramtype retention_policy: ~azure.storage.queue.models.RetentionPolicy + """ super(Metrics, self).__init__(**kwargs) self.version = version self.enabled = enabled @@ -424,17 +532,17 @@ class PeekedMessageItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param message_id: Required. The Id of the Message. - :type message_id: str - :param insertion_time: Required. The time the Message was inserted into the Queue. - :type insertion_time: ~datetime.datetime - :param expiration_time: Required. The time that the Message will expire and be automatically + :ivar message_id: Required. The Id of the Message. + :vartype message_id: str + :ivar insertion_time: Required. The time the Message was inserted into the Queue. + :vartype insertion_time: ~datetime.datetime + :ivar expiration_time: Required. The time that the Message will expire and be automatically deleted. - :type expiration_time: ~datetime.datetime - :param dequeue_count: Required. The number of times the message has been dequeued. - :type dequeue_count: long - :param message_text: Required. The content of the Message. - :type message_text: str + :vartype expiration_time: ~datetime.datetime + :ivar dequeue_count: Required. The number of times the message has been dequeued. + :vartype dequeue_count: long + :ivar message_text: Required. The content of the Message. + :vartype message_text: str """ _validation = { @@ -466,6 +574,19 @@ def __init__( message_text: str, **kwargs ): + """ + :keyword message_id: Required. The Id of the Message. + :paramtype message_id: str + :keyword insertion_time: Required. The time the Message was inserted into the Queue. + :paramtype insertion_time: ~datetime.datetime + :keyword expiration_time: Required. The time that the Message will expire and be automatically + deleted. + :paramtype expiration_time: ~datetime.datetime + :keyword dequeue_count: Required. The number of times the message has been dequeued. + :paramtype dequeue_count: long + :keyword message_text: Required. The content of the Message. + :paramtype message_text: str + """ super(PeekedMessageItem, self).__init__(**kwargs) self.message_id = message_id self.insertion_time = insertion_time @@ -479,10 +600,10 @@ class QueueItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the Queue. - :type name: str - :param metadata: Dictionary of :code:``. - :type metadata: dict[str, str] + :ivar name: Required. The name of the Queue. + :vartype name: str + :ivar metadata: Dictionary of :code:``. + :vartype metadata: dict[str, str] """ _validation = { @@ -504,6 +625,12 @@ def __init__( metadata: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword name: Required. The name of the Queue. + :paramtype name: str + :keyword metadata: Dictionary of :code:``. + :paramtype metadata: dict[str, str] + """ super(QueueItem, self).__init__(**kwargs) self.name = name self.metadata = metadata @@ -514,8 +641,8 @@ class QueueMessage(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param message_text: Required. The content of the message. - :type message_text: str + :ivar message_text: Required. The content of the message. + :vartype message_text: str """ _validation = { @@ -532,6 +659,10 @@ def __init__( message_text: str, **kwargs ): + """ + :keyword message_text: Required. The content of the message. + :paramtype message_text: str + """ super(QueueMessage, self).__init__(**kwargs) self.message_text = message_text @@ -541,12 +672,12 @@ class RetentionPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param enabled: Required. Indicates whether a retention policy is enabled for the storage + :ivar enabled: Required. Indicates whether a retention policy is enabled for the storage service. - :type enabled: bool - :param days: Indicates the number of days that metrics or logging or soft-deleted data should - be retained. All data older than this value will be deleted. - :type days: int + :vartype enabled: bool + :ivar days: Indicates the number of days that metrics or logging or soft-deleted data should be + retained. All data older than this value will be deleted. + :vartype days: int """ _validation = { @@ -566,6 +697,14 @@ def __init__( days: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Required. Indicates whether a retention policy is enabled for the storage + service. + :paramtype enabled: bool + :keyword days: Indicates the number of days that metrics or logging or soft-deleted data should + be retained. All data older than this value will be deleted. + :paramtype days: int + """ super(RetentionPolicy, self).__init__(**kwargs) self.enabled = enabled self.days = days @@ -576,10 +715,10 @@ class SignedIdentifier(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. a unique id. - :type id: str - :param access_policy: The access policy. - :type access_policy: ~azure.storage.queue.models.AccessPolicy + :ivar id: Required. a unique id. + :vartype id: str + :ivar access_policy: The access policy. + :vartype access_policy: ~azure.storage.queue.models.AccessPolicy """ _validation = { @@ -598,6 +737,12 @@ def __init__( access_policy: Optional["AccessPolicy"] = None, **kwargs ): + """ + :keyword id: Required. a unique id. + :paramtype id: str + :keyword access_policy: The access policy. + :paramtype access_policy: ~azure.storage.queue.models.AccessPolicy + """ super(SignedIdentifier, self).__init__(**kwargs) self.id = id self.access_policy = access_policy @@ -606,8 +751,8 @@ def __init__( class StorageError(msrest.serialization.Model): """StorageError. - :param message: - :type message: str + :ivar message: + :vartype message: str """ _attribute_map = { @@ -620,6 +765,10 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword message: + :paramtype message: str + """ super(StorageError, self).__init__(**kwargs) self.message = message @@ -627,16 +776,16 @@ def __init__( class StorageServiceProperties(msrest.serialization.Model): """Storage Service Properties. - :param logging: Azure Analytics Logging settings. - :type logging: ~azure.storage.queue.models.Logging - :param hour_metrics: A summary of request statistics grouped by API in hourly aggregates for + :ivar logging: Azure Analytics Logging settings. + :vartype logging: ~azure.storage.queue.models.Logging + :ivar hour_metrics: A summary of request statistics grouped by API in hourly aggregates for queues. - :type hour_metrics: ~azure.storage.queue.models.Metrics - :param minute_metrics: a summary of request statistics grouped by API in minute aggregates for + :vartype hour_metrics: ~azure.storage.queue.models.Metrics + :ivar minute_metrics: a summary of request statistics grouped by API in minute aggregates for queues. - :type minute_metrics: ~azure.storage.queue.models.Metrics - :param cors: The set of CORS rules. - :type cors: list[~azure.storage.queue.models.CorsRule] + :vartype minute_metrics: ~azure.storage.queue.models.Metrics + :ivar cors: The set of CORS rules. + :vartype cors: list[~azure.storage.queue.models.CorsRule] """ _attribute_map = { @@ -655,6 +804,18 @@ def __init__( cors: Optional[List["CorsRule"]] = None, **kwargs ): + """ + :keyword logging: Azure Analytics Logging settings. + :paramtype logging: ~azure.storage.queue.models.Logging + :keyword hour_metrics: A summary of request statistics grouped by API in hourly aggregates for + queues. + :paramtype hour_metrics: ~azure.storage.queue.models.Metrics + :keyword minute_metrics: a summary of request statistics grouped by API in minute aggregates + for queues. + :paramtype minute_metrics: ~azure.storage.queue.models.Metrics + :keyword cors: The set of CORS rules. + :paramtype cors: list[~azure.storage.queue.models.CorsRule] + """ super(StorageServiceProperties, self).__init__(**kwargs) self.logging = logging self.hour_metrics = hour_metrics @@ -665,8 +826,8 @@ def __init__( class StorageServiceStats(msrest.serialization.Model): """Stats for the storage service. - :param geo_replication: Geo-Replication information for the Secondary Storage Service. - :type geo_replication: ~azure.storage.queue.models.GeoReplication + :ivar geo_replication: Geo-Replication information for the Secondary Storage Service. + :vartype geo_replication: ~azure.storage.queue.models.GeoReplication """ _attribute_map = { @@ -679,5 +840,9 @@ def __init__( geo_replication: Optional["GeoReplication"] = None, **kwargs ): + """ + :keyword geo_replication: Geo-Replication information for the Secondary Storage Service. + :paramtype geo_replication: ~azure.storage.queue.models.GeoReplication + """ super(StorageServiceStats, self).__init__(**kwargs) self.geo_replication = geo_replication diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_message_id_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_message_id_operations.py index 0d1a4a7f7d7b..fb5e01abad45 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_message_id_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_message_id_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,21 +7,115 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - + from typing import Any, Callable, Dict, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_update_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2018-03-28") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + pop_receipt = kwargs.pop('pop_receipt') # type: str + visibilitytimeout = kwargs.pop('visibilitytimeout') # type: int + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{queueName}/messages/{messageid}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['popreceipt'] = _SERIALIZER.query("pop_receipt", pop_receipt, 'str') + _query_parameters['visibilitytimeout'] = _SERIALIZER.query("visibilitytimeout", visibilitytimeout, 'int', maximum=604800, minimum=0) + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2018-03-28") # type: str + pop_receipt = kwargs.pop('pop_receipt') # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{queueName}/messages/{messageid}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['popreceipt'] = _SERIALIZER.query("pop_receipt", pop_receipt, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class MessageIdOperations(object): """MessageIdOperations operations. @@ -43,7 +138,8 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def update( + @distributed_trace + def update( # pylint: disable=inconsistent-return-statements self, pop_receipt, # type: str visibilitytimeout, # type: int @@ -69,8 +165,8 @@ def update( later than the expiry time. :type visibilitytimeout: int :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -87,44 +183,38 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['popreceipt'] = self._serialize.query("pop_receipt", pop_receipt, 'str') - query_parameters['visibilitytimeout'] = self._serialize.query("visibilitytimeout", visibilitytimeout, 'int', maximum=604800, minimum=0) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + if queue_message is not None: - body_content = self._serialize.body(queue_message, 'QueueMessage', is_xml=True) + _content = self._serialize.body(queue_message, 'QueueMessage', is_xml=True) else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _content = None + + request = build_update_request( + url=self._config.url, + version=self._config.version, + content_type=content_type, + pop_receipt=pop_receipt, + visibilitytimeout=visibilitytimeout, + content=_content, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.update.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -134,12 +224,15 @@ def update( response_headers['x-ms-popreceipt']=self._deserialize('str', response.headers.get('x-ms-popreceipt')) response_headers['x-ms-time-next-visible']=self._deserialize('rfc-1123', response.headers.get('x-ms-time-next-visible')) + if cls: return cls(pipeline_response, None, response_headers) - update.metadata = {'url': '/{queueName}/messages/{messageid}'} # type: ignore + update.metadata = {'url': "{url}/{queueName}/messages/{messageid}"} # type: ignore + - def delete( + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, pop_receipt, # type: str timeout=None, # type: Optional[int] @@ -153,8 +246,8 @@ def delete( call to the Get Messages or Update Message operation. :type pop_receipt: str :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -169,35 +262,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/xml" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['popreceipt'] = self._serialize.query("pop_receipt", pop_receipt, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_delete_request( + url=self._config.url, + version=self._config.version, + pop_receipt=pop_receipt, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.delete.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -205,7 +292,9 @@ def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{queueName}/messages/{messageid}'} # type: ignore + delete.metadata = {'url': "{url}/{queueName}/messages/{messageid}"} # type: ignore + diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py index 0849705219a7..5cff867c3b36 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,21 +7,204 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - + from typing import Any, Callable, Dict, List, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_dequeue_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2018-03-28") # type: str + number_of_messages = kwargs.pop('number_of_messages', None) # type: Optional[int] + visibilitytimeout = kwargs.pop('visibilitytimeout', None) # type: Optional[int] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{queueName}/messages") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if number_of_messages is not None: + _query_parameters['numofmessages'] = _SERIALIZER.query("number_of_messages", number_of_messages, 'int', minimum=1) + if visibilitytimeout is not None: + _query_parameters['visibilitytimeout'] = _SERIALIZER.query("visibilitytimeout", visibilitytimeout, 'int', maximum=604800, minimum=0) + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_clear_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2018-03-28") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{queueName}/messages") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_enqueue_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2018-03-28") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + visibilitytimeout = kwargs.pop('visibilitytimeout', None) # type: Optional[int] + message_time_to_live = kwargs.pop('message_time_to_live', None) # type: Optional[int] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{queueName}/messages") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if visibilitytimeout is not None: + _query_parameters['visibilitytimeout'] = _SERIALIZER.query("visibilitytimeout", visibilitytimeout, 'int', maximum=604800, minimum=0) + if message_time_to_live is not None: + _query_parameters['messagettl'] = _SERIALIZER.query("message_time_to_live", message_time_to_live, 'int', minimum=-1) + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_peek_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + peekonly = kwargs.pop('peekonly', "true") # type: str + version = kwargs.pop('version', "2018-03-28") # type: str + number_of_messages = kwargs.pop('number_of_messages', None) # type: Optional[int] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{queueName}/messages") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['peekonly'] = _SERIALIZER.query("peekonly", peekonly, 'str') + if number_of_messages is not None: + _query_parameters['numofmessages'] = _SERIALIZER.query("number_of_messages", number_of_messages, 'int', minimum=1) + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class MessagesOperations(object): """MessagesOperations operations. @@ -43,6 +227,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def dequeue( self, number_of_messages=None, # type: Optional[int] @@ -66,8 +251,8 @@ def dequeue( later than the expiry time. :type visibilitytimeout: int :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -82,53 +267,49 @@ def dequeue( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/xml" - # Construct URL - url = self.dequeue.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if number_of_messages is not None: - query_parameters['numofmessages'] = self._serialize.query("number_of_messages", number_of_messages, 'int', minimum=1) - if visibilitytimeout is not None: - query_parameters['visibilitytimeout'] = self._serialize.query("visibilitytimeout", visibilitytimeout, 'int', maximum=604800, minimum=0) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_dequeue_request( + url=self._config.url, + version=self._config.version, + number_of_messages=number_of_messages, + visibilitytimeout=visibilitytimeout, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.dequeue.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[DequeuedMessageItem]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - dequeue.metadata = {'url': '/{queueName}/messages'} # type: ignore - def clear( + dequeue.metadata = {'url': "{url}/{queueName}/messages"} # type: ignore + + + @distributed_trace + def clear( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -138,8 +319,8 @@ def clear( """The Clear operation deletes all messages from the specified queue. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -154,34 +335,28 @@ def clear( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/xml" - # Construct URL - url = self.clear.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_clear_request( + url=self._config.url, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.clear.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -189,11 +364,14 @@ def clear( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - clear.metadata = {'url': '/{queueName}/messages'} # type: ignore + clear.metadata = {'url': "{url}/{queueName}/messages"} # type: ignore + + @distributed_trace def enqueue( self, queue_message, # type: "_models.QueueMessage" @@ -212,9 +390,9 @@ def enqueue( :param queue_message: A Message object which can be stored in a Queue. :type queue_message: ~azure.storage.queue.models.QueueMessage - :param visibilitytimeout: Optional. If specified, the request must be made using an x-ms- - version of 2011-08-18 or later. If not specified, the default value is 0. Specifies the new - visibility timeout value, in seconds, relative to server time. The new value must be larger + :param visibilitytimeout: Optional. If specified, the request must be made using an + x-ms-version of 2011-08-18 or later. If not specified, the default value is 0. Specifies the + new visibility timeout value, in seconds, relative to server time. The new value must be larger than or equal to 0, and cannot be larger than 7 days. The visibility timeout of a message cannot be set to a value later than the expiry time. visibilitytimeout should be set to a value smaller than the time-to-live value. @@ -222,12 +400,12 @@ def enqueue( :param message_time_to_live: Optional. Specifies the time-to-live interval for the message, in seconds. Prior to version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum time-to-live can be any positive number, as well as -1 - indicating that the message does not expire. If this parameter is omitted, the default time-to- - live is 7 days. + indicating that the message does not expire. If this parameter is omitted, the default + time-to-live is 7 days. :type message_time_to_live: int :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -242,57 +420,53 @@ def enqueue( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - # Construct URL - url = self.enqueue.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if visibilitytimeout is not None: - query_parameters['visibilitytimeout'] = self._serialize.query("visibilitytimeout", visibilitytimeout, 'int', maximum=604800, minimum=0) - if message_time_to_live is not None: - query_parameters['messagettl'] = self._serialize.query("message_time_to_live", message_time_to_live, 'int', minimum=-1) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(queue_message, 'QueueMessage', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + + _content = self._serialize.body(queue_message, 'QueueMessage', is_xml=True) + + request = build_enqueue_request( + url=self._config.url, + version=self._config.version, + content_type=content_type, + content=_content, + visibilitytimeout=visibilitytimeout, + message_time_to_live=message_time_to_live, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.enqueue.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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[EnqueuedMessage]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - enqueue.metadata = {'url': '/{queueName}/messages'} # type: ignore + enqueue.metadata = {'url': "{url}/{queueName}/messages"} # type: ignore + + + @distributed_trace def peek( self, number_of_messages=None, # type: Optional[int] @@ -310,12 +484,15 @@ def peek( operation. :type number_of_messages: int :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword peekonly: Peek message(s). The default value is "true". Note that overriding this + default value may result in unsupported behavior. + :paramtype peekonly: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of PeekedMessageItem, or the result of cls(response) :rtype: list[~azure.storage.queue.models.PeekedMessageItem] @@ -326,48 +503,45 @@ def peek( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - peekonly = "true" - accept = "application/xml" - # Construct URL - url = self.peek.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['peekonly'] = self._serialize.query("peekonly", peekonly, 'str') - if number_of_messages is not None: - query_parameters['numofmessages'] = self._serialize.query("number_of_messages", number_of_messages, 'int', minimum=1) - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + peekonly = kwargs.pop('peekonly', "true") # type: str + + + request = build_peek_request( + url=self._config.url, + peekonly=peekonly, + version=self._config.version, + number_of_messages=number_of_messages, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.peek.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[PeekedMessageItem]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - peek.metadata = {'url': '/{queueName}/messages'} # type: ignore + + peek.metadata = {'url': "{url}/{queueName}/messages"} # type: ignore + diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py index 784057fd47e8..18f65717b26e 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,21 +7,279 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - + from typing import Any, Callable, Dict, List, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2018-03-28") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{queueName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + version = kwargs.pop('version', "2018-03-28") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{queueName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "metadata") # type: str + version = kwargs.pop('version', "2018-03-28") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{queueName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_metadata_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "metadata") # type: str + version = kwargs.pop('version', "2018-03-28") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + metadata = kwargs.pop('metadata', None) # type: Optional[Dict[str, str]] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{queueName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if metadata is not None: + _header_parameters['x-ms-meta'] = _SERIALIZER.header("metadata", metadata, '{str}') + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_access_policy_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "acl") # type: str + version = kwargs.pop('version', "2018-03-28") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{queueName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_access_policy_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "acl") # type: str + version = kwargs.pop('version', "2018-03-28") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/{queueName}") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class QueueOperations(object): """QueueOperations operations. @@ -43,10 +302,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def create( + @distributed_trace + def create( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] request_id_parameter=None, # type: Optional[str] **kwargs # type: Any ): @@ -54,15 +314,15 @@ def create( """creates a new queue under the given account. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param metadata: Optional. Include this parameter to specify that the queue's metadata be returned as part of the response body. Note that metadata requested with this parameter must be stored in accordance with the naming restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata names must adhere to the naming conventions for C# identifiers. - :type metadata: str + :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str @@ -76,36 +336,29 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/xml" - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_create_request( + url=self._config.url, + version=self._config.version, + timeout=timeout, + metadata=metadata, + request_id_parameter=request_id_parameter, + template_url=self.create.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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -113,18 +366,22 @@ def create( response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if response.status_code == 204: response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - create.metadata = {'url': '/{queueName}'} # type: ignore + create.metadata = {'url': "{url}/{queueName}"} # type: ignore - def delete( + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -134,8 +391,8 @@ def delete( """operation permanently deletes the specified queue. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -150,34 +407,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/xml" - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_delete_request( + url=self._config.url, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.delete.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -185,12 +436,15 @@ def delete( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - delete.metadata = {'url': '/{queueName}'} # type: ignore + delete.metadata = {'url': "{url}/{queueName}"} # type: ignore - def get_properties( + + @distributed_trace + def get_properties( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -201,12 +455,15 @@ def get_properties( associated with the queue as name-values pairs. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -217,54 +474,52 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "metadata" - accept = "application/xml" - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "metadata") # type: str + + + request = build_get_properties_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} - response_headers['x-ms-meta']=self._deserialize('str', response.headers.get('x-ms-meta')) + response_headers['x-ms-meta']=self._deserialize('{str}', response.headers.get('x-ms-meta')) response_headers['x-ms-approximate-messages-count']=self._deserialize('int', response.headers.get('x-ms-approximate-messages-count')) response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - get_properties.metadata = {'url': '/{queueName}'} # type: ignore + get_properties.metadata = {'url': "{url}/{queueName}"} # type: ignore - def set_metadata( + + @distributed_trace + def set_metadata( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] - metadata=None, # type: Optional[str] + metadata=None, # type: Optional[Dict[str, str]] request_id_parameter=None, # type: Optional[str] **kwargs # type: Any ): @@ -273,18 +528,21 @@ def set_metadata( name-value pairs. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param metadata: Optional. Include this parameter to specify that the queue's metadata be returned as part of the response body. Note that metadata requested with this parameter must be stored in accordance with the naming restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata names must adhere to the naming conventions for C# identifiers. - :type metadata: str + :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "metadata". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -295,38 +553,32 @@ def set_metadata( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "metadata" - accept = "application/xml" - # Construct URL - url = self.set_metadata.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if metadata is not None: - header_parameters['x-ms-meta'] = self._serialize.header("metadata", metadata, 'str') - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "metadata") # type: str + + + request = build_set_metadata_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + metadata=metadata, + request_id_parameter=request_id_parameter, + template_url=self.set_metadata.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -334,11 +586,14 @@ def set_metadata( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_metadata.metadata = {'url': '/{queueName}'} # type: ignore + set_metadata.metadata = {'url': "{url}/{queueName}"} # type: ignore + + @distributed_trace def get_access_policy( self, timeout=None, # type: Optional[int] @@ -350,12 +605,15 @@ def get_access_policy( Shared Access Signatures. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "acl". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier, or the result of cls(response) :rtype: list[~azure.storage.queue.models.SignedIdentifier] @@ -366,51 +624,50 @@ def get_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "acl" - accept = "application/xml" - # Construct URL - url = self.get_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "acl") # type: str + + + request = build_get_access_policy_request( + url=self._config.url, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_access_policy.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('[SignedIdentifier]', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_access_policy.metadata = {'url': '/{queueName}'} # type: ignore - def set_access_policy( + get_access_policy.metadata = {'url': "{url}/{queueName}"} # type: ignore + + + @distributed_trace + def set_access_policy( # pylint: disable=inconsistent-return-statements self, timeout=None, # type: Optional[int] request_id_parameter=None, # type: Optional[str] @@ -421,14 +678,17 @@ def set_access_policy( """sets stored access policies for the queue that may be used with Shared Access Signatures. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str :param queue_acl: the acls for the queue. :type queue_acl: list[~azure.storage.queue.models.SignedIdentifier] + :keyword comp: comp. The default value is "acl". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -439,45 +699,39 @@ def set_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "acl" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - serialization_ctxt = {'xml': {'name': 'SignedIdentifiers', 'wrapped': True}} + + comp = kwargs.pop('comp', "acl") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + + serialization_ctxt = {"xml": {'name': 'SignedIdentifiers', 'wrapped': True}} if queue_acl is not None: - body_content = self._serialize.body(queue_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) + _content = self._serialize.body(queue_acl, '[SignedIdentifier]', is_xml=True, serialization_ctxt=serialization_ctxt) else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _content = None + + request = build_set_access_policy_request( + url=self._config.url, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.set_access_policy.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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} @@ -485,7 +739,9 @@ def set_access_policy( response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + if cls: return cls(pipeline_response, None, response_headers) - set_access_policy.metadata = {'url': '/{queueName}'} # type: ignore + set_access_policy.metadata = {'url': "{url}/{queueName}"} # type: ignore + diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_service_operations.py index 61efad58fe3d..bf2e7e3f4520 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,21 +7,213 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from typing import TYPE_CHECKING -import warnings + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - + from typing import Any, Callable, Dict, List, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_set_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2018-03-28") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_properties_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + version = kwargs.pop('version', "2018-03-28") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_statistics_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "stats") # type: str + version = kwargs.pop('version', "2018-03-28") # type: str + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['restype'] = _SERIALIZER.query("restype", restype, 'str') + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_queues_segment_request( + url, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + comp = kwargs.pop('comp', "list") # type: str + version = kwargs.pop('version', "2018-03-28") # type: str + prefix = kwargs.pop('prefix', None) # type: Optional[str] + marker = kwargs.pop('marker', None) # type: Optional[str] + maxresults = kwargs.pop('maxresults', None) # type: Optional[int] + include = kwargs.pop('include', None) # type: Optional[List[str]] + timeout = kwargs.pop('timeout', None) # type: Optional[int] + request_id_parameter = kwargs.pop('request_id_parameter', None) # type: Optional[str] + + accept = "application/xml" + # Construct URL + _url = kwargs.pop("template_url", "{url}/") + path_format_arguments = { + "url": _SERIALIZER.url("url", url, 'str', skip_quote=True), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['comp'] = _SERIALIZER.query("comp", comp, 'str') + if prefix is not None: + _query_parameters['prefix'] = _SERIALIZER.query("prefix", prefix, 'str') + if marker is not None: + _query_parameters['marker'] = _SERIALIZER.query("marker", marker, 'str') + if maxresults is not None: + _query_parameters['maxresults'] = _SERIALIZER.query("maxresults", maxresults, 'int', minimum=1) + if include is not None: + _query_parameters['include'] = _SERIALIZER.query("include", include, '[str]', div=',') + if timeout is not None: + _query_parameters['timeout'] = _SERIALIZER.query("timeout", timeout, 'int', minimum=0) + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['x-ms-version'] = _SERIALIZER.header("version", version, 'str') + if request_id_parameter is not None: + _header_parameters['x-ms-client-request-id'] = _SERIALIZER.header("request_id_parameter", request_id_parameter, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on class ServiceOperations(object): """ServiceOperations operations. @@ -43,7 +236,8 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def set_properties( + @distributed_trace + def set_properties( # pylint: disable=inconsistent-return-statements self, storage_service_properties, # type: "_models.StorageServiceProperties" timeout=None, # type: Optional[int] @@ -57,12 +251,18 @@ def set_properties( :param storage_service_properties: The StorageService properties. :type storage_service_properties: ~azure.storage.queue.models.StorageServiceProperties :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -73,54 +273,51 @@ def set_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "properties" - content_type = kwargs.pop("content_type", "application/xml") - accept = "application/xml" - - # Construct URL - url = self.set_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True) - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + content_type = kwargs.pop('content_type', "application/xml") # type: Optional[str] + + _content = self._serialize.body(storage_service_properties, 'StorageServiceProperties', is_xml=True) + + request = build_set_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + content_type=content_type, + content=_content, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.set_properties.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) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + if cls: return cls(pipeline_response, None, response_headers) - set_properties.metadata = {'url': '/'} # type: ignore + set_properties.metadata = {'url': "{url}/"} # type: ignore + + @distributed_trace def get_properties( self, timeout=None, # type: Optional[int] @@ -132,12 +329,18 @@ def get_properties( Analytics and CORS (Cross-Origin Resource Sharing) rules. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "properties". Note that overriding this default value + may result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties, or the result of cls(response) :rtype: ~azure.storage.queue.models.StorageServiceProperties @@ -148,51 +351,50 @@ def get_properties( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "properties" - accept = "application/xml" - - # Construct URL - url = self.get_properties.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "properties") # type: str + + + request = build_get_properties_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_properties.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) + deserialized = self._deserialize('StorageServiceProperties', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_properties.metadata = {'url': '/'} # type: ignore + get_properties.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace def get_statistics( self, timeout=None, # type: Optional[int] @@ -205,12 +407,18 @@ def get_statistics( storage account. :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword restype: restype. The default value is "service". Note that overriding this default + value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. The default value is "stats". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceStats, or the result of cls(response) :rtype: ~azure.storage.queue.models.StorageServiceStats @@ -221,52 +429,51 @@ def get_statistics( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - restype = "service" - comp = "stats" - accept = "application/xml" - - # Construct URL - url = self.get_statistics.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['restype'] = self._serialize.query("restype", restype, 'str') - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + restype = kwargs.pop('restype', "service") # type: str + comp = kwargs.pop('comp', "stats") # type: str + + + request = build_get_statistics_request( + url=self._config.url, + restype=restype, + comp=comp, + version=self._config.version, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.get_statistics.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('StorageServiceStats', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - get_statistics.metadata = {'url': '/'} # type: ignore + get_statistics.metadata = {'url': "{url}/"} # type: ignore + + + @distributed_trace def list_queues_segment( self, prefix=None, # type: Optional[str] @@ -296,16 +503,19 @@ def list_queues_segment( possible that the service will return fewer results than specified by maxresults, or than the default of 5000. :type maxresults: int - :param include: Include this parameter to specify that the queues's metadata be returned as - part of the response body. + :param include: Include this parameter to specify that the queues' metadata be returned as part + of the response body. :type include: list[str] :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting + Timeouts for Queue Service Operations.. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. :type request_id_parameter: str + :keyword comp: comp. The default value is "list". Note that overriding this default value may + result in unsupported behavior. + :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListQueuesSegmentResponse, or the result of cls(response) :rtype: ~azure.storage.queue.models.ListQueuesSegmentResponse @@ -316,54 +526,48 @@ def list_queues_segment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - comp = "list" - accept = "application/xml" - # Construct URL - url = self.list_queues_segment.metadata['url'] # type: ignore - path_format_arguments = { - 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['comp'] = self._serialize.query("comp", comp, 'str') - if prefix is not None: - query_parameters['prefix'] = self._serialize.query("prefix", prefix, 'str') - if marker is not None: - query_parameters['marker'] = self._serialize.query("marker", marker, 'str') - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', minimum=1) - if include is not None: - query_parameters['include'] = self._serialize.query("include", include, '[str]', div=',') - if timeout is not None: - query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0) - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str') - if request_id_parameter is not None: - header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id_parameter", request_id_parameter, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + comp = kwargs.pop('comp', "list") # type: str + + + request = build_list_queues_segment_request( + url=self._config.url, + comp=comp, + version=self._config.version, + prefix=prefix, + marker=marker, + maxresults=maxresults, + include=include, + timeout=timeout, + request_id_parameter=request_id_parameter, + template_url=self.list_queues_segment.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 [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.StorageError, response) + error = self._deserialize.failsafe_deserialize(_models.StorageError, pipeline_response) raise HttpResponseError(response=response, model=error) response_headers = {} response_headers['x-ms-request-id']=self._deserialize('str', response.headers.get('x-ms-request-id')) response_headers['x-ms-version']=self._deserialize('str', response.headers.get('x-ms-version')) response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date')) + deserialized = self._deserialize('ListQueuesSegmentResponse', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized - list_queues_segment.metadata = {'url': '/'} # type: ignore + + list_queues_segment.metadata = {'url': "{url}/"} # type: ignore + diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_client.py index deb75114632d..7145c11e937c 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_client.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_client.py @@ -105,7 +105,7 @@ def __init__( self._config.message_encode_policy = kwargs.get('message_encode_policy', None) or NoEncodePolicy() self._config.message_decode_policy = kwargs.get('message_decode_policy', None) or NoDecodePolicy() - self._client = AzureQueueStorage(self.url, pipeline=self._pipeline) + self._client = AzureQueueStorage(self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access def _format_url(self, hostname): diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_service_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_service_client.py index 4315759ba15d..374b71a54f8b 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_service_client.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_queue_service_client.py @@ -108,7 +108,7 @@ def __init__( raise ValueError("You need to provide either a SAS token or an account shared key to authenticate.") self._query_str, credential = self._format_query_string(sas_token, credential) super(QueueServiceClient, self).__init__(parsed_url, service='queue', credential=credential, **kwargs) - self._client = AzureQueueStorage(self.url, pipeline=self._pipeline) + self._client = AzureQueueStorage(self.url, base_url=self.url, pipeline=self._pipeline) self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access def _format_url(self, hostname): diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py index a6d3a2f50d42..e46b84f9da31 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_client_async.py @@ -111,7 +111,8 @@ def __init__( super(QueueClient, self).__init__( account_url, queue_name=queue_name, credential=credential, loop=loop, **kwargs ) - self._client = AzureQueueStorage(self.url, pipeline=self._pipeline, loop=loop) # type: ignore + self._client = AzureQueueStorage(self.url, base_url=self.url, + pipeline=self._pipeline, loop=loop) # type: ignore self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access self._loop = loop diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py index 91df8cf5509c..3b84577bfcd0 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/_queue_service_client_async.py @@ -101,7 +101,7 @@ def __init__( credential=credential, loop=loop, **kwargs) - self._client = AzureQueueStorage(url=self.url, pipeline=self._pipeline, loop=loop) # type: ignore + self._client = AzureQueueStorage(self.url, base_url=self.url, pipeline=self._pipeline, loop=loop) # type: ignore self._client._config.version = get_api_version(kwargs) # pylint: disable=protected-access self._loop = loop diff --git a/sdk/storage/azure-storage-queue/setup.py b/sdk/storage/azure-storage-queue/setup.py index 3d02f627594e..55610b664cf5 100644 --- a/sdk/storage/azure-storage-queue/setup.py +++ b/sdk/storage/azure-storage-queue/setup.py @@ -66,8 +66,8 @@ ]), python_requires=">=3.6", install_requires=[ - "azure-core<2.0.0,>=1.15.0", - "msrest>=0.6.18", + "azure-core<2.0.0,>=1.20.1", + "msrest>=0.6.21", "cryptography>=2.1.4" ], ) diff --git a/sdk/storage/azure-storage-queue/swagger/README.md b/sdk/storage/azure-storage-queue/swagger/README.md index 392b20b68a0e..86d6eff238a6 100644 --- a/sdk/storage/azure-storage-queue/swagger/README.md +++ b/sdk/storage/azure-storage-queue/swagger/README.md @@ -19,7 +19,7 @@ autorest --use=C:/work/autorest.python --version=2.0.4280 ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.QueueStorage/preview/2018-03-28/queue.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/data-plane/Microsoft.QueueStorage/preview/2018-03-28/queue.json output-folder: ../azure/storage/queue/_generated namespace: azure.storage.queue no-namespace-folders: true @@ -67,3 +67,48 @@ directive: transform: > $.required = false; ``` + +### Remove QueueName from parameter list since it is not needed +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + for (const property in $) + { + if (property.includes('/{queueName}/messages/{messageid}')) + { + $[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/QueueName") && false == param['$ref'].endsWith("#/parameters/MessageId"))}); + } + else if (property.includes('/{queueName}')) + { + $[property]["parameters"] = $[property]["parameters"].filter(function(param) { return (typeof param['$ref'] === "undefined") || (false == param['$ref'].endsWith("#/parameters/QueueName"))}); + } + } +``` + +### Remove x-ms-parameterized-host +``` yaml +directive: +- from: swagger-document + where: $ + transform: > + $["x-ms-parameterized-host"] = undefined; +``` + +### Add url parameter to each operation and add it to the url +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"] + transform: > + for (const property in $) + { + $[property]["parameters"].push({"$ref": "#/parameters/Url"}); + + var oldName = property; + var newName = '{url}' + property; + $[newName] = $[oldName]; + delete $[oldName]; + } +``` diff --git a/shared_requirements.txt b/shared_requirements.txt index 81e7123afa49..be524e8fd84a 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -152,13 +152,11 @@ chardet<5,>=3.0.2 #override azure-ai-language-questionanswering azure-core<2.0.0,>=1.19.1 #override azure-search-documents azure-core<2.0.0,>=1.19.0 #override azure-ai-formrecognizer azure-core<2.0.0,>=1.20.1 -#override azure-storage-blob azure-core<2.0.0,>=1.15.0 +#override azure-storage-blob azure-core<2.0.0,>=1.20.1 #override azure-storage-blob-changefeed azure-storage-blob>=12.5.0,<13.0.0 -#override azure-storage-queue azure-core<2.0.0,>=1.15.0 -#override azure-storage-queue msrest>=0.6.18 -#override azure-storage-file-share azure-core<2.0.0,>=1.15.0 -#override azure-storage-file-datalake azure-core<2.0.0,>=1.15.0 -#override azure-storage-file-datalake msrest>=0.6.21 +#override azure-storage-queue azure-core<2.0.0,>=1.20.1 +#override azure-storage-file-share azure-core<2.0.0,>=1.20.1 +#override azure-storage-file-datalake azure-core<2.0.0,>=1.20.1 #override azure-storage-file-datalake azure-storage-blob<13.0.0,>=12.10.0b2 #override azure-security-attestation azure-core<2.0.0,>=1.8.2 #override azure-data-tables msrest>=0.6.19 From a1a7fb36e6851737fc8d01aa74b0d8b3566c7a34 Mon Sep 17 00:00:00 2001 From: Jacob Lauzon Date: Tue, 8 Mar 2022 16:57:22 -0800 Subject: [PATCH 2/2] Re-generate with latest autorest --- .../blob/_generated/_azure_blob_storage.py | 7 +- .../storage/blob/_generated/_configuration.py | 5 +- .../_generated/aio/_azure_blob_storage.py | 7 +- .../blob/_generated/aio/_configuration.py | 5 +- .../aio/operations/_append_blob_operations.py | 122 +++--- .../aio/operations/_blob_operations.py | 385 ++++++++++-------- .../aio/operations/_block_blob_operations.py | 183 +++++---- .../aio/operations/_container_operations.py | 273 +++++++------ .../aio/operations/_page_blob_operations.py | 211 +++++----- .../aio/operations/_service_operations.py | 121 +++--- .../operations/_append_blob_operations.py | 122 +++--- .../_generated/operations/_blob_operations.py | 385 ++++++++++-------- .../operations/_block_blob_operations.py | 183 +++++---- .../operations/_container_operations.py | 273 +++++++------ .../operations/_page_blob_operations.py | 211 +++++----- .../operations/_service_operations.py | 121 +++--- .../_azure_data_lake_storage_restapi.py | 12 +- .../filedatalake/_generated/_configuration.py | 10 +- .../aio/_azure_data_lake_storage_restapi.py | 12 +- .../_generated/aio/_configuration.py | 10 +- .../aio/operations/_file_system_operations.py | 93 +++-- .../aio/operations/_path_operations.py | 236 ++++++----- .../aio/operations/_service_operations.py | 43 +- .../operations/_file_system_operations.py | 93 +++-- .../_generated/operations/_path_operations.py | 236 ++++++----- .../operations/_service_operations.py | 43 +- .../_generated/_azure_file_storage.py | 11 +- .../fileshare/_generated/_configuration.py | 9 +- .../_generated/aio/_azure_file_storage.py | 11 +- .../_generated/aio/_configuration.py | 9 +- .../aio/operations/_directory_operations.py | 152 +++---- .../aio/operations/_file_operations.py | 252 ++++++------ .../aio/operations/_service_operations.py | 60 ++- .../aio/operations/_share_operations.py | 275 +++++++------ .../operations/_directory_operations.py | 152 +++---- .../_generated/operations/_file_operations.py | 254 ++++++------ .../operations/_service_operations.py | 60 ++- .../operations/_share_operations.py | 275 +++++++------ .../queue/_generated/_azure_queue_storage.py | 7 +- .../queue/_generated/_configuration.py | 5 +- .../_generated/aio/_azure_queue_storage.py | 7 +- .../queue/_generated/aio/_configuration.py | 5 +- .../aio/operations/_message_id_operations.py | 40 +- .../aio/operations/_messages_operations.py | 58 +-- .../aio/operations/_queue_operations.py | 80 ++-- .../aio/operations/_service_operations.py | 81 ++-- .../operations/_message_id_operations.py | 40 +- .../operations/_messages_operations.py | 58 +-- .../operations/_queue_operations.py | 80 ++-- .../operations/_service_operations.py | 81 ++-- 50 files changed, 2875 insertions(+), 2589 deletions(-) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py index 104c2a8e3331..9b7ce9758e76 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_azure_blob_storage.py @@ -41,11 +41,10 @@ class AzureBlobStorage(object): :param url: The URL of the service account, container, or blob that is the target of the desired operation. :type url: str - :param base_url: Service URL. Default value is ''. + :param base_url: Service URL. Default value is "". :type base_url: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2021-04-10". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2021-04-10". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py index be7ef30eb6d7..b000f2c00f16 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/_configuration.py @@ -26,9 +26,8 @@ class AzureBlobStorageConfiguration(Configuration): # pylint: disable=too-many- :param url: The URL of the service account, container, or blob that is the target of the desired operation. :type url: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2021-04-10". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2021-04-10". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py index bc66db3a1ece..7a91065e3073 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_azure_blob_storage.py @@ -36,11 +36,10 @@ class AzureBlobStorage: :param url: The URL of the service account, container, or blob that is the target of the desired operation. :type url: str - :param base_url: Service URL. Default value is ''. + :param base_url: Service URL. Default value is "". :type base_url: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2021-04-10". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2021-04-10". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py index 7ec5902f95fe..c264f6cc1a7b 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/_configuration.py @@ -22,9 +22,8 @@ class AzureBlobStorageConfiguration(Configuration): # pylint: disable=too-many- :param url: The URL of the service account, container, or blob that is the target of the desired operation. :type url: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2021-04-10". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2021-04-10". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py index f95fe3c16901..e5126f1e2a96 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_append_blob_operations.py @@ -22,26 +22,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class AppendBlobOperations: - """AppendBlobOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.blob.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.blob.aio.AzureBlobStorage`'s + :attr:`append_blob` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def create( # pylint: disable=inconsistent-return-statements @@ -68,7 +66,7 @@ async def create( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -76,32 +74,35 @@ async def create( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: Specified if a legal hold should be set on the blob. + :param legal_hold: Specified if a legal hold should be set on the blob. Default value is None. :type legal_hold: bool - :param blob_http_headers: Parameter group. + :param blob_http_headers: Parameter group. Default value is None. :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append - blob. The default value is "AppendBlob". Note that overriding this default value may result in + blob. Default value is "AppendBlob". Note that overriding this default value may result in unsupported behavior. :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -248,30 +249,31 @@ async def append_block( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param transactional_content_crc64: Specify the transactional crc64 for the body, to be - validated by the service. + validated by the service. Default value is None. :type transactional_content_crc64: bytearray :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param append_position_access_conditions: Parameter group. + :param append_position_access_conditions: Parameter group. Default value is None. :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "appendblock". Note that overriding this default - value may result in unsupported behavior. + :keyword comp: comp. Default value is "appendblock". Note that overriding this default value + may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -409,44 +411,45 @@ async def append_block_from_url( # pylint: disable=inconsistent-return-statemen :type source_url: str :param content_length: The length of the request. :type content_length: long - :param source_range: Bytes of source data in the specified range. + :param source_range: Bytes of source data in the specified range. Default value is None. :type source_range: str :param source_content_md5: Specify the md5 calculated for the range of bytes that must be read - from the copy source. + from the copy source. Default value is None. :type source_content_md5: bytearray :param source_contentcrc64: Specify the crc64 calculated for the range of bytes that must be - read from the copy source. + read from the copy source. Default value is None. :type source_contentcrc64: bytearray :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid - OAuth access token to copy source. + OAuth access token to copy source. Default value is None. :type copy_source_authorization: str - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param append_position_access_conditions: Parameter group. + :param append_position_access_conditions: Parameter group. Default value is None. :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :keyword comp: comp. The default value is "appendblock". Note that overriding this default - value may result in unsupported behavior. + :keyword comp: comp. Default value is "appendblock". Note that overriding this default value + may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -583,19 +586,20 @@ async def seal( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param append_position_access_conditions: Parameter group. + :param append_position_access_conditions: Parameter group. Default value is None. :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions - :keyword comp: comp. The default value is "seal". Note that overriding this default value may + :keyword comp: comp. Default value is "seal". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py index 968af7598c41..a7a16e030d38 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py @@ -22,26 +22,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class BlobOperations: # pylint: disable=too-many-public-methods - """BlobOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.blob.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.blob.aio.AzureBlobStorage`'s + :attr:`blob` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def download( @@ -65,34 +63,36 @@ async def download( specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param version_id: The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. + Default value is None. :type version_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param range: Return only the bytes of the blob in the specified range. + :param range: Return only the bytes of the blob in the specified range. Default value is None. :type range: str :param range_get_content_md5: When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB - in size. + in size. Default value is None. :type range_get_content_md5: bool :param range_get_content_crc64: When set to true and specified together with the Range, the service returns the CRC64 hash for the range, as long as the range is less than or equal to 4 - MB in size. + MB in size. Default value is None. :type range_get_content_crc64: bool :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: IO, or the result of cls(response) @@ -284,24 +284,26 @@ async def get_properties( # pylint: disable=inconsistent-return-statements specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param version_id: The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. + Default value is None. :type version_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -457,29 +459,32 @@ async def delete( # pylint: disable=inconsistent-return-statements specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param version_id: The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. + Default value is None. :type version_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param delete_snapshots: Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob and all of its snapshots. only: Delete - only the blob's snapshots and not the blob itself. + only the blob's snapshots and not the blob itself. Default value is None. :type delete_snapshots: str or ~azure.storage.blob.models.DeleteSnapshotsOptionType :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param blob_delete_type: Optional. Only possible value is 'permanent', which specifies to - permanently delete a blob if blob soft delete is enabled. The default value is "Permanent". + permanently delete a blob if blob soft delete is enabled. Possible values are "Permanent" or + None. Default value is "Permanent". :type blob_delete_type: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -564,13 +569,14 @@ async def undelete( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "undelete". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "undelete". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -638,14 +644,15 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param expires_on: The time to set the blob to expiry. + :param expires_on: The time to set the blob to expiry. Default value is None. :type expires_on: str - :keyword comp: comp. The default value is "expiry". Note that overriding this default value may + :keyword comp: comp. Default value is "expiry". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -717,19 +724,20 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param blob_http_headers: Parameter group. + :param blob_http_headers: Parameter group. Default value is None. :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "properties". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -839,20 +847,22 @@ async def set_immutability_policy( # pylint: disable=inconsistent-return-statem :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "immutabilityPolicies". Note that overriding this - default value may result in unsupported behavior. + :keyword comp: comp. Default value is "immutabilityPolicies". Note that overriding this default + value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -924,13 +934,14 @@ async def delete_immutability_policy( # pylint: disable=inconsistent-return-sta :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "immutabilityPolicies". Note that overriding this - default value may result in unsupported behavior. + :keyword comp: comp. Default value is "immutabilityPolicies". Note that overriding this default + value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -997,13 +1008,14 @@ async def set_legal_hold( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "legalhold". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "legalhold". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1075,7 +1087,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -1083,21 +1095,22 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "metadata". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1206,25 +1219,26 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease - duration cannot be changed using renew or change. + duration cannot be changed using renew or change. Default value is None. :type duration: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "acquire". Note that + :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1317,17 +1331,18 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "release". Note that + :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1418,17 +1433,18 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "renew". Note that + :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1525,17 +1541,18 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "change". Note that + :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1626,7 +1643,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param break_period: For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter @@ -1634,17 +1651,18 @@ async def break_lease( # pylint: disable=inconsistent-return-statements lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease - breaks immediately. + breaks immediately. Default value is None. :type break_period: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "break". Note that + :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1736,7 +1754,7 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -1744,21 +1762,22 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. The default value is "snapshot". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "snapshot". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1879,7 +1898,7 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -1887,34 +1906,37 @@ async def start_copy_from_url( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] - :param tier: Optional. Indicates the tier to be set on the blob. + :param tier: Optional. Indicates the tier to be set on the blob. Default value is None. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param rehydrate_priority: Optional: Indicates the priority with which to rehydrate an archived - blob. + blob. Default value is None. :type rehydrate_priority: str or ~azure.storage.blob.models.RehydratePriority :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param seal_blob: Overrides the sealed state of the destination blob. Service version - 2019-12-12 and newer. + 2019-12-12 and newer. Default value is None. :type seal_blob: bool :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: Specified if a legal hold should be set on the blob. + :param legal_hold: Specified if a legal hold should be set on the blob. Default value is None. :type legal_hold: bool - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2044,7 +2066,7 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -2052,39 +2074,42 @@ async def copy_from_url( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] - :param tier: Optional. Indicates the tier to be set on the blob. + :param tier: Optional. Indicates the tier to be set on the blob. Default value is None. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param source_content_md5: Specify the md5 calculated for the range of bytes that must be read - from the copy source. + from the copy source. Default value is None. :type source_content_md5: bytearray - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: Specified if a legal hold should be set on the blob. + :param legal_hold: Specified if a legal hold should be set on the blob. Default value is None. :type legal_hold: bool :param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid - OAuth access token to copy source. + OAuth access token to copy source. Default value is None. :type copy_source_authorization: str - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :keyword x_ms_requires_sync: This header indicates that this is a synchronous Copy Blob From - URL instead of a Asynchronous Copy Blob. The default value is "true". Note that overriding this + URL instead of a Asynchronous Copy Blob. Default value is "true". Note that overriding this default value may result in unsupported behavior. :paramtype x_ms_requires_sync: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2209,17 +2234,18 @@ async def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. The default value is "copy". Note that overriding this default value may + :keyword comp: comp. Default value is "copy". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword copy_action_abort_constant: Copy action. The default value is "abort". Note that + :keyword copy_action_abort_constant: Copy action. Default value is "abort". Note that overriding this default value may result in unsupported behavior. :paramtype copy_action_abort_constant: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2304,27 +2330,29 @@ async def set_tier( # pylint: disable=inconsistent-return-statements specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param version_id: The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. + Default value is None. :type version_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param rehydrate_priority: Optional: Indicates the priority with which to rehydrate an archived - blob. + blob. Default value is None. :type rehydrate_priority: str or ~azure.storage.blob.models.RehydratePriority :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "tier". Note that overriding this default value may + :keyword comp: comp. Default value is "tier". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2402,11 +2430,11 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements ) -> None: """Returns the sku name and account kind. - :keyword restype: restype. The default value is "account". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "account". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2479,25 +2507,26 @@ async def query( specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param query_request: the query request. + :param query_request: the query request. Default value is None. :type query_request: ~azure.storage.blob.models.QueryRequest - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "query". Note that overriding this default value may + :keyword comp: comp. Default value is "query". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2673,25 +2702,27 @@ async def get_tags( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param version_id: The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. + Default value is None. :type version_id: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. The default value is "tags". Note that overriding this default value may + :keyword comp: comp. Default value is "tags". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2775,27 +2806,29 @@ async def set_tags( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param version_id: The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. + Default value is None. :type version_id: str :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param transactional_content_crc64: Specify the transactional crc64 for the body, to be - validated by the service. + validated by the service. Default value is None. :type transactional_content_crc64: bytearray :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param tags: Blob tags. + :param tags: Blob tags. Default value is None. :type tags: ~azure.storage.blob.models.BlobTags - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. The default value is "tags". Note that overriding this default value may + :keyword comp: comp. Default value is "tags". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py index d05cb986a2b5..178a92b2d0d7 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_block_blob_operations.py @@ -22,26 +22,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class BlockBlobOperations: - """BlockBlobOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.blob.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.blob.aio.AzureBlobStorage`'s + :attr:`block_blob` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def upload( # pylint: disable=inconsistent-return-statements @@ -77,10 +75,10 @@ async def upload( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -88,34 +86,37 @@ async def upload( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] - :param tier: Optional. Indicates the tier to be set on the blob. + :param tier: Optional. Indicates the tier to be set on the blob. Default value is None. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: Specified if a legal hold should be set on the blob. + :param legal_hold: Specified if a legal hold should be set on the blob. Default value is None. :type legal_hold: bool - :param blob_http_headers: Parameter group. + :param blob_http_headers: Parameter group. Default value is None. :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append - blob. The default value is "BlockBlob". Note that overriding this default value may result in + blob. Default value is "BlockBlob". Note that overriding this default value may result in unsupported behavior. :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -279,10 +280,10 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -290,39 +291,41 @@ async def put_blob_from_url( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] - :param tier: Optional. Indicates the tier to be set on the blob. + :param tier: Optional. Indicates the tier to be set on the blob. Default value is None. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param source_content_md5: Specify the md5 calculated for the range of bytes that must be read - from the copy source. + from the copy source. Default value is None. :type source_content_md5: bytearray - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param copy_source_blob_properties: Optional, default is true. Indicates if properties from the source blob should be copied. :type copy_source_blob_properties: bool :param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid - OAuth access token to copy source. + OAuth access token to copy source. Default value is None. :type copy_source_authorization: str - :param blob_http_headers: Parameter group. + :param blob_http_headers: Parameter group. Default value is None. :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append - blob. The default value is "BlockBlob". Note that overriding this default value may result in + blob. Default value is "BlockBlob". Note that overriding this default value may result in unsupported behavior. :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -487,26 +490,27 @@ async def stage_block( # pylint: disable=inconsistent-return-statements :param body: Initial data. :type body: IO :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param transactional_content_crc64: Specify the transactional crc64 for the body, to be - validated by the service. + validated by the service. Default value is None. :type transactional_content_crc64: bytearray :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :keyword comp: comp. The default value is "block". Note that overriding this default value may + :keyword comp: comp. Default value is "block". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -619,35 +623,36 @@ async def stage_block_from_url( # pylint: disable=inconsistent-return-statement :type content_length: long :param source_url: Specify a URL to the copy source. :type source_url: str - :param source_range: Bytes of source data in the specified range. + :param source_range: Bytes of source data in the specified range. Default value is None. :type source_range: str :param source_content_md5: Specify the md5 calculated for the range of bytes that must be read - from the copy source. + from the copy source. Default value is None. :type source_content_md5: bytearray :param source_contentcrc64: Specify the crc64 calculated for the range of bytes that must be - read from the copy source. + read from the copy source. Default value is None. :type source_contentcrc64: bytearray :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid - OAuth access token to copy source. + OAuth access token to copy source. Default value is None. :type copy_source_authorization: str - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :keyword comp: comp. The default value is "block". Note that overriding this default value may + :keyword comp: comp. Default value is "block". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -777,13 +782,13 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param transactional_content_crc64: Specify the transactional crc64 for the body, to be - validated by the service. + validated by the service. Default value is None. :type transactional_content_crc64: bytearray :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -791,34 +796,37 @@ async def commit_block_list( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] - :param tier: Optional. Indicates the tier to be set on the blob. + :param tier: Optional. Indicates the tier to be set on the blob. Default value is None. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: Specified if a legal hold should be set on the blob. + :param legal_hold: Specified if a legal hold should be set on the blob. Default value is None. :type legal_hold: bool - :param blob_http_headers: Parameter group. + :param blob_http_headers: Parameter group. Default value is None. :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "blocklist". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "blocklist". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -962,25 +970,26 @@ async def get_block_list( specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param list_type: Specifies whether to return the list of committed blocks, the list of - uncommitted blocks, or both lists together. + uncommitted blocks, or both lists together. Default value is "committed". :type list_type: str or ~azure.storage.blob.models.BlockListType :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "blocklist". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "blocklist". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BlockList, or the result of cls(response) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py index 2ff4c7c44605..1196d09e6239 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_container_operations.py @@ -21,26 +21,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ContainerOperations: - """ContainerOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.blob.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.blob.aio.AzureBlobStorage`'s + :attr:`container` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def create( # pylint: disable=inconsistent-return-statements @@ -58,7 +56,7 @@ async def create( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -66,17 +64,18 @@ async def create( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] :param access: Specifies whether data in the container may be accessed publicly and the level - of access. + of access. Default value is None. :type access: str or ~azure.storage.blob.models.PublicAccessType :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param container_cpk_scope_info: Parameter group. + :param container_cpk_scope_info: Parameter group. Default value is None. :type container_cpk_scope_info: ~azure.storage.blob.models.ContainerCpkScopeInfo - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -154,14 +153,15 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -245,16 +245,17 @@ async def delete( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -333,7 +334,7 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -341,20 +342,21 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "metadata". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -433,18 +435,19 @@ async def get_access_policy( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "acl". Note that overriding this default value may - result in unsupported behavior. + :keyword comp: comp. Default value is "acl". Note that overriding this default value may result + in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier, or the result of cls(response) @@ -525,25 +528,26 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param access: Specifies whether data in the container may be accessed publicly and the level - of access. + of access. Default value is None. :type access: str or ~azure.storage.blob.models.PublicAccessType :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param container_acl: the acls for the container. + :param container_acl: the acls for the container. Default value is None. :type container_acl: list[~azure.storage.blob.models.SignedIdentifier] - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "acl". Note that overriding this default value may - result in unsupported behavior. + :keyword comp: comp. Default value is "acl". Note that overriding this default value may result + in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -633,22 +637,23 @@ async def restore( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param deleted_container_name: Optional. Version 2019-12-12 and later. Specifies the name of - the deleted container to restore. + the deleted container to restore. Default value is None. :type deleted_container_name: str :param deleted_container_version: Optional. Version 2019-12-12 and later. Specifies the - version of the deleted container to restore. + version of the deleted container to restore. Default value is None. :type deleted_container_version: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "undelete". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "undelete". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -720,18 +725,19 @@ async def rename( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param source_lease_id: A lease ID for the source path. If specified, the source path must have - an active lease and the lease ID must match. + an active lease and the lease ID must match. Default value is None. :type source_lease_id: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "rename". Note that overriding this default value may + :keyword comp: comp. Default value is "rename". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -806,18 +812,19 @@ async def submit_batch( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :keyword multipart_content_type: Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_:code:``. :paramtype multipart_content_type: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "batch". Note that overriding this default value may + :keyword comp: comp. Default value is "batch". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -895,32 +902,33 @@ async def filter_blobs( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param where: Filters the results to return only to return only blobs whose tags match the - specified expression. + specified expression. Default value is None. :type where: str :param marker: A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the - client. + client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than - the default of 5000. + the default of 5000. Default value is None. :type maxresults: int - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "blobs". Note that overriding this default value may + :keyword comp: comp. Default value is "blobs". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -997,28 +1005,29 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease - duration cannot be changed using renew or change. + duration cannot be changed using renew or change. Default value is None. :type duration: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword action: Describes what lease action to take. The default value is "acquire". Note that + :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1104,20 +1113,21 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword action: Describes what lease action to take. The default value is "release". Note that + :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1201,20 +1211,21 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword action: Describes what lease action to take. The default value is "renew". Note that + :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1297,7 +1308,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param break_period: For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter @@ -1305,20 +1316,21 @@ async def break_lease( # pylint: disable=inconsistent-return-statements lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease - breaks immediately. + breaks immediately. Default value is None. :type break_period: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword action: Describes what lease action to take. The default value is "break". Note that + :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1408,20 +1420,21 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword action: Describes what lease action to take. The default value is "change". Note that + :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1504,37 +1517,38 @@ async def list_blob_flat_segment( """[Update] The List Blobs operation returns a list of the blobs under the specified container. :param prefix: Filters the results to return only containers whose name begins with the - specified prefix. + specified prefix. Default value is None. :type prefix: str :param marker: A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the - client. + client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than - the default of 5000. + the default of 5000. Default value is None. :type maxresults: int :param include: Include this parameter to specify one or more datasets to include in the - response. + response. Default value is None. :type include: list[str or ~azure.storage.blob.models.ListBlobsIncludeItem] :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "list". Note that overriding this default value may + :keyword comp: comp. Default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1617,37 +1631,38 @@ async def list_blob_hierarchy_segment( single character or a string. :type delimiter: str :param prefix: Filters the results to return only containers whose name begins with the - specified prefix. + specified prefix. Default value is None. :type prefix: str :param marker: A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the - client. + client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than - the default of 5000. + the default of 5000. Default value is None. :type maxresults: int :param include: Include this parameter to specify one or more datasets to include in the - response. + response. Default value is None. :type include: list[str or ~azure.storage.blob.models.ListBlobsIncludeItem] :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "list". Note that overriding this default value may + :keyword comp: comp. Default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1718,11 +1733,11 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements ) -> None: """Returns the sku name and account kind. - :keyword restype: restype. The default value is "account". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "account". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py index 5f9f87bd36ba..4f20bea55a9e 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_page_blob_operations.py @@ -22,26 +22,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PageBlobOperations: - """PageBlobOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.blob.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.blob.aio.AzureBlobStorage`'s + :attr:`page_blob` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def create( # pylint: disable=inconsistent-return-statements @@ -74,9 +72,9 @@ async def create( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param tier: Optional. Indicates the tier to be set on the page blob. + :param tier: Optional. Indicates the tier to be set on the page blob. Default value is None. :type tier: str or ~azure.storage.blob.models.PremiumPageBlobAccessTier :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -84,36 +82,39 @@ async def create( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] :param blob_sequence_number: Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 - and 2^63 - 1. + and 2^63 - 1. Default value is 0. :type blob_sequence_number: long :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: Specified if a legal hold should be set on the blob. + :param legal_hold: Specified if a legal hold should be set on the blob. Default value is None. :type legal_hold: bool - :param blob_http_headers: Parameter group. + :param blob_http_headers: Parameter group. Default value is None. :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append - blob. The default value is "PageBlob". Note that overriding this default value may result in + blob. Default value is "PageBlob". Note that overriding this default value may result in unsupported behavior. :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -260,33 +261,34 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements :param body: Initial data. :type body: IO :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param transactional_content_crc64: Specify the transactional crc64 for the body, to be - validated by the service. + validated by the service. Default value is None. :type transactional_content_crc64: bytearray :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param range: Return only the bytes of the blob in the specified range. + :param range: Return only the bytes of the blob in the specified range. Default value is None. :type range: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param sequence_number_access_conditions: Parameter group. + :param sequence_number_access_conditions: Parameter group. Default value is None. :type sequence_number_access_conditions: ~azure.storage.blob.models.SequenceNumberAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "page". Note that overriding this default value may + :keyword comp: comp. Default value is "page". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -296,7 +298,7 @@ async def upload_pages( # pylint: disable=inconsistent-return-statements and Content-Length headers must match to perform the update. * Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that - indicates the range to clear, up to maximum blob size. The default value is "update". Note that + indicates the range to clear, up to maximum blob size. Default value is "update". Note that overriding this default value may result in unsupported behavior. :paramtype page_write: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -432,25 +434,26 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param range: Return only the bytes of the blob in the specified range. + :param range: Return only the bytes of the blob in the specified range. Default value is None. :type range: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param sequence_number_access_conditions: Parameter group. + :param sequence_number_access_conditions: Parameter group. Default value is None. :type sequence_number_access_conditions: ~azure.storage.blob.models.SequenceNumberAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "page". Note that overriding this default value may + :keyword comp: comp. Default value is "page". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -460,7 +463,7 @@ async def clear_pages( # pylint: disable=inconsistent-return-statements and Content-Length headers must match to perform the update. * Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that - indicates the range to clear, up to maximum blob size. The default value is "clear". Note that + indicates the range to clear, up to maximum blob size. Default value is "clear". Note that overriding this default value may result in unsupported behavior. :paramtype page_write: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -600,37 +603,38 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen be 512 aligned and range-end is required. :type range: str :param source_content_md5: Specify the md5 calculated for the range of bytes that must be read - from the copy source. + from the copy source. Default value is None. :type source_content_md5: bytearray :param source_contentcrc64: Specify the crc64 calculated for the range of bytes that must be - read from the copy source. + read from the copy source. Default value is None. :type source_contentcrc64: bytearray :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid - OAuth access token to copy source. + OAuth access token to copy source. Default value is None. :type copy_source_authorization: str - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param sequence_number_access_conditions: Parameter group. + :param sequence_number_access_conditions: Parameter group. Default value is None. :type sequence_number_access_conditions: ~azure.storage.blob.models.SequenceNumberAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :keyword comp: comp. The default value is "page". Note that overriding this default value may + :keyword comp: comp. Default value is "page". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -640,7 +644,7 @@ async def upload_pages_from_url( # pylint: disable=inconsistent-return-statemen and Content-Length headers must match to perform the update. * Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that - indicates the range to clear, up to maximum blob size. The default value is "update". Note that + indicates the range to clear, up to maximum blob size. Default value is "update". Note that overriding this default value may result in unsupported behavior. :paramtype page_write: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -784,24 +788,25 @@ async def get_page_ranges( specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param range: Return only the bytes of the blob in the specified range. + :param range: Return only the bytes of the blob in the specified range. Default value is None. :type range: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "pagelist". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "pagelist". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PageList, or the result of cls(response) @@ -901,36 +906,37 @@ async def get_page_ranges_diff( specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param prevsnapshot: Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only for blobs - created on or after January 1, 2016. + created on or after January 1, 2016. Default value is None. :type prevsnapshot: str :param prev_snapshot_url: Optional. This header is only supported in service versions 2019-04-19 and after and specifies the URL of a previous snapshot of the target blob. The response will only contain pages that were changed between the target blob and its previous - snapshot. + snapshot. Default value is None. :type prev_snapshot_url: str - :param range: Return only the bytes of the blob in the specified range. + :param range: Return only the bytes of the blob in the specified range. Default value is None. :type range: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "pagelist". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "pagelist". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PageList, or the result of cls(response) @@ -1032,21 +1038,22 @@ async def resize( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "properties". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1156,21 +1163,22 @@ async def update_sequence_number( # pylint: disable=inconsistent-return-stateme :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param blob_sequence_number: Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 - and 2^63 - 1. + and 2^63 - 1. Default value is 0. :type blob_sequence_number: long :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "properties". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1270,14 +1278,15 @@ async def copy_incremental( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "incrementalcopy". Note that overriding this default + :keyword comp: comp. Default value is "incrementalcopy". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py index 8f0432a723cb..6c2e8752670e 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_service_operations.py @@ -21,26 +21,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ServiceOperations: - """ServiceOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.blob.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.blob.aio.AzureBlobStorage`'s + :attr:`service` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def set_properties( # pylint: disable=inconsistent-return-statements @@ -58,16 +56,17 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "service". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "service". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -137,16 +136,17 @@ async def get_properties( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "service". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "service". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties, or the result of cls(response) @@ -216,15 +216,16 @@ async def get_statistics( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "service". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "service". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "stats". Note that overriding this default value may + :keyword comp: comp. Default value is "stats". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -297,34 +298,35 @@ async def list_containers_segment( account. :param prefix: Filters the results to return only containers whose name begins with the - specified prefix. + specified prefix. Default value is None. :type prefix: str :param marker: A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the - client. + client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than - the default of 5000. + the default of 5000. Default value is None. :type maxresults: int :param include: Include this parameter to specify that the container's metadata be returned as - part of the response body. + part of the response body. Default value is None. :type include: list[str or ~azure.storage.blob.models.ListContainersIncludeType] :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "list". Note that overriding this default value may + :keyword comp: comp. Default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -399,16 +401,17 @@ async def get_user_delegation_key( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "service". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "service". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "userdelegationkey". Note that overriding this - default value may result in unsupported behavior. + :keyword comp: comp. Default value is "userdelegationkey". Note that overriding this default + value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: UserDelegationKey, or the result of cls(response) @@ -476,11 +479,11 @@ async def get_account_info( # pylint: disable=inconsistent-return-statements ) -> None: """Returns the sku name and account kind. - :keyword restype: restype. The default value is "account". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "account". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -553,15 +556,16 @@ async def submit_batch( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :keyword multipart_content_type: Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_:code:``. :paramtype multipart_content_type: str - :keyword comp: comp. The default value is "batch". Note that overriding this default value may + :keyword comp: comp. Default value is "batch". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -638,29 +642,30 @@ async def filter_blobs( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param where: Filters the results to return only to return only blobs whose tags match the - specified expression. + specified expression. Default value is None. :type where: str :param marker: A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the - client. + client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than - the default of 5000. + the default of 5000. Default value is None. :type maxresults: int - :keyword comp: comp. The default value is "blobs". Note that overriding this default value may + :keyword comp: comp. Default value is "blobs". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py index 74b23b6ec62c..7a3792b4ab15 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_append_blob_operations.py @@ -392,26 +392,24 @@ def build_seal_request( # fmt: on class AppendBlobOperations(object): - """AppendBlobOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.blob.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.blob.AzureBlobStorage`'s + :attr:`append_blob` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def create( # pylint: disable=inconsistent-return-statements @@ -439,7 +437,7 @@ def create( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -447,32 +445,35 @@ def create( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: Specified if a legal hold should be set on the blob. + :param legal_hold: Specified if a legal hold should be set on the blob. Default value is None. :type legal_hold: bool - :param blob_http_headers: Parameter group. + :param blob_http_headers: Parameter group. Default value is None. :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append - blob. The default value is "AppendBlob". Note that overriding this default value may result in + blob. Default value is "AppendBlob". Note that overriding this default value may result in unsupported behavior. :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -620,30 +621,31 @@ def append_block( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param transactional_content_crc64: Specify the transactional crc64 for the body, to be - validated by the service. + validated by the service. Default value is None. :type transactional_content_crc64: bytearray :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param append_position_access_conditions: Parameter group. + :param append_position_access_conditions: Parameter group. Default value is None. :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "appendblock". Note that overriding this default - value may result in unsupported behavior. + :keyword comp: comp. Default value is "appendblock". Note that overriding this default value + may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -782,44 +784,45 @@ def append_block_from_url( # pylint: disable=inconsistent-return-statements :type source_url: str :param content_length: The length of the request. :type content_length: long - :param source_range: Bytes of source data in the specified range. + :param source_range: Bytes of source data in the specified range. Default value is None. :type source_range: str :param source_content_md5: Specify the md5 calculated for the range of bytes that must be read - from the copy source. + from the copy source. Default value is None. :type source_content_md5: bytearray :param source_contentcrc64: Specify the crc64 calculated for the range of bytes that must be - read from the copy source. + read from the copy source. Default value is None. :type source_contentcrc64: bytearray :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid - OAuth access token to copy source. + OAuth access token to copy source. Default value is None. :type copy_source_authorization: str - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param append_position_access_conditions: Parameter group. + :param append_position_access_conditions: Parameter group. Default value is None. :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :keyword comp: comp. The default value is "appendblock". Note that overriding this default - value may result in unsupported behavior. + :keyword comp: comp. Default value is "appendblock". Note that overriding this default value + may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -957,19 +960,20 @@ def seal( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param append_position_access_conditions: Parameter group. + :param append_position_access_conditions: Parameter group. Default value is None. :type append_position_access_conditions: ~azure.storage.blob.models.AppendPositionAccessConditions - :keyword comp: comp. The default value is "seal". Note that overriding this default value may + :keyword comp: comp. Default value is "seal". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py index 367645b0be87..170be8f071f2 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py @@ -1533,26 +1533,24 @@ def build_set_tags_request( # fmt: on class BlobOperations(object): # pylint: disable=too-many-public-methods - """BlobOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.blob.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.blob.AzureBlobStorage`'s + :attr:`blob` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def download( @@ -1577,34 +1575,36 @@ def download( specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param version_id: The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. + Default value is None. :type version_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param range: Return only the bytes of the blob in the specified range. + :param range: Return only the bytes of the blob in the specified range. Default value is None. :type range: str :param range_get_content_md5: When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB - in size. + in size. Default value is None. :type range_get_content_md5: bool :param range_get_content_crc64: When set to true and specified together with the Range, the service returns the CRC64 hash for the range, as long as the range is less than or equal to 4 - MB in size. + MB in size. Default value is None. :type range_get_content_crc64: bool :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: IO, or the result of cls(response) @@ -1797,24 +1797,26 @@ def get_properties( # pylint: disable=inconsistent-return-statements specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param version_id: The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. + Default value is None. :type version_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1971,29 +1973,32 @@ def delete( # pylint: disable=inconsistent-return-statements specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param version_id: The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. + Default value is None. :type version_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param delete_snapshots: Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob and all of its snapshots. only: Delete - only the blob's snapshots and not the blob itself. + only the blob's snapshots and not the blob itself. Default value is None. :type delete_snapshots: str or ~azure.storage.blob.models.DeleteSnapshotsOptionType :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param blob_delete_type: Optional. Only possible value is 'permanent', which specifies to - permanently delete a blob if blob soft delete is enabled. The default value is "Permanent". + permanently delete a blob if blob soft delete is enabled. Possible values are "Permanent" or + None. Default value is "Permanent". :type blob_delete_type: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2079,13 +2084,14 @@ def undelete( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "undelete". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "undelete". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2154,14 +2160,15 @@ def set_expiry( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param expires_on: The time to set the blob to expiry. + :param expires_on: The time to set the blob to expiry. Default value is None. :type expires_on: str - :keyword comp: comp. The default value is "expiry". Note that overriding this default value may + :keyword comp: comp. Default value is "expiry". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2234,19 +2241,20 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param blob_http_headers: Parameter group. + :param blob_http_headers: Parameter group. Default value is None. :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "properties". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2357,20 +2365,22 @@ def set_immutability_policy( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "immutabilityPolicies". Note that overriding this - default value may result in unsupported behavior. + :keyword comp: comp. Default value is "immutabilityPolicies". Note that overriding this default + value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2443,13 +2453,14 @@ def delete_immutability_policy( # pylint: disable=inconsistent-return-statement :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "immutabilityPolicies". Note that overriding this - default value may result in unsupported behavior. + :keyword comp: comp. Default value is "immutabilityPolicies". Note that overriding this default + value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2517,13 +2528,14 @@ def set_legal_hold( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "legalhold". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "legalhold". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2596,7 +2608,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -2604,21 +2616,22 @@ def set_metadata( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "metadata". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2728,25 +2741,26 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease - duration cannot be changed using renew or change. + duration cannot be changed using renew or change. Default value is None. :type duration: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "acquire". Note that + :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2840,17 +2854,18 @@ def release_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "release". Note that + :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2942,17 +2957,18 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "renew". Note that + :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -3050,17 +3066,18 @@ def change_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "change". Note that + :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -3152,7 +3169,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param break_period: For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter @@ -3160,17 +3177,18 @@ def break_lease( # pylint: disable=inconsistent-return-statements lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease - breaks immediately. + breaks immediately. Default value is None. :type break_period: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "break". Note that + :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -3263,7 +3281,7 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -3271,21 +3289,22 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. The default value is "snapshot". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "snapshot". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -3407,7 +3426,7 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -3415,34 +3434,37 @@ def start_copy_from_url( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] - :param tier: Optional. Indicates the tier to be set on the blob. + :param tier: Optional. Indicates the tier to be set on the blob. Default value is None. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param rehydrate_priority: Optional: Indicates the priority with which to rehydrate an archived - blob. + blob. Default value is None. :type rehydrate_priority: str or ~azure.storage.blob.models.RehydratePriority :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param seal_blob: Overrides the sealed state of the destination blob. Service version - 2019-12-12 and newer. + 2019-12-12 and newer. Default value is None. :type seal_blob: bool :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: Specified if a legal hold should be set on the blob. + :param legal_hold: Specified if a legal hold should be set on the blob. Default value is None. :type legal_hold: bool - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -3573,7 +3595,7 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -3581,39 +3603,42 @@ def copy_from_url( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] - :param tier: Optional. Indicates the tier to be set on the blob. + :param tier: Optional. Indicates the tier to be set on the blob. Default value is None. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param source_content_md5: Specify the md5 calculated for the range of bytes that must be read - from the copy source. + from the copy source. Default value is None. :type source_content_md5: bytearray - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: Specified if a legal hold should be set on the blob. + :param legal_hold: Specified if a legal hold should be set on the blob. Default value is None. :type legal_hold: bool :param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid - OAuth access token to copy source. + OAuth access token to copy source. Default value is None. :type copy_source_authorization: str - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo :keyword x_ms_requires_sync: This header indicates that this is a synchronous Copy Blob From - URL instead of a Asynchronous Copy Blob. The default value is "true". Note that overriding this + URL instead of a Asynchronous Copy Blob. Default value is "true". Note that overriding this default value may result in unsupported behavior. :paramtype x_ms_requires_sync: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -3739,17 +3764,18 @@ def abort_copy_from_url( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. The default value is "copy". Note that overriding this default value may + :keyword comp: comp. Default value is "copy". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword copy_action_abort_constant: Copy action. The default value is "abort". Note that + :keyword copy_action_abort_constant: Copy action. Default value is "abort". Note that overriding this default value may result in unsupported behavior. :paramtype copy_action_abort_constant: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -3835,27 +3861,29 @@ def set_tier( # pylint: disable=inconsistent-return-statements specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param version_id: The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. + Default value is None. :type version_id: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param rehydrate_priority: Optional: Indicates the priority with which to rehydrate an archived - blob. + blob. Default value is None. :type rehydrate_priority: str or ~azure.storage.blob.models.RehydratePriority :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "tier". Note that overriding this default value may + :keyword comp: comp. Default value is "tier". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -3934,11 +3962,11 @@ def get_account_info( # pylint: disable=inconsistent-return-statements # type: (...) -> None """Returns the sku name and account kind. - :keyword restype: restype. The default value is "account". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "account". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -4012,25 +4040,26 @@ def query( specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param query_request: the query request. + :param query_request: the query request. Default value is None. :type query_request: ~azure.storage.blob.models.QueryRequest - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "query". Note that overriding this default value may + :keyword comp: comp. Default value is "query". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -4207,25 +4236,27 @@ def get_tags( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param snapshot: The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param version_id: The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. + Default value is None. :type version_id: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. The default value is "tags". Note that overriding this default value may + :keyword comp: comp. Default value is "tags". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -4310,27 +4341,29 @@ def set_tags( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param version_id: The version id parameter is an opaque DateTime value that, when present, specifies the version of the blob to operate on. It's for service version 2019-10-10 and newer. + Default value is None. :type version_id: str :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param transactional_content_crc64: Specify the transactional crc64 for the body, to be - validated by the service. + validated by the service. Default value is None. :type transactional_content_crc64: bytearray :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param tags: Blob tags. + :param tags: Blob tags. Default value is None. :type tags: ~azure.storage.blob.models.BlobTags - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword comp: comp. The default value is "tags". Note that overriding this default value may + :keyword comp: comp. Default value is "tags". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py index 8b0e7656c967..35208c4b8fd9 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_block_blob_operations.py @@ -598,26 +598,24 @@ def build_get_block_list_request( # fmt: on class BlockBlobOperations(object): - """BlockBlobOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.blob.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.blob.AzureBlobStorage`'s + :attr:`block_blob` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def upload( # pylint: disable=inconsistent-return-statements @@ -654,10 +652,10 @@ def upload( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -665,34 +663,37 @@ def upload( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] - :param tier: Optional. Indicates the tier to be set on the blob. + :param tier: Optional. Indicates the tier to be set on the blob. Default value is None. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: Specified if a legal hold should be set on the blob. + :param legal_hold: Specified if a legal hold should be set on the blob. Default value is None. :type legal_hold: bool - :param blob_http_headers: Parameter group. + :param blob_http_headers: Parameter group. Default value is None. :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append - blob. The default value is "BlockBlob". Note that overriding this default value may result in + blob. Default value is "BlockBlob". Note that overriding this default value may result in unsupported behavior. :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -857,10 +858,10 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -868,39 +869,41 @@ def put_blob_from_url( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] - :param tier: Optional. Indicates the tier to be set on the blob. + :param tier: Optional. Indicates the tier to be set on the blob. Default value is None. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param source_content_md5: Specify the md5 calculated for the range of bytes that must be read - from the copy source. + from the copy source. Default value is None. :type source_content_md5: bytearray - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param copy_source_blob_properties: Optional, default is true. Indicates if properties from the source blob should be copied. :type copy_source_blob_properties: bool :param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid - OAuth access token to copy source. + OAuth access token to copy source. Default value is None. :type copy_source_authorization: str - :param blob_http_headers: Parameter group. + :param blob_http_headers: Parameter group. Default value is None. :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append - blob. The default value is "BlockBlob". Note that overriding this default value may result in + blob. Default value is "BlockBlob". Note that overriding this default value may result in unsupported behavior. :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1066,26 +1069,27 @@ def stage_block( # pylint: disable=inconsistent-return-statements :param body: Initial data. :type body: IO :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param transactional_content_crc64: Specify the transactional crc64 for the body, to be - validated by the service. + validated by the service. Default value is None. :type transactional_content_crc64: bytearray :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :keyword comp: comp. The default value is "block". Note that overriding this default value may + :keyword comp: comp. Default value is "block". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1199,35 +1203,36 @@ def stage_block_from_url( # pylint: disable=inconsistent-return-statements :type content_length: long :param source_url: Specify a URL to the copy source. :type source_url: str - :param source_range: Bytes of source data in the specified range. + :param source_range: Bytes of source data in the specified range. Default value is None. :type source_range: str :param source_content_md5: Specify the md5 calculated for the range of bytes that must be read - from the copy source. + from the copy source. Default value is None. :type source_content_md5: bytearray :param source_contentcrc64: Specify the crc64 calculated for the range of bytes that must be - read from the copy source. + read from the copy source. Default value is None. :type source_contentcrc64: bytearray :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid - OAuth access token to copy source. + OAuth access token to copy source. Default value is None. :type copy_source_authorization: str - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :keyword comp: comp. The default value is "block". Note that overriding this default value may + :keyword comp: comp. Default value is "block". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1358,13 +1363,13 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param transactional_content_crc64: Specify the transactional crc64 for the body, to be - validated by the service. + validated by the service. Default value is None. :type transactional_content_crc64: bytearray :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -1372,34 +1377,37 @@ def commit_block_list( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] - :param tier: Optional. Indicates the tier to be set on the blob. + :param tier: Optional. Indicates the tier to be set on the blob. Default value is None. :type tier: str or ~azure.storage.blob.models.AccessTierOptional :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: Specified if a legal hold should be set on the blob. + :param legal_hold: Specified if a legal hold should be set on the blob. Default value is None. :type legal_hold: bool - :param blob_http_headers: Parameter group. + :param blob_http_headers: Parameter group. Default value is None. :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "blocklist". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "blocklist". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1544,25 +1552,26 @@ def get_block_list( specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param list_type: Specifies whether to return the list of committed blocks, the list of - uncommitted blocks, or both lists together. + uncommitted blocks, or both lists together. Default value is "committed". :type list_type: str or ~azure.storage.blob.models.BlockListType :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "blocklist". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "blocklist". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BlockList, or the result of cls(response) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py index e92b12f34c1e..7ce3a0211224 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_container_operations.py @@ -951,26 +951,24 @@ def build_get_account_info_request( # fmt: on class ContainerOperations(object): - """ContainerOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.blob.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.blob.AzureBlobStorage`'s + :attr:`container` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def create( # pylint: disable=inconsistent-return-statements @@ -989,7 +987,7 @@ def create( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -997,17 +995,18 @@ def create( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] :param access: Specifies whether data in the container may be accessed publicly and the level - of access. + of access. Default value is None. :type access: str or ~azure.storage.blob.models.PublicAccessType :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param container_cpk_scope_info: Parameter group. + :param container_cpk_scope_info: Parameter group. Default value is None. :type container_cpk_scope_info: ~azure.storage.blob.models.ContainerCpkScopeInfo - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1086,14 +1085,15 @@ def get_properties( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1178,16 +1178,17 @@ def delete( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1267,7 +1268,7 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -1275,20 +1276,21 @@ def set_metadata( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "metadata". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1368,18 +1370,19 @@ def get_access_policy( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "acl". Note that overriding this default value may - result in unsupported behavior. + :keyword comp: comp. Default value is "acl". Note that overriding this default value may result + in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier, or the result of cls(response) @@ -1461,25 +1464,26 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param access: Specifies whether data in the container may be accessed publicly and the level - of access. + of access. Default value is None. :type access: str or ~azure.storage.blob.models.PublicAccessType :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param container_acl: the acls for the container. + :param container_acl: the acls for the container. Default value is None. :type container_acl: list[~azure.storage.blob.models.SignedIdentifier] - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "acl". Note that overriding this default value may - result in unsupported behavior. + :keyword comp: comp. Default value is "acl". Note that overriding this default value may result + in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1570,22 +1574,23 @@ def restore( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param deleted_container_name: Optional. Version 2019-12-12 and later. Specifies the name of - the deleted container to restore. + the deleted container to restore. Default value is None. :type deleted_container_name: str :param deleted_container_version: Optional. Version 2019-12-12 and later. Specifies the - version of the deleted container to restore. + version of the deleted container to restore. Default value is None. :type deleted_container_version: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "undelete". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "undelete". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1658,18 +1663,19 @@ def rename( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param source_lease_id: A lease ID for the source path. If specified, the source path must have - an active lease and the lease ID must match. + an active lease and the lease ID must match. Default value is None. :type source_lease_id: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "rename". Note that overriding this default value may + :keyword comp: comp. Default value is "rename". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1745,18 +1751,19 @@ def submit_batch( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :keyword multipart_content_type: Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_:code:``. :paramtype multipart_content_type: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "batch". Note that overriding this default value may + :keyword comp: comp. Default value is "batch". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1835,32 +1842,33 @@ def filter_blobs( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param where: Filters the results to return only to return only blobs whose tags match the - specified expression. + specified expression. Default value is None. :type where: str :param marker: A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the - client. + client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than - the default of 5000. + the default of 5000. Default value is None. :type maxresults: int - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "blobs". Note that overriding this default value may + :keyword comp: comp. Default value is "blobs". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1938,28 +1946,29 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease - duration cannot be changed using renew or change. + duration cannot be changed using renew or change. Default value is None. :type duration: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword action: Describes what lease action to take. The default value is "acquire". Note that + :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2046,20 +2055,21 @@ def release_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword action: Describes what lease action to take. The default value is "release". Note that + :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2144,20 +2154,21 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword action: Describes what lease action to take. The default value is "renew". Note that + :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2241,7 +2252,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param break_period: For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter @@ -2249,20 +2260,21 @@ def break_lease( # pylint: disable=inconsistent-return-statements lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease - breaks immediately. + breaks immediately. Default value is None. :type break_period: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword action: Describes what lease action to take. The default value is "break". Note that + :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2353,20 +2365,21 @@ def change_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword action: Describes what lease action to take. The default value is "change". Note that + :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2450,37 +2463,38 @@ def list_blob_flat_segment( """[Update] The List Blobs operation returns a list of the blobs under the specified container. :param prefix: Filters the results to return only containers whose name begins with the - specified prefix. + specified prefix. Default value is None. :type prefix: str :param marker: A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the - client. + client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than - the default of 5000. + the default of 5000. Default value is None. :type maxresults: int :param include: Include this parameter to specify one or more datasets to include in the - response. + response. Default value is None. :type include: list[str or ~azure.storage.blob.models.ListBlobsIncludeItem] :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "list". Note that overriding this default value may + :keyword comp: comp. Default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2564,37 +2578,38 @@ def list_blob_hierarchy_segment( single character or a string. :type delimiter: str :param prefix: Filters the results to return only containers whose name begins with the - specified prefix. + specified prefix. Default value is None. :type prefix: str :param marker: A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the - client. + client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than - the default of 5000. + the default of 5000. Default value is None. :type maxresults: int :param include: Include this parameter to specify one or more datasets to include in the - response. + response. Default value is None. :type include: list[str or ~azure.storage.blob.models.ListBlobsIncludeItem] :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "list". Note that overriding this default value may + :keyword comp: comp. Default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2666,11 +2681,11 @@ def get_account_info( # pylint: disable=inconsistent-return-statements # type: (...) -> None """Returns the sku name and account kind. - :keyword restype: restype. The default value is "account". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "account". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py index 364e589f72e1..a85f8ff66cf9 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_page_blob_operations.py @@ -770,26 +770,24 @@ def build_copy_incremental_request( # fmt: on class PageBlobOperations(object): - """PageBlobOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.blob.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.blob.AzureBlobStorage`'s + :attr:`page_blob` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def create( # pylint: disable=inconsistent-return-statements @@ -823,9 +821,9 @@ def create( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param tier: Optional. Indicates the tier to be set on the page blob. + :param tier: Optional. Indicates the tier to be set on the page blob. Default value is None. :type tier: str or ~azure.storage.blob.models.PremiumPageBlobAccessTier :param metadata: Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob @@ -833,36 +831,39 @@ def create( # pylint: disable=inconsistent-return-statements blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more - information. + information. Default value is None. :type metadata: dict[str, str] :param blob_sequence_number: Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 - and 2^63 - 1. + and 2^63 - 1. Default value is 0. :type blob_sequence_number: long :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param blob_tags_string: Optional. Used to set blob tags in various blob operations. + :param blob_tags_string: Optional. Used to set blob tags in various blob operations. Default + value is None. :type blob_tags_string: str :param immutability_policy_expiry: Specifies the date time when the blobs immutability policy - is set to expire. + is set to expire. Default value is None. :type immutability_policy_expiry: ~datetime.datetime :param immutability_policy_mode: Specifies the immutability policy mode to set on the blob. + Default value is None. :type immutability_policy_mode: str or ~azure.storage.blob.models.BlobImmutabilityPolicyMode - :param legal_hold: Specified if a legal hold should be set on the blob. + :param legal_hold: Specified if a legal hold should be set on the blob. Default value is None. :type legal_hold: bool - :param blob_http_headers: Parameter group. + :param blob_http_headers: Parameter group. Default value is None. :type blob_http_headers: ~azure.storage.blob.models.BlobHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions :keyword blob_type: Specifies the type of blob to create: block blob, page blob, or append - blob. The default value is "PageBlob". Note that overriding this default value may result in + blob. Default value is "PageBlob". Note that overriding this default value may result in unsupported behavior. :paramtype blob_type: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1010,33 +1011,34 @@ def upload_pages( # pylint: disable=inconsistent-return-statements :param body: Initial data. :type body: IO :param transactional_content_md5: Specify the transactional md5 for the body, to be validated - by the service. + by the service. Default value is None. :type transactional_content_md5: bytearray :param transactional_content_crc64: Specify the transactional crc64 for the body, to be - validated by the service. + validated by the service. Default value is None. :type transactional_content_crc64: bytearray :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param range: Return only the bytes of the blob in the specified range. + :param range: Return only the bytes of the blob in the specified range. Default value is None. :type range: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param sequence_number_access_conditions: Parameter group. + :param sequence_number_access_conditions: Parameter group. Default value is None. :type sequence_number_access_conditions: ~azure.storage.blob.models.SequenceNumberAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "page". Note that overriding this default value may + :keyword comp: comp. Default value is "page". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -1046,7 +1048,7 @@ def upload_pages( # pylint: disable=inconsistent-return-statements and Content-Length headers must match to perform the update. * Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that - indicates the range to clear, up to maximum blob size. The default value is "update". Note that + indicates the range to clear, up to maximum blob size. Default value is "update". Note that overriding this default value may result in unsupported behavior. :paramtype page_write: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1183,25 +1185,26 @@ def clear_pages( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param range: Return only the bytes of the blob in the specified range. + :param range: Return only the bytes of the blob in the specified range. Default value is None. :type range: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param sequence_number_access_conditions: Parameter group. + :param sequence_number_access_conditions: Parameter group. Default value is None. :type sequence_number_access_conditions: ~azure.storage.blob.models.SequenceNumberAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "page". Note that overriding this default value may + :keyword comp: comp. Default value is "page". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -1211,7 +1214,7 @@ def clear_pages( # pylint: disable=inconsistent-return-statements and Content-Length headers must match to perform the update. * Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that - indicates the range to clear, up to maximum blob size. The default value is "clear". Note that + indicates the range to clear, up to maximum blob size. Default value is "clear". Note that overriding this default value may result in unsupported behavior. :paramtype page_write: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1352,37 +1355,38 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements be 512 aligned and range-end is required. :type range: str :param source_content_md5: Specify the md5 calculated for the range of bytes that must be read - from the copy source. + from the copy source. Default value is None. :type source_content_md5: bytearray :param source_contentcrc64: Specify the crc64 calculated for the range of bytes that must be - read from the copy source. + read from the copy source. Default value is None. :type source_contentcrc64: bytearray :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid - OAuth access token to copy source. + OAuth access token to copy source. Default value is None. :type copy_source_authorization: str - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param sequence_number_access_conditions: Parameter group. + :param sequence_number_access_conditions: Parameter group. Default value is None. :type sequence_number_access_conditions: ~azure.storage.blob.models.SequenceNumberAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.blob.models.SourceModifiedAccessConditions - :keyword comp: comp. The default value is "page". Note that overriding this default value may + :keyword comp: comp. Default value is "page". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword page_write: Required. You may specify one of the following options: @@ -1392,7 +1396,7 @@ def upload_pages_from_url( # pylint: disable=inconsistent-return-statements and Content-Length headers must match to perform the update. * Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that - indicates the range to clear, up to maximum blob size. The default value is "update". Note that + indicates the range to clear, up to maximum blob size. Default value is "update". Note that overriding this default value may result in unsupported behavior. :paramtype page_write: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1537,24 +1541,25 @@ def get_page_ranges( specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param range: Return only the bytes of the blob in the specified range. + :param range: Return only the bytes of the blob in the specified range. Default value is None. :type range: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "pagelist". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "pagelist". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PageList, or the result of cls(response) @@ -1655,36 +1660,37 @@ def get_page_ranges_diff( specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see :code:`Creating - a Snapshot of a Blob.`. + a Snapshot of a Blob.`. Default value is None. :type snapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param prevsnapshot: Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only for blobs - created on or after January 1, 2016. + created on or after January 1, 2016. Default value is None. :type prevsnapshot: str :param prev_snapshot_url: Optional. This header is only supported in service versions 2019-04-19 and after and specifies the URL of a previous snapshot of the target blob. The response will only contain pages that were changed between the target blob and its previous - snapshot. + snapshot. Default value is None. :type prev_snapshot_url: str - :param range: Return only the bytes of the blob in the specified range. + :param range: Return only the bytes of the blob in the specified range. Default value is None. :type range: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "pagelist". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "pagelist". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PageList, or the result of cls(response) @@ -1787,21 +1793,22 @@ def resize( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param cpk_info: Parameter group. + :param cpk_info: Parameter group. Default value is None. :type cpk_info: ~azure.storage.blob.models.CpkInfo - :param cpk_scope_info: Parameter group. + :param cpk_scope_info: Parameter group. Default value is None. :type cpk_scope_info: ~azure.storage.blob.models.CpkScopeInfo - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "properties". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1912,21 +1919,22 @@ def update_sequence_number( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param blob_sequence_number: Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 - and 2^63 - 1. + and 2^63 - 1. Default value is 0. :type blob_sequence_number: long :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.blob.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "properties". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2027,14 +2035,15 @@ def copy_incremental( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.blob.models.ModifiedAccessConditions - :keyword comp: comp. The default value is "incrementalcopy". Note that overriding this default + :keyword comp: comp. Default value is "incrementalcopy". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py index 6e1e74f5b213..cfeebbe00248 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_service_operations.py @@ -393,26 +393,24 @@ def build_filter_blobs_request( # fmt: on class ServiceOperations(object): - """ServiceOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.blob.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.blob.AzureBlobStorage`'s + :attr:`service` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def set_properties( # pylint: disable=inconsistent-return-statements @@ -431,16 +429,17 @@ def set_properties( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "service". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "service". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -511,16 +510,17 @@ def get_properties( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "service". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "service". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties, or the result of cls(response) @@ -591,15 +591,16 @@ def get_statistics( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "service". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "service". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "stats". Note that overriding this default value may + :keyword comp: comp. Default value is "stats". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -673,34 +674,35 @@ def list_containers_segment( account. :param prefix: Filters the results to return only containers whose name begins with the - specified prefix. + specified prefix. Default value is None. :type prefix: str :param marker: A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the - client. + client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than - the default of 5000. + the default of 5000. Default value is None. :type maxresults: int :param include: Include this parameter to specify that the container's metadata be returned as - part of the response body. + part of the response body. Default value is None. :type include: list[str or ~azure.storage.blob.models.ListContainersIncludeType] :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "list". Note that overriding this default value may + :keyword comp: comp. Default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -776,16 +778,17 @@ def get_user_delegation_key( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "service". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "service". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "userdelegationkey". Note that overriding this - default value may result in unsupported behavior. + :keyword comp: comp. Default value is "userdelegationkey". Note that overriding this default + value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: UserDelegationKey, or the result of cls(response) @@ -854,11 +857,11 @@ def get_account_info( # pylint: disable=inconsistent-return-statements # type: (...) -> None """Returns the sku name and account kind. - :keyword restype: restype. The default value is "account". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "account". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -932,15 +935,16 @@ def submit_batch( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :keyword multipart_content_type: Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_:code:``. :paramtype multipart_content_type: str - :keyword comp: comp. The default value is "batch". Note that overriding this default value may + :keyword comp: comp. Default value is "batch". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1018,29 +1022,30 @@ def filter_blobs( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param where: Filters the results to return only to return only blobs whose tags match the - specified expression. + specified expression. Default value is None. :type where: str :param marker: A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the - client. + client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than - the default of 5000. + the default of 5000. Default value is None. :type maxresults: int - :keyword comp: comp. The default value is "blobs". Note that overriding this default value may + :keyword comp: comp. Default value is "blobs". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_azure_data_lake_storage_restapi.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_azure_data_lake_storage_restapi.py index 6f136ca8f7ab..efa3845ff86d 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_azure_data_lake_storage_restapi.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_azure_data_lake_storage_restapi.py @@ -35,15 +35,13 @@ class AzureDataLakeStorageRESTAPI(object): :param url: The URL of the service account, container, or blob that is the target of the desired operation. :type url: str - :param base_url: Service URL. Default value is ''. + :param base_url: Service URL. Default value is "". :type base_url: str - :keyword resource: The value must be "filesystem" for all filesystem operations. The default - value is "filesystem". Note that overriding this default value may result in unsupported - behavior. + :keyword resource: The value must be "filesystem" for all filesystem operations. Default value + is "filesystem". Note that overriding this default value may result in unsupported behavior. :paramtype resource: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2020-10-02". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2020-10-02". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_configuration.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_configuration.py index 6a8f7d7950a1..035e908ed121 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_configuration.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/_configuration.py @@ -26,13 +26,11 @@ class AzureDataLakeStorageRESTAPIConfiguration(Configuration): # pylint: disabl :param url: The URL of the service account, container, or blob that is the target of the desired operation. :type url: str - :keyword resource: The value must be "filesystem" for all filesystem operations. The default - value is "filesystem". Note that overriding this default value may result in unsupported - behavior. + :keyword resource: The value must be "filesystem" for all filesystem operations. Default value + is "filesystem". Note that overriding this default value may result in unsupported behavior. :paramtype resource: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2020-10-02". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2020-10-02". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_azure_data_lake_storage_restapi.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_azure_data_lake_storage_restapi.py index be64a6b6cc1a..3ff38e5d8888 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_azure_data_lake_storage_restapi.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_azure_data_lake_storage_restapi.py @@ -30,15 +30,13 @@ class AzureDataLakeStorageRESTAPI: :param url: The URL of the service account, container, or blob that is the target of the desired operation. :type url: str - :param base_url: Service URL. Default value is ''. + :param base_url: Service URL. Default value is "". :type base_url: str - :keyword resource: The value must be "filesystem" for all filesystem operations. The default - value is "filesystem". Note that overriding this default value may result in unsupported - behavior. + :keyword resource: The value must be "filesystem" for all filesystem operations. Default value + is "filesystem". Note that overriding this default value may result in unsupported behavior. :paramtype resource: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2020-10-02". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2020-10-02". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_configuration.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_configuration.py index c8c4d24203d4..36dc41a2e7b5 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/_configuration.py @@ -22,13 +22,11 @@ class AzureDataLakeStorageRESTAPIConfiguration(Configuration): # pylint: disabl :param url: The URL of the service account, container, or blob that is the target of the desired operation. :type url: str - :keyword resource: The value must be "filesystem" for all filesystem operations. The default - value is "filesystem". Note that overriding this default value may result in unsupported - behavior. + :keyword resource: The value must be "filesystem" for all filesystem operations. Default value + is "filesystem". Note that overriding this default value may result in unsupported behavior. :paramtype resource: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2020-10-02". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2020-10-02". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_file_system_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_file_system_operations.py index 65df1f9bfc86..1f25cef5911d 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_file_system_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_file_system_operations.py @@ -21,26 +21,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class FileSystemOperations: - """FileSystemOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.filedatalake.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.filedatalake.aio.AzureDataLakeStorageRESTAPI`'s + :attr:`file_system` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def create( # pylint: disable=inconsistent-return-statements @@ -56,12 +54,13 @@ async def create( # pylint: disable=inconsistent-return-statements operation fails. This operation does not support conditional HTTP requests. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param properties: Optional. User-defined properties to be stored with the filesystem, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value @@ -69,7 +68,8 @@ async def create( # pylint: disable=inconsistent-return-statements ISO-8859-1 character set. If the filesystem exists, any properties not included in the list will be removed. All properties are removed if the header is omitted. To merge new and existing properties, first get all existing properties and the current E-Tag, then make a - conditional request with the E-Tag and include values for all properties. + conditional request with the E-Tag and include values for all properties. Default value is + None. :type properties: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -138,12 +138,13 @@ async def set_properties( # pylint: disable=inconsistent-return-statements `_. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param properties: Optional. User-defined properties to be stored with the filesystem, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value @@ -151,9 +152,10 @@ async def set_properties( # pylint: disable=inconsistent-return-statements ISO-8859-1 character set. If the filesystem exists, any properties not included in the list will be removed. All properties are removed if the header is omitted. To merge new and existing properties, first get all existing properties and the current E-Tag, then make a - conditional request with the E-Tag and include values for all properties. + conditional request with the E-Tag and include values for all properties. Default value is + None. :type properties: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -224,12 +226,13 @@ async def get_properties( # pylint: disable=inconsistent-return-statements All system and user-defined filesystem properties are specified in the response headers. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -303,14 +306,15 @@ async def delete( # pylint: disable=inconsistent-return-statements `_. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -385,24 +389,26 @@ async def list_paths( :param recursive: Required. :type recursive: bool :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param continuation: Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the delete operation to - continue deleting the directory. + continue deleting the directory. Default value is None. :type continuation: str :param path: Optional. Filters results to paths within the specified directory. An error - occurs if the directory does not exist. + occurs if the directory does not exist. Default value is None. :type path: str :param max_results: An optional value that specifies the maximum number of items to return. If - omitted or greater than 5,000, the response will include up to 5,000 items. + omitted or greater than 5,000, the response will include up to 5,000 items. Default value is + None. :type max_results: int :param upn: Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the user identity values returned in the x-ms-owner, x-ms-group, and x-ms-acl response @@ -484,41 +490,44 @@ async def list_blob_hierarchy_segment( ) -> "_models.ListBlobsHierarchySegmentResponse": """The List Blobs operation returns a list of the blobs under the specified container. - :param prefix: Filters results to filesystems within the specified prefix. + :param prefix: Filters results to filesystems within the specified prefix. Default value is + None. :type prefix: str :param delimiter: When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a - single character or a string. + single character or a string. Default value is None. :type delimiter: str :param marker: A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the - client. + client. Default value is None. :type marker: str :param max_results: An optional value that specifies the maximum number of items to return. If - omitted or greater than 5,000, the response will include up to 5,000 items. + omitted or greater than 5,000, the response will include up to 5,000 items. Default value is + None. :type max_results: int :param include: Include this parameter to specify one or more datasets to include in the - response. + response. Default value is None. :type include: list[str or ~azure.storage.filedatalake.models.ListBlobsIncludeItem] :param showonly: Include this parameter to specify one or more datasets to include in the - response. The default value is "deleted". + response. Possible values are "deleted" or None. Default value is "deleted". :type showonly: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "list". Note that overriding this default value may + :keyword comp: comp. Default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_path_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_path_operations.py index ae481506e7f0..f2c95eca104a 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_path_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_path_operations.py @@ -21,26 +21,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PathOperations: - """PathOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.filedatalake.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.filedatalake.aio.AzureDataLakeStorageRESTAPI`'s + :attr:`path` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def create( # pylint: disable=inconsistent-return-statements @@ -71,34 +69,35 @@ async def create( # pylint: disable=inconsistent-return-statements To fail if the destination already exists, use a conditional request with If-None-Match: "*". :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param resource: Required only for Create File and Create Directory. The value must be "file" - or "directory". + or "directory". Default value is None. :type resource: str or ~azure.storage.filedatalake.models.PathResourceType :param continuation: Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the delete operation to - continue deleting the directory. + continue deleting the directory. Default value is None. :type continuation: str :param mode: Optional. Valid only when namespace is enabled. This parameter determines the behavior of the rename operation. The value must be "legacy" or "posix", and the default value - will be "posix". + will be "posix". Default value is None. :type mode: str or ~azure.storage.filedatalake.models.PathRenameMode :param rename_source: An optional file or directory to be renamed. The value must have the following format: "/{filesystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties; otherwise, the existing properties will be preserved. This value must be a URL percent-encoded string. Note that the string may only contain ASCII - characters in the ISO-8859-1 character set. + characters in the ISO-8859-1 character set. Default value is None. :type rename_source: str :param source_lease_id: A lease ID for the source path. If specified, the source path must have - an active lease and the lease ID must match. + an active lease and the lease ID must match. Default value is None. :type source_lease_id: str :param properties: Optional. User-defined properties to be stored with the filesystem, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value @@ -106,12 +105,14 @@ async def create( # pylint: disable=inconsistent-return-statements ISO-8859-1 character set. If the filesystem exists, any properties not included in the list will be removed. All properties are removed if the header is omitted. To merge new and existing properties, first get all existing properties and the current E-Tag, then make a - conditional request with the E-Tag and include values for all properties. + conditional request with the E-Tag and include values for all properties. Default value is + None. :type properties: str :param permissions: Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + Default value is None. :type permissions: str :param umask: Optional and only valid if Hierarchical Namespace is enabled for the account. When creating a file or directory and the parent folder does not have a default ACL, the umask @@ -119,15 +120,15 @@ async def create( # pylint: disable=inconsistent-return-statements given by p bitwise and not u, where p is the permission and u is the umask. For example, if p is 0777 and u is 0057, then the resulting permission is 0720. The default permission is 0777 for a directory and 0666 for a file. The default umask is 0027. The umask must be specified - in 4-digit octal notation (e.g. 0766). + in 4-digit octal notation (e.g. 0766). Default value is None. :type umask: str - :param path_http_headers: Parameter group. + :param path_http_headers: Parameter group. Default value is None. :type path_http_headers: ~azure.storage.filedatalake.models.PathHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.filedatalake.models.SourceModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response @@ -285,22 +286,23 @@ async def update( :param body: Initial data. :type body: IO :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param max_records: Optional. Valid for "SetAccessControlRecursive" operation. It specifies the maximum number of files or directories on which the acl change will be applied. If omitted or - greater than 2,000, the request will process up to 2,000 items. + greater than 2,000, the request will process up to 2,000 items. Default value is None. :type max_records: int :param continuation: Optional. The number of paths processed with each invocation is limited. If the number of paths to be processed exceeds this limit, a continuation token is returned in the response header x-ms-continuation. When a continuation token is returned in the response, it must be percent-encoded and specified in a subsequent invocation of - setAccessControlRecursive operation. + setAccessControlRecursive operation. Default value is None. :type continuation: str :param force_flag: Optional. Valid for "SetAccessControlRecursive" operation. If set to false, the operation will terminate quickly on encountering user errors (4XX). If true, the operation @@ -314,7 +316,8 @@ async def update( position where the data is to be appended. Uploaded data is not immediately flushed, or written, to the file. To flush, the previously uploaded data must be contiguous, the position parameter must be specified and equal to the length of the file after all data has been - written, and there must not be a request entity body included with the request. + written, and there must not be a request entity body included with the request. Default value + is None. :type position: long :param retain_uncommitted_data: Valid only for flush operations. If "true", uncommitted data is retained after the flush operation completes; otherwise, the uncommitted data is deleted @@ -334,7 +337,8 @@ async def update( indicate that the file stream has been closed.". :type close: bool :param content_length: Required for "Append Data" and "Flush Data". Must be 0 for "Flush - Data". Must be the length of the request content in bytes for "Append Data". + Data". Must be the length of the request content in bytes for "Append Data". Default value is + None. :type content_length: long :param properties: Optional. User-defined properties to be stored with the filesystem, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value @@ -342,27 +346,29 @@ async def update( ISO-8859-1 character set. If the filesystem exists, any properties not included in the list will be removed. All properties are removed if the header is omitted. To merge new and existing properties, first get all existing properties and the current E-Tag, then make a - conditional request with the E-Tag and include values for all properties. + conditional request with the E-Tag and include values for all properties. Default value is + None. :type properties: str - :param owner: Optional. The owner of the blob or directory. + :param owner: Optional. The owner of the blob or directory. Default value is None. :type owner: str - :param group: Optional. The owning group of the blob or directory. + :param group: Optional. The owning group of the blob or directory. Default value is None. :type group: str :param permissions: Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + Default value is None. :type permissions: str :param acl: Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. Each access control entry (ACE) consists of a scope, a type, a user or group identifier, and permissions in the format - "[scope:][type]:[id]:[permissions]". + "[scope:][type]:[id]:[permissions]". Default value is None. :type acl: str - :param path_http_headers: Parameter group. + :param path_http_headers: Parameter group. Default value is None. :type path_http_headers: ~azure.storage.filedatalake.models.PathHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: SetAccessControlRecursiveResponse, or the result of cls(response) @@ -522,28 +528,29 @@ async def lease( # pylint: disable=inconsistent-return-statements existing lease. Use "release" and specify the "x-ms-lease-id" to release a lease. :type x_ms_lease_action: str or ~azure.storage.filedatalake.models.PathLeaseAction :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param x_ms_lease_duration: The lease duration is required to acquire a lease, and specifies the duration of the lease in seconds. The lease duration must be between 15 and 60 seconds or - -1 for infinite lease. + -1 for infinite lease. Default value is None. :type x_ms_lease_duration: int :param x_ms_lease_break_period: The lease break period duration is optional to break a lease, and specifies the break period of the lease in seconds. The lease break duration must be - between 0 and 60 seconds. + between 0 and 60 seconds. Default value is None. :type x_ms_lease_break_period: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -652,25 +659,27 @@ async def read( `_. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param range: The HTTP Range request header specifies one or more byte ranges of the resource - to be retrieved. + to be retrieved. Default value is None. :type range: str :param x_ms_range_get_content_md5: Optional. When this header is set to "true" and specified together with the Range header, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4MB in size. If this header is specified without the Range header, the service returns status code 400 (Bad Request). If this header is set to true when - the range exceeds 4 MB in size, the service returns status code 400 (Bad Request). + the range exceeds 4 MB in size, the service returns status code 400 (Bad Request). Default + value is None. :type x_ms_range_get_content_md5: bool - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: IO, or the result of cls(response) @@ -801,17 +810,18 @@ async def get_properties( # pylint: disable=inconsistent-return-statements `_. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param action: Optional. If the value is "getStatus" only the system defined properties for the path are returned. If the value is "getAccessControl" the access control list is returned in the response headers (Hierarchical Namespace must be enabled for the account), otherwise the - properties are returned. + properties are returned. Default value is None. :type action: str or ~azure.storage.filedatalake.models.PathGetPropertiesAction :param upn: Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the user identity values returned in the x-ms-owner, x-ms-group, and x-ms-acl response @@ -820,9 +830,9 @@ async def get_properties( # pylint: disable=inconsistent-return-statements false. Note that group and application Object IDs are not translated because they do not have unique friendly names. :type upn: bool - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -927,24 +937,25 @@ async def delete( # pylint: disable=inconsistent-return-statements `_. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param recursive: Required. + :param recursive: Required. Default value is None. :type recursive: bool :param continuation: Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the delete operation to - continue deleting the directory. + continue deleting the directory. Default value is None. :type continuation: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1031,31 +1042,33 @@ async def set_access_control( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param owner: Optional. The owner of the blob or directory. + :param owner: Optional. The owner of the blob or directory. Default value is None. :type owner: str - :param group: Optional. The owning group of the blob or directory. + :param group: Optional. The owning group of the blob or directory. Default value is None. :type group: str :param permissions: Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + Default value is None. :type permissions: str :param acl: Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. Each access control entry (ACE) consists of a scope, a type, a user or group identifier, and permissions in the format - "[scope:][type]:[id]:[permissions]". + "[scope:][type]:[id]:[permissions]". Default value is None. :type acl: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions - :keyword action: action. The default value is "setAccessControl". Note that overriding this - default value may result in unsupported behavior. + :keyword action: action. Default value is "setAccessControl". Note that overriding this default + value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1152,13 +1165,13 @@ async def set_access_control_recursive( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param continuation: Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the delete operation to - continue deleting the directory. + continue deleting the directory. Default value is None. :type continuation: str :param force_flag: Optional. Valid for "SetAccessControlRecursive" operation. If set to false, the operation will terminate quickly on encountering user errors (4XX). If true, the operation @@ -1168,17 +1181,18 @@ async def set_access_control_recursive( :type force_flag: bool :param max_records: Optional. It specifies the maximum number of files or directories on which the acl change will be applied. If omitted or greater than 2,000, the request will process up - to 2,000 items. + to 2,000 items. Default value is None. :type max_records: int :param acl: Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. Each access control entry (ACE) consists of a scope, a type, a user or group identifier, and permissions in the format - "[scope:][type]:[id]:[permissions]". + "[scope:][type]:[id]:[permissions]". Default value is None. :type acl: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword action: action. The default value is "setAccessControlRecursive". Note that overriding + :keyword action: action. Default value is "setAccessControlRecursive". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1259,7 +1273,7 @@ async def flush_data( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param position: This parameter allows the caller to upload data in parallel and control the order in which it is appended to the file. It is required when uploading data to be appended @@ -1267,7 +1281,8 @@ async def flush_data( # pylint: disable=inconsistent-return-statements position where the data is to be appended. Uploaded data is not immediately flushed, or written, to the file. To flush, the previously uploaded data must be contiguous, the position parameter must be specified and equal to the length of the file after all data has been - written, and there must not be a request entity body included with the request. + written, and there must not be a request entity body included with the request. Default value + is None. :type position: long :param retain_uncommitted_data: Valid only for flush operations. If "true", uncommitted data is retained after the flush operation completes; otherwise, the uncommitted data is deleted @@ -1287,19 +1302,21 @@ async def flush_data( # pylint: disable=inconsistent-return-statements indicate that the file stream has been closed.". :type close: bool :param content_length: Required for "Append Data" and "Flush Data". Must be 0 for "Flush - Data". Must be the length of the request content in bytes for "Append Data". + Data". Must be the length of the request content in bytes for "Append Data". Default value is + None. :type content_length: long :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param path_http_headers: Parameter group. + :param path_http_headers: Parameter group. Default value is None. :type path_http_headers: ~azure.storage.filedatalake.models.PathHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions - :keyword action: action. The default value is "flush". Note that overriding this default value - may result in unsupported behavior. + :keyword action: action. Default value is "flush". Note that overriding this default value may + result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1418,28 +1435,31 @@ async def append_data( # pylint: disable=inconsistent-return-statements position where the data is to be appended. Uploaded data is not immediately flushed, or written, to the file. To flush, the previously uploaded data must be contiguous, the position parameter must be specified and equal to the length of the file after all data has been - written, and there must not be a request entity body included with the request. + written, and there must not be a request entity body included with the request. Default value + is None. :type position: long :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param content_length: Required for "Append Data" and "Flush Data". Must be 0 for "Flush - Data". Must be the length of the request content in bytes for "Append Data". + Data". Must be the length of the request content in bytes for "Append Data". Default value is + None. :type content_length: long :param transactional_content_crc64: Specify the transactional crc64 for the body, to be - validated by the service. + validated by the service. Default value is None. :type transactional_content_crc64: bytearray :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param path_http_headers: Parameter group. + :param path_http_headers: Parameter group. Default value is None. :type path_http_headers: ~azure.storage.filedatalake.models.PathHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :keyword action: action. The default value is "append". Note that overriding this default value - may result in unsupported behavior. + :keyword action: action. Default value is "append". Note that overriding this default value may + result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1526,14 +1546,15 @@ async def set_expiry( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param expires_on: The time to set the blob to expiry. + :param expires_on: The time to set the blob to expiry. Default value is None. :type expires_on: str - :keyword comp: comp. The default value is "expiry". Note that overriding this default value may + :keyword comp: comp. Default value is "expiry". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1603,16 +1624,17 @@ async def undelete( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param undelete_source: Only for hierarchical namespace enabled accounts. Optional. The path of - the soft deleted blob to undelete. + the soft deleted blob to undelete. Default value is None. :type undelete_source: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "undelete". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "undelete". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_service_operations.py index dd5365398f2a..6a09b88a228e 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/aio/operations/_service_operations.py @@ -22,26 +22,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ServiceOperations: - """ServiceOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.filedatalake.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.filedatalake.aio.AzureDataLakeStorageRESTAPI`'s + :attr:`service` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def list_file_systems( @@ -57,26 +55,29 @@ def list_file_systems( List filesystems and their properties in given account. - :param prefix: Filters results to filesystems within the specified prefix. + :param prefix: Filters results to filesystems within the specified prefix. Default value is + None. :type prefix: str :param continuation: Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the delete operation to - continue deleting the directory. + continue deleting the directory. Default value is None. :type continuation: str :param max_results: An optional value that specifies the maximum number of items to return. If - omitted or greater than 5,000, the response will include up to 5,000 items. + omitted or greater than 5,000, the response will include up to 5,000 items. Default value is + None. :type max_results: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :keyword resource: The value must be "account" for all account operations. The default value is + :keyword resource: The value must be "account" for all account operations. Default value is "account". Note that overriding this default value may result in unsupported behavior. :paramtype resource: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_file_system_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_file_system_operations.py index 2df91bc33e27..943589323762 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_file_system_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_file_system_operations.py @@ -329,26 +329,24 @@ def build_list_blob_hierarchy_segment_request( # fmt: on class FileSystemOperations(object): - """FileSystemOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.filedatalake.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.filedatalake.AzureDataLakeStorageRESTAPI`'s + :attr:`file_system` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def create( # pylint: disable=inconsistent-return-statements @@ -365,12 +363,13 @@ def create( # pylint: disable=inconsistent-return-statements operation fails. This operation does not support conditional HTTP requests. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param properties: Optional. User-defined properties to be stored with the filesystem, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value @@ -378,7 +377,8 @@ def create( # pylint: disable=inconsistent-return-statements ISO-8859-1 character set. If the filesystem exists, any properties not included in the list will be removed. All properties are removed if the header is omitted. To merge new and existing properties, first get all existing properties and the current E-Tag, then make a - conditional request with the E-Tag and include values for all properties. + conditional request with the E-Tag and include values for all properties. Default value is + None. :type properties: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -448,12 +448,13 @@ def set_properties( # pylint: disable=inconsistent-return-statements `_. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param properties: Optional. User-defined properties to be stored with the filesystem, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value @@ -461,9 +462,10 @@ def set_properties( # pylint: disable=inconsistent-return-statements ISO-8859-1 character set. If the filesystem exists, any properties not included in the list will be removed. All properties are removed if the header is omitted. To merge new and existing properties, first get all existing properties and the current E-Tag, then make a - conditional request with the E-Tag and include values for all properties. + conditional request with the E-Tag and include values for all properties. Default value is + None. :type properties: str - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -535,12 +537,13 @@ def get_properties( # pylint: disable=inconsistent-return-statements All system and user-defined filesystem properties are specified in the response headers. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -615,14 +618,15 @@ def delete( # pylint: disable=inconsistent-return-statements `_. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -698,24 +702,26 @@ def list_paths( :param recursive: Required. :type recursive: bool :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param continuation: Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the delete operation to - continue deleting the directory. + continue deleting the directory. Default value is None. :type continuation: str :param path: Optional. Filters results to paths within the specified directory. An error - occurs if the directory does not exist. + occurs if the directory does not exist. Default value is None. :type path: str :param max_results: An optional value that specifies the maximum number of items to return. If - omitted or greater than 5,000, the response will include up to 5,000 items. + omitted or greater than 5,000, the response will include up to 5,000 items. Default value is + None. :type max_results: int :param upn: Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the user identity values returned in the x-ms-owner, x-ms-group, and x-ms-acl response @@ -798,41 +804,44 @@ def list_blob_hierarchy_segment( # type: (...) -> "_models.ListBlobsHierarchySegmentResponse" """The List Blobs operation returns a list of the blobs under the specified container. - :param prefix: Filters results to filesystems within the specified prefix. + :param prefix: Filters results to filesystems within the specified prefix. Default value is + None. :type prefix: str :param delimiter: When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a - single character or a string. + single character or a string. Default value is None. :type delimiter: str :param marker: A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the - client. + client. Default value is None. :type marker: str :param max_results: An optional value that specifies the maximum number of items to return. If - omitted or greater than 5,000, the response will include up to 5,000 items. + omitted or greater than 5,000, the response will include up to 5,000 items. Default value is + None. :type max_results: int :param include: Include this parameter to specify one or more datasets to include in the - response. + response. Default value is None. :type include: list[str or ~azure.storage.filedatalake.models.ListBlobsIncludeItem] :param showonly: Include this parameter to specify one or more datasets to include in the - response. The default value is "deleted". + response. Possible values are "deleted" or None. Default value is "deleted". :type showonly: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword restype: restype. The default value is "container". Note that overriding this default + :keyword restype: restype. Default value is "container". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "list". Note that overriding this default value may + :keyword comp: comp. Default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_path_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_path_operations.py index 894d78cc30ca..b4e7a349aa1e 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_path_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_path_operations.py @@ -854,26 +854,24 @@ def build_undelete_request( # fmt: on class PathOperations(object): - """PathOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.filedatalake.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.filedatalake.AzureDataLakeStorageRESTAPI`'s + :attr:`path` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def create( # pylint: disable=inconsistent-return-statements @@ -905,34 +903,35 @@ def create( # pylint: disable=inconsistent-return-statements To fail if the destination already exists, use a conditional request with If-None-Match: "*". :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param resource: Required only for Create File and Create Directory. The value must be "file" - or "directory". + or "directory". Default value is None. :type resource: str or ~azure.storage.filedatalake.models.PathResourceType :param continuation: Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the delete operation to - continue deleting the directory. + continue deleting the directory. Default value is None. :type continuation: str :param mode: Optional. Valid only when namespace is enabled. This parameter determines the behavior of the rename operation. The value must be "legacy" or "posix", and the default value - will be "posix". + will be "posix". Default value is None. :type mode: str or ~azure.storage.filedatalake.models.PathRenameMode :param rename_source: An optional file or directory to be renamed. The value must have the following format: "/{filesystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties; otherwise, the existing properties will be preserved. This value must be a URL percent-encoded string. Note that the string may only contain ASCII - characters in the ISO-8859-1 character set. + characters in the ISO-8859-1 character set. Default value is None. :type rename_source: str :param source_lease_id: A lease ID for the source path. If specified, the source path must have - an active lease and the lease ID must match. + an active lease and the lease ID must match. Default value is None. :type source_lease_id: str :param properties: Optional. User-defined properties to be stored with the filesystem, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value @@ -940,12 +939,14 @@ def create( # pylint: disable=inconsistent-return-statements ISO-8859-1 character set. If the filesystem exists, any properties not included in the list will be removed. All properties are removed if the header is omitted. To merge new and existing properties, first get all existing properties and the current E-Tag, then make a - conditional request with the E-Tag and include values for all properties. + conditional request with the E-Tag and include values for all properties. Default value is + None. :type properties: str :param permissions: Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + Default value is None. :type permissions: str :param umask: Optional and only valid if Hierarchical Namespace is enabled for the account. When creating a file or directory and the parent folder does not have a default ACL, the umask @@ -953,15 +954,15 @@ def create( # pylint: disable=inconsistent-return-statements given by p bitwise and not u, where p is the permission and u is the umask. For example, if p is 0777 and u is 0057, then the resulting permission is 0720. The default permission is 0777 for a directory and 0666 for a file. The default umask is 0027. The umask must be specified - in 4-digit octal notation (e.g. 0766). + in 4-digit octal notation (e.g. 0766). Default value is None. :type umask: str - :param path_http_headers: Parameter group. + :param path_http_headers: Parameter group. Default value is None. :type path_http_headers: ~azure.storage.filedatalake.models.PathHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.filedatalake.models.SourceModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response @@ -1120,22 +1121,23 @@ def update( :param body: Initial data. :type body: IO :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param max_records: Optional. Valid for "SetAccessControlRecursive" operation. It specifies the maximum number of files or directories on which the acl change will be applied. If omitted or - greater than 2,000, the request will process up to 2,000 items. + greater than 2,000, the request will process up to 2,000 items. Default value is None. :type max_records: int :param continuation: Optional. The number of paths processed with each invocation is limited. If the number of paths to be processed exceeds this limit, a continuation token is returned in the response header x-ms-continuation. When a continuation token is returned in the response, it must be percent-encoded and specified in a subsequent invocation of - setAccessControlRecursive operation. + setAccessControlRecursive operation. Default value is None. :type continuation: str :param force_flag: Optional. Valid for "SetAccessControlRecursive" operation. If set to false, the operation will terminate quickly on encountering user errors (4XX). If true, the operation @@ -1149,7 +1151,8 @@ def update( position where the data is to be appended. Uploaded data is not immediately flushed, or written, to the file. To flush, the previously uploaded data must be contiguous, the position parameter must be specified and equal to the length of the file after all data has been - written, and there must not be a request entity body included with the request. + written, and there must not be a request entity body included with the request. Default value + is None. :type position: long :param retain_uncommitted_data: Valid only for flush operations. If "true", uncommitted data is retained after the flush operation completes; otherwise, the uncommitted data is deleted @@ -1169,7 +1172,8 @@ def update( indicate that the file stream has been closed.". :type close: bool :param content_length: Required for "Append Data" and "Flush Data". Must be 0 for "Flush - Data". Must be the length of the request content in bytes for "Append Data". + Data". Must be the length of the request content in bytes for "Append Data". Default value is + None. :type content_length: long :param properties: Optional. User-defined properties to be stored with the filesystem, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value @@ -1177,27 +1181,29 @@ def update( ISO-8859-1 character set. If the filesystem exists, any properties not included in the list will be removed. All properties are removed if the header is omitted. To merge new and existing properties, first get all existing properties and the current E-Tag, then make a - conditional request with the E-Tag and include values for all properties. + conditional request with the E-Tag and include values for all properties. Default value is + None. :type properties: str - :param owner: Optional. The owner of the blob or directory. + :param owner: Optional. The owner of the blob or directory. Default value is None. :type owner: str - :param group: Optional. The owning group of the blob or directory. + :param group: Optional. The owning group of the blob or directory. Default value is None. :type group: str :param permissions: Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + Default value is None. :type permissions: str :param acl: Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. Each access control entry (ACE) consists of a scope, a type, a user or group identifier, and permissions in the format - "[scope:][type]:[id]:[permissions]". + "[scope:][type]:[id]:[permissions]". Default value is None. :type acl: str - :param path_http_headers: Parameter group. + :param path_http_headers: Parameter group. Default value is None. :type path_http_headers: ~azure.storage.filedatalake.models.PathHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: SetAccessControlRecursiveResponse, or the result of cls(response) @@ -1358,28 +1364,29 @@ def lease( # pylint: disable=inconsistent-return-statements existing lease. Use "release" and specify the "x-ms-lease-id" to release a lease. :type x_ms_lease_action: str or ~azure.storage.filedatalake.models.PathLeaseAction :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param x_ms_lease_duration: The lease duration is required to acquire a lease, and specifies the duration of the lease in seconds. The lease duration must be between 15 and 60 seconds or - -1 for infinite lease. + -1 for infinite lease. Default value is None. :type x_ms_lease_duration: int :param x_ms_lease_break_period: The lease break period duration is optional to break a lease, and specifies the break period of the lease in seconds. The lease break duration must be - between 0 and 60 seconds. + between 0 and 60 seconds. Default value is None. :type x_ms_lease_break_period: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1489,25 +1496,27 @@ def read( `_. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param range: The HTTP Range request header specifies one or more byte ranges of the resource - to be retrieved. + to be retrieved. Default value is None. :type range: str :param x_ms_range_get_content_md5: Optional. When this header is set to "true" and specified together with the Range header, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4MB in size. If this header is specified without the Range header, the service returns status code 400 (Bad Request). If this header is set to true when - the range exceeds 4 MB in size, the service returns status code 400 (Bad Request). + the range exceeds 4 MB in size, the service returns status code 400 (Bad Request). Default + value is None. :type x_ms_range_get_content_md5: bool - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: IO, or the result of cls(response) @@ -1639,17 +1648,18 @@ def get_properties( # pylint: disable=inconsistent-return-statements `_. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param action: Optional. If the value is "getStatus" only the system defined properties for the path are returned. If the value is "getAccessControl" the access control list is returned in the response headers (Hierarchical Namespace must be enabled for the account), otherwise the - properties are returned. + properties are returned. Default value is None. :type action: str or ~azure.storage.filedatalake.models.PathGetPropertiesAction :param upn: Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the user identity values returned in the x-ms-owner, x-ms-group, and x-ms-acl response @@ -1658,9 +1668,9 @@ def get_properties( # pylint: disable=inconsistent-return-statements false. Note that group and application Object IDs are not translated because they do not have unique friendly names. :type upn: bool - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1766,24 +1776,25 @@ def delete( # pylint: disable=inconsistent-return-statements `_. :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param recursive: Required. + :param recursive: Required. Default value is None. :type recursive: bool :param continuation: Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the delete operation to - continue deleting the directory. + continue deleting the directory. Default value is None. :type continuation: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1871,31 +1882,33 @@ def set_access_control( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :param owner: Optional. The owner of the blob or directory. + :param owner: Optional. The owner of the blob or directory. Default value is None. :type owner: str - :param group: Optional. The owning group of the blob or directory. + :param group: Optional. The owning group of the blob or directory. Default value is None. :type group: str :param permissions: Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + Default value is None. :type permissions: str :param acl: Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. Each access control entry (ACE) consists of a scope, a type, a user or group identifier, and permissions in the format - "[scope:][type]:[id]:[permissions]". + "[scope:][type]:[id]:[permissions]". Default value is None. :type acl: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions - :keyword action: action. The default value is "setAccessControl". Note that overriding this - default value may result in unsupported behavior. + :keyword action: action. Default value is "setAccessControl". Note that overriding this default + value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1993,13 +2006,13 @@ def set_access_control_recursive( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param continuation: Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the delete operation to - continue deleting the directory. + continue deleting the directory. Default value is None. :type continuation: str :param force_flag: Optional. Valid for "SetAccessControlRecursive" operation. If set to false, the operation will terminate quickly on encountering user errors (4XX). If true, the operation @@ -2009,17 +2022,18 @@ def set_access_control_recursive( :type force_flag: bool :param max_records: Optional. It specifies the maximum number of files or directories on which the acl change will be applied. If omitted or greater than 2,000, the request will process up - to 2,000 items. + to 2,000 items. Default value is None. :type max_records: int :param acl: Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. Each access control entry (ACE) consists of a scope, a type, a user or group identifier, and permissions in the format - "[scope:][type]:[id]:[permissions]". + "[scope:][type]:[id]:[permissions]". Default value is None. :type acl: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword action: action. The default value is "setAccessControlRecursive". Note that overriding + :keyword action: action. Default value is "setAccessControlRecursive". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2101,7 +2115,7 @@ def flush_data( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param position: This parameter allows the caller to upload data in parallel and control the order in which it is appended to the file. It is required when uploading data to be appended @@ -2109,7 +2123,8 @@ def flush_data( # pylint: disable=inconsistent-return-statements position where the data is to be appended. Uploaded data is not immediately flushed, or written, to the file. To flush, the previously uploaded data must be contiguous, the position parameter must be specified and equal to the length of the file after all data has been - written, and there must not be a request entity body included with the request. + written, and there must not be a request entity body included with the request. Default value + is None. :type position: long :param retain_uncommitted_data: Valid only for flush operations. If "true", uncommitted data is retained after the flush operation completes; otherwise, the uncommitted data is deleted @@ -2129,19 +2144,21 @@ def flush_data( # pylint: disable=inconsistent-return-statements indicate that the file stream has been closed.". :type close: bool :param content_length: Required for "Append Data" and "Flush Data". Must be 0 for "Flush - Data". Must be the length of the request content in bytes for "Append Data". + Data". Must be the length of the request content in bytes for "Append Data". Default value is + None. :type content_length: long :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param path_http_headers: Parameter group. + :param path_http_headers: Parameter group. Default value is None. :type path_http_headers: ~azure.storage.filedatalake.models.PathHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :param modified_access_conditions: Parameter group. + :param modified_access_conditions: Parameter group. Default value is None. :type modified_access_conditions: ~azure.storage.filedatalake.models.ModifiedAccessConditions - :keyword action: action. The default value is "flush". Note that overriding this default value - may result in unsupported behavior. + :keyword action: action. Default value is "flush". Note that overriding this default value may + result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2261,28 +2278,31 @@ def append_data( # pylint: disable=inconsistent-return-statements position where the data is to be appended. Uploaded data is not immediately flushed, or written, to the file. To flush, the previously uploaded data must be contiguous, the position parameter must be specified and equal to the length of the file after all data has been - written, and there must not be a request entity body included with the request. + written, and there must not be a request entity body included with the request. Default value + is None. :type position: long :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param content_length: Required for "Append Data" and "Flush Data". Must be 0 for "Flush - Data". Must be the length of the request content in bytes for "Append Data". + Data". Must be the length of the request content in bytes for "Append Data". Default value is + None. :type content_length: long :param transactional_content_crc64: Specify the transactional crc64 for the body, to be - validated by the service. + validated by the service. Default value is None. :type transactional_content_crc64: bytearray :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param path_http_headers: Parameter group. + :param path_http_headers: Parameter group. Default value is None. :type path_http_headers: ~azure.storage.filedatalake.models.PathHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.filedatalake.models.LeaseAccessConditions - :keyword action: action. The default value is "append". Note that overriding this default value - may result in unsupported behavior. + :keyword action: action. Default value is "append". Note that overriding this default value may + result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2370,14 +2390,15 @@ def set_expiry( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param expires_on: The time to set the blob to expiry. + :param expires_on: The time to set the blob to expiry. Default value is None. :type expires_on: str - :keyword comp: comp. The default value is "expiry". Note that overriding this default value may + :keyword comp: comp. Default value is "expiry". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2448,16 +2469,17 @@ def undelete( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int :param undelete_source: Only for hierarchical namespace enabled accounts. Optional. The path of - the soft deleted blob to undelete. + the soft deleted blob to undelete. Default value is None. :type undelete_source: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "undelete". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "undelete". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_service_operations.py index dd973179fe97..615bdecddc74 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_generated/operations/_service_operations.py @@ -81,26 +81,24 @@ def build_list_file_systems_request( # fmt: on class ServiceOperations(object): - """ServiceOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.filedatalake.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.filedatalake.AzureDataLakeStorageRESTAPI`'s + :attr:`service` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def list_file_systems( @@ -117,26 +115,29 @@ def list_file_systems( List filesystems and their properties in given account. - :param prefix: Filters results to filesystems within the specified prefix. + :param prefix: Filters results to filesystems within the specified prefix. Default value is + None. :type prefix: str :param continuation: Optional. When deleting a directory, the number of paths that are deleted with each invocation is limited. If the number of paths to be deleted exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the delete operation to - continue deleting the directory. + continue deleting the directory. Default value is None. :type continuation: str :param max_results: An optional value that specifies the maximum number of items to return. If - omitted or greater than 5,000, the response will include up to 5,000 items. + omitted or greater than 5,000, the response will include up to 5,000 items. Default value is + None. :type max_results: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for Blob Service Operations.`. + Timeouts for Blob Service Operations.`. Default value is None. :type timeout: int - :keyword resource: The value must be "account" for all account operations. The default value is + :keyword resource: The value must be "account" for all account operations. Default value is "account". Note that overriding this default value may result in unsupported behavior. :paramtype resource: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py index 4c686e9ba00a..0db38399349b 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py @@ -37,15 +37,14 @@ class AzureFileStorage(object): :param url: The URL of the service account, share, directory or file that is the target of the desired operation. :type url: str - :param base_url: Service URL. Default value is ''. + :param base_url: Service URL. Default value is "". :type base_url: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2021-04-10". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2021-04-10". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes - downloaded from the source url into the specified range. The default value is "update". Note - that overriding this default value may result in unsupported behavior. + downloaded from the source url into the specified range. Default value is "update". Note that + overriding this default value may result in unsupported behavior. :paramtype file_range_write_from_url: str """ diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py index 14c5ef371c15..0081fe3a7b61 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_configuration.py @@ -26,13 +26,12 @@ class AzureFileStorageConfiguration(Configuration): # pylint: disable=too-many- :param url: The URL of the service account, share, directory or file that is the target of the desired operation. :type url: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2021-04-10". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2021-04-10". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes - downloaded from the source url into the specified range. The default value is "update". Note - that overriding this default value may result in unsupported behavior. + downloaded from the source url into the specified range. Default value is "update". Note that + overriding this default value may result in unsupported behavior. :paramtype file_range_write_from_url: str """ diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py index f376dc49fdb5..c0604f347f2f 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage.py @@ -32,15 +32,14 @@ class AzureFileStorage: :param url: The URL of the service account, share, directory or file that is the target of the desired operation. :type url: str - :param base_url: Service URL. Default value is ''. + :param base_url: Service URL. Default value is "". :type base_url: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2021-04-10". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2021-04-10". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes - downloaded from the source url into the specified range. The default value is "update". Note - that overriding this default value may result in unsupported behavior. + downloaded from the source url into the specified range. Default value is "update". Note that + overriding this default value may result in unsupported behavior. :paramtype file_range_write_from_url: str """ diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py index 0e9cc80e336f..f85c556de75d 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_configuration.py @@ -22,13 +22,12 @@ class AzureFileStorageConfiguration(Configuration): # pylint: disable=too-many- :param url: The URL of the service account, share, directory or file that is the target of the desired operation. :type url: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2021-04-10". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2021-04-10". Note that overriding this default value may result in unsupported behavior. :paramtype version: str :keyword file_range_write_from_url: Only update is supported: - Update: Writes the bytes - downloaded from the source url into the specified range. The default value is "update". Note - that overriding this default value may result in unsupported behavior. + downloaded from the source url into the specified range. Default value is "update". Note that + overriding this default value may result in unsupported behavior. :paramtype file_range_write_from_url: str """ diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py index c804e27c8718..d28949dd62d3 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_directory_operations.py @@ -21,26 +21,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class DirectoryOperations: - """DirectoryOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.fileshare.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.fileshare.aio.AzureFileStorage`'s + :attr:`directory` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def create( # pylint: disable=inconsistent-return-statements @@ -59,27 +57,32 @@ async def create( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str :param file_attributes: If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + Default value is "none". :type file_attributes: str - :param file_creation_time: Creation time for the file/directory. Default value: Now. + :param file_creation_time: Creation time for the file/directory. Default value: Now. Default + value is "now". :type file_creation_time: str :param file_last_write_time: Last write time for the file/directory. Default value: Now. + Default value is "now". :type file_last_write_time: str - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -158,14 +161,14 @@ async def get_properties( # pylint: disable=inconsistent-return-statements subdirectories. :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -240,9 +243,9 @@ async def delete( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -309,29 +312,33 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str :param file_attributes: If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + Default value is "none". :type file_attributes: str - :param file_creation_time: Creation time for the file/directory. Default value: Now. + :param file_creation_time: Creation time for the file/directory. Default value: Now. Default + value is "now". :type file_creation_time: str :param file_last_write_time: Last write time for the file/directory. Default value: Now. + Default value is "now". :type file_last_write_time: str - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -410,15 +417,16 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "metadata". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -489,34 +497,34 @@ async def list_files_and_directories_segment( contents only for a single level of the directory hierarchy. :param prefix: Filters the results to return only entries whose name begins with the specified - prefix. + prefix. Default value is None. :type prefix: str :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param marker: A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request - the next set of list items. The marker value is opaque to the client. + the next set of list items. The marker value is opaque to the client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 - items. + items. Default value is None. :type maxresults: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param include: Include this parameter to specify one or more datasets to include in the - response. + response. Default value is None. :type include: list[str or ~azure.storage.fileshare.models.ListFilesIncludeType] - :param include_extended_info: Include extended information. + :param include_extended_info: Include extended information. Default value is None. :type include_extended_info: bool - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "list". Note that overriding this default value may + :keyword comp: comp. Default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -594,25 +602,25 @@ async def list_handles( :param marker: A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request - the next set of list items. The marker value is opaque to the client. + the next set of list items. The marker value is opaque to the client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 - items. + items. Default value is None. :type maxresults: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param recursive: Specifies operation should apply to the directory specified in the URI, its - files, its subdirectories and their files. + files, its subdirectories and their files. Default value is None. :type recursive: bool - :keyword comp: comp. The default value is "listhandles". Note that overriding this default - value may result in unsupported behavior. + :keyword comp: comp. Default value is "listhandles". Note that overriding this default value + may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListHandlesResponse, or the result of cls(response) @@ -688,21 +696,21 @@ async def force_close_handles( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param marker: A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request - the next set of list items. The marker value is opaque to the client. + the next set of list items. The marker value is opaque to the client. Default value is None. :type marker: str :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param recursive: Specifies operation should apply to the directory specified in the URI, its - files, its subdirectories and their files. + files, its subdirectories and their files. Default value is None. :type recursive: bool - :keyword comp: comp. The default value is "forceclosehandles". Note that overriding this - default value may result in unsupported behavior. + :keyword comp: comp. Default value is "forceclosehandles". Note that overriding this default + value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -782,43 +790,45 @@ async def rename( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param replace_if_exists: Optional. A boolean value for if the destination file already exists, whether this request will overwrite the file or not. If true, the rename will succeed and will overwrite the destination file. If not provided or if false and the destination file does exist, the request will not overwrite the destination file. If provided and the destination file doesn’t exist, the rename will succeed. Note: This value does not override the - x-ms-file-copy-ignore-read-only header value. + x-ms-file-copy-ignore-read-only header value. Default value is None. :type replace_if_exists: bool :param ignore_read_only: Optional. A boolean value that specifies whether the ReadOnly attribute on a preexisting destination file should be respected. If true, the rename will succeed, otherwise, a previous file at the destination with the ReadOnly attribute set will - cause the rename to fail. + cause the rename to fail. Default value is None. :type ignore_read_only: bool :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :param source_lease_access_conditions: Parameter group. + :param source_lease_access_conditions: Parameter group. Default value is None. :type source_lease_access_conditions: ~azure.storage.fileshare.models.SourceLeaseAccessConditions - :param destination_lease_access_conditions: Parameter group. + :param destination_lease_access_conditions: Parameter group. Default value is None. :type destination_lease_access_conditions: ~azure.storage.fileshare.models.DestinationLeaseAccessConditions - :param copy_file_smb_info: Parameter group. + :param copy_file_smb_info: Parameter group. Default value is None. :type copy_file_smb_info: ~azure.storage.fileshare.models.CopyFileSmbInfo - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "rename". Note that overriding this default value may + :keyword comp: comp. Default value is "rename". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py index 97a5a50cceac..3a96b3520f90 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_file_operations.py @@ -21,26 +21,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class FileOperations: - """FileOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.fileshare.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.fileshare.aio.AzureFileStorage`'s + :attr:`file` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def create( # pylint: disable=inconsistent-return-statements @@ -64,31 +62,36 @@ async def create( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str :param file_attributes: If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + Default value is "none". :type file_attributes: str - :param file_creation_time: Creation time for the file/directory. Default value: Now. + :param file_creation_time: Creation time for the file/directory. Default value: Now. Default + value is "now". :type file_creation_time: str :param file_last_write_time: Last write time for the file/directory. Default value: Now. + Default value is "now". :type file_last_write_time: str - :param file_http_headers: Parameter group. + :param file_http_headers: Parameter group. Default value is None. :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword file_type_constant: Dummy constant parameter, file type can only be file. The default + :keyword file_type_constant: Dummy constant parameter, file type can only be file. Default value is "file". Note that overriding this default value may result in unsupported behavior. :paramtype file_type_constant: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -193,15 +196,15 @@ async def download( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param range: Return file data only from the specified byte range. + :param range: Return file data only from the specified byte range. Default value is None. :type range: str :param range_get_content_md5: When this header is set to true and specified together with the Range header, the service returns the MD5 hash for the range, as long as the range is less than - or equal to 4 MB in size. + or equal to 4 MB in size. Default value is None. :type range_get_content_md5: bool - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: IO, or the result of cls(response) @@ -337,14 +340,14 @@ async def get_properties( # pylint: disable=inconsistent-return-statements file. It does not return the content of the file. :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -436,9 +439,9 @@ async def delete( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -508,34 +511,38 @@ async def set_http_headers( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param file_content_length: Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are - cleared. + cleared. Default value is None. :type file_content_length: long :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str :param file_attributes: If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + Default value is "none". :type file_attributes: str - :param file_creation_time: Creation time for the file/directory. Default value: Now. + :param file_creation_time: Creation time for the file/directory. Default value: Now. Default + value is "now". :type file_creation_time: str :param file_last_write_time: Last write time for the file/directory. Default value: Now. + Default value is "now". :type file_last_write_time: str - :param file_http_headers: Parameter group. + :param file_http_headers: Parameter group. Default value is None. :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "properties". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -637,14 +644,15 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "metadata". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -716,23 +724,24 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease - duration cannot be changed using renew or change. + duration cannot be changed using renew or change. Default value is None. :type duration: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "acquire". Note that + :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -808,15 +817,16 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "release". Note that + :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -891,19 +901,20 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "change". Note that + :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -977,17 +988,18 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "break". Note that + :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1075,24 +1087,25 @@ async def upload_range( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param file_range_write: Specify one of the following options: - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update. - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and set the Range header to a value that indicates the range to clear, up to maximum file size. + Default value is "update". :type file_range_write: str or ~azure.storage.fileshare.models.FileRangeWriteType :param content_md5: An MD5 hash of the content. This hash is used to verify the integrity of the data during transport. When the Content-MD5 header is specified, the File service compares the hash of the content that has arrived with the header value that was sent. If the two hashes - do not match, the operation will fail with error code 400 (Bad Request). + do not match, the operation will fail with error code 400 (Bad Request). Default value is None. :type content_md5: bytearray - :param optionalbody: Initial data. + :param optionalbody: Initial data. Default value is None. :type optionalbody: IO - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "range". Note that overriding this default value may + :keyword comp: comp. Default value is "range". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1191,22 +1204,22 @@ async def upload_range_from_url( # pylint: disable=inconsistent-return-statemen :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param source_range: Bytes of source data in the specified range. + :param source_range: Bytes of source data in the specified range. Default value is None. :type source_range: str :param source_content_crc64: Specify the crc64 calculated for the range of bytes that must be - read from the copy source. + read from the copy source. Default value is None. :type source_content_crc64: bytearray :param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid - OAuth access token to copy source. + OAuth access token to copy source. Default value is None. :type copy_source_authorization: str - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.fileshare.models.SourceModifiedAccessConditions - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "range". Note that overriding this default value may + :keyword comp: comp. Default value is "range". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1292,22 +1305,23 @@ async def get_range_list( """Returns the list of valid ranges for a file. :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param prevsharesnapshot: The previous snapshot parameter is an opaque DateTime value that, - when present, specifies the previous snapshot. + when present, specifies the previous snapshot. Default value is None. :type prevsharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param range: Specifies the range of bytes over which to list ranges, inclusively. + :param range: Specifies the range of bytes over which to list ranges, inclusively. Default + value is None. :type range: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "rangelist". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "rangelist". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ShareFileRangeList, or the result of cls(response) @@ -1395,22 +1409,24 @@ async def start_copy( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str - :param copy_file_smb_info: Parameter group. + :param copy_file_smb_info: Parameter group. Default value is None. :type copy_file_smb_info: ~azure.storage.fileshare.models.CopyFileSmbInfo - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1505,15 +1521,15 @@ async def abort_copy( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "copy". Note that overriding this default value may + :keyword comp: comp. Default value is "copy". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword copy_action_abort_constant: Abort. The default value is "abort". Note that overriding - this default value may result in unsupported behavior. + :keyword copy_action_abort_constant: Abort. Default value is "abort". Note that overriding this + default value may result in unsupported behavior. :paramtype copy_action_abort_constant: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1584,22 +1600,22 @@ async def list_handles( :param marker: A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request - the next set of list items. The marker value is opaque to the client. + the next set of list items. The marker value is opaque to the client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 - items. + items. Default value is None. :type maxresults: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str - :keyword comp: comp. The default value is "listhandles". Note that overriding this default - value may result in unsupported behavior. + :keyword comp: comp. Default value is "listhandles". Note that overriding this default value + may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListHandlesResponse, or the result of cls(response) @@ -1673,18 +1689,18 @@ async def force_close_handles( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param marker: A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request - the next set of list items. The marker value is opaque to the client. + the next set of list items. The marker value is opaque to the client. Default value is None. :type marker: str :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str - :keyword comp: comp. The default value is "forceclosehandles". Note that overriding this - default value may result in unsupported behavior. + :keyword comp: comp. Default value is "forceclosehandles". Note that overriding this default + value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1763,40 +1779,42 @@ async def rename( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param replace_if_exists: Optional. A boolean value for if the destination file already exists, whether this request will overwrite the file or not. If true, the rename will succeed and will overwrite the destination file. If not provided or if false and the destination file does exist, the request will not overwrite the destination file. If provided and the destination file doesn’t exist, the rename will succeed. Note: This value does not override the - x-ms-file-copy-ignore-read-only header value. + x-ms-file-copy-ignore-read-only header value. Default value is None. :type replace_if_exists: bool :param ignore_read_only: Optional. A boolean value that specifies whether the ReadOnly attribute on a preexisting destination file should be respected. If true, the rename will succeed, otherwise, a previous file at the destination with the ReadOnly attribute set will - cause the rename to fail. + cause the rename to fail. Default value is None. :type ignore_read_only: bool :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :param source_lease_access_conditions: Parameter group. + :param source_lease_access_conditions: Parameter group. Default value is None. :type source_lease_access_conditions: ~azure.storage.fileshare.models.SourceLeaseAccessConditions - :param destination_lease_access_conditions: Parameter group. + :param destination_lease_access_conditions: Parameter group. Default value is None. :type destination_lease_access_conditions: ~azure.storage.fileshare.models.DestinationLeaseAccessConditions - :param copy_file_smb_info: Parameter group. + :param copy_file_smb_info: Parameter group. Default value is None. :type copy_file_smb_info: ~azure.storage.fileshare.models.CopyFileSmbInfo - :keyword comp: comp. The default value is "rename". Note that overriding this default value may + :keyword comp: comp. Default value is "rename". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py index 5e6883053dde..c38f113cce1f 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_service_operations.py @@ -21,26 +21,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ServiceOperations: - """ServiceOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.fileshare.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.fileshare.aio.AzureFileStorage`'s + :attr:`service` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def set_properties( # pylint: disable=inconsistent-return-statements @@ -57,13 +55,13 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword restype: restype. The default value is "service". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "service". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -130,13 +128,13 @@ async def get_properties( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword restype: restype. The default value is "service". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "service". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties, or the result of cls(response) @@ -204,26 +202,26 @@ async def list_shares_segment( specified account. :param prefix: Filters the results to return only entries whose name begins with the specified - prefix. + prefix. Default value is None. :type prefix: str :param marker: A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request - the next set of list items. The marker value is opaque to the client. + the next set of list items. The marker value is opaque to the client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 - items. + items. Default value is None. :type maxresults: int :param include: Include this parameter to specify one or more datasets to include in the - response. + response. Default value is None. :type include: list[str or ~azure.storage.fileshare.models.ListSharesIncludeType] :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword comp: comp. The default value is "list". Note that overriding this default value may + :keyword comp: comp. Default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py index 6b4f2621763c..e295968b559f 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations/_share_operations.py @@ -21,26 +21,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ShareOperations: - """ShareOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.fileshare.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.fileshare.aio.AzureFileStorage`'s + :attr:`share` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def create( # pylint: disable=inconsistent-return-statements @@ -59,20 +57,22 @@ async def create( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :param quota: Specifies the maximum size of the share, in gigabytes. + :param quota: Specifies the maximum size of the share, in gigabytes. Default value is None. :type quota: int - :param access_tier: Specifies the access tier of the share. + :param access_tier: Specifies the access tier of the share. Default value is None. :type access_tier: str or ~azure.storage.fileshare.models.ShareAccessTier - :param enabled_protocols: Protocols to enable on the share. + :param enabled_protocols: Protocols to enable on the share. Default value is None. :type enabled_protocols: str - :param root_squash: Root squash to set on the share. Only valid for NFS shares. + :param root_squash: Root squash to set on the share. Only valid for NFS shares. Default value + is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -141,17 +141,17 @@ async def get_properties( # pylint: disable=inconsistent-return-statements snapshot. The data returned does not include the share's list of files. :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -236,20 +236,20 @@ async def delete( # pylint: disable=inconsistent-return-statements and any files contained within it are later deleted during garbage collection. :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param delete_snapshots: Specifies the option include to delete the base share and all of its - snapshots. + snapshots. Default value is None. :type delete_snapshots: str or ~azure.storage.fileshare.models.DeleteSnapshotsOptionType - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -321,30 +321,31 @@ async def acquire_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease - duration cannot be changed using renew or change. + duration cannot be changed using renew or change. Default value is None. :type duration: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "acquire". Note that + :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -423,22 +424,23 @@ async def release_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "release". Note that + :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -516,26 +518,27 @@ async def change_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "change". Note that + :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -614,22 +617,23 @@ async def renew_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "renew". Note that + :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -706,7 +710,7 @@ async def break_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param break_period: For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter @@ -714,24 +718,25 @@ async def break_lease( # pylint: disable=inconsistent-return-statements lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease - breaks immediately. + breaks immediately. Default value is None. :type break_period: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "break". Note that + :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -809,15 +814,16 @@ async def create_snapshot( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "snapshot". Note that overriding this default value + :keyword restype: restype. Default value is "share". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "snapshot". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -887,13 +893,13 @@ async def create_permission( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "filepermission". Note that overriding this default - value may result in unsupported behavior. + :keyword comp: comp. Default value is "filepermission". Note that overriding this default value + may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -964,13 +970,13 @@ async def get_permission( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "filepermission". Note that overriding this default - value may result in unsupported behavior. + :keyword comp: comp. Default value is "filepermission". Note that overriding this default value + may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharePermission, or the result of cls(response) @@ -1041,21 +1047,22 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param quota: Specifies the maximum size of the share, in gigabytes. + :param quota: Specifies the maximum size of the share, in gigabytes. Default value is None. :type quota: int - :param access_tier: Specifies the access tier of the share. + :param access_tier: Specifies the access tier of the share. Default value is None. :type access_tier: str or ~azure.storage.fileshare.models.ShareAccessTier - :param root_squash: Root squash to set on the share. Only valid for NFS shares. + :param root_squash: Root squash to set on the share. Only valid for NFS shares. Default value + is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "share". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1129,17 +1136,18 @@ async def set_metadata( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "metadata". Note that overriding this default value + :keyword restype: restype. Default value is "share". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1210,15 +1218,15 @@ async def get_access_policy( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "acl". Note that overriding this default value may - result in unsupported behavior. + :keyword comp: comp. Default value is "acl". Note that overriding this default value may result + in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier, or the result of cls(response) @@ -1292,17 +1300,17 @@ async def set_access_policy( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param share_acl: The ACL for the share. + :param share_acl: The ACL for the share. Default value is None. :type share_acl: list[~azure.storage.fileshare.models.SignedIdentifier] - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "acl". Note that overriding this default value may - result in unsupported behavior. + :keyword comp: comp. Default value is "acl". Note that overriding this default value may result + in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1380,14 +1388,14 @@ async def get_statistics( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "stats". Note that overriding this default value may + :keyword comp: comp. Default value is "stats". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1463,20 +1471,23 @@ async def restore( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param deleted_share_name: Specifies the name of the previously-deleted share. + :param deleted_share_name: Specifies the name of the previously-deleted share. Default value is + None. :type deleted_share_name: str - :param deleted_share_version: Specifies the version of the previously-deleted share. + :param deleted_share_version: Specifies the version of the previously-deleted share. Default + value is None. :type deleted_share_version: str - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "undelete". Note that overriding this default value + :keyword restype: restype. Default value is "share". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "undelete". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py index 011e76856e1b..d2d78df324a3 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_directory_operations.py @@ -486,26 +486,24 @@ def build_rename_request( # fmt: on class DirectoryOperations(object): - """DirectoryOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.fileshare.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.fileshare.AzureFileStorage`'s + :attr:`directory` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def create( # pylint: disable=inconsistent-return-statements @@ -525,27 +523,32 @@ def create( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str :param file_attributes: If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + Default value is "none". :type file_attributes: str - :param file_creation_time: Creation time for the file/directory. Default value: Now. + :param file_creation_time: Creation time for the file/directory. Default value: Now. Default + value is "now". :type file_creation_time: str :param file_last_write_time: Last write time for the file/directory. Default value: Now. + Default value is "now". :type file_last_write_time: str - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -625,14 +628,14 @@ def get_properties( # pylint: disable=inconsistent-return-statements subdirectories. :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -708,9 +711,9 @@ def delete( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -778,29 +781,33 @@ def set_properties( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str :param file_attributes: If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + Default value is "none". :type file_attributes: str - :param file_creation_time: Creation time for the file/directory. Default value: Now. + :param file_creation_time: Creation time for the file/directory. Default value: Now. Default + value is "now". :type file_creation_time: str :param file_last_write_time: Last write time for the file/directory. Default value: Now. + Default value is "now". :type file_last_write_time: str - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -880,15 +887,16 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "metadata". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -960,34 +968,34 @@ def list_files_and_directories_segment( contents only for a single level of the directory hierarchy. :param prefix: Filters the results to return only entries whose name begins with the specified - prefix. + prefix. Default value is None. :type prefix: str :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param marker: A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request - the next set of list items. The marker value is opaque to the client. + the next set of list items. The marker value is opaque to the client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 - items. + items. Default value is None. :type maxresults: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param include: Include this parameter to specify one or more datasets to include in the - response. + response. Default value is None. :type include: list[str or ~azure.storage.fileshare.models.ListFilesIncludeType] - :param include_extended_info: Include extended information. + :param include_extended_info: Include extended information. Default value is None. :type include_extended_info: bool - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "list". Note that overriding this default value may + :keyword comp: comp. Default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1066,25 +1074,25 @@ def list_handles( :param marker: A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request - the next set of list items. The marker value is opaque to the client. + the next set of list items. The marker value is opaque to the client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 - items. + items. Default value is None. :type maxresults: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param recursive: Specifies operation should apply to the directory specified in the URI, its - files, its subdirectories and their files. + files, its subdirectories and their files. Default value is None. :type recursive: bool - :keyword comp: comp. The default value is "listhandles". Note that overriding this default - value may result in unsupported behavior. + :keyword comp: comp. Default value is "listhandles". Note that overriding this default value + may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListHandlesResponse, or the result of cls(response) @@ -1161,21 +1169,21 @@ def force_close_handles( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param marker: A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request - the next set of list items. The marker value is opaque to the client. + the next set of list items. The marker value is opaque to the client. Default value is None. :type marker: str :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param recursive: Specifies operation should apply to the directory specified in the URI, its - files, its subdirectories and their files. + files, its subdirectories and their files. Default value is None. :type recursive: bool - :keyword comp: comp. The default value is "forceclosehandles". Note that overriding this - default value may result in unsupported behavior. + :keyword comp: comp. Default value is "forceclosehandles". Note that overriding this default + value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1256,43 +1264,45 @@ def rename( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param replace_if_exists: Optional. A boolean value for if the destination file already exists, whether this request will overwrite the file or not. If true, the rename will succeed and will overwrite the destination file. If not provided or if false and the destination file does exist, the request will not overwrite the destination file. If provided and the destination file doesn’t exist, the rename will succeed. Note: This value does not override the - x-ms-file-copy-ignore-read-only header value. + x-ms-file-copy-ignore-read-only header value. Default value is None. :type replace_if_exists: bool :param ignore_read_only: Optional. A boolean value that specifies whether the ReadOnly attribute on a preexisting destination file should be respected. If true, the rename will succeed, otherwise, a previous file at the destination with the ReadOnly attribute set will - cause the rename to fail. + cause the rename to fail. Default value is None. :type ignore_read_only: bool :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :param source_lease_access_conditions: Parameter group. + :param source_lease_access_conditions: Parameter group. Default value is None. :type source_lease_access_conditions: ~azure.storage.fileshare.models.SourceLeaseAccessConditions - :param destination_lease_access_conditions: Parameter group. + :param destination_lease_access_conditions: Parameter group. Default value is None. :type destination_lease_access_conditions: ~azure.storage.fileshare.models.DestinationLeaseAccessConditions - :param copy_file_smb_info: Parameter group. + :param copy_file_smb_info: Parameter group. Default value is None. :type copy_file_smb_info: ~azure.storage.fileshare.models.CopyFileSmbInfo - :keyword restype: restype. The default value is "directory". Note that overriding this default + :keyword restype: restype. Default value is "directory". Note that overriding this default value may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "rename". Note that overriding this default value may + :keyword comp: comp. Default value is "rename". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py index f7ff6f71066c..6b439911cdbf 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_file_operations.py @@ -750,7 +750,7 @@ def build_start_copy_request( if file_permission_copy_mode is not None: _header_parameters['x-ms-file-permission-copy-mode'] = _SERIALIZER.header("file_permission_copy_mode", file_permission_copy_mode, 'str') if ignore_read_only is not None: - _header_parameters['x-ms-file-copy-ignore-read-only'] = _SERIALIZER.header("ignore_read_only", ignore_read_only, 'bool') + _header_parameters['x-ms-file-copy-ignore-readonly'] = _SERIALIZER.header("ignore_read_only", ignore_read_only, 'bool') if file_attributes is not None: _header_parameters['x-ms-file-attributes'] = _SERIALIZER.header("file_attributes", file_attributes, 'str') if file_creation_time is not None: @@ -981,26 +981,24 @@ def build_rename_request( # fmt: on class FileOperations(object): - """FileOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.fileshare.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.fileshare.AzureFileStorage`'s + :attr:`file` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def create( # pylint: disable=inconsistent-return-statements @@ -1025,31 +1023,36 @@ def create( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str :param file_attributes: If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + Default value is "none". :type file_attributes: str - :param file_creation_time: Creation time for the file/directory. Default value: Now. + :param file_creation_time: Creation time for the file/directory. Default value: Now. Default + value is "now". :type file_creation_time: str :param file_last_write_time: Last write time for the file/directory. Default value: Now. + Default value is "now". :type file_last_write_time: str - :param file_http_headers: Parameter group. + :param file_http_headers: Parameter group. Default value is None. :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword file_type_constant: Dummy constant parameter, file type can only be file. The default + :keyword file_type_constant: Dummy constant parameter, file type can only be file. Default value is "file". Note that overriding this default value may result in unsupported behavior. :paramtype file_type_constant: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1155,15 +1158,15 @@ def download( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param range: Return file data only from the specified byte range. + :param range: Return file data only from the specified byte range. Default value is None. :type range: str :param range_get_content_md5: When this header is set to true and specified together with the Range header, the service returns the MD5 hash for the range, as long as the range is less than - or equal to 4 MB in size. + or equal to 4 MB in size. Default value is None. :type range_get_content_md5: bool - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: IO, or the result of cls(response) @@ -1300,14 +1303,14 @@ def get_properties( # pylint: disable=inconsistent-return-statements file. It does not return the content of the file. :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1400,9 +1403,9 @@ def delete( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1473,34 +1476,38 @@ def set_http_headers( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param file_content_length: Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are - cleared. + cleared. Default value is None. :type file_content_length: long :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str :param file_attributes: If specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can also be specified as default. + Default value is "none". :type file_attributes: str - :param file_creation_time: Creation time for the file/directory. Default value: Now. + :param file_creation_time: Creation time for the file/directory. Default value: Now. Default + value is "now". :type file_creation_time: str :param file_last_write_time: Last write time for the file/directory. Default value: Now. + Default value is "now". :type file_last_write_time: str - :param file_http_headers: Parameter group. + :param file_http_headers: Parameter group. Default value is None. :type file_http_headers: ~azure.storage.fileshare.models.FileHTTPHeaders - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "properties". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1603,14 +1610,15 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "metadata". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1683,23 +1691,24 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease - duration cannot be changed using renew or change. + duration cannot be changed using renew or change. Default value is None. :type duration: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "acquire". Note that + :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1776,15 +1785,16 @@ def release_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "release". Note that + :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1860,19 +1870,20 @@ def change_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "change". Note that + :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -1947,17 +1958,18 @@ def break_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "break". Note that + :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2046,24 +2058,25 @@ def upload_range( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param file_range_write: Specify one of the following options: - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update. - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and set the Range header to a value that indicates the range to clear, up to maximum file size. + Default value is "update". :type file_range_write: str or ~azure.storage.fileshare.models.FileRangeWriteType :param content_md5: An MD5 hash of the content. This hash is used to verify the integrity of the data during transport. When the Content-MD5 header is specified, the File service compares the hash of the content that has arrived with the header value that was sent. If the two hashes - do not match, the operation will fail with error code 400 (Bad Request). + do not match, the operation will fail with error code 400 (Bad Request). Default value is None. :type content_md5: bytearray - :param optionalbody: Initial data. + :param optionalbody: Initial data. Default value is None. :type optionalbody: IO - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "range". Note that overriding this default value may + :keyword comp: comp. Default value is "range". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2163,22 +2176,22 @@ def upload_range_from_url( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param source_range: Bytes of source data in the specified range. + :param source_range: Bytes of source data in the specified range. Default value is None. :type source_range: str :param source_content_crc64: Specify the crc64 calculated for the range of bytes that must be - read from the copy source. + read from the copy source. Default value is None. :type source_content_crc64: bytearray :param copy_source_authorization: Only Bearer type is supported. Credentials should be a valid - OAuth access token to copy source. + OAuth access token to copy source. Default value is None. :type copy_source_authorization: str - :param source_modified_access_conditions: Parameter group. + :param source_modified_access_conditions: Parameter group. Default value is None. :type source_modified_access_conditions: ~azure.storage.fileshare.models.SourceModifiedAccessConditions - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "range". Note that overriding this default value may + :keyword comp: comp. Default value is "range". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2265,22 +2278,23 @@ def get_range_list( """Returns the list of valid ranges for a file. :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param prevsharesnapshot: The previous snapshot parameter is an opaque DateTime value that, - when present, specifies the previous snapshot. + when present, specifies the previous snapshot. Default value is None. :type prevsharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param range: Specifies the range of bytes over which to list ranges, inclusively. + :param range: Specifies the range of bytes over which to list ranges, inclusively. Default + value is None. :type range: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "rangelist". Note that overriding this default value - may result in unsupported behavior. + :keyword comp: comp. Default value is "rangelist". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ShareFileRangeList, or the result of cls(response) @@ -2369,22 +2383,24 @@ def start_copy( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str - :param copy_file_smb_info: Parameter group. + :param copy_file_smb_info: Parameter group. Default value is None. :type copy_file_smb_info: ~azure.storage.fileshare.models.CopyFileSmbInfo - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2480,15 +2496,15 @@ def abort_copy( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "copy". Note that overriding this default value may + :keyword comp: comp. Default value is "copy". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword copy_action_abort_constant: Abort. The default value is "abort". Note that overriding - this default value may result in unsupported behavior. + :keyword copy_action_abort_constant: Abort. Default value is "abort". Note that overriding this + default value may result in unsupported behavior. :paramtype copy_action_abort_constant: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2560,22 +2576,22 @@ def list_handles( :param marker: A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request - the next set of list items. The marker value is opaque to the client. + the next set of list items. The marker value is opaque to the client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 - items. + items. Default value is None. :type maxresults: int :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str - :keyword comp: comp. The default value is "listhandles". Note that overriding this default - value may result in unsupported behavior. + :keyword comp: comp. Default value is "listhandles". Note that overriding this default value + may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ListHandlesResponse, or the result of cls(response) @@ -2650,18 +2666,18 @@ def force_close_handles( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param marker: A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request - the next set of list items. The marker value is opaque to the client. + the next set of list items. The marker value is opaque to the client. Default value is None. :type marker: str :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str - :keyword comp: comp. The default value is "forceclosehandles". Note that overriding this - default value may result in unsupported behavior. + :keyword comp: comp. Default value is "forceclosehandles". Note that overriding this default + value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2741,40 +2757,42 @@ def rename( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param replace_if_exists: Optional. A boolean value for if the destination file already exists, whether this request will overwrite the file or not. If true, the rename will succeed and will overwrite the destination file. If not provided or if false and the destination file does exist, the request will not overwrite the destination file. If provided and the destination file doesn’t exist, the rename will succeed. Note: This value does not override the - x-ms-file-copy-ignore-read-only header value. + x-ms-file-copy-ignore-read-only header value. Default value is None. :type replace_if_exists: bool :param ignore_read_only: Optional. A boolean value that specifies whether the ReadOnly attribute on a preexisting destination file should be respected. If true, the rename will succeed, otherwise, a previous file at the destination with the ReadOnly attribute set will - cause the rename to fail. + cause the rename to fail. Default value is None. :type ignore_read_only: bool :param file_permission: If specified the permission (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the x-ms-file-permission or - x-ms-file-permission-key should be specified. + x-ms-file-permission-key should be specified. Default value is "inherit". :type file_permission: str :param file_permission_key: Key of the permission to be set for the directory/file. Note: Only - one of the x-ms-file-permission or x-ms-file-permission-key should be specified. + one of the x-ms-file-permission or x-ms-file-permission-key should be specified. Default value + is None. :type file_permission_key: str - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :param source_lease_access_conditions: Parameter group. + :param source_lease_access_conditions: Parameter group. Default value is None. :type source_lease_access_conditions: ~azure.storage.fileshare.models.SourceLeaseAccessConditions - :param destination_lease_access_conditions: Parameter group. + :param destination_lease_access_conditions: Parameter group. Default value is None. :type destination_lease_access_conditions: ~azure.storage.fileshare.models.DestinationLeaseAccessConditions - :param copy_file_smb_info: Parameter group. + :param copy_file_smb_info: Parameter group. Default value is None. :type copy_file_smb_info: ~azure.storage.fileshare.models.CopyFileSmbInfo - :keyword comp: comp. The default value is "rename". Note that overriding this default value may + :keyword comp: comp. Default value is "rename". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py index 8b6c91ca74a7..11dd780695f6 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_service_operations.py @@ -163,26 +163,24 @@ def build_list_shares_segment_request( # fmt: on class ServiceOperations(object): - """ServiceOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.fileshare.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.fileshare.AzureFileStorage`'s + :attr:`service` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def set_properties( # pylint: disable=inconsistent-return-statements @@ -200,13 +198,13 @@ def set_properties( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword restype: restype. The default value is "service". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "service". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -274,13 +272,13 @@ def get_properties( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword restype: restype. The default value is "service". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "service". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageServiceProperties, or the result of cls(response) @@ -349,26 +347,26 @@ def list_shares_segment( specified account. :param prefix: Filters the results to return only entries whose name begins with the specified - prefix. + prefix. Default value is None. :type prefix: str :param marker: A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request - the next set of list items. The marker value is opaque to the client. + the next set of list items. The marker value is opaque to the client. Default value is None. :type marker: str :param maxresults: Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 - items. + items. Default value is None. :type maxresults: int :param include: Include this parameter to specify one or more datasets to include in the - response. + response. Default value is None. :type include: list[str or ~azure.storage.fileshare.models.ListSharesIncludeType] :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword comp: comp. The default value is "list". Note that overriding this default value may + :keyword comp: comp. Default value is "list". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py index 0bc9902450f1..0ee16c0af09e 100644 --- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py +++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py @@ -842,26 +842,24 @@ def build_restore_request( # fmt: on class ShareOperations(object): - """ShareOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.fileshare.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.fileshare.AzureFileStorage`'s + :attr:`share` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def create( # pylint: disable=inconsistent-return-statements @@ -881,20 +879,22 @@ def create( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :param quota: Specifies the maximum size of the share, in gigabytes. + :param quota: Specifies the maximum size of the share, in gigabytes. Default value is None. :type quota: int - :param access_tier: Specifies the access tier of the share. + :param access_tier: Specifies the access tier of the share. Default value is None. :type access_tier: str or ~azure.storage.fileshare.models.ShareAccessTier - :param enabled_protocols: Protocols to enable on the share. + :param enabled_protocols: Protocols to enable on the share. Default value is None. :type enabled_protocols: str - :param root_squash: Root squash to set on the share. Only valid for NFS shares. + :param root_squash: Root squash to set on the share. Only valid for NFS shares. Default value + is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -964,17 +964,17 @@ def get_properties( # pylint: disable=inconsistent-return-statements snapshot. The data returned does not include the share's list of files. :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1060,20 +1060,20 @@ def delete( # pylint: disable=inconsistent-return-statements and any files contained within it are later deleted during garbage collection. :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param delete_snapshots: Specifies the option include to delete the base share and all of its - snapshots. + snapshots. Default value is None. :type delete_snapshots: str or ~azure.storage.fileshare.models.DeleteSnapshotsOptionType - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1146,30 +1146,31 @@ def acquire_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param duration: Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease - duration cannot be changed using renew or change. + duration cannot be changed using renew or change. Default value is None. :type duration: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "acquire". Note that + :keyword action: Describes what lease action to take. Default value is "acquire". Note that overriding this default value may result in unsupported behavior. :paramtype action: str - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1249,22 +1250,23 @@ def release_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "release". Note that + :keyword action: Describes what lease action to take. Default value is "release". Note that overriding this default value may result in unsupported behavior. :paramtype action: str - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1343,26 +1345,27 @@ def change_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param proposed_lease_id: Proposed lease ID, in a GUID string format. The File service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid - Constructor (String) for a list of valid GUID string formats. + Constructor (String) for a list of valid GUID string formats. Default value is None. :type proposed_lease_id: str :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "change". Note that + :keyword action: Describes what lease action to take. Default value is "change". Note that overriding this default value may result in unsupported behavior. :paramtype action: str - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1442,22 +1445,23 @@ def renew_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "renew". Note that + :keyword action: Describes what lease action to take. Default value is "renew". Note that overriding this default value may result in unsupported behavior. :paramtype action: str - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1535,7 +1539,7 @@ def break_lease( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param break_period: For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter @@ -1543,24 +1547,25 @@ def break_lease( # pylint: disable=inconsistent-return-statements lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease - breaks immediately. + breaks immediately. Default value is None. :type break_period: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :param sharesnapshot: The snapshot parameter is an opaque DateTime value that, when present, - specifies the share snapshot to query. + specifies the share snapshot to query. Default value is None. :type sharesnapshot: str - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword comp: comp. The default value is "lease". Note that overriding this default value may + :keyword comp: comp. Default value is "lease". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str - :keyword action: Describes what lease action to take. The default value is "break". Note that + :keyword action: Describes what lease action to take. Default value is "break". Note that overriding this default value may result in unsupported behavior. :paramtype action: str - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1639,15 +1644,16 @@ def create_snapshot( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "snapshot". Note that overriding this default value + :keyword restype: restype. Default value is "share". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "snapshot". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1718,13 +1724,13 @@ def create_permission( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "filepermission". Note that overriding this default - value may result in unsupported behavior. + :keyword comp: comp. Default value is "filepermission". Note that overriding this default value + may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1796,13 +1802,13 @@ def get_permission( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "filepermission". Note that overriding this default - value may result in unsupported behavior. + :keyword comp: comp. Default value is "filepermission". Note that overriding this default value + may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SharePermission, or the result of cls(response) @@ -1874,21 +1880,22 @@ def set_properties( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param quota: Specifies the maximum size of the share, in gigabytes. + :param quota: Specifies the maximum size of the share, in gigabytes. Default value is None. :type quota: int - :param access_tier: Specifies the access tier of the share. + :param access_tier: Specifies the access tier of the share. Default value is None. :type access_tier: str or ~azure.storage.fileshare.models.ShareAccessTier - :param root_squash: Root squash to set on the share. Only valid for NFS shares. + :param root_squash: Root squash to set on the share. Only valid for NFS shares. Default value + is None. :type root_squash: str or ~azure.storage.fileshare.models.ShareRootSquash - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "properties". Note that overriding this default value + :keyword restype: restype. Default value is "share". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "properties". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -1963,17 +1970,18 @@ def set_metadata( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param metadata: A name-value pair to associate with a file storage object. + :param metadata: A name-value pair to associate with a file storage object. Default value is + None. :type metadata: dict[str, str] - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "metadata". Note that overriding this default value + :keyword restype: restype. Default value is "share". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "metadata". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2045,15 +2053,15 @@ def get_access_policy( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "acl". Note that overriding this default value may - result in unsupported behavior. + :keyword comp: comp. Default value is "acl". Note that overriding this default value may result + in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of SignedIdentifier, or the result of cls(response) @@ -2128,17 +2136,17 @@ def set_access_policy( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param share_acl: The ACL for the share. + :param share_acl: The ACL for the share. Default value is None. :type share_acl: list[~azure.storage.fileshare.models.SignedIdentifier] - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "acl". Note that overriding this default value may - result in unsupported behavior. + :keyword comp: comp. Default value is "acl". Note that overriding this default value may result + in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -2217,14 +2225,14 @@ def get_statistics( :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int - :param lease_access_conditions: Parameter group. + :param lease_access_conditions: Parameter group. Default value is None. :type lease_access_conditions: ~azure.storage.fileshare.models.LeaseAccessConditions - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. + :keyword restype: restype. Default value is "share". Note that overriding this default value + may result in unsupported behavior. :paramtype restype: str - :keyword comp: comp. The default value is "stats". Note that overriding this default value may + :keyword comp: comp. Default value is "stats". Note that overriding this default value may result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -2301,20 +2309,23 @@ def restore( # pylint: disable=inconsistent-return-statements :param timeout: The timeout parameter is expressed in seconds. For more information, see :code:`Setting - Timeouts for File Service Operations.`. + Timeouts for File Service Operations.`. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :param deleted_share_name: Specifies the name of the previously-deleted share. + :param deleted_share_name: Specifies the name of the previously-deleted share. Default value is + None. :type deleted_share_name: str - :param deleted_share_version: Specifies the version of the previously-deleted share. + :param deleted_share_version: Specifies the version of the previously-deleted share. Default + value is None. :type deleted_share_version: str - :keyword restype: restype. The default value is "share". Note that overriding this default - value may result in unsupported behavior. - :paramtype restype: str - :keyword comp: comp. The default value is "undelete". Note that overriding this default value + :keyword restype: restype. Default value is "share". Note that overriding this default value may result in unsupported behavior. + :paramtype restype: str + :keyword comp: comp. Default value is "undelete". Note that overriding this default value may + result in unsupported behavior. :paramtype comp: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_azure_queue_storage.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_azure_queue_storage.py index ef213aa44564..45525e050ff1 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_azure_queue_storage.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_azure_queue_storage.py @@ -37,11 +37,10 @@ class AzureQueueStorage(object): :param url: The URL of the service account, queue or message that is the target of the desired operation. :type url: str - :param base_url: Service URL. Default value is ''. + :param base_url: Service URL. Default value is "". :type base_url: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2018-03-28". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2018-03-28". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_configuration.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_configuration.py index 1b8ffd3ca71d..b7cc08c469a0 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_configuration.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/_configuration.py @@ -26,9 +26,8 @@ class AzureQueueStorageConfiguration(Configuration): # pylint: disable=too-many :param url: The URL of the service account, queue or message that is the target of the desired operation. :type url: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2018-03-28". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2018-03-28". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage.py index fb7504d4a13c..a7d7e37fdc7b 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_azure_queue_storage.py @@ -32,11 +32,10 @@ class AzureQueueStorage: :param url: The URL of the service account, queue or message that is the target of the desired operation. :type url: str - :param base_url: Service URL. Default value is ''. + :param base_url: Service URL. Default value is "". :type base_url: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2018-03-28". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2018-03-28". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration.py index 3ed517526354..df57bdab9401 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/_configuration.py @@ -22,9 +22,8 @@ class AzureQueueStorageConfiguration(Configuration): # pylint: disable=too-many :param url: The URL of the service account, queue or message that is the target of the desired operation. :type url: str - :keyword version: Specifies the version of the operation to use for this request. The default - value is "2018-03-28". Note that overriding this default value may result in unsupported - behavior. + :keyword version: Specifies the version of the operation to use for this request. Default value + is "2018-03-28". Note that overriding this default value may result in unsupported behavior. :paramtype version: str """ diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py index a077e9848c58..6b57990f635f 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_message_id_operations.py @@ -21,26 +21,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MessageIdOperations: - """MessageIdOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.queue.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.queue.aio.AzureQueueStorage`'s + :attr:`message_id` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def update( # pylint: disable=inconsistent-return-statements @@ -69,12 +67,13 @@ async def update( # pylint: disable=inconsistent-return-statements :type visibilitytimeout: int :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting - Timeouts for Queue Service Operations.. + Timeouts for Queue Service Operations.. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py index f9f1b3b7a21d..4b774c0b20b1 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_messages_operations.py @@ -21,26 +21,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MessagesOperations: - """MessagesOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.queue.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.queue.aio.AzureQueueStorage`'s + :attr:`messages` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def dequeue( @@ -56,7 +54,7 @@ async def dequeue( :param number_of_messages: Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this - operation. + operation. Default value is None. :type number_of_messages: int :param visibilitytimeout: Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds. A specified value must be larger than @@ -66,10 +64,11 @@ async def dequeue( :type visibilitytimeout: int :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting - Timeouts for Queue Service Operations.. + Timeouts for Queue Service Operations.. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -213,14 +213,15 @@ async def enqueue( seconds. Prior to version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this parameter is omitted, the default - time-to-live is 7 days. + time-to-live is 7 days. Default value is None. :type message_time_to_live: int :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting - Timeouts for Queue Service Operations.. + Timeouts for Queue Service Operations.. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword peekonly: Peek message(s). The default value is "true". Note that overriding this - default value may result in unsupported behavior. + :keyword peekonly: Peek message(s). Default value is "true". Note that overriding this default + value may result in unsupported behavior. :paramtype peekonly: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of PeekedMessageItem, or the result of cls(response) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py index bad3912e7d4e..9dc311caf49a 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/aio/operations/_queue_operations.py @@ -21,26 +21,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class QueueOperations: - """QueueOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.queue.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.queue.aio.AzureQueueStorage`'s + :attr:`queue` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def create( # pylint: disable=inconsistent-return-statements @@ -54,16 +52,17 @@ async def create( # pylint: disable=inconsistent-return-statements :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting - Timeouts for Queue Service Operations.. + Timeouts for Queue Service Operations.. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -193,13 +193,14 @@ async def get_properties( # pylint: disable=inconsistent-return-statements :param timeout: The The timeout parameter is expressed in seconds. For more information, see None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace_async async def set_properties( # pylint: disable=inconsistent-return-statements @@ -57,16 +55,17 @@ async def set_properties( # pylint: disable=inconsistent-return-statements :type storage_service_properties: ~azure.storage.queue.models.StorageServiceProperties :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting - Timeouts for Queue Service Operations.. + Timeouts for Queue Service Operations.. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py index 5cff867c3b36..c6fc190aef28 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_messages_operations.py @@ -206,26 +206,24 @@ def build_peek_request( # fmt: on class MessagesOperations(object): - """MessagesOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.queue.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.queue.AzureQueueStorage`'s + :attr:`messages` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def dequeue( @@ -242,7 +240,7 @@ def dequeue( :param number_of_messages: Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this - operation. + operation. Default value is None. :type number_of_messages: int :param visibilitytimeout: Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds. A specified value must be larger than @@ -252,10 +250,11 @@ def dequeue( :type visibilitytimeout: int :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting - Timeouts for Queue Service Operations.. + Timeouts for Queue Service Operations.. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -401,14 +401,15 @@ def enqueue( seconds. Prior to version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this parameter is omitted, the default - time-to-live is 7 days. + time-to-live is 7 days. Default value is None. :type message_time_to_live: int :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting - Timeouts for Queue Service Operations.. + Timeouts for Queue Service Operations.. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str - :keyword peekonly: Peek message(s). The default value is "true". Note that overriding this - default value may result in unsupported behavior. + :keyword peekonly: Peek message(s). Default value is "true". Note that overriding this default + value may result in unsupported behavior. :paramtype peekonly: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of PeekedMessageItem, or the result of cls(response) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py index 18f65717b26e..1655c5131fc0 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/_generated/operations/_queue_operations.py @@ -281,26 +281,24 @@ def build_set_access_policy_request( # fmt: on class QueueOperations(object): - """QueueOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.storage.queue.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.storage.queue.AzureQueueStorage`'s + :attr:`queue` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + args = list(args) + self._client = args.pop(0) if args else kwargs.pop("client") + self._config = args.pop(0) if args else kwargs.pop("config") + self._serialize = args.pop(0) if args else kwargs.pop("serializer") + self._deserialize = args.pop(0) if args else kwargs.pop("deserializer") + @distributed_trace def create( # pylint: disable=inconsistent-return-statements @@ -315,16 +313,17 @@ def create( # pylint: disable=inconsistent-return-statements :param timeout: The The timeout parameter is expressed in seconds. For more information, see Setting - Timeouts for Queue Service Operations.. + Timeouts for Queue Service Operations.. Default value is None. :type timeout: int :param request_id_parameter: Provides a client-generated, opaque value with a 1 KB character - limit that is recorded in the analytics logs when storage analytics logging is enabled. + limit that is recorded in the analytics logs when storage analytics logging is enabled. Default + value is None. :type request_id_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -456,13 +456,14 @@ def get_properties( # pylint: disable=inconsistent-return-statements :param timeout: The The timeout parameter is expressed in seconds. For more information, see