IPWorks SFTP 2020 Python Edition

Questions / Feedback?

on_get_attributes Event

Fires when a client needs to get file information.

Syntax

class SFTPServerGetAttributesEventParams(object):
  @property
  def connection_id() -> int: ...
  @property
  def user() -> str: ...
  @property
  def path() -> str: ...
  @property
  def flags() -> int: ...
  @property
  def file_type() -> int: ...
  @file_type.setter
  def file_type(value) -> None: ...
  @property
  def file_size() -> int: ...
  @file_size.setter
  def file_size(value) -> None: ...
  @property
  def file_owner() -> str: ...
  @file_owner.setter
  def file_owner(value) -> None: ...
  @property
  def file_group() -> str: ...
  @file_group.setter
  def file_group(value) -> None: ...
  @property
  def file_permissions() -> int: ...
  @file_permissions.setter
  def file_permissions(value) -> None: ...
  @property
  def file_a_time() -> int: ...
  @file_a_time.setter
  def file_a_time(value) -> None: ...
  @property
  def file_create_time() -> int: ...
  @file_create_time.setter
  def file_create_time(value) -> None: ...
  @property
  def file_m_time() -> int: ...
  @file_m_time.setter
  def file_m_time(value) -> None: ...
  @property
  def file_attrib_bits() -> int: ...
  @file_attrib_bits.setter
  def file_attrib_bits(value) -> None: ...
  @property
  def file_attrib_bits_valid() -> int: ...
  @file_attrib_bits_valid.setter
  def file_attrib_bits_valid(value) -> None: ...
  @property
  def other_attributes() -> str: ...
  @other_attributes.setter
  def other_attributes(value) -> None: ...
  @property
  def status_code() -> int: ...
  @status_code.setter
  def status_code(value) -> None: ...

# In class SFTPServer:
@property
def on_get_attributes() -> Callable[[SFTPServerGetAttributesEventParams], None]: ...
@on_get_attributes.setter
def on_get_attributes(event_hook: Callable[[SFTPServerGetAttributesEventParams], None]) -> None: ...

Remarks

The on_get_attributes event fires when an SFTP client sends an SSH_FXP_STAT, SSH_FXP_LSTAT or SSH_FXP_FSTAT request. Path is the file path. Flags specifies the set of file attributes the client is interested in.

File/Directory Attributes are specified using the following values:

FileType: The type of file. Can be one of the following values:

  • SSH_FILEXFER_TYPE_REGULAR (1)
  • SSH_FILEXFER_TYPE_DIRECTORY (2)
  • SSH_FILEXFER_TYPE_SYMLINK (3)
  • SSH_FILEXFER_TYPE_SPECIAL (4)
  • SSH_FILEXFER_TYPE_UNKNOWN (5)
  • SSH_FILEXFER_TYPE_SOCKET (6)
  • SSH_FILEXFER_TYPE_CHAR_DEVICE (7)
  • SSH_FILEXFER_TYPE_BLOCK_DEVICE (8)
  • SSH_FILEXFER_TYPE_FIFO (9)

FileSize: The file size, in bytes.

FileOwner: The file owner. If the ProtocolVersion configuration option is "3" (default), this field should be a numeric Unix-like user identifier. V4-V6 of the SFTP Protocol allow an arbitrary string.

FileGroup: The file owner group. If the ProtocolVersion configuration option is "3" (default), this field should be a numeric Unix-like group identifier. V4-V6 of the SFTP Protocol allow an arbitrary string.

FilePermissions: The POSIX-style file permissions.

FileATime: The file last-access time, in milliseconds since Jan 1, 1970 in UTC.

FileCreateTime: The file creation time, in milliseconds since Jan 1, 1970 in UTC.

FileMTime: The file last-modified time, in milliseconds since Jan 1, 1970 in UTC.

FileAttrBits: The file attributes, as a combination of the following values:

  • SSH_FILEXFER_ATTR_FLAGS_READONLY (0x00000001)
  • SSH_FILEXFER_ATTR_FLAGS_SYSTEM (0x00000002)
  • SSH_FILEXFER_ATTR_FLAGS_HIDDEN (0x00000004)
  • SSH_FILEXFER_ATTR_FLAGS_CASE_INSENSITIVE (0x00000008)
  • SSH_FILEXFER_ATTR_FLAGS_ARCHIVE (0x00000010)
  • SSH_FILEXFER_ATTR_FLAGS_ENCRYPTED (0x00000020)
  • SSH_FILEXFER_ATTR_FLAGS_COMPRESSED (0x00000040)
  • SSH_FILEXFER_ATTR_FLAGS_SPARSE (0x00000080)
  • SSH_FILEXFER_ATTR_FLAGS_APPEND_ONLY (0x00000100)
  • SSH_FILEXFER_ATTR_FLAGS_IMMUTABLE (0x00000200)
  • SSH_FILEXFER_ATTR_FLAGS_SYNC (0x00000400)
  • SSH_FILEXFER_ATTR_FLAGS_TRANSLATION_ERR (0x00000800)

FileAttrBitsValid: A mask specifying which bits in FileAttrBits are supported by the server.

OtherAttributes: A semi-colon (';') delimited list of Name=Value pairs of other attributes supported by SFTP. These include:

  • MIMEType (String)
  • AllocationSize (64-bit int)
  • ATimeNS (int): ATime nanoseconds
  • CreateTimeNS (int): CreateTime nanoseconds
  • MTimeNS (int): MTime nanoseconds
  • TextHint (8-bit int)
  • LinkCount (int)
  • UntranslatedName (String)

FileMimeType: The MIME type of the file.

Valid status codes are:

  • SSH_FX_OK 0
  • SSH_FX_EOF 1
  • SSH_FX_NO_SUCH_FILE 2
  • SSH_FX_PERMISSION_DENIED 3
  • SSH_FX_FAILURE 4
  • SSH_FX_BAD_MESSAGE 5
  • SSH_FX_NO_CONNECTION 6
  • SSH_FX_CONNECTION_LOST 7
  • SSH_FX_OP_UNSUPPORTED 8
  • SSH_FX_INVALID_HANDLE 9
  • SSH_FX_NO_SUCH_PATH 10
  • SSH_FX_FILE_ALREADY_EXISTS 11
  • SSH_FX_WRITE_PROTECT 12
  • SSH_FX_NO_MEDIA 13
  • SSH_FX_NO_SPACE_ON_FILESYSTEM 14
  • SSH_FX_QUOTA_EXCEEDED 15
  • SSH_FX_UNKNOWN_PRINCIPAL 16
  • SSH_FX_LOCK_CONFLICT 17
  • SSH_FX_DIR_NOT_EMPTY 18
  • SSH_FX_NOT_A_DIRECTORY 19
  • SSH_FX_INVALID_FILENAME 20
  • SSH_FX_LINK_LOOP 21
  • SSH_FX_CANNOT_DELETE 22
  • SSH_FX_INVALID_PARAMETER 23
  • SSH_FX_FILE_IS_A_DIRECTORY 24
  • SSH_FX_BYTE_RANGE_LOCK_CONFLICT 25
  • SSH_FX_BYTE_RANGE_LOCK_REFUSED 26
  • SSH_FX_DELETE_PENDING 27
  • SSH_FX_FILE_CORRUPT 28
  • SSH_FX_OWNER_INVALID 29
  • SSH_FX_GROUP_INVALID 30
  • SSH_FX_NO_MATCHING_BYTE_RANGE_LOCK 31

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks SFTP 2020 Python Edition - Version 20.0 [Build 8263]