CRUD
delete_secret(identifier, project=None, entity_id=None, delete_all_versions=False, **kwargs)
Delete object from backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
str
|
Entity key (store://...) or entity name. |
required |
project |
str
|
Project name. |
None
|
entity_id |
str
|
Entity ID. |
None
|
delete_all_versions |
bool
|
Delete all versions of the named entity. If True, use entity name instead of entity key as identifier. |
False
|
**kwargs |
dict
|
Parameters to pass to the API call. |
{}
|
Returns:
Type | Description |
---|---|
dict
|
Response from backend. |
Examples:
If delete_all_versions is False:
Otherwise:
Source code in digitalhub_core/entities/secret/crud.py
get_secret(identifier, project=None, entity_id=None, **kwargs)
Get object from backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
str
|
Entity key (store://...) or entity name. |
required |
project |
str
|
Project name. |
None
|
entity_id |
str
|
Entity ID. |
None
|
**kwargs |
dict
|
Parameters to pass to the API call. |
{}
|
Returns:
Type | Description |
---|---|
Secret
|
Object instance. |
Examples:
Using entity key:
Using entity name:
Source code in digitalhub_core/entities/secret/crud.py
get_secret_versions(identifier, project=None, **kwargs)
Get object versions from backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
str
|
Entity key (store://...) or entity name. |
required |
project |
str
|
Project name. |
None
|
**kwargs |
dict
|
Parameters to pass to the API call. |
{}
|
Returns:
Type | Description |
---|---|
list[Secret]
|
List of object instances. |
Examples:
Using entity key:
Using entity name:
Source code in digitalhub_core/entities/secret/crud.py
import_secret(file)
Import object from a YAML file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
str
|
Path to YAML file. |
required |
Returns:
Type | Description |
---|---|
Secret
|
Object instance. |
Examples:
Source code in digitalhub_core/entities/secret/crud.py
list_secrets(project, **kwargs)
List all latest version objects from backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project |
str
|
Project name. |
required |
**kwargs |
dict
|
Parameters to pass to the API call. |
{}
|
Returns:
Type | Description |
---|---|
list[Secret]
|
List of object instances. |
Examples:
Source code in digitalhub_core/entities/secret/crud.py
new_secret(project, name, uuid=None, description=None, labels=None, embedded=True, secret_value=None, **kwargs)
Create a new object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project |
str
|
Project name. |
required |
name |
str
|
Object name. |
required |
uuid |
str
|
ID of the object (UUID4, e.g. 40f25c4b-d26b-4221-b048-9527aff291e2). |
None
|
description |
str
|
Description of the object (human readable). |
None
|
labels |
list[str]
|
List of labels. |
None
|
embedded |
bool
|
Flag to determine if object spec must be embedded in project spec. |
True
|
secret_value |
str
|
Value of the secret. |
None
|
**kwargs |
dict
|
Spec keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
Secret
|
Object instance. |
Examples:
>>> obj = new_secret(project="my-project",
>>> name="my-secret",
>>> secret_value="my-secret-value")