azure.storage.file.models module

class azure.storage.file.models.ContentSettings(content_type=None, content_encoding=None, content_language=None, content_disposition=None, cache_control=None, content_md5=None)[source]

Bases: object

Used to store the content settings of a file.

Variables:
  • content_type (str) – The content type specified for the file. If no content type was specified, the default content type is application/octet-stream.
  • content_encoding (str) – If content_encoding has previously been set for the file, that value is stored.
  • content_language (str) – If content_language has previously been set for the file, that value is stored.
  • content_disposition (str) – content_disposition conveys additional information about how to process the response payload, and also can be used to attach additional metadata. If content_disposition has previously been set for the file, that value is stored.
  • cache_control (str) – If cache_control has previously been set for the file, that value is stored.
  • content_md5 (str) – If the content_md5 has been set for the file, this response header is stored so that the client can check for message content integrity.
class azure.storage.file.models.CopyProperties[source]

Bases: object

File Copy Properties.

Variables:
  • id (str) – String identifier for the last attempted Copy File operation where this file was the destination file. This header does not appear if this file has never been the destination in a Copy File operation, or if this file has been modified after a concluded Copy File operation using Set File Properties or Put File.
  • source (str) – URL up to 2 KB in length that specifies the source file used in the last attempted Copy File operation where this file was the destination file. This header does not appear if this file has never been the destination in a Copy File operation, or if this file has been modified after a concluded Copy File operation using Set File Properties or Put File.
  • status (str) –
    State of the copy operation identified by Copy ID, with these values:
    success:
    Copy completed successfully.
    pending:
    Copy is in progress. Check copy_status_description if intermittent, non-fatal errors impede copy progress but don’t cause failure.
    aborted:
    Copy was ended by Abort Copy File.
    failed:
    Copy failed. See copy_status_description for failure details.
  • progress (str) – Contains the number of bytes copied and the total bytes in the source in the last attempted Copy File operation where this file was the destination file. Can show between 0 and Content-Length bytes copied.
  • completion_time (datetime) – Conclusion time of the last attempted Copy File operation where this file was the destination file. This value can specify the time of a completed, aborted, or failed copy attempt.
  • status_description (str) – Only appears when x-ms-copy-status is failed or pending. Describes cause of fatal or non-fatal copy operation failure.
class azure.storage.file.models.Directory(name=None, props=None, metadata=None)[source]

Bases: object

Directory class.

Variables:
  • name (str) – The name of the directory.
  • properties (DirectoryProperties) – System properties for the directory.
  • metadata (dict mapping str to str) – A dict containing name-value pairs associated with the directory as metadata. This var is set to None unless the include=metadata param was included for the list directory operation. If this parameter was specified but the directory has no metadata, metadata will be set to an empty dictionary.
class azure.storage.file.models.DirectoryProperties[source]

Bases: object

File directory’s properties class.

Variables:
  • last_modified (datetime) – A datetime object representing the last time the directory was modified.
  • etag (str) – The ETag contains a value that you can use to perform operations conditionally.
class azure.storage.file.models.File(name=None, content=None, props=None, metadata=None)[source]

Bases: object

File class.

Variables:
  • name (str) – The name of the file.
  • content (str or bytes) – File content.
  • properties (FileProperties) – System properties for the file.
  • metadata (dict mapping str to str) – A dict containing name-value pairs associated with the file as metadata. This var is set to None unless the include=metadata param was included for the list file operation. If this parameter was specified but the file has no metadata, metadata will be set to an empty dictionary.
class azure.storage.file.models.FilePermissions(read=False, create=False, write=False, delete=False, _str=None)[source]

Bases: object

FilePermissions class to be used with generate_file_shared_access_signature() API.

Variables:
Parameters:
  • read (bool) – Read the content, properties, metadata. Use the file as the source of a copy operation.
  • create (bool) – Create a new file or copy a file to a new file.
  • write (bool) – Create or write content, properties, metadata. Resize the file. Use the file as the destination of a copy operation within the same account.
  • delete (bool) – Delete the file.
  • _str (str) – A string representing the permissions.
CREATE = <azure.storage.file.models.FilePermissions object>
DELETE = <azure.storage.file.models.FilePermissions object>
READ = <azure.storage.file.models.FilePermissions object>
WRITE = <azure.storage.file.models.FilePermissions object>
class azure.storage.file.models.FileProperties[source]

Bases: object

File Properties.

Variables:
  • last_modified (datetime) – A datetime object representing the last time the file was modified.
  • etag (str) – The ETag contains a value that you can use to perform operations conditionally.
  • content_length (int) – The length of the content returned. If the entire blob was requested, the length of blob in bytes. If a subset of the blob was requested, the length of the returned subset.
  • content_range (str) – Indicates the range of bytes returned in the event that the client requested a subset of the blob.
  • content_settings (ContentSettings) – Stores all the content settings for the file.
  • copy (CopyProperties) – Stores all the copy properties for the file.
class azure.storage.file.models.FileRange(start=None, end=None)[source]

Bases: object

File Range.

Variables:
  • start (int) – Byte index for start of file range.
  • end (int) – Byte index for end of file range.
class azure.storage.file.models.Share(name=None, props=None, metadata=None)[source]

Bases: object

File share class.

Variables:
  • name (str) – The name of the share.
  • properties (ShareProperties) – System properties for the share.
  • metadata (dict mapping str to str) – A dict containing name-value pairs associated with the share as metadata. This var is set to None unless the include=metadata param was included for the list shares operation. If this parameter was specified but the share has no metadata, metadata will be set to an empty dictionary.
class azure.storage.file.models.SharePermissions(read=False, write=False, delete=False, list=False, _str=None)[source]

Bases: object

SharePermissions class to be used with azure.storage.file.FileService.generate_share_shared_access_signature method and for the AccessPolicies used with azure.storage.file.FileService.set_share_acl.

Variables:
  • FilePermissions.DELETE (SharePermissions) – Delete any file in the share. Note: You cannot grant permissions to delete a share with a service SAS. Use an account SAS instead.
  • FilePermissions.LIST (SharePermissions) – List files and directories in the share.
  • FilePermissions.READ (SharePermissions) – Read the content, properties or metadata of any file in the share. Use any file in the share as the source of a copy operation.
  • FilePermissions.WRITE (SharePermissions) – For any file in the share, create or write content, properties or metadata. Resize the file. Use the file as the destination of a copy operation within the same account. Note: You cannot grant permissions to read or write share properties or metadata with a service SAS. Use an account SAS instead.
Parameters:
  • read (bool) – Read the content, properties or metadata of any file in the share. Use any file in the share as the source of a copy operation.
  • write (bool) – For any file in the share, create or write content, properties or metadata. Resize the file. Use the file as the destination of a copy operation within the same account. Note: You cannot grant permissions to read or write share properties or metadata with a service SAS. Use an account SAS instead.
  • delete (bool) – Delete any file in the share. Note: You cannot grant permissions to delete a share with a service SAS. Use an account SAS instead.
  • list (bool) – List files and directories in the share.
  • _str (str) – A string representing the permissions
DELETE = <azure.storage.file.models.SharePermissions object>
LIST = <azure.storage.file.models.SharePermissions object>
READ = <azure.storage.file.models.SharePermissions object>
WRITE = <azure.storage.file.models.SharePermissions object>
class azure.storage.file.models.ShareProperties[source]

Bases: object

File share’s properties class.

Variables:
  • last_modified (datetime) – A datetime object representing the last time the share was modified.
  • etag (str) – The ETag contains a value that you can use to perform operations conditionally.
  • quote (int) – Returns the current share quota in GB.