graviti.manager.storage_config#

The implementation of the StorageConfig and StorageConfigManager.

Module Contents#

Classes#

StorageConfig

This class defines the structure of the storage config of Graviti Data Platform.

StorageConfigManager

This class defines the operations on the storage config in Graviti.

class graviti.manager.storage_config.StorageConfig(workspace, name)[source]#

Bases: graviti.utility.ReprMixin

This class defines the structure of the storage config of Graviti Data Platform.

Parameters
  • workspace (graviti.Workspace) – The workspace of the storage config.

  • response

    The response of the OpenAPI associated with the storage config:

    {
        "id": <str>
        "name": <str>
        "config_type": <str>
        "backend_type": <str>
    }
    

  • name (str) –

name#

The name of the storage config.

config_type[source]#

The type of the storage config.

backend_type[source]#

The backend type of the storage config.

classmethod from_response(cls, workspace, response)[source]#

Create a StorageConfig instance from the response.

Parameters
  • workspace (graviti.Workspace) – The workspace of the storage config.

  • response (Dict[str, Any]) –

    The response of the storage config:

    {
        "id": <str>
        "name": <str>
        "config_type": <str>
        "backend_type":  <str>
    }
    

  • cls (Type[_T]) –

Returns

A StorageConfig instance created from the response.

Return type

_T

class graviti.manager.storage_config.StorageConfigManager(workspace)[source]#

This class defines the operations on the storage config in Graviti.

Parameters

workspace (graviti.Workspace) – Class Workspace instance.

property default_storage_config(self)[source]#

The default storage config of this worksapce.

Returns

The default storage config of this worksapce.

Return type

str

get(self, name)[source]#

Get a Graviti storage config with given name.

Parameters

name (str) – The name of the storage config.

Returns

The requested storage_config instance.

Raises

ResourceNameError – When the given storage config name is invalid.

Return type

StorageConfig

list(self)[source]#

List Graviti storage configs.

Returns

The LazyPagingList of StorageConfig instances.

Return type

graviti.manager.lazy.LazyPagingList[StorageConfig]

edit(self, *, default_storage_config)[source]#

Update Graviti storage config related configs.

Parameters

default_storage_config (str) – The name of the new default storage config.

Raises

ResourceNameError – When the given default storage config name is invalid.

Return type

None