Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ async def download(
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'))
response_headers['x-ms-version-id']=self._deserialize('str', response.headers.get('x-ms-version-id'))
response_headers['Accept-Ranges']=self._deserialize('str', response.headers.get('Accept-Ranges'))
response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
response_headers['x-ms-blob-committed-block-count']=self._deserialize('int', response.headers.get('x-ms-blob-committed-block-count'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,86 @@ async def restore(

restore.metadata = {'url': '/{containerName}'} # type: ignore

async def rename(
self,
source_container_name: str,
timeout: Optional[int] = None,
request_id_parameter: Optional[str] = None,
source_lease_id: Optional[str] = None,
**kwargs
) -> None:
"""Renames an existing container.

:param source_container_name: Required. Specifies the name of the container to rename.
:type source_container_name: str
:param timeout: The timeout parameter is expressed in seconds. For more information, see
:code:`<a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-
timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>`.
: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 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 callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
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)
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)
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'))
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

async def acquire_lease(
self,
timeout: Optional[int] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@ async def get_account_info(
response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
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'))
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from ._models_py3 import CpkInfo
from ._models_py3 import CpkScopeInfo
from ._models_py3 import DataLakeStorageError
from ._models_py3 import DataLakeStorageErrorDetails
from ._models_py3 import DataLakeStorageErrorAutoGenerated
from ._models_py3 import DelimitedTextConfiguration
from ._models_py3 import DirectoryHttpHeaders
from ._models_py3 import FilterBlobItem
Expand Down Expand Up @@ -85,7 +85,7 @@
from ._models import CpkInfo # type: ignore
from ._models import CpkScopeInfo # type: ignore
from ._models import DataLakeStorageError # type: ignore
from ._models import DataLakeStorageErrorDetails # type: ignore
from ._models import DataLakeStorageErrorAutoGenerated # type: ignore
from ._models import DelimitedTextConfiguration # type: ignore
from ._models import DirectoryHttpHeaders # type: ignore
from ._models import FilterBlobItem # type: ignore
Expand Down Expand Up @@ -167,7 +167,7 @@
'CpkInfo',
'CpkScopeInfo',
'DataLakeStorageError',
'DataLakeStorageErrorDetails',
'DataLakeStorageErrorAutoGenerated',
'DelimitedTextConfiguration',
'DirectoryHttpHeaders',
'FilterBlobItem',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ class BlobItemInternal(msrest.serialization.Model):
'properties': {'key': 'Properties', 'type': 'BlobPropertiesInternal'},
'metadata': {'key': 'Metadata', 'type': 'BlobMetadata'},
'blob_tags': {'key': 'BlobTags', 'type': 'BlobTags'},
'object_replication_metadata': {'key': 'OrMetadata', 'type': '{str}'},
'object_replication_metadata': {'key': 'ObjectReplicationMetadata', 'type': '{str}'},
}
_xml_map = {
'name': 'Blob'
Expand Down Expand Up @@ -955,11 +955,12 @@ class DataLakeStorageError(msrest.serialization.Model):
"""DataLakeStorageError.

:param data_lake_storage_error_details: The service error response object.
:type data_lake_storage_error_details: ~azure.storage.blob.models.DataLakeStorageErrorDetails
:type data_lake_storage_error_details:
~azure.storage.blob.models.DataLakeStorageErrorAutoGenerated
"""

_attribute_map = {
'data_lake_storage_error_details': {'key': 'error', 'type': 'DataLakeStorageErrorDetails'},
'data_lake_storage_error_details': {'key': 'error', 'type': 'DataLakeStorageErrorAutoGenerated'},
}

def __init__(
Expand All @@ -970,7 +971,7 @@ def __init__(
self.data_lake_storage_error_details = kwargs.get('data_lake_storage_error_details', None)


class DataLakeStorageErrorDetails(msrest.serialization.Model):
class DataLakeStorageErrorAutoGenerated(msrest.serialization.Model):
"""The service error response object.

:param code: The service error code.
Expand All @@ -988,7 +989,7 @@ def __init__(
self,
**kwargs
):
super(DataLakeStorageErrorDetails, self).__init__(**kwargs)
super(DataLakeStorageErrorAutoGenerated, self).__init__(**kwargs)
self.code = kwargs.get('code', None)
self.message = kwargs.get('message', None)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ class BlobItemInternal(msrest.serialization.Model):
'properties': {'key': 'Properties', 'type': 'BlobPropertiesInternal'},
'metadata': {'key': 'Metadata', 'type': 'BlobMetadata'},
'blob_tags': {'key': 'BlobTags', 'type': 'BlobTags'},
'object_replication_metadata': {'key': 'OrMetadata', 'type': '{str}'},
'object_replication_metadata': {'key': 'ObjectReplicationMetadata', 'type': '{str}'},
}
_xml_map = {
'name': 'Blob'
Expand Down Expand Up @@ -1090,24 +1090,25 @@ class DataLakeStorageError(msrest.serialization.Model):
"""DataLakeStorageError.

:param data_lake_storage_error_details: The service error response object.
:type data_lake_storage_error_details: ~azure.storage.blob.models.DataLakeStorageErrorDetails
:type data_lake_storage_error_details:
~azure.storage.blob.models.DataLakeStorageErrorAutoGenerated
"""

_attribute_map = {
'data_lake_storage_error_details': {'key': 'error', 'type': 'DataLakeStorageErrorDetails'},
'data_lake_storage_error_details': {'key': 'error', 'type': 'DataLakeStorageErrorAutoGenerated'},
}

def __init__(
self,
*,
data_lake_storage_error_details: Optional["DataLakeStorageErrorDetails"] = None,
data_lake_storage_error_details: Optional["DataLakeStorageErrorAutoGenerated"] = None,
**kwargs
):
super(DataLakeStorageError, self).__init__(**kwargs)
self.data_lake_storage_error_details = data_lake_storage_error_details


class DataLakeStorageErrorDetails(msrest.serialization.Model):
class DataLakeStorageErrorAutoGenerated(msrest.serialization.Model):
"""The service error response object.

:param code: The service error code.
Expand All @@ -1128,7 +1129,7 @@ def __init__(
message: Optional[str] = None,
**kwargs
):
super(DataLakeStorageErrorDetails, self).__init__(**kwargs)
super(DataLakeStorageErrorAutoGenerated, self).__init__(**kwargs)
self.code = code
self.message = message

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ def download(
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'))
response_headers['x-ms-version-id']=self._deserialize('str', response.headers.get('x-ms-version-id'))
response_headers['Accept-Ranges']=self._deserialize('str', response.headers.get('Accept-Ranges'))
response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
response_headers['x-ms-blob-committed-block-count']=self._deserialize('int', response.headers.get('x-ms-blob-committed-block-count'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,87 @@ def restore(

restore.metadata = {'url': '/{containerName}'} # type: ignore

def rename(
self,
source_container_name, # type: str
timeout=None, # type: Optional[int]
request_id_parameter=None, # type: Optional[str]
source_lease_id=None, # type: Optional[str]
**kwargs # type: Any
):
# type: (...) -> None
"""Renames an existing container.

:param source_container_name: Required. Specifies the name of the container to rename.
:type source_container_name: str
:param timeout: The timeout parameter is expressed in seconds. For more information, see
:code:`<a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-
timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>`.
: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 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 callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
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)
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)
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'))
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

def acquire_lease(
self,
timeout=None, # type: Optional[int]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@ def get_account_info(
response_headers['Date']=self._deserialize('rfc-1123', response.headers.get('Date'))
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'))
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)
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-blob/swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.BlobStorage/preview/2020-04-08/blob.json
input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/7184eaab3308c16dd935a4020209b765d8296fbe/specification/storage/data-plane/Microsoft.BlobStorage/preview/2020-04-08/blob.json
output-folder: ../azure/storage/blob/_generated
namespace: azure.storage.blob
no-namespace-folders: true
Expand Down