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,114 @@
|
|
|
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.parent import Parent
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class FolderResponse(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
FolderResponse
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
container_id: StrictStr = Field(description="Globally unique, user-friendly identifier.", alias="containerId")
|
|
33
|
+
creation_time: datetime = Field(description="Timestamp at which the folder was created.", alias="creationTime")
|
|
34
|
+
folder_id: StrictStr = Field(description="Globally unique folder identifier.", alias="folderId")
|
|
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: StrictStr = Field(description="Folder name.")
|
|
40
|
+
parent: Parent
|
|
41
|
+
update_time: datetime = Field(description="Timestamp at which the folder was last modified.", alias="updateTime")
|
|
42
|
+
__properties: ClassVar[List[str]] = [
|
|
43
|
+
"containerId",
|
|
44
|
+
"creationTime",
|
|
45
|
+
"folderId",
|
|
46
|
+
"labels",
|
|
47
|
+
"name",
|
|
48
|
+
"parent",
|
|
49
|
+
"updateTime",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
model_config = ConfigDict(
|
|
53
|
+
populate_by_name=True,
|
|
54
|
+
validate_assignment=True,
|
|
55
|
+
protected_namespaces=(),
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
def to_str(self) -> str:
|
|
59
|
+
"""Returns the string representation of the model using alias"""
|
|
60
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
61
|
+
|
|
62
|
+
def to_json(self) -> str:
|
|
63
|
+
"""Returns the JSON representation of the model using alias"""
|
|
64
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
65
|
+
return json.dumps(self.to_dict())
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
69
|
+
"""Create an instance of FolderResponse from a JSON string"""
|
|
70
|
+
return cls.from_dict(json.loads(json_str))
|
|
71
|
+
|
|
72
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
73
|
+
"""Return the dictionary representation of the model using alias.
|
|
74
|
+
|
|
75
|
+
This has the following differences from calling pydantic's
|
|
76
|
+
`self.model_dump(by_alias=True)`:
|
|
77
|
+
|
|
78
|
+
* `None` is only added to the output dict for nullable fields that
|
|
79
|
+
were set at model initialization. Other fields with value `None`
|
|
80
|
+
are ignored.
|
|
81
|
+
"""
|
|
82
|
+
excluded_fields: Set[str] = set([])
|
|
83
|
+
|
|
84
|
+
_dict = self.model_dump(
|
|
85
|
+
by_alias=True,
|
|
86
|
+
exclude=excluded_fields,
|
|
87
|
+
exclude_none=True,
|
|
88
|
+
)
|
|
89
|
+
# override the default output from pydantic by calling `to_dict()` of parent
|
|
90
|
+
if self.parent:
|
|
91
|
+
_dict["parent"] = self.parent.to_dict()
|
|
92
|
+
return _dict
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
96
|
+
"""Create an instance of FolderResponse from a dict"""
|
|
97
|
+
if obj is None:
|
|
98
|
+
return None
|
|
99
|
+
|
|
100
|
+
if not isinstance(obj, dict):
|
|
101
|
+
return cls.model_validate(obj)
|
|
102
|
+
|
|
103
|
+
_obj = cls.model_validate(
|
|
104
|
+
{
|
|
105
|
+
"containerId": obj.get("containerId"),
|
|
106
|
+
"creationTime": obj.get("creationTime"),
|
|
107
|
+
"folderId": obj.get("folderId"),
|
|
108
|
+
"labels": obj.get("labels"),
|
|
109
|
+
"name": obj.get("name"),
|
|
110
|
+
"parent": Parent.from_dict(obj["parent"]) if obj.get("parent") is not None else None,
|
|
111
|
+
"updateTime": obj.get("updateTime"),
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
return _obj
|
|
@@ -0,0 +1,133 @@
|
|
|
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
|
+
from stackit.resourcemanager.models.parent_list_inner import ParentListInner
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class GetProjectResponse(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
GetProjectResponse
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
container_id: StrictStr = Field(description="Globally unique identifier.", alias="containerId")
|
|
35
|
+
creation_time: datetime = Field(description="Timestamp at which the project was created.", alias="creationTime")
|
|
36
|
+
labels: Optional[Dict[str, StrictStr]] = Field(
|
|
37
|
+
default=None,
|
|
38
|
+
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}`.",
|
|
39
|
+
)
|
|
40
|
+
lifecycle_state: LifecycleState = Field(alias="lifecycleState")
|
|
41
|
+
name: StrictStr = Field(description="Project name.")
|
|
42
|
+
parent: Parent
|
|
43
|
+
parents: Optional[List[ParentListInner]] = None
|
|
44
|
+
project_id: StrictStr = Field(description="Globally unique identifier.", alias="projectId")
|
|
45
|
+
update_time: datetime = Field(description="Timestamp at which the project was last modified.", alias="updateTime")
|
|
46
|
+
__properties: ClassVar[List[str]] = [
|
|
47
|
+
"containerId",
|
|
48
|
+
"creationTime",
|
|
49
|
+
"labels",
|
|
50
|
+
"lifecycleState",
|
|
51
|
+
"name",
|
|
52
|
+
"parent",
|
|
53
|
+
"parents",
|
|
54
|
+
"projectId",
|
|
55
|
+
"updateTime",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
model_config = ConfigDict(
|
|
59
|
+
populate_by_name=True,
|
|
60
|
+
validate_assignment=True,
|
|
61
|
+
protected_namespaces=(),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
def to_str(self) -> str:
|
|
65
|
+
"""Returns the string representation of the model using alias"""
|
|
66
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
67
|
+
|
|
68
|
+
def to_json(self) -> str:
|
|
69
|
+
"""Returns the JSON representation of the model using alias"""
|
|
70
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
71
|
+
return json.dumps(self.to_dict())
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of GetProjectResponse from a JSON string"""
|
|
76
|
+
return cls.from_dict(json.loads(json_str))
|
|
77
|
+
|
|
78
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
79
|
+
"""Return the dictionary representation of the model using alias.
|
|
80
|
+
|
|
81
|
+
This has the following differences from calling pydantic's
|
|
82
|
+
`self.model_dump(by_alias=True)`:
|
|
83
|
+
|
|
84
|
+
* `None` is only added to the output dict for nullable fields that
|
|
85
|
+
were set at model initialization. Other fields with value `None`
|
|
86
|
+
are ignored.
|
|
87
|
+
"""
|
|
88
|
+
excluded_fields: Set[str] = set([])
|
|
89
|
+
|
|
90
|
+
_dict = self.model_dump(
|
|
91
|
+
by_alias=True,
|
|
92
|
+
exclude=excluded_fields,
|
|
93
|
+
exclude_none=True,
|
|
94
|
+
)
|
|
95
|
+
# override the default output from pydantic by calling `to_dict()` of parent
|
|
96
|
+
if self.parent:
|
|
97
|
+
_dict["parent"] = self.parent.to_dict()
|
|
98
|
+
# override the default output from pydantic by calling `to_dict()` of each item in parents (list)
|
|
99
|
+
_items = []
|
|
100
|
+
if self.parents:
|
|
101
|
+
for _item in self.parents:
|
|
102
|
+
if _item:
|
|
103
|
+
_items.append(_item.to_dict())
|
|
104
|
+
_dict["parents"] = _items
|
|
105
|
+
return _dict
|
|
106
|
+
|
|
107
|
+
@classmethod
|
|
108
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
109
|
+
"""Create an instance of GetProjectResponse from a dict"""
|
|
110
|
+
if obj is None:
|
|
111
|
+
return None
|
|
112
|
+
|
|
113
|
+
if not isinstance(obj, dict):
|
|
114
|
+
return cls.model_validate(obj)
|
|
115
|
+
|
|
116
|
+
_obj = cls.model_validate(
|
|
117
|
+
{
|
|
118
|
+
"containerId": obj.get("containerId"),
|
|
119
|
+
"creationTime": obj.get("creationTime"),
|
|
120
|
+
"labels": obj.get("labels"),
|
|
121
|
+
"lifecycleState": obj.get("lifecycleState"),
|
|
122
|
+
"name": obj.get("name"),
|
|
123
|
+
"parent": Parent.from_dict(obj["parent"]) if obj.get("parent") is not None else None,
|
|
124
|
+
"parents": (
|
|
125
|
+
[ParentListInner.from_dict(_item) for _item in obj["parents"]]
|
|
126
|
+
if obj.get("parents") is not None
|
|
127
|
+
else None
|
|
128
|
+
),
|
|
129
|
+
"projectId": obj.get("projectId"),
|
|
130
|
+
"updateTime": obj.get("updateTime"),
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
return _obj
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
from enum import Enum
|
|
18
|
+
|
|
19
|
+
from typing_extensions import Self
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class LifecycleState(str, Enum):
|
|
23
|
+
"""
|
|
24
|
+
Lifecycle state of the resource container. | LIFECYCLE STATE | DESCRIPTION | |----------|--------------------| | CREATING | The creation process has been triggered. The state remains until resource manager gets notified about successful process completion. | | ACTIVE | Resource container can be fully used. | | INACTIVE | Resource container usage has been disabled. | | DELETING | The deletion process has been triggered. The state remains until resource manager gets notified about successful process completion. Afterwards, the record will be deleted. |
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
allowed enum values
|
|
29
|
+
"""
|
|
30
|
+
CREATING = "CREATING"
|
|
31
|
+
ACTIVE = "ACTIVE"
|
|
32
|
+
DELETING = "DELETING"
|
|
33
|
+
INACTIVE = "INACTIVE"
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def from_json(cls, json_str: str) -> Self:
|
|
37
|
+
"""Create an instance of LifecycleState from a JSON string"""
|
|
38
|
+
return cls(json.loads(json_str))
|
|
@@ -0,0 +1,110 @@
|
|
|
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, Union
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing_extensions import Annotated, Self
|
|
22
|
+
|
|
23
|
+
from stackit.resourcemanager.models.list_organization_containers_response_items_inner import (
|
|
24
|
+
ListOrganizationContainersResponseItemsInner,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ListOrganizationContainersResponse(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
ListOrganizationContainersResponse
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
cursor: StrictStr = Field(
|
|
34
|
+
description="A pagination cursor is returned on the first call of the pagination process. If given, it will start from the end of the previous position. If not given, a new pagination is started."
|
|
35
|
+
)
|
|
36
|
+
items: List[ListOrganizationContainersResponseItemsInner]
|
|
37
|
+
limit: Union[
|
|
38
|
+
Annotated[float, Field(le=100, strict=True, ge=0)], Annotated[int, Field(le=100, strict=True, ge=0)]
|
|
39
|
+
] = Field(
|
|
40
|
+
description="The maximum number of projects to return in the response. If not present, an appropriate default will be used."
|
|
41
|
+
)
|
|
42
|
+
__properties: ClassVar[List[str]] = ["cursor", "items", "limit"]
|
|
43
|
+
|
|
44
|
+
model_config = ConfigDict(
|
|
45
|
+
populate_by_name=True,
|
|
46
|
+
validate_assignment=True,
|
|
47
|
+
protected_namespaces=(),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
def to_str(self) -> str:
|
|
51
|
+
"""Returns the string representation of the model using alias"""
|
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
53
|
+
|
|
54
|
+
def to_json(self) -> str:
|
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
|
56
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
57
|
+
return json.dumps(self.to_dict())
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
61
|
+
"""Create an instance of ListOrganizationContainersResponse from a JSON string"""
|
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
|
63
|
+
|
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
|
66
|
+
|
|
67
|
+
This has the following differences from calling pydantic's
|
|
68
|
+
`self.model_dump(by_alias=True)`:
|
|
69
|
+
|
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
|
71
|
+
were set at model initialization. Other fields with value `None`
|
|
72
|
+
are ignored.
|
|
73
|
+
"""
|
|
74
|
+
excluded_fields: Set[str] = set([])
|
|
75
|
+
|
|
76
|
+
_dict = self.model_dump(
|
|
77
|
+
by_alias=True,
|
|
78
|
+
exclude=excluded_fields,
|
|
79
|
+
exclude_none=True,
|
|
80
|
+
)
|
|
81
|
+
# override the default output from pydantic by calling `to_dict()` of each item in items (list)
|
|
82
|
+
_items = []
|
|
83
|
+
if self.items:
|
|
84
|
+
for _item in self.items:
|
|
85
|
+
if _item:
|
|
86
|
+
_items.append(_item.to_dict())
|
|
87
|
+
_dict["items"] = _items
|
|
88
|
+
return _dict
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
92
|
+
"""Create an instance of ListOrganizationContainersResponse from a dict"""
|
|
93
|
+
if obj is None:
|
|
94
|
+
return None
|
|
95
|
+
|
|
96
|
+
if not isinstance(obj, dict):
|
|
97
|
+
return cls.model_validate(obj)
|
|
98
|
+
|
|
99
|
+
_obj = cls.model_validate(
|
|
100
|
+
{
|
|
101
|
+
"cursor": obj.get("cursor"),
|
|
102
|
+
"items": (
|
|
103
|
+
[ListOrganizationContainersResponseItemsInner.from_dict(_item) for _item in obj["items"]]
|
|
104
|
+
if obj.get("items") is not None
|
|
105
|
+
else None
|
|
106
|
+
),
|
|
107
|
+
"limit": obj.get("limit") if obj.get("limit") is not None else 50,
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
return _obj
|
|
@@ -0,0 +1,164 @@
|
|
|
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 TYPE_CHECKING, Any, Dict, Optional, Set, Union
|
|
19
|
+
|
|
20
|
+
from pydantic import (
|
|
21
|
+
BaseModel,
|
|
22
|
+
ValidationError,
|
|
23
|
+
field_validator,
|
|
24
|
+
)
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
from stackit.resourcemanager.models.list_organization_containers_response_items_inner_any_of import (
|
|
28
|
+
ListOrganizationContainersResponseItemsInnerAnyOf,
|
|
29
|
+
)
|
|
30
|
+
from stackit.resourcemanager.models.list_organization_containers_response_items_inner_any_of1 import (
|
|
31
|
+
ListOrganizationContainersResponseItemsInnerAnyOf1,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
LISTORGANIZATIONCONTAINERSRESPONSEITEMSINNER_ANY_OF_SCHEMAS = [
|
|
36
|
+
"ListOrganizationContainersResponseItemsInnerAnyOf",
|
|
37
|
+
"ListOrganizationContainersResponseItemsInnerAnyOf1",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class ListOrganizationContainersResponseItemsInner(BaseModel):
|
|
42
|
+
"""
|
|
43
|
+
ListOrganizationContainersResponseItemsInner
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
# data type: ListOrganizationContainersResponseItemsInnerAnyOf
|
|
47
|
+
anyof_schema_1_validator: Optional[ListOrganizationContainersResponseItemsInnerAnyOf] = None
|
|
48
|
+
# data type: ListOrganizationContainersResponseItemsInnerAnyOf1
|
|
49
|
+
anyof_schema_2_validator: Optional[ListOrganizationContainersResponseItemsInnerAnyOf1] = None
|
|
50
|
+
if TYPE_CHECKING:
|
|
51
|
+
actual_instance: Optional[
|
|
52
|
+
Union[ListOrganizationContainersResponseItemsInnerAnyOf, ListOrganizationContainersResponseItemsInnerAnyOf1]
|
|
53
|
+
] = None
|
|
54
|
+
else:
|
|
55
|
+
actual_instance: Any = None
|
|
56
|
+
any_of_schemas: Set[str] = {
|
|
57
|
+
"ListOrganizationContainersResponseItemsInnerAnyOf",
|
|
58
|
+
"ListOrganizationContainersResponseItemsInnerAnyOf1",
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
model_config = {
|
|
62
|
+
"validate_assignment": True,
|
|
63
|
+
"protected_namespaces": (),
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
67
|
+
if args:
|
|
68
|
+
if len(args) > 1:
|
|
69
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
70
|
+
if kwargs:
|
|
71
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
72
|
+
super().__init__(actual_instance=args[0])
|
|
73
|
+
else:
|
|
74
|
+
super().__init__(**kwargs)
|
|
75
|
+
|
|
76
|
+
@field_validator("actual_instance")
|
|
77
|
+
def actual_instance_must_validate_anyof(cls, v):
|
|
78
|
+
instance = ListOrganizationContainersResponseItemsInner.model_construct()
|
|
79
|
+
error_messages = []
|
|
80
|
+
# validate data type: ListOrganizationContainersResponseItemsInnerAnyOf
|
|
81
|
+
if not isinstance(v, ListOrganizationContainersResponseItemsInnerAnyOf):
|
|
82
|
+
error_messages.append(
|
|
83
|
+
f"Error! Input type `{type(v)}` is not `ListOrganizationContainersResponseItemsInnerAnyOf`"
|
|
84
|
+
)
|
|
85
|
+
else:
|
|
86
|
+
return v
|
|
87
|
+
|
|
88
|
+
# validate data type: ListOrganizationContainersResponseItemsInnerAnyOf1
|
|
89
|
+
if not isinstance(v, ListOrganizationContainersResponseItemsInnerAnyOf1):
|
|
90
|
+
error_messages.append(
|
|
91
|
+
f"Error! Input type `{type(v)}` is not `ListOrganizationContainersResponseItemsInnerAnyOf1`"
|
|
92
|
+
)
|
|
93
|
+
else:
|
|
94
|
+
return v
|
|
95
|
+
|
|
96
|
+
if error_messages:
|
|
97
|
+
# no match
|
|
98
|
+
raise ValueError(
|
|
99
|
+
"No match found when setting the actual_instance in ListOrganizationContainersResponseItemsInner with anyOf schemas: ListOrganizationContainersResponseItemsInnerAnyOf, ListOrganizationContainersResponseItemsInnerAnyOf1. Details: "
|
|
100
|
+
+ ", ".join(error_messages)
|
|
101
|
+
)
|
|
102
|
+
else:
|
|
103
|
+
return v
|
|
104
|
+
|
|
105
|
+
@classmethod
|
|
106
|
+
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
|
107
|
+
return cls.from_json(json.dumps(obj))
|
|
108
|
+
|
|
109
|
+
@classmethod
|
|
110
|
+
def from_json(cls, json_str: str) -> Self:
|
|
111
|
+
"""Returns the object represented by the json string"""
|
|
112
|
+
instance = cls.model_construct()
|
|
113
|
+
error_messages = []
|
|
114
|
+
try:
|
|
115
|
+
instance.actual_instance = ListOrganizationContainersResponseItemsInnerAnyOf.from_json(json_str)
|
|
116
|
+
return instance
|
|
117
|
+
except (ValidationError, ValueError) as e:
|
|
118
|
+
error_messages.append(str(e))
|
|
119
|
+
try:
|
|
120
|
+
instance.actual_instance = ListOrganizationContainersResponseItemsInnerAnyOf1.from_json(json_str)
|
|
121
|
+
return instance
|
|
122
|
+
except (ValidationError, ValueError) as e:
|
|
123
|
+
error_messages.append(str(e))
|
|
124
|
+
|
|
125
|
+
if error_messages:
|
|
126
|
+
# no match
|
|
127
|
+
raise ValueError(
|
|
128
|
+
"No match found when deserializing the JSON string into ListOrganizationContainersResponseItemsInner with anyOf schemas: ListOrganizationContainersResponseItemsInnerAnyOf, ListOrganizationContainersResponseItemsInnerAnyOf1. Details: "
|
|
129
|
+
+ ", ".join(error_messages)
|
|
130
|
+
)
|
|
131
|
+
else:
|
|
132
|
+
return instance
|
|
133
|
+
|
|
134
|
+
def to_json(self) -> str:
|
|
135
|
+
"""Returns the JSON representation of the actual instance"""
|
|
136
|
+
if self.actual_instance is None:
|
|
137
|
+
return "null"
|
|
138
|
+
|
|
139
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
140
|
+
return self.actual_instance.to_json()
|
|
141
|
+
else:
|
|
142
|
+
return json.dumps(self.actual_instance)
|
|
143
|
+
|
|
144
|
+
def to_dict(
|
|
145
|
+
self,
|
|
146
|
+
) -> Optional[
|
|
147
|
+
Union[
|
|
148
|
+
Dict[str, Any],
|
|
149
|
+
ListOrganizationContainersResponseItemsInnerAnyOf,
|
|
150
|
+
ListOrganizationContainersResponseItemsInnerAnyOf1,
|
|
151
|
+
]
|
|
152
|
+
]:
|
|
153
|
+
"""Returns the dict representation of the actual instance"""
|
|
154
|
+
if self.actual_instance is None:
|
|
155
|
+
return None
|
|
156
|
+
|
|
157
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
158
|
+
return self.actual_instance.to_dict()
|
|
159
|
+
else:
|
|
160
|
+
return self.actual_instance
|
|
161
|
+
|
|
162
|
+
def to_str(self) -> str:
|
|
163
|
+
"""Returns the string representation of the actual instance"""
|
|
164
|
+
return pprint.pformat(self.model_dump())
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
from stackit.resourcemanager.models.folder_response import FolderResponse
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ListOrganizationContainersResponseItemsInnerAnyOf(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
ListOrganizationContainersResponseItemsInnerAnyOf
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
item: FolderResponse
|
|
32
|
+
type: StrictStr = Field(description="Resource container type.")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["item", "type"]
|
|
34
|
+
|
|
35
|
+
@field_validator("type")
|
|
36
|
+
def type_validate_enum(cls, value):
|
|
37
|
+
"""Validates the enum"""
|
|
38
|
+
if value not in set(["FOLDER"]):
|
|
39
|
+
raise ValueError("must be one of enum values ('FOLDER')")
|
|
40
|
+
return value
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
populate_by_name=True,
|
|
44
|
+
validate_assignment=True,
|
|
45
|
+
protected_namespaces=(),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of ListOrganizationContainersResponseItemsInnerAnyOf from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
"""
|
|
72
|
+
excluded_fields: Set[str] = set([])
|
|
73
|
+
|
|
74
|
+
_dict = self.model_dump(
|
|
75
|
+
by_alias=True,
|
|
76
|
+
exclude=excluded_fields,
|
|
77
|
+
exclude_none=True,
|
|
78
|
+
)
|
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of item
|
|
80
|
+
if self.item:
|
|
81
|
+
_dict["item"] = self.item.to_dict()
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of ListOrganizationContainersResponseItemsInnerAnyOf from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate(
|
|
94
|
+
{
|
|
95
|
+
"item": FolderResponse.from_dict(obj["item"]) if obj.get("item") is not None else None,
|
|
96
|
+
"type": obj.get("type"),
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
return _obj
|