graviti.openapi.storage_config#

Interfaces about the storage config.

Module Contents#

Functions#

list_storage_configs(access_key, url, workspace, *, sort = None, offset = None, limit = None)

Execute the OpenAPI GET /v2/workspaces/{workspace}/storage-configs.

get_storage_config(access_key, url, workspace, storage_config)

Execute the OpenAPI GET /v2/workspaces/{workspace}/storage-configs/{storage_config}.

update_storage_configs(access_key, url, workspace, *, default_storage_config)

Execute the OpenAPI PATCH /v2/workspaces/{workspace}/storage-configs.

graviti.openapi.storage_config.list_storage_configs(access_key, url, workspace, *, sort=None, offset=None, limit=None)[source]#

Execute the OpenAPI GET /v2/workspaces/{workspace}/storage-configs.

Parameters
  • access_key (str) – User’s access key.

  • url (str) – The URL of the graviti website.

  • workspace (str) – The name of the workspace.

  • sort (graviti.utility.SortParam) – The column and the direction the list result sorted by.

  • offset (Optional[int]) – The offset of the page. The default value of this param in OpenAPIv2 is 0.

  • limit (Optional[int]) – The limit of the page. The default value of this param in OpenAPIv2 is 128.

Returns

The response of OpenAPI.

Return type

Dict[str, Any]

Examples

>>> list_storage_configs("ACCESSKEY-********", "https://api.graviti.com", "portex-test")
{
    "default_storage_config": "AliCloud-oss-cn-shanghai",
    "storage_configs": [
        {
            "id": "2bc95d506db2401b898067f1045d7f60",
            "name": "AliCloud-oss-cn-shanghai",
            "config_type": "GRAVITI",
            "backend_type": "OSS"
        },
        {
            "id": "2bc95d506db2401b898067f1045d7f61",
            "name": "OSSConfig",
            "config_type": "AUTHORIZED",
            "backend_type": "OSS"
        }
    ],
    "offset": 0,
    "record_size": 2,
    "total_count": 2
}
graviti.openapi.storage_config.get_storage_config(access_key, url, workspace, storage_config)[source]#

Execute the OpenAPI GET /v2/workspaces/{workspace}/storage-configs/{storage_config}.

Parameters
  • access_key (str) – User’s access key.

  • url (str) – The URL of the graviti website.

  • workspace (str) – The name of the workspace.

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

Returns

The response of OpenAPI.

Return type

Dict[str, Any]

Examples

>>> get_storage_config(
...     "ACCESSKEY-********",
...     "https://api.graviti.com",
...     "portex-test",
...     "AliCloud-oss-cn-shanghai",
... )
{
    "id": "2bc95d506db2401b898067f1045d7f60",
    "name": "AliCloud-oss-cn-shanghai",
    "config_type": "GRAVITI",
    "backend_type": "OSS",
}
graviti.openapi.storage_config.update_storage_configs(access_key, url, workspace, *, default_storage_config)[source]#

Execute the OpenAPI PATCH /v2/workspaces/{workspace}/storage-configs.

Parameters
  • access_key (str) – User’s access key.

  • url (str) – The URL of the graviti website.

  • workspace (str) – The name of the workspace.

  • default_storage_config (str) – New default storage config.

Return type

None

Examples

>>> update_storage_config(
...     "ACCESSKEY-********",
...     "https://api.graviti.com",
...     "portex-test",
...     "AliCloud-oss-cn-shanghai",
... )