CRUD
delete_function(identifier, project=None, entity_id=None, delete_all_versions=False, cascade=True, **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
|
cascade |
bool
|
Cascade delete. |
True
|
**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/function/crud.py
get_function(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 |
---|---|
Function
|
Object instance. |
Examples:
Using entity key:
Using entity name:
Source code in digitalhub_core/entities/function/crud.py
get_function_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[Function]
|
List of object instances. |
Examples:
Using entity key:
Using entity name:
Source code in digitalhub_core/entities/function/crud.py
import_function(file)
Get object from file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
str
|
Path to YAML file. |
required |
Returns:
Type | Description |
---|---|
Function
|
Object instance. |
Examples:
Source code in digitalhub_core/entities/function/crud.py
list_functions(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[Function]
|
List of object instances. |
Examples:
Source code in digitalhub_core/entities/function/crud.py
new_function(project, name, kind, uuid=None, description=None, labels=None, embedded=True, **kwargs)
Create a Function instance with the given parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project |
str
|
Project name. |
required |
name |
str
|
Object name. |
required |
kind |
str
|
Kind the object. |
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
|
**kwargs |
dict
|
Spec keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
Function
|
Object instance. |
Examples:
>>> obj = new_function(project="my-project",
>>> name="my-function",
>>> kind="python",
>>> code_src="function.py",
>>> handler="function-handler")