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(mode, retain_until=None)[source]

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

Parameters:
__init__(mode, retain_until=None)[source]
Parameters:
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(mode, period=None)[source]

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

Parameters:
__init__(mode, period=None)[source]
Parameters:
class b2sdk.v2.RetentionPeriod(years=None, days=None)[source]

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

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

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

Parameters:
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(default_retention, is_file_lock_enabled)[source]

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

Parameters:
__init__(default_retention, is_file_lock_enabled)[source]
Parameters:
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)