stackit-resourcemanager 0.0.1a0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- stackit/resourcemanager/__init__.py +67 -0
- stackit/resourcemanager/api/__init__.py +4 -0
- stackit/resourcemanager/api/default_api.py +2703 -0
- stackit/resourcemanager/api_client.py +626 -0
- stackit/resourcemanager/api_response.py +23 -0
- stackit/resourcemanager/configuration.py +110 -0
- stackit/resourcemanager/exceptions.py +198 -0
- stackit/resourcemanager/models/__init__.py +48 -0
- stackit/resourcemanager/models/create_project_payload.py +122 -0
- stackit/resourcemanager/models/error_response.py +94 -0
- stackit/resourcemanager/models/folder_response.py +114 -0
- stackit/resourcemanager/models/get_project_response.py +133 -0
- stackit/resourcemanager/models/lifecycle_state.py +38 -0
- stackit/resourcemanager/models/list_organization_containers_response.py +110 -0
- stackit/resourcemanager/models/list_organization_containers_response_items_inner.py +164 -0
- stackit/resourcemanager/models/list_organization_containers_response_items_inner_any_of.py +99 -0
- stackit/resourcemanager/models/list_organization_containers_response_items_inner_any_of1.py +96 -0
- stackit/resourcemanager/models/list_organizations_response.py +110 -0
- stackit/resourcemanager/models/list_organizations_response_items_inner.py +115 -0
- stackit/resourcemanager/models/list_projects_response.py +104 -0
- stackit/resourcemanager/models/member.py +82 -0
- stackit/resourcemanager/models/organization_response.py +115 -0
- stackit/resourcemanager/models/parent.py +92 -0
- stackit/resourcemanager/models/parent_list_inner.py +107 -0
- stackit/resourcemanager/models/partial_update_project_payload.py +108 -0
- stackit/resourcemanager/models/project.py +118 -0
- stackit/resourcemanager/py.typed +0 -0
- stackit/resourcemanager/rest.py +148 -0
- stackit_resourcemanager-0.0.1a0.dist-info/METADATA +65 -0
- stackit_resourcemanager-0.0.1a0.dist-info/RECORD +31 -0
- stackit_resourcemanager-0.0.1a0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Resource Manager API
|
|
5
|
+
|
|
6
|
+
API v2 to manage resource containers - organizations, folders, projects incl. labels ### Resource Management STACKIT resource management handles the terms _Organization_, _Folder_, _Project_, _Label_, and the hierarchical structure between them. Technically, organizations, folders, and projects are _Resource Containers_ to which a _Label_ can be attached to. The STACKIT _Resource Manager_ provides CRUD endpoints to query and to modify the state. ### Organizations STACKIT organizations are the base element to create and to use cloud-resources. An organization is bound to one customer account. Organizations have a lifecycle. - Organizations are always the root node in resource hierarchy and do not have a parent ### Projects STACKIT projects are needed to use cloud-resources. Projects serve as wrapper for underlying technical structures and processes. Projects have a lifecycle. Projects compared to folders may have different policies. - Projects are optional, but mandatory for cloud-resource usage - A project can be created having either an organization, or a folder as parent - A project must not have a project as parent - Project names under the same parent must not be unique - Root organization cannot be changed ### Label STACKIT labels are key-value pairs including a resource container reference. Labels can be defined and attached freely to resource containers by which resources can be organized and queried. - Policy-based, immutable labels may exists
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501 docstring might be too long
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Parent(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
Parent container.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
container_id: StrictStr = Field(
|
|
30
|
+
description="User-friendly identifier of either organization or folder (will replace id).", alias="containerId"
|
|
31
|
+
)
|
|
32
|
+
id: StrictStr = Field(description="Identifier of either organization or folder.")
|
|
33
|
+
type: StrictStr = Field(description="Container type of parent container.")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["containerId", "id", "type"]
|
|
35
|
+
|
|
36
|
+
@field_validator("type")
|
|
37
|
+
def type_validate_enum(cls, value):
|
|
38
|
+
"""Validates the enum"""
|
|
39
|
+
if value not in set(["ORGANIZATION", "FOLDER"]):
|
|
40
|
+
raise ValueError("must be one of enum values ('ORGANIZATION', 'FOLDER')")
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
model_config = ConfigDict(
|
|
44
|
+
populate_by_name=True,
|
|
45
|
+
validate_assignment=True,
|
|
46
|
+
protected_namespaces=(),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
def to_str(self) -> str:
|
|
50
|
+
"""Returns the string representation of the model using alias"""
|
|
51
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
52
|
+
|
|
53
|
+
def to_json(self) -> str:
|
|
54
|
+
"""Returns the JSON representation of the model using alias"""
|
|
55
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
56
|
+
return json.dumps(self.to_dict())
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
60
|
+
"""Create an instance of Parent from a JSON string"""
|
|
61
|
+
return cls.from_dict(json.loads(json_str))
|
|
62
|
+
|
|
63
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
64
|
+
"""Return the dictionary representation of the model using alias.
|
|
65
|
+
|
|
66
|
+
This has the following differences from calling pydantic's
|
|
67
|
+
`self.model_dump(by_alias=True)`:
|
|
68
|
+
|
|
69
|
+
* `None` is only added to the output dict for nullable fields that
|
|
70
|
+
were set at model initialization. Other fields with value `None`
|
|
71
|
+
are ignored.
|
|
72
|
+
"""
|
|
73
|
+
excluded_fields: Set[str] = set([])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of Parent from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate({"containerId": obj.get("containerId"), "id": obj.get("id"), "type": obj.get("type")})
|
|
92
|
+
return _obj
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Resource Manager API
|
|
5
|
+
|
|
6
|
+
API v2 to manage resource containers - organizations, folders, projects incl. labels ### Resource Management STACKIT resource management handles the terms _Organization_, _Folder_, _Project_, _Label_, and the hierarchical structure between them. Technically, organizations, folders, and projects are _Resource Containers_ to which a _Label_ can be attached to. The STACKIT _Resource Manager_ provides CRUD endpoints to query and to modify the state. ### Organizations STACKIT organizations are the base element to create and to use cloud-resources. An organization is bound to one customer account. Organizations have a lifecycle. - Organizations are always the root node in resource hierarchy and do not have a parent ### Projects STACKIT projects are needed to use cloud-resources. Projects serve as wrapper for underlying technical structures and processes. Projects have a lifecycle. Projects compared to folders may have different policies. - Projects are optional, but mandatory for cloud-resource usage - A project can be created having either an organization, or a folder as parent - A project must not have a project as parent - Project names under the same parent must not be unique - Root organization cannot be changed ### Label STACKIT labels are key-value pairs including a resource container reference. Labels can be defined and attached freely to resource containers by which resources can be organized and queried. - Policy-based, immutable labels may exists
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501 docstring might be too long
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
|
+
from typing_extensions import Self
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ParentListInner(BaseModel):
|
|
25
|
+
"""
|
|
26
|
+
ParentListInner
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
container_id: StrictStr = Field(
|
|
30
|
+
description="User-friendly identifier of either organization or folder (will replace id).", alias="containerId"
|
|
31
|
+
)
|
|
32
|
+
container_parent_id: StrictStr = Field(
|
|
33
|
+
description="User-friendly parent identifier of either organization or folder (will replace parentId).",
|
|
34
|
+
alias="containerParentId",
|
|
35
|
+
)
|
|
36
|
+
id: StrictStr = Field(description="Identifier.")
|
|
37
|
+
name: StrictStr = Field(description="Parent container name.")
|
|
38
|
+
parent_id: StrictStr = Field(description="Identifier of the parent resource container.", alias="parentId")
|
|
39
|
+
type: StrictStr = Field(description="Parent container type.")
|
|
40
|
+
__properties: ClassVar[List[str]] = ["containerId", "containerParentId", "id", "name", "parentId", "type"]
|
|
41
|
+
|
|
42
|
+
@field_validator("type")
|
|
43
|
+
def type_validate_enum(cls, value):
|
|
44
|
+
"""Validates the enum"""
|
|
45
|
+
if value not in set(["FOLDER", "ORGANIZATION"]):
|
|
46
|
+
raise ValueError("must be one of enum values ('FOLDER', 'ORGANIZATION')")
|
|
47
|
+
return value
|
|
48
|
+
|
|
49
|
+
model_config = ConfigDict(
|
|
50
|
+
populate_by_name=True,
|
|
51
|
+
validate_assignment=True,
|
|
52
|
+
protected_namespaces=(),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
def to_str(self) -> str:
|
|
56
|
+
"""Returns the string representation of the model using alias"""
|
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
58
|
+
|
|
59
|
+
def to_json(self) -> str:
|
|
60
|
+
"""Returns the JSON representation of the model using alias"""
|
|
61
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
62
|
+
return json.dumps(self.to_dict())
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
66
|
+
"""Create an instance of ParentListInner from a JSON string"""
|
|
67
|
+
return cls.from_dict(json.loads(json_str))
|
|
68
|
+
|
|
69
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
70
|
+
"""Return the dictionary representation of the model using alias.
|
|
71
|
+
|
|
72
|
+
This has the following differences from calling pydantic's
|
|
73
|
+
`self.model_dump(by_alias=True)`:
|
|
74
|
+
|
|
75
|
+
* `None` is only added to the output dict for nullable fields that
|
|
76
|
+
were set at model initialization. Other fields with value `None`
|
|
77
|
+
are ignored.
|
|
78
|
+
"""
|
|
79
|
+
excluded_fields: Set[str] = set([])
|
|
80
|
+
|
|
81
|
+
_dict = self.model_dump(
|
|
82
|
+
by_alias=True,
|
|
83
|
+
exclude=excluded_fields,
|
|
84
|
+
exclude_none=True,
|
|
85
|
+
)
|
|
86
|
+
return _dict
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
90
|
+
"""Create an instance of ParentListInner from a dict"""
|
|
91
|
+
if obj is None:
|
|
92
|
+
return None
|
|
93
|
+
|
|
94
|
+
if not isinstance(obj, dict):
|
|
95
|
+
return cls.model_validate(obj)
|
|
96
|
+
|
|
97
|
+
_obj = cls.model_validate(
|
|
98
|
+
{
|
|
99
|
+
"containerId": obj.get("containerId"),
|
|
100
|
+
"containerParentId": obj.get("containerParentId"),
|
|
101
|
+
"id": obj.get("id"),
|
|
102
|
+
"name": obj.get("name"),
|
|
103
|
+
"parentId": obj.get("parentId"),
|
|
104
|
+
"type": obj.get("type"),
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
return _obj
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Resource Manager API
|
|
5
|
+
|
|
6
|
+
API v2 to manage resource containers - organizations, folders, projects incl. labels ### Resource Management STACKIT resource management handles the terms _Organization_, _Folder_, _Project_, _Label_, and the hierarchical structure between them. Technically, organizations, folders, and projects are _Resource Containers_ to which a _Label_ can be attached to. The STACKIT _Resource Manager_ provides CRUD endpoints to query and to modify the state. ### Organizations STACKIT organizations are the base element to create and to use cloud-resources. An organization is bound to one customer account. Organizations have a lifecycle. - Organizations are always the root node in resource hierarchy and do not have a parent ### Projects STACKIT projects are needed to use cloud-resources. Projects serve as wrapper for underlying technical structures and processes. Projects have a lifecycle. Projects compared to folders may have different policies. - Projects are optional, but mandatory for cloud-resource usage - A project can be created having either an organization, or a folder as parent - A project must not have a project as parent - Project names under the same parent must not be unique - Root organization cannot be changed ### Label STACKIT labels are key-value pairs including a resource container reference. Labels can be defined and attached freely to resource containers by which resources can be organized and queried. - Policy-based, immutable labels may exists
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501 docstring might be too long
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
22
|
+
from typing_extensions import Annotated, Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class PartialUpdateProjectPayload(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
PartialUpdateProjectPayload
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
container_parent_id: Optional[StrictStr] = Field(
|
|
31
|
+
default=None,
|
|
32
|
+
description="New parent identifier for the resource container - containerId as well as UUID identifier is supported.",
|
|
33
|
+
alias="containerParentId",
|
|
34
|
+
)
|
|
35
|
+
labels: Optional[Dict[str, StrictStr]] = Field(
|
|
36
|
+
default=None,
|
|
37
|
+
description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
|
|
38
|
+
)
|
|
39
|
+
name: Optional[Annotated[str, Field(strict=True)]] = Field(
|
|
40
|
+
default=None,
|
|
41
|
+
description="New name for the resource container matching the regex `^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$`.",
|
|
42
|
+
)
|
|
43
|
+
__properties: ClassVar[List[str]] = ["containerParentId", "labels", "name"]
|
|
44
|
+
|
|
45
|
+
@field_validator("name")
|
|
46
|
+
def name_validate_regular_expression(cls, value):
|
|
47
|
+
"""Validates the regular expression"""
|
|
48
|
+
if value is None:
|
|
49
|
+
return value
|
|
50
|
+
|
|
51
|
+
if not re.match(r"^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$", value):
|
|
52
|
+
raise ValueError(
|
|
53
|
+
r"must validate the regular expression /^[a-zA-ZäüöÄÜÖ0-9]( ?[a-zA-ZäüöÄÜÖß0-9_+&-]){0,39}$/"
|
|
54
|
+
)
|
|
55
|
+
return value
|
|
56
|
+
|
|
57
|
+
model_config = ConfigDict(
|
|
58
|
+
populate_by_name=True,
|
|
59
|
+
validate_assignment=True,
|
|
60
|
+
protected_namespaces=(),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
def to_str(self) -> str:
|
|
64
|
+
"""Returns the string representation of the model using alias"""
|
|
65
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
66
|
+
|
|
67
|
+
def to_json(self) -> str:
|
|
68
|
+
"""Returns the JSON representation of the model using alias"""
|
|
69
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
70
|
+
return json.dumps(self.to_dict())
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
74
|
+
"""Create an instance of PartialUpdateProjectPayload from a JSON string"""
|
|
75
|
+
return cls.from_dict(json.loads(json_str))
|
|
76
|
+
|
|
77
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
78
|
+
"""Return the dictionary representation of the model using alias.
|
|
79
|
+
|
|
80
|
+
This has the following differences from calling pydantic's
|
|
81
|
+
`self.model_dump(by_alias=True)`:
|
|
82
|
+
|
|
83
|
+
* `None` is only added to the output dict for nullable fields that
|
|
84
|
+
were set at model initialization. Other fields with value `None`
|
|
85
|
+
are ignored.
|
|
86
|
+
"""
|
|
87
|
+
excluded_fields: Set[str] = set([])
|
|
88
|
+
|
|
89
|
+
_dict = self.model_dump(
|
|
90
|
+
by_alias=True,
|
|
91
|
+
exclude=excluded_fields,
|
|
92
|
+
exclude_none=True,
|
|
93
|
+
)
|
|
94
|
+
return _dict
|
|
95
|
+
|
|
96
|
+
@classmethod
|
|
97
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
98
|
+
"""Create an instance of PartialUpdateProjectPayload from a dict"""
|
|
99
|
+
if obj is None:
|
|
100
|
+
return None
|
|
101
|
+
|
|
102
|
+
if not isinstance(obj, dict):
|
|
103
|
+
return cls.model_validate(obj)
|
|
104
|
+
|
|
105
|
+
_obj = cls.model_validate(
|
|
106
|
+
{"containerParentId": obj.get("containerParentId"), "labels": obj.get("labels"), "name": obj.get("name")}
|
|
107
|
+
)
|
|
108
|
+
return _obj
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Resource Manager API
|
|
5
|
+
|
|
6
|
+
API v2 to manage resource containers - organizations, folders, projects incl. labels ### Resource Management STACKIT resource management handles the terms _Organization_, _Folder_, _Project_, _Label_, and the hierarchical structure between them. Technically, organizations, folders, and projects are _Resource Containers_ to which a _Label_ can be attached to. The STACKIT _Resource Manager_ provides CRUD endpoints to query and to modify the state. ### Organizations STACKIT organizations are the base element to create and to use cloud-resources. An organization is bound to one customer account. Organizations have a lifecycle. - Organizations are always the root node in resource hierarchy and do not have a parent ### Projects STACKIT projects are needed to use cloud-resources. Projects serve as wrapper for underlying technical structures and processes. Projects have a lifecycle. Projects compared to folders may have different policies. - Projects are optional, but mandatory for cloud-resource usage - A project can be created having either an organization, or a folder as parent - A project must not have a project as parent - Project names under the same parent must not be unique - Root organization cannot be changed ### Label STACKIT labels are key-value pairs including a resource container reference. Labels can be defined and attached freely to resource containers by which resources can be organized and queried. - Policy-based, immutable labels may exists
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501 docstring might be too long
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from datetime import datetime
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
from stackit.resourcemanager.models.lifecycle_state import LifecycleState
|
|
25
|
+
from stackit.resourcemanager.models.parent import Parent
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Project(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
Project
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
container_id: StrictStr = Field(description="Globally unique, user-friendly identifier.", alias="containerId")
|
|
34
|
+
creation_time: datetime = Field(description="Timestamp at which the project was created.", alias="creationTime")
|
|
35
|
+
labels: Optional[Dict[str, StrictStr]] = Field(
|
|
36
|
+
default=None,
|
|
37
|
+
description="Labels are key-value string pairs that can be attached to a resource container. Some labels may be enforced via policies. - A label key must match the regex `[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`. - A label value must match the regex `^$|[A-ZÄÜÖa-zäüöß0-9_-]{1,64}`.",
|
|
38
|
+
)
|
|
39
|
+
lifecycle_state: LifecycleState = Field(alias="lifecycleState")
|
|
40
|
+
name: StrictStr = Field(description="Project name.")
|
|
41
|
+
parent: Parent
|
|
42
|
+
project_id: StrictStr = Field(description="Globally unique, project identifier.", alias="projectId")
|
|
43
|
+
update_time: datetime = Field(description="Timestamp at which the project was last modified.", alias="updateTime")
|
|
44
|
+
__properties: ClassVar[List[str]] = [
|
|
45
|
+
"containerId",
|
|
46
|
+
"creationTime",
|
|
47
|
+
"labels",
|
|
48
|
+
"lifecycleState",
|
|
49
|
+
"name",
|
|
50
|
+
"parent",
|
|
51
|
+
"projectId",
|
|
52
|
+
"updateTime",
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
model_config = ConfigDict(
|
|
56
|
+
populate_by_name=True,
|
|
57
|
+
validate_assignment=True,
|
|
58
|
+
protected_namespaces=(),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
def to_str(self) -> str:
|
|
62
|
+
"""Returns the string representation of the model using alias"""
|
|
63
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
64
|
+
|
|
65
|
+
def to_json(self) -> str:
|
|
66
|
+
"""Returns the JSON representation of the model using alias"""
|
|
67
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
68
|
+
return json.dumps(self.to_dict())
|
|
69
|
+
|
|
70
|
+
@classmethod
|
|
71
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
72
|
+
"""Create an instance of Project from a JSON string"""
|
|
73
|
+
return cls.from_dict(json.loads(json_str))
|
|
74
|
+
|
|
75
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
76
|
+
"""Return the dictionary representation of the model using alias.
|
|
77
|
+
|
|
78
|
+
This has the following differences from calling pydantic's
|
|
79
|
+
`self.model_dump(by_alias=True)`:
|
|
80
|
+
|
|
81
|
+
* `None` is only added to the output dict for nullable fields that
|
|
82
|
+
were set at model initialization. Other fields with value `None`
|
|
83
|
+
are ignored.
|
|
84
|
+
"""
|
|
85
|
+
excluded_fields: Set[str] = set([])
|
|
86
|
+
|
|
87
|
+
_dict = self.model_dump(
|
|
88
|
+
by_alias=True,
|
|
89
|
+
exclude=excluded_fields,
|
|
90
|
+
exclude_none=True,
|
|
91
|
+
)
|
|
92
|
+
# override the default output from pydantic by calling `to_dict()` of parent
|
|
93
|
+
if self.parent:
|
|
94
|
+
_dict["parent"] = self.parent.to_dict()
|
|
95
|
+
return _dict
|
|
96
|
+
|
|
97
|
+
@classmethod
|
|
98
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
99
|
+
"""Create an instance of Project from a dict"""
|
|
100
|
+
if obj is None:
|
|
101
|
+
return None
|
|
102
|
+
|
|
103
|
+
if not isinstance(obj, dict):
|
|
104
|
+
return cls.model_validate(obj)
|
|
105
|
+
|
|
106
|
+
_obj = cls.model_validate(
|
|
107
|
+
{
|
|
108
|
+
"containerId": obj.get("containerId"),
|
|
109
|
+
"creationTime": obj.get("creationTime"),
|
|
110
|
+
"labels": obj.get("labels"),
|
|
111
|
+
"lifecycleState": obj.get("lifecycleState"),
|
|
112
|
+
"name": obj.get("name"),
|
|
113
|
+
"parent": Parent.from_dict(obj["parent"]) if obj.get("parent") is not None else None,
|
|
114
|
+
"projectId": obj.get("projectId"),
|
|
115
|
+
"updateTime": obj.get("updateTime"),
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
return _obj
|
|
File without changes
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Resource Manager API
|
|
5
|
+
|
|
6
|
+
API v2 to manage resource containers - organizations, folders, projects incl. labels ### Resource Management STACKIT resource management handles the terms _Organization_, _Folder_, _Project_, _Label_, and the hierarchical structure between them. Technically, organizations, folders, and projects are _Resource Containers_ to which a _Label_ can be attached to. The STACKIT _Resource Manager_ provides CRUD endpoints to query and to modify the state. ### Organizations STACKIT organizations are the base element to create and to use cloud-resources. An organization is bound to one customer account. Organizations have a lifecycle. - Organizations are always the root node in resource hierarchy and do not have a parent ### Projects STACKIT projects are needed to use cloud-resources. Projects serve as wrapper for underlying technical structures and processes. Projects have a lifecycle. Projects compared to folders may have different policies. - Projects are optional, but mandatory for cloud-resource usage - A project can be created having either an organization, or a folder as parent - A project must not have a project as parent - Project names under the same parent must not be unique - Root organization cannot be changed ### Label STACKIT labels are key-value pairs including a resource container reference. Labels can be defined and attached freely to resource containers by which resources can be organized and queried. - Policy-based, immutable labels may exists
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 2.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501 docstring might be too long
|
|
13
|
+
|
|
14
|
+
import io
|
|
15
|
+
import json
|
|
16
|
+
import re
|
|
17
|
+
|
|
18
|
+
import requests
|
|
19
|
+
from stackit.core.authorization import Authorization
|
|
20
|
+
from stackit.core.configuration import Configuration
|
|
21
|
+
|
|
22
|
+
from stackit.resourcemanager.exceptions import ApiException, ApiValueError
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
RESTResponseType = requests.Response
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class RESTResponse(io.IOBase):
|
|
29
|
+
|
|
30
|
+
def __init__(self, resp) -> None:
|
|
31
|
+
self.response = resp
|
|
32
|
+
self.status = resp.status_code
|
|
33
|
+
self.reason = resp.reason
|
|
34
|
+
self.data = None
|
|
35
|
+
|
|
36
|
+
def read(self):
|
|
37
|
+
if self.data is None:
|
|
38
|
+
self.data = self.response.content
|
|
39
|
+
return self.data
|
|
40
|
+
|
|
41
|
+
def getheaders(self):
|
|
42
|
+
"""Returns a dictionary of the response headers."""
|
|
43
|
+
return self.response.headers
|
|
44
|
+
|
|
45
|
+
def getheader(self, name, default=None):
|
|
46
|
+
"""Returns a given response header."""
|
|
47
|
+
return self.response.headers.get(name, default)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class RESTClientObject:
|
|
51
|
+
def __init__(self, config: Configuration) -> None:
|
|
52
|
+
self.session = config.custom_http_session if config.custom_http_session else requests.Session()
|
|
53
|
+
authorization = Authorization(config)
|
|
54
|
+
self.session.auth = authorization.auth_method
|
|
55
|
+
|
|
56
|
+
def request(self, method, url, headers=None, body=None, post_params=None, _request_timeout=None):
|
|
57
|
+
"""Perform requests.
|
|
58
|
+
|
|
59
|
+
:param method: http request method
|
|
60
|
+
:param url: http request url
|
|
61
|
+
:param headers: http request headers
|
|
62
|
+
:param body: request json body, for `application/json`
|
|
63
|
+
:param post_params: request post parameters,
|
|
64
|
+
`application/x-www-form-urlencoded`
|
|
65
|
+
and `multipart/form-data`
|
|
66
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
67
|
+
number provided, it will be total request
|
|
68
|
+
timeout. It can also be a pair (tuple) of
|
|
69
|
+
(connection, read) timeouts.
|
|
70
|
+
"""
|
|
71
|
+
method = method.upper()
|
|
72
|
+
if method not in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"]:
|
|
73
|
+
raise ValueError("Method %s not allowed", method)
|
|
74
|
+
|
|
75
|
+
if post_params and body:
|
|
76
|
+
raise ApiValueError("body parameter cannot be used with post_params parameter.")
|
|
77
|
+
|
|
78
|
+
post_params = post_params or {}
|
|
79
|
+
headers = headers or {}
|
|
80
|
+
|
|
81
|
+
try:
|
|
82
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
83
|
+
if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
|
|
84
|
+
|
|
85
|
+
# no content type provided or payload is json
|
|
86
|
+
content_type = headers.get("Content-Type")
|
|
87
|
+
if not content_type or re.search("json", content_type, re.IGNORECASE):
|
|
88
|
+
request_body = None
|
|
89
|
+
if body is not None:
|
|
90
|
+
request_body = json.dumps(body)
|
|
91
|
+
r = self.session.request(
|
|
92
|
+
method,
|
|
93
|
+
url,
|
|
94
|
+
data=request_body,
|
|
95
|
+
headers=headers,
|
|
96
|
+
)
|
|
97
|
+
elif content_type == "application/x-www-form-urlencoded":
|
|
98
|
+
r = self.session.request(
|
|
99
|
+
method,
|
|
100
|
+
url,
|
|
101
|
+
params=post_params,
|
|
102
|
+
headers=headers,
|
|
103
|
+
)
|
|
104
|
+
elif content_type == "multipart/form-data":
|
|
105
|
+
# must del headers['Content-Type'], or the correct
|
|
106
|
+
# Content-Type which generated by urllib3 will be
|
|
107
|
+
# overwritten.
|
|
108
|
+
del headers["Content-Type"]
|
|
109
|
+
# Ensures that dict objects are serialized
|
|
110
|
+
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a, b) for a, b in post_params]
|
|
111
|
+
r = self.session.request(
|
|
112
|
+
method,
|
|
113
|
+
url,
|
|
114
|
+
files=post_params,
|
|
115
|
+
headers=headers,
|
|
116
|
+
)
|
|
117
|
+
# Pass a `string` parameter directly in the body to support
|
|
118
|
+
# other content types than JSON when `body` argument is
|
|
119
|
+
# provided in serialized form.
|
|
120
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
|
121
|
+
r = self.session.request(
|
|
122
|
+
method,
|
|
123
|
+
url,
|
|
124
|
+
data=body,
|
|
125
|
+
headers=headers,
|
|
126
|
+
)
|
|
127
|
+
elif headers["Content-Type"] == "text/plain" and isinstance(body, bool):
|
|
128
|
+
request_body = "true" if body else "false"
|
|
129
|
+
r = self.session.request(method, url, data=request_body, headers=headers)
|
|
130
|
+
else:
|
|
131
|
+
# Cannot generate the request from given parameters
|
|
132
|
+
msg = """Cannot prepare a request message for provided
|
|
133
|
+
arguments. Please check that your arguments match
|
|
134
|
+
declared content type."""
|
|
135
|
+
raise ApiException(status=0, reason=msg)
|
|
136
|
+
# For `GET`, `HEAD`
|
|
137
|
+
else:
|
|
138
|
+
r = self.session.request(
|
|
139
|
+
method,
|
|
140
|
+
url,
|
|
141
|
+
params={},
|
|
142
|
+
headers=headers,
|
|
143
|
+
)
|
|
144
|
+
except requests.exceptions.SSLError as e:
|
|
145
|
+
msg = "\n".join([type(e).__name__, str(e)])
|
|
146
|
+
raise ApiException(status=0, reason=msg)
|
|
147
|
+
|
|
148
|
+
return RESTResponse(r)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: stackit-resourcemanager
|
|
3
|
+
Version: 0.0.1a0
|
|
4
|
+
Summary: Resource Manager API
|
|
5
|
+
Author: STACKIT Developer Tools
|
|
6
|
+
Author-email: developer-tools@stackit.cloud
|
|
7
|
+
Requires-Python: >=3.8,<4.0
|
|
8
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Dist: pydantic (>=2.9.2)
|
|
18
|
+
Requires-Dist: python-dateutil (>=2.9.0.post0)
|
|
19
|
+
Requires-Dist: requests (>=2.32.3)
|
|
20
|
+
Requires-Dist: stackit-core (>=0.0.1a)
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# stackit.resourcemanager
|
|
24
|
+
API v2 to manage resource containers - organizations, folders, projects incl. labels
|
|
25
|
+
|
|
26
|
+
### Resource Management
|
|
27
|
+
STACKIT resource management handles the terms _Organization_, _Folder_, _Project_, _Label_, and the hierarchical structure between them. Technically, organizations,
|
|
28
|
+
folders, and projects are _Resource Containers_ to which a _Label_ can be attached to. The STACKIT _Resource Manager_ provides CRUD endpoints to query and to modify the state.
|
|
29
|
+
|
|
30
|
+
### Organizations
|
|
31
|
+
STACKIT organizations are the base element to create and to use cloud-resources. An organization is bound to one customer account. Organizations have a lifecycle.
|
|
32
|
+
- Organizations are always the root node in resource hierarchy and do not have a parent
|
|
33
|
+
|
|
34
|
+
### Projects
|
|
35
|
+
STACKIT projects are needed to use cloud-resources. Projects serve as wrapper for underlying technical structures and processes. Projects have a lifecycle. Projects compared to folders may have different policies.
|
|
36
|
+
- Projects are optional, but mandatory for cloud-resource usage
|
|
37
|
+
- A project can be created having either an organization, or a folder as parent
|
|
38
|
+
- A project must not have a project as parent
|
|
39
|
+
- Project names under the same parent must not be unique
|
|
40
|
+
- Root organization cannot be changed
|
|
41
|
+
|
|
42
|
+
### Label
|
|
43
|
+
STACKIT labels are key-value pairs including a resource container reference. Labels can be defined and attached freely to resource containers by which resources can be organized and queried.
|
|
44
|
+
- Policy-based, immutable labels may exists
|
|
45
|
+
|
|
46
|
+
For more information, please visit [https://support.stackit.cloud/servicedesk](https://support.stackit.cloud/servicedesk)
|
|
47
|
+
|
|
48
|
+
This package is part of the STACKIT Python SDK. For additional information, please visit the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-python) of the SDK.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Installation & Usage
|
|
52
|
+
### pip install
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
pip install stackit-resourcemanager
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Then import the package:
|
|
59
|
+
```python
|
|
60
|
+
import stackit.resourcemanager
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Getting Started
|
|
64
|
+
|
|
65
|
+
[Examples](https://github.com/stackitcloud/stackit-sdk-python/tree/main/examples) for the usage of the package can be found in the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-python) of the SDK.
|