sams.storage.destinations – Storage Destinations

class Destination(config_str: str)

A Destination instance

Variables
  • config_string (str) – A string from any STORAGE_DESTINATION config attribute

  • entries (list[str]) – The entries as provided by the config_string

  • name (str) – The name of the destination

  • provider_name (str) – The name of the provider

  • provider (Provider) – The provider instance

  • config (str) – The config part from the entries

provider_instance()sams.storage.providers.base.SamsBaseStorageProvider

Retrieve the Storage instance for this destination

Returns

An Storage Provider instance

Return type

SamsBaseStorageProvider

to_dict()

Return a dictionary containing name and provider

Returns

A dictionary containing name and provider_name of destination

Return type

dict

class Destinations

A mechanism to register storage destinations with the system

This is used when bootstrapping the application to register storage destinations from strings in the config.

Usage:

from sams.storage.destinations import destinations

destinations.register(...)
destinations.get(...)
destinations.exists(...)
destinations.all(...)
destinations.clear(...)
register(config_string: str)

Register a storage destination with the system

Parameters

config_string (str) – A string from any STORAGE_DESTINATION config attribute

get(name: str)sams.storage.destinations.Destination

Retrieve a registered storage destination by it’s name

Parameters

name (str) – The name of the storage destination

Returns

Returns the Destination instance

Return type

Destination

Raises

sams_client.errors.SamsStorageDestinationErrors.NotFound – if the destination is not found

exists(name: str)bool

Check if a storage destination with name exists

Parameters

name (str) – The name of the storage destination

Returns

True if the destination exists, False if not

all()Dict[str, sams.storage.destinations.Destination]

Returns all the registered storage destinations

clear()

Clears all of the registered storage destinations