你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

BlobContainersOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

StorageManagementClient's

<xref:blob_containers> attribute.

Inheritance
builtins.object
BlobContainersOperations

Constructor

BlobContainersOperations(*args, **kwargs)

Methods

begin_object_level_worm

This operation migrates a blob container from container level WORM to object level immutability enabled container. Prerequisites require a container level immutability policy either in locked or unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container.

clear_legal_hold

Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request.

create

Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container.

create_or_update_immutability_policy

Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation.

delete

Deletes specified container under its account.

delete_immutability_policy

Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the container after deleting all expired blobs inside the policy locked container.

extend_immutability_policy

Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation.

get

Gets properties of a specified container.

get_immutability_policy

Gets the existing immutability policy along with the corresponding ETag in response headers and body.

lease

The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite.

list

Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token.

lock_immutability_policy

Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation.

set_legal_hold

Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request.

update

Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist.

begin_object_level_worm

This operation migrates a blob container from container level WORM to object level immutability enabled container. Prerequisites require a container level immutability policy either in locked or unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container.

begin_object_level_worm(resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> LROPoller[None]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

container_name
Required
str

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.

Returns

Type Description

An instance of LROPoller that returns either None or the result of cls(response)

Exceptions

Type Description

Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request.

clear_legal_hold(resource_group_name: str, account_name: str, container_name: str, legal_hold: _models.LegalHold, *, content_type: str = 'application/json', **kwargs: Any) -> _models.LegalHold

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

container_name
Required
str

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.

legal_hold
Required

The LegalHold property that will be clear from a blob container. Is either a LegalHold type or a IO[bytes] type. Required.

Returns

Type Description

LegalHold or the result of cls(response)

Exceptions

Type Description

create

Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container.

create(resource_group_name: str, account_name: str, container_name: str, blob_container: _models.BlobContainer, *, content_type: str = 'application/json', **kwargs: Any) -> _models.BlobContainer

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

container_name
Required
str

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.

blob_container
Required

Properties of the blob container to create. Is either a BlobContainer type or a IO[bytes] type. Required.

Returns

Type Description

BlobContainer or the result of cls(response)

Exceptions

Type Description

create_or_update_immutability_policy

Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation.

create_or_update_immutability_policy(resource_group_name: str, account_name: str, container_name: str, if_match: str | None = None, parameters: _models.ImmutabilityPolicy | None = None, *, content_type: str = 'application/json', **kwargs: Any) -> _models.ImmutabilityPolicy

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

container_name
Required
str

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.

if_match
Required
str

The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied. Default value is None.

parameters
Required

The ImmutabilityPolicy Properties that will be created or updated to a blob container. Is either a ImmutabilityPolicy type or a IO[bytes] type. Default value is None.

Returns

Type Description

ImmutabilityPolicy or the result of cls(response)

Exceptions

Type Description

delete

Deletes specified container under its account.

delete(resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> None

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

container_name
Required
str

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.

Returns

Type Description

None or the result of cls(response)

Exceptions

Type Description

delete_immutability_policy

Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the container after deleting all expired blobs inside the policy locked container.

delete_immutability_policy(resource_group_name: str, account_name: str, container_name: str, if_match: str, **kwargs: Any) -> ImmutabilityPolicy

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

container_name
Required
str

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.

if_match
Required
str

The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied. Required.

Returns

Type Description

ImmutabilityPolicy or the result of cls(response)

Exceptions

Type Description

extend_immutability_policy

Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation.

extend_immutability_policy(resource_group_name: str, account_name: str, container_name: str, if_match: str, parameters: _models.ImmutabilityPolicy | None = None, *, content_type: str = 'application/json', **kwargs: Any) -> _models.ImmutabilityPolicy

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

container_name
Required
str

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.

if_match
Required
str

The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied. Required.

parameters
Required

The ImmutabilityPolicy Properties that will be extended for a blob container. Is either a ImmutabilityPolicy type or a IO[bytes] type. Default value is None.

Returns

Type Description

ImmutabilityPolicy or the result of cls(response)

Exceptions

Type Description

get

Gets properties of a specified container.

get(resource_group_name: str, account_name: str, container_name: str, **kwargs: Any) -> BlobContainer

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

container_name
Required
str

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.

Returns

Type Description

BlobContainer or the result of cls(response)

Exceptions

Type Description

get_immutability_policy

Gets the existing immutability policy along with the corresponding ETag in response headers and body.

get_immutability_policy(resource_group_name: str, account_name: str, container_name: str, if_match: str | None = None, **kwargs: Any) -> ImmutabilityPolicy

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

container_name
Required
str

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.

if_match
Required
str

The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied. Default value is None.

Returns

Type Description

ImmutabilityPolicy or the result of cls(response)

Exceptions

Type Description

lease

The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite.

lease(resource_group_name: str, account_name: str, container_name: str, parameters: _models.LeaseContainerRequest | None = None, *, content_type: str = 'application/json', **kwargs: Any) -> _models.LeaseContainerResponse

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

container_name
Required
str

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.

parameters
Required

Lease Container request body. Is either a LeaseContainerRequest type or a IO[bytes] type. Default value is None.

Returns

Type Description

LeaseContainerResponse or the result of cls(response)

Exceptions

Type Description

list

Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token.

list(resource_group_name: str, account_name: str, maxpagesize: str | None = None, filter: str | None = None, include: str | ListContainersInclude | None = None, **kwargs: Any) -> Iterable[ListContainerItem]

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

maxpagesize
Required
str

Optional. Specified maximum number of containers that can be included in the list. Default value is None.

filter
Required
str

Optional. When specified, only container names starting with the filter will be listed. Default value is None.

include
Required

Optional, used to include the properties for soft deleted blob containers. "deleted" Default value is None.

Returns

Type Description

An iterator like instance of either ListContainerItem or the result of cls(response)

Exceptions

Type Description

lock_immutability_policy

Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation.

lock_immutability_policy(resource_group_name: str, account_name: str, container_name: str, if_match: str, **kwargs: Any) -> ImmutabilityPolicy

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

container_name
Required
str

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.

if_match
Required
str

The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied. Required.

Returns

Type Description

ImmutabilityPolicy or the result of cls(response)

Exceptions

Type Description

Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request.

set_legal_hold(resource_group_name: str, account_name: str, container_name: str, legal_hold: _models.LegalHold, *, content_type: str = 'application/json', **kwargs: Any) -> _models.LegalHold

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

container_name
Required
str

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.

legal_hold
Required

The LegalHold property that will be set to a blob container. Is either a LegalHold type or a IO[bytes] type. Required.

Returns

Type Description

LegalHold or the result of cls(response)

Exceptions

Type Description

update

Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist.

update(resource_group_name: str, account_name: str, container_name: str, blob_container: _models.BlobContainer, *, content_type: str = 'application/json', **kwargs: Any) -> _models.BlobContainer

Parameters

Name Description
resource_group_name
Required
str

The name of the resource group within the user's subscription. The name is case insensitive. Required.

account_name
Required
str

The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Required.

container_name
Required
str

The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. Required.

blob_container
Required

Properties to update for the blob container. Is either a BlobContainer type or a IO[bytes] type. Required.

Returns

Type Description

BlobContainer or the result of cls(response)

Exceptions

Type Description

Attributes

models

models = <module 'azure.mgmt.storage.v2023_05_01.models' from 'C:\\hostedtoolcache\\windows\\Python\\3.11.9\\x64\\Lib\\site-packages\\azure\\mgmt\\storage\\v2023_05_01\\models\\__init__.py'>