stackit-automation 0.1.0__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/automation/__init__.py +187 -0
- stackit/automation/api/__init__.py +4 -0
- stackit/automation/api/default_api.py +2971 -0
- stackit/automation/api_client.py +650 -0
- stackit/automation/api_response.py +22 -0
- stackit/automation/configuration.py +163 -0
- stackit/automation/exceptions.py +218 -0
- stackit/automation/models/__init__.py +73 -0
- stackit/automation/models/automation_schedule_trigger.py +85 -0
- stackit/automation/models/automation_triggers.py +101 -0
- stackit/automation/models/create_snapshots_result.py +85 -0
- stackit/automation/models/create_volume_automation_payload.py +125 -0
- stackit/automation/models/error_info_detail.py +93 -0
- stackit/automation/models/error_response.py +90 -0
- stackit/automation/models/error_response_content.py +108 -0
- stackit/automation/models/error_response_content_details.py +99 -0
- stackit/automation/models/event_create_response.py +83 -0
- stackit/automation/models/get_volume_ids_result.py +85 -0
- stackit/automation/models/get_volume_template_response.py +125 -0
- stackit/automation/models/help_error_detail.py +87 -0
- stackit/automation/models/list_automations_item.py +146 -0
- stackit/automation/models/list_automations_response.py +106 -0
- stackit/automation/models/list_executions_item.py +129 -0
- stackit/automation/models/list_executions_response.py +106 -0
- stackit/automation/models/list_templates_response.py +104 -0
- stackit/automation/models/localized_message_error_detail.py +87 -0
- stackit/automation/models/partial_update_volume_automation_payload.py +122 -0
- stackit/automation/models/schedule.py +84 -0
- stackit/automation/models/schedule_details.py +87 -0
- stackit/automation/models/schedule_patch_request.py +87 -0
- stackit/automation/models/schedule_request.py +87 -0
- stackit/automation/models/snapshot_retention_policy.py +99 -0
- stackit/automation/models/template.py +108 -0
- stackit/automation/models/volume_automation.py +165 -0
- stackit/automation/models/volume_automation_input.py +99 -0
- stackit/automation/models/volume_execution_automation.py +162 -0
- stackit/automation/models/volume_execution_details.py +100 -0
- stackit/automation/models/volume_execution_output.py +102 -0
- stackit/automation/models/volume_execution_output_step.py +105 -0
- stackit/automation/models/volume_execution_response.py +138 -0
- stackit/automation/models/volume_output.py +100 -0
- stackit/automation/models/volume_output_step.py +94 -0
- stackit/automation/models/volume_output_step_result.py +99 -0
- stackit/automation/models/volume_recovery_point_management_input.py +118 -0
- stackit/automation/models/volume_template_automation_input.py +90 -0
- stackit/automation/py.typed +0 -0
- stackit/automation/rest.py +164 -0
- stackit_automation-0.1.0.dist-info/METADATA +46 -0
- stackit_automation-0.1.0.dist-info/RECORD +52 -0
- stackit_automation-0.1.0.dist-info/WHEEL +4 -0
- stackit_automation-0.1.0.dist-info/licenses/LICENSE.md +201 -0
- stackit_automation-0.1.0.dist-info/licenses/NOTICE.txt +2 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Automation Service API
|
|
5
|
+
|
|
6
|
+
API endpoints for automation management .
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0
|
|
9
|
+
Contact: support@stackit.de
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
import re # noqa: F401
|
|
20
|
+
from datetime import datetime
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
22
|
+
from uuid import UUID
|
|
23
|
+
|
|
24
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
from stackit.automation.models.automation_triggers import AutomationTriggers
|
|
29
|
+
from stackit.automation.models.volume_automation_input import VolumeAutomationInput
|
|
30
|
+
from stackit.automation.models.volume_output import VolumeOutput
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class VolumeExecutionAutomation(BaseModel):
|
|
34
|
+
"""
|
|
35
|
+
VolumeExecutionAutomation
|
|
36
|
+
""" # noqa: E501
|
|
37
|
+
|
|
38
|
+
create_time: datetime = Field(alias="createTime")
|
|
39
|
+
description: Optional[StrictStr] = None
|
|
40
|
+
input: Optional[VolumeAutomationInput] = None
|
|
41
|
+
name: Optional[StrictStr] = None
|
|
42
|
+
output: Optional[VolumeOutput] = None
|
|
43
|
+
template_id: Optional[UUID] = Field(default=None, alias="templateId")
|
|
44
|
+
triggers: Optional[AutomationTriggers] = None
|
|
45
|
+
update_time: datetime = Field(alias="updateTime")
|
|
46
|
+
__properties: ClassVar[List[str]] = [
|
|
47
|
+
"createTime",
|
|
48
|
+
"description",
|
|
49
|
+
"input",
|
|
50
|
+
"name",
|
|
51
|
+
"output",
|
|
52
|
+
"templateId",
|
|
53
|
+
"triggers",
|
|
54
|
+
"updateTime",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
@field_validator("create_time", mode="before")
|
|
58
|
+
def create_time_change_year_zero_to_one(cls, value):
|
|
59
|
+
"""Workaround which prevents year 0 issue"""
|
|
60
|
+
if isinstance(value, str):
|
|
61
|
+
# Check for year "0000" at the beginning of the string
|
|
62
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
63
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
64
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
65
|
+
):
|
|
66
|
+
# Workaround: Replace "0000" with "0001"
|
|
67
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
68
|
+
return value
|
|
69
|
+
|
|
70
|
+
@field_validator("update_time", mode="before")
|
|
71
|
+
def update_time_change_year_zero_to_one(cls, value):
|
|
72
|
+
"""Workaround which prevents year 0 issue"""
|
|
73
|
+
if isinstance(value, str):
|
|
74
|
+
# Check for year "0000" at the beginning of the string
|
|
75
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
76
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
77
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
78
|
+
):
|
|
79
|
+
# Workaround: Replace "0000" with "0001"
|
|
80
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
81
|
+
return value
|
|
82
|
+
|
|
83
|
+
model_config = ConfigDict(
|
|
84
|
+
validate_by_name=True,
|
|
85
|
+
validate_by_alias=True,
|
|
86
|
+
validate_assignment=True,
|
|
87
|
+
protected_namespaces=(),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
def to_str(self) -> str:
|
|
91
|
+
"""Returns the string representation of the model using alias"""
|
|
92
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
93
|
+
|
|
94
|
+
def to_json(self) -> str:
|
|
95
|
+
"""Returns the JSON representation of the model using alias"""
|
|
96
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
100
|
+
"""Create an instance of VolumeExecutionAutomation from a JSON string"""
|
|
101
|
+
return cls.from_dict(json.loads(json_str))
|
|
102
|
+
|
|
103
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
104
|
+
"""Return the dictionary representation of the model using alias.
|
|
105
|
+
|
|
106
|
+
This has the following differences from calling pydantic's
|
|
107
|
+
`self.model_dump(by_alias=True)`:
|
|
108
|
+
|
|
109
|
+
* `None` is only added to the output dict for nullable fields that
|
|
110
|
+
were set at model initialization. Other fields with value `None`
|
|
111
|
+
are ignored.
|
|
112
|
+
"""
|
|
113
|
+
excluded_fields: Set[str] = set([])
|
|
114
|
+
|
|
115
|
+
_dict = self.model_dump(
|
|
116
|
+
by_alias=True,
|
|
117
|
+
exclude=excluded_fields,
|
|
118
|
+
exclude_none=True,
|
|
119
|
+
)
|
|
120
|
+
# override the default output from pydantic by calling `to_dict()` of input
|
|
121
|
+
if self.input:
|
|
122
|
+
_dict["input"] = self.input.to_dict()
|
|
123
|
+
# override the default output from pydantic by calling `to_dict()` of output
|
|
124
|
+
if self.output:
|
|
125
|
+
_dict["output"] = self.output.to_dict()
|
|
126
|
+
# override the default output from pydantic by calling `to_dict()` of triggers
|
|
127
|
+
if self.triggers:
|
|
128
|
+
_dict["triggers"] = self.triggers.to_dict()
|
|
129
|
+
# set to None if input (nullable) is None
|
|
130
|
+
# and model_fields_set contains the field
|
|
131
|
+
if self.input is None and "input" in self.model_fields_set:
|
|
132
|
+
_dict["input"] = None
|
|
133
|
+
|
|
134
|
+
# set to None if triggers (nullable) is None
|
|
135
|
+
# and model_fields_set contains the field
|
|
136
|
+
if self.triggers is None and "triggers" in self.model_fields_set:
|
|
137
|
+
_dict["triggers"] = None
|
|
138
|
+
|
|
139
|
+
return _dict
|
|
140
|
+
|
|
141
|
+
@classmethod
|
|
142
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
143
|
+
"""Create an instance of VolumeExecutionAutomation from a dict"""
|
|
144
|
+
if obj is None:
|
|
145
|
+
return None
|
|
146
|
+
|
|
147
|
+
if not isinstance(obj, dict):
|
|
148
|
+
return cls.model_validate(obj)
|
|
149
|
+
|
|
150
|
+
_obj = cls.model_validate(
|
|
151
|
+
{
|
|
152
|
+
"createTime": obj.get("createTime"),
|
|
153
|
+
"description": obj.get("description"),
|
|
154
|
+
"input": VolumeAutomationInput.from_dict(obj["input"]) if obj.get("input") is not None else None,
|
|
155
|
+
"name": obj.get("name"),
|
|
156
|
+
"output": VolumeOutput.from_dict(obj["output"]) if obj.get("output") is not None else None,
|
|
157
|
+
"templateId": obj.get("templateId"),
|
|
158
|
+
"triggers": AutomationTriggers.from_dict(obj["triggers"]) if obj.get("triggers") is not None else None,
|
|
159
|
+
"updateTime": obj.get("updateTime"),
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
return _obj
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Automation Service API
|
|
5
|
+
|
|
6
|
+
API endpoints for automation management .
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0
|
|
9
|
+
Contact: support@stackit.de
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict
|
|
22
|
+
from pydantic_core import to_jsonable_python
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
from stackit.automation.models.volume_execution_automation import (
|
|
26
|
+
VolumeExecutionAutomation,
|
|
27
|
+
)
|
|
28
|
+
from stackit.automation.models.volume_execution_output import VolumeExecutionOutput
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class VolumeExecutionDetails(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
VolumeExecutionDetails
|
|
34
|
+
""" # noqa: E501
|
|
35
|
+
|
|
36
|
+
config: VolumeExecutionAutomation
|
|
37
|
+
output: Optional[VolumeExecutionOutput] = None
|
|
38
|
+
__properties: ClassVar[List[str]] = ["config", "output"]
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
validate_by_name=True,
|
|
42
|
+
validate_by_alias=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
|
+
"""Create an instance of VolumeExecutionDetails from a JSON string"""
|
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
|
59
|
+
|
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
|
62
|
+
|
|
63
|
+
This has the following differences from calling pydantic's
|
|
64
|
+
`self.model_dump(by_alias=True)`:
|
|
65
|
+
|
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
|
67
|
+
were set at model initialization. Other fields with value `None`
|
|
68
|
+
are ignored.
|
|
69
|
+
"""
|
|
70
|
+
excluded_fields: Set[str] = set([])
|
|
71
|
+
|
|
72
|
+
_dict = self.model_dump(
|
|
73
|
+
by_alias=True,
|
|
74
|
+
exclude=excluded_fields,
|
|
75
|
+
exclude_none=True,
|
|
76
|
+
)
|
|
77
|
+
# override the default output from pydantic by calling `to_dict()` of config
|
|
78
|
+
if self.config:
|
|
79
|
+
_dict["config"] = self.config.to_dict()
|
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of output
|
|
81
|
+
if self.output:
|
|
82
|
+
_dict["output"] = self.output.to_dict()
|
|
83
|
+
return _dict
|
|
84
|
+
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
87
|
+
"""Create an instance of VolumeExecutionDetails from a dict"""
|
|
88
|
+
if obj is None:
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
if not isinstance(obj, dict):
|
|
92
|
+
return cls.model_validate(obj)
|
|
93
|
+
|
|
94
|
+
_obj = cls.model_validate(
|
|
95
|
+
{
|
|
96
|
+
"config": VolumeExecutionAutomation.from_dict(obj["config"]) if obj.get("config") is not None else None,
|
|
97
|
+
"output": VolumeExecutionOutput.from_dict(obj["output"]) if obj.get("output") is not None else None,
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
return _obj
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Automation Service API
|
|
5
|
+
|
|
6
|
+
API endpoints for automation management .
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0
|
|
9
|
+
Contact: support@stackit.de
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict
|
|
22
|
+
from pydantic_core import to_jsonable_python
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
from stackit.automation.models.volume_execution_output_step import (
|
|
26
|
+
VolumeExecutionOutputStep,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class VolumeExecutionOutput(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
VolumeExecutionOutput
|
|
33
|
+
""" # noqa: E501
|
|
34
|
+
|
|
35
|
+
steps: Optional[List[VolumeExecutionOutputStep]] = None
|
|
36
|
+
__properties: ClassVar[List[str]] = ["steps"]
|
|
37
|
+
|
|
38
|
+
model_config = ConfigDict(
|
|
39
|
+
validate_by_name=True,
|
|
40
|
+
validate_by_alias=True,
|
|
41
|
+
validate_assignment=True,
|
|
42
|
+
protected_namespaces=(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
def to_str(self) -> str:
|
|
46
|
+
"""Returns the string representation of the model using alias"""
|
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> str:
|
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
|
51
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
+
"""Create an instance of VolumeExecutionOutput from a JSON string"""
|
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
|
57
|
+
|
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
|
60
|
+
|
|
61
|
+
This has the following differences from calling pydantic's
|
|
62
|
+
`self.model_dump(by_alias=True)`:
|
|
63
|
+
|
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
|
65
|
+
were set at model initialization. Other fields with value `None`
|
|
66
|
+
are ignored.
|
|
67
|
+
"""
|
|
68
|
+
excluded_fields: Set[str] = set([])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in steps (list)
|
|
76
|
+
_items = []
|
|
77
|
+
if self.steps:
|
|
78
|
+
for _item_steps in self.steps:
|
|
79
|
+
if _item_steps:
|
|
80
|
+
_items.append(_item_steps.to_dict())
|
|
81
|
+
_dict["steps"] = _items
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of VolumeExecutionOutput 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
|
+
"steps": (
|
|
96
|
+
[VolumeExecutionOutputStep.from_dict(_item) for _item in obj["steps"]]
|
|
97
|
+
if obj.get("steps") is not None
|
|
98
|
+
else None
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
return _obj
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Automation Service API
|
|
5
|
+
|
|
6
|
+
API endpoints for automation management .
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0
|
|
9
|
+
Contact: support@stackit.de
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
|
|
22
|
+
from pydantic_core import to_jsonable_python
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
from stackit.automation.models.volume_output_step_result import VolumeOutputStepResult
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class VolumeExecutionOutputStep(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
VolumeExecutionOutputStep
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
|
|
33
|
+
message: Optional[StrictStr] = None
|
|
34
|
+
name: StrictStr
|
|
35
|
+
result: Optional[VolumeOutputStepResult] = None
|
|
36
|
+
status: StrictStr
|
|
37
|
+
__properties: ClassVar[List[str]] = ["message", "name", "result", "status"]
|
|
38
|
+
|
|
39
|
+
@field_validator("status")
|
|
40
|
+
def status_validate_enum(cls, value):
|
|
41
|
+
"""Validates the enum"""
|
|
42
|
+
if value not in set(["PENDING", "RUNNING", "FAILED", "SUCCESSFUL"]):
|
|
43
|
+
raise ValueError("must be one of enum values ('PENDING', 'RUNNING', 'FAILED', 'SUCCESSFUL')")
|
|
44
|
+
return value
|
|
45
|
+
|
|
46
|
+
model_config = ConfigDict(
|
|
47
|
+
validate_by_name=True,
|
|
48
|
+
validate_by_alias=True,
|
|
49
|
+
validate_assignment=True,
|
|
50
|
+
protected_namespaces=(),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
def to_str(self) -> str:
|
|
54
|
+
"""Returns the string representation of the model using alias"""
|
|
55
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
56
|
+
|
|
57
|
+
def to_json(self) -> str:
|
|
58
|
+
"""Returns the JSON representation of the model using alias"""
|
|
59
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
60
|
+
|
|
61
|
+
@classmethod
|
|
62
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
63
|
+
"""Create an instance of VolumeExecutionOutputStep from a JSON string"""
|
|
64
|
+
return cls.from_dict(json.loads(json_str))
|
|
65
|
+
|
|
66
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
67
|
+
"""Return the dictionary representation of the model using alias.
|
|
68
|
+
|
|
69
|
+
This has the following differences from calling pydantic's
|
|
70
|
+
`self.model_dump(by_alias=True)`:
|
|
71
|
+
|
|
72
|
+
* `None` is only added to the output dict for nullable fields that
|
|
73
|
+
were set at model initialization. Other fields with value `None`
|
|
74
|
+
are ignored.
|
|
75
|
+
"""
|
|
76
|
+
excluded_fields: Set[str] = set([])
|
|
77
|
+
|
|
78
|
+
_dict = self.model_dump(
|
|
79
|
+
by_alias=True,
|
|
80
|
+
exclude=excluded_fields,
|
|
81
|
+
exclude_none=True,
|
|
82
|
+
)
|
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of result
|
|
84
|
+
if self.result:
|
|
85
|
+
_dict["result"] = self.result.to_dict()
|
|
86
|
+
return _dict
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
90
|
+
"""Create an instance of VolumeExecutionOutputStep 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
|
+
"message": obj.get("message"),
|
|
100
|
+
"name": obj.get("name"),
|
|
101
|
+
"result": VolumeOutputStepResult.from_dict(obj["result"]) if obj.get("result") is not None else None,
|
|
102
|
+
"status": obj.get("status"),
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
return _obj
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Automation Service API
|
|
5
|
+
|
|
6
|
+
API endpoints for automation management .
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0
|
|
9
|
+
Contact: support@stackit.de
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
import re # noqa: F401
|
|
20
|
+
from datetime import datetime
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
22
|
+
from uuid import UUID
|
|
23
|
+
|
|
24
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
from stackit.automation.models.volume_execution_details import VolumeExecutionDetails
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class VolumeExecutionResponse(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
VolumeExecutionResponse
|
|
34
|
+
""" # noqa: E501
|
|
35
|
+
|
|
36
|
+
automation: Optional[VolumeExecutionDetails] = None
|
|
37
|
+
create_time: datetime = Field(alias="createTime")
|
|
38
|
+
end_time: Optional[datetime] = Field(default=None, alias="endTime")
|
|
39
|
+
id: UUID
|
|
40
|
+
status: StrictStr
|
|
41
|
+
__properties: ClassVar[List[str]] = ["automation", "createTime", "endTime", "id", "status"]
|
|
42
|
+
|
|
43
|
+
@field_validator("create_time", mode="before")
|
|
44
|
+
def create_time_change_year_zero_to_one(cls, value):
|
|
45
|
+
"""Workaround which prevents year 0 issue"""
|
|
46
|
+
if isinstance(value, str):
|
|
47
|
+
# Check for year "0000" at the beginning of the string
|
|
48
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
49
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
50
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
51
|
+
):
|
|
52
|
+
# Workaround: Replace "0000" with "0001"
|
|
53
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
54
|
+
return value
|
|
55
|
+
|
|
56
|
+
@field_validator("end_time", mode="before")
|
|
57
|
+
def end_time_change_year_zero_to_one(cls, value):
|
|
58
|
+
"""Workaround which prevents year 0 issue"""
|
|
59
|
+
if isinstance(value, str):
|
|
60
|
+
# Check for year "0000" at the beginning of the string
|
|
61
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
62
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
63
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
64
|
+
):
|
|
65
|
+
# Workaround: Replace "0000" with "0001"
|
|
66
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
67
|
+
return value
|
|
68
|
+
|
|
69
|
+
@field_validator("status")
|
|
70
|
+
def status_validate_enum(cls, value):
|
|
71
|
+
"""Validates the enum"""
|
|
72
|
+
if value not in set(["PENDING", "RUNNING", "COMPLETED", "FAILED", "TERMINATED"]):
|
|
73
|
+
raise ValueError("must be one of enum values ('PENDING', 'RUNNING', 'COMPLETED', 'FAILED', 'TERMINATED')")
|
|
74
|
+
return value
|
|
75
|
+
|
|
76
|
+
model_config = ConfigDict(
|
|
77
|
+
validate_by_name=True,
|
|
78
|
+
validate_by_alias=True,
|
|
79
|
+
validate_assignment=True,
|
|
80
|
+
protected_namespaces=(),
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
def to_str(self) -> str:
|
|
84
|
+
"""Returns the string representation of the model using alias"""
|
|
85
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
86
|
+
|
|
87
|
+
def to_json(self) -> str:
|
|
88
|
+
"""Returns the JSON representation of the model using alias"""
|
|
89
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
93
|
+
"""Create an instance of VolumeExecutionResponse from a JSON string"""
|
|
94
|
+
return cls.from_dict(json.loads(json_str))
|
|
95
|
+
|
|
96
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
97
|
+
"""Return the dictionary representation of the model using alias.
|
|
98
|
+
|
|
99
|
+
This has the following differences from calling pydantic's
|
|
100
|
+
`self.model_dump(by_alias=True)`:
|
|
101
|
+
|
|
102
|
+
* `None` is only added to the output dict for nullable fields that
|
|
103
|
+
were set at model initialization. Other fields with value `None`
|
|
104
|
+
are ignored.
|
|
105
|
+
"""
|
|
106
|
+
excluded_fields: Set[str] = set([])
|
|
107
|
+
|
|
108
|
+
_dict = self.model_dump(
|
|
109
|
+
by_alias=True,
|
|
110
|
+
exclude=excluded_fields,
|
|
111
|
+
exclude_none=True,
|
|
112
|
+
)
|
|
113
|
+
# override the default output from pydantic by calling `to_dict()` of automation
|
|
114
|
+
if self.automation:
|
|
115
|
+
_dict["automation"] = self.automation.to_dict()
|
|
116
|
+
return _dict
|
|
117
|
+
|
|
118
|
+
@classmethod
|
|
119
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
120
|
+
"""Create an instance of VolumeExecutionResponse from a dict"""
|
|
121
|
+
if obj is None:
|
|
122
|
+
return None
|
|
123
|
+
|
|
124
|
+
if not isinstance(obj, dict):
|
|
125
|
+
return cls.model_validate(obj)
|
|
126
|
+
|
|
127
|
+
_obj = cls.model_validate(
|
|
128
|
+
{
|
|
129
|
+
"automation": (
|
|
130
|
+
VolumeExecutionDetails.from_dict(obj["automation"]) if obj.get("automation") is not None else None
|
|
131
|
+
),
|
|
132
|
+
"createTime": obj.get("createTime"),
|
|
133
|
+
"endTime": obj.get("endTime"),
|
|
134
|
+
"id": obj.get("id"),
|
|
135
|
+
"status": obj.get("status"),
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
return _obj
|