FileSharesOperations Class

Warning

DO NOT instantiate this class directly.

Instead, you should access the following operations through

StorageManagementClient's

<xref:file_shares> attribute.

Inheritance
builtins.object
FileSharesOperations

Constructor

FileSharesOperations(*args, **kwargs)

Methods

create

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

delete

Deletes specified share under its account.

get

Gets properties of a specified share.

list

Lists all shares.

restore

Restore a file share within a valid retention days if share soft delete is enabled.

update

Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist.

create

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

create(resource_group_name: str, account_name: str, share_name: str, file_share: _models.FileShare, expand: str | _models.PutSharesExpand | None = None, *, content_type: str = 'application/json', **kwargs: Any) -> _models.FileShare

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.

share_name
Required
str

The name of the file share within the specified storage account. File share 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.

file_share
Required

Properties of the file share to create. Is either a FileShare type or a IO[bytes] type. Required.

expand
Required

Optional, used to create a snapshot. "snapshots" Default value is None.

Returns

Type Description

FileShare or the result of cls(response)

Exceptions

Type Description

delete

Deletes specified share under its account.

delete(resource_group_name: str, account_name: str, share_name: str, x_ms_snapshot: str | None = None, **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.

share_name
Required
str

The name of the file share within the specified storage account. File share 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.

x_ms_snapshot
Required
str

Optional, used to delete a snapshot. Default value is None.

Returns

Type Description

None or the result of cls(response)

Exceptions

Type Description

get

Gets properties of a specified share.

get(resource_group_name: str, account_name: str, share_name: str, expand: Literal['stats'] = 'stats', x_ms_snapshot: str | None = None, **kwargs: Any) -> FileShare

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.

share_name
Required
str

The name of the file share within the specified storage account. File share 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.

expand
Required
str

Optional, used to expand the properties within share's properties. Known values are "stats" and None. Default value is "stats".

x_ms_snapshot
Required
str

Optional, used to retrieve properties of a snapshot. Default value is None.

Returns

Type Description

FileShare or the result of cls(response)

Exceptions

Type Description

list

Lists all shares.

list(resource_group_name: str, account_name: str, maxpagesize: str | None = None, filter: str | None = None, expand: str | ListSharesExpand | None = None, **kwargs: Any) -> Iterable[FileShareItem]

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 shares that can be included in the list. Default value is None.

filter
Required
str

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

expand
Required

Optional, used to expand the properties within share's properties. Known values are: "deleted" and "snapshots". Default value is None.

Returns

Type Description

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

Exceptions

Type Description

restore

Restore a file share within a valid retention days if share soft delete is enabled.

restore(resource_group_name: str, account_name: str, share_name: str, deleted_share: _models.DeletedShare, *, content_type: str = 'application/json', **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.

share_name
Required
str

The name of the file share within the specified storage account. File share 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.

deleted_share
Required

Is either a DeletedShare type or a IO[bytes] type. Required.

Returns

Type Description

None or the result of cls(response)

Exceptions

Type Description

update

Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist.

update(resource_group_name: str, account_name: str, share_name: str, file_share: _models.FileShare, *, content_type: str = 'application/json', **kwargs: Any) -> _models.FileShare

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.

share_name
Required
str

The name of the file share within the specified storage account. File share 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.

file_share
Required

Properties to update for the file share. Is either a FileShare type or a IO[bytes] type. Required.

Returns

Type Description

FileShare or the result of cls(response)

Exceptions

Type Description

Attributes

models

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