File locks

class b2sdk.v2.LegalHold[source]

Enum holding information about legalHold switch in a file.

ON = 'on'

legal hold set to “on”

OFF = 'off'

legal hold set to “off”

UNSET = None

server default, as for now it is functionally equivalent to OFF

UNKNOWN = 'unknown'

the client is not authorized to read legal hold settings

is_on()[source]

Is the legalHold switch on?

is_off()[source]

Is the legalHold switch off or left as default (which also means off)?

is_unknown()[source]

Is the legalHold switch unknown?

class b2sdk.v2.FileRetentionSetting[source]

Represent file retention settings, i.e. whether the file is retained, in which mode and until when

__init__(mode: RetentionMode, retain_until: Optional[int] = None)[source]
class b2sdk.v2.RetentionMode[source]

Enum class representing retention modes set in files and buckets

GOVERNANCE = 'governance'

retention settings for files in this mode can be modified by clients with appropriate application key capabilities

COMPLIANCE = 'compliance'

retention settings for files in this mode can only be modified by extending the retention dates by clients with appropriate application key capabilities

NONE = None

retention not set

UNKNOWN = 'unknown'

the client is not authorized to read retention settings

class b2sdk.v2.BucketRetentionSetting[source]

Represent bucket’s default file retention settings, i.e. whether the files should be retained, in which mode and for how long

__init__(mode: RetentionMode, period: Optional[RetentionPeriod] = None)[source]
class b2sdk.v2.RetentionPeriod[source]

Represent a time period (either in days or in years) that is used as a default for bucket retention

KNOWN_UNITS = ['days', 'years']
__init__(years: Optional[int] = None, days: Optional[int] = None)[source]

Create a retention period, provide exactly one of: days, years

classmethod from_period_dict(period_dict)[source]

Build a RetentionPeriod from an object returned by the server, such as:

{
    "duration": 2,
    "unit": "years"
}
as_dict()[source]
class b2sdk.v2.FileLockConfiguration[source]

Represent bucket’s file lock configuration, i.e. whether the file lock mechanism is enabled and default file retention

__init__(default_retention: BucketRetentionSetting, is_file_lock_enabled: Optional[bool])[source]
b2sdk.v2.UNKNOWN_BUCKET_RETENTION

alias of BucketRetentionSetting(‘unknown’, None)

b2sdk.v2.UNKNOWN_FILE_LOCK_CONFIGURATION

alias of FileLockConfiguration(BucketRetentionSetting(‘unknown’, None), None)

b2sdk.v2.NO_RETENTION_BUCKET_SETTING

alias of BucketRetentionSetting(None, None)

b2sdk.v2.NO_RETENTION_FILE_SETTING

alias of FileRetentionSetting(None, None)

b2sdk.v2.UNKNOWN_FILE_RETENTION_SETTING

alias of FileRetentionSetting(‘unknown’, None)