gpf_entrepot_toolbelt.orchestrator.models.storage module

class gpf_entrepot_toolbelt.orchestrator.models.storage.GpfStorage(_id: str, name: str, type: str, type_infos: dict)

Bases : object

GPF Storage class.

Exemple

output = GpfStorage(
    _id="1231544456-1546546-164565",
    name="input_storage",
    type="POSTGRESQL",
    type_infos={}
)
__init__(_id: str, name: str, type: str, type_infos: dict) None
property database: PgDatabase

Returns associated PgDatabase.

Raise KeyError in case of missing information.

Returns

PgDatabase: associated PgDatabase

classmethod from_dict(val: dict) Self

Load object from a dict.

Paramètres:

val (dict) – dict value to load

Renvoie:

object with attributes filled from dict.

Type renvoyé:

Self

Exemple

stored_data = GpfStorage.from_dict(
        {
            "_id" : "1231544456-1546546-164565",
            "name" : "input_storage",
            "type" : "POSTGRESQL",
            "type_infos" : {}
        }
    )
print(stored_data._id)
property is_fs_storage: bool

Checks if object is a FILESYSTEM storage.

Renvoie:

True if is a FileSystem.

Type renvoyé:

bool

property is_object_storage: bool

Checks if object is an object storage.

Renvoie:

True if is a object storage.

Type renvoyé:

bool

property is_s3_storage: bool

Checks if object is a s3 storage.

Renvoie:

True if is a S3 storage.

Type renvoyé:

bool

name: str
property readonly_database: PgDatabase

Returns associated PgDatabase with read only port if defined.

Raise KeyError in case of missing information.

Returns

PgDatabase: associated PgDatabase

to_dict() dict

Convert dataclass object into dictionary. Supersedes dataclass.asdict.

Renvoie:

object as dictionary

Type renvoyé:

dict

Exemple

output = GpfStorage(
    _id="1231544456-1546546-164565",
    name="input_storage",
    type="POSTGRESQL",
    type_info={}
)
print(output.to_dict())
type: str
type_infos: dict