CRUD
delete_project(name, cascade=True, clean_context=True, local=False, **kwargs)
Delete a project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Project name. |
required |
cascade |
bool
|
Flag to determine if delete is cascading. |
True
|
clean_context |
bool
|
Flag to determine if context will be deleted. If a context is deleted, all its objects are unreacheable. |
True
|
local |
bool
|
Flag to determine if backend is local. |
False
|
**kwargs |
dict
|
Parameters to pass to the API call. |
{}
|
Returns:
Type | Description |
---|---|
dict
|
Response from backend. |
Examples:
>>> delete_project("my-project")
Source code in digitalhub_core/entities/project/crud.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
|
get_or_create_project(name, local=False, config=None, context=None, setup_kwargs=None, **kwargs)
Try to get project. If not exists, create it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Project name. |
required |
local |
bool
|
Flag to determine if backend is local. |
False
|
config |
dict
|
DHCore environment configuration. |
None
|
context |
str
|
Folder where the project will saves its context locally. |
None
|
setup_kwargs |
dict
|
Setup keyword arguments passed to setup_project() function. |
None
|
**kwargs |
dict
|
Keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
Project
|
Object instance. |
Source code in digitalhub_core/entities/project/crud.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
|
get_project(name, local=False, config=None, setup_kwargs=None, **kwargs)
Retrieves project details from backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The Project name. |
required |
local |
bool
|
Flag to determine if backend is local. |
False
|
config |
dict
|
DHCore environment configuration. |
None
|
setup_kwargs |
dict
|
Setup keyword arguments passed to setup_project() function. |
None
|
**kwargs |
dict
|
Parameters to pass to the API call. |
{}
|
Returns:
Type | Description |
---|---|
Project
|
Object instance. |
Examples:
>>> obj = get_project("my-project")
Source code in digitalhub_core/entities/project/crud.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
import_project(file, local=False, config=None, setup_kwargs=None)
Import object from a YAML file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
str
|
Path to YAML file. |
required |
local |
bool
|
Flag to determine if backend is local. |
False
|
config |
dict
|
DHCore environment configuration. |
None
|
setup_kwargs |
dict
|
Setup keyword arguments passed to setup_project() function. |
None
|
Returns:
Type | Description |
---|---|
Project
|
Object instance. |
Examples:
>>> obj = import_project("my-project.yaml")
Source code in digitalhub_core/entities/project/crud.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
load_project(name=None, filename=None, local=False, config=None, setup_kwargs=None, **kwargs)
Load project and context from backend or file. Name or filename must be provided. Name takes precedence over filename.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Project name. |
None
|
filename |
str
|
Path to YAML file. |
None
|
local |
bool
|
Flag to determine if backend is local. |
False
|
config |
dict
|
DHCore environment configuration. |
None
|
setup_kwargs |
dict
|
Setup keyword arguments passed to setup_project() function. |
None
|
**kwargs |
dict
|
Keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
Project
|
Object instance. |
Examples:
If name is provided, load project from backend.
>>> obj = load_project(name="my-project")
If filename is provided, load project from file.
>>> obj = load_project(filename="my-project.yaml")
Source code in digitalhub_core/entities/project/crud.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
new_project(name, description=None, labels=None, local=False, config=None, context=None, setup_kwargs=None, **kwargs)
Create a new object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Object name. |
required |
description |
str
|
Description of the object (human readable). |
None
|
labels |
list[str]
|
List of labels. |
None
|
local |
bool
|
If True, use local backend, if False use DHCore backend. Default to False. |
False
|
config |
dict
|
DHCore environment configuration. |
None
|
context |
str
|
The context local folder of the project. |
None
|
setup_kwargs |
dict
|
Setup keyword arguments passed to setup_project() function. |
None
|
**kwargs |
dict
|
Keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
Project
|
Object instance. |
Examples:
>>> obj = new_project("my-project")
Source code in digitalhub_core/entities/project/crud.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
update_project(entity, local=False, **kwargs)
Update object. Note that object spec are immutable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entity |
Project
|
Object to update. |
required |
local |
bool
|
Flag to determine if backend is local. |
False
|
**kwargs |
dict
|
Parameters to pass to the API call. |
{}
|
Returns:
Type | Description |
---|---|
Project
|
The updated object. |
Examples:
>>> obj = update_project(obj)
Source code in digitalhub_core/entities/project/crud.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
|