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,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_output_step import VolumeOutputStep
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class VolumeOutput(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
VolumeOutput
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
|
|
33
|
+
steps: Optional[List[VolumeOutputStep]] = None
|
|
34
|
+
__properties: ClassVar[List[str]] = ["steps"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
validate_by_name=True,
|
|
38
|
+
validate_by_alias=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of VolumeOutput from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
# override the default output from pydantic by calling `to_dict()` of each item in steps (list)
|
|
74
|
+
_items = []
|
|
75
|
+
if self.steps:
|
|
76
|
+
for _item_steps in self.steps:
|
|
77
|
+
if _item_steps:
|
|
78
|
+
_items.append(_item_steps.to_dict())
|
|
79
|
+
_dict["steps"] = _items
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of VolumeOutput 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(
|
|
92
|
+
{
|
|
93
|
+
"steps": (
|
|
94
|
+
[VolumeOutputStep.from_dict(_item) for _item in obj["steps"]]
|
|
95
|
+
if obj.get("steps") is not None
|
|
96
|
+
else None
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
return _obj
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
|
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 VolumeOutputStep(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
VolumeOutputStep
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
|
|
33
|
+
name: StrictStr
|
|
34
|
+
result: Optional[VolumeOutputStepResult] = None
|
|
35
|
+
__properties: ClassVar[List[str]] = ["name", "result"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
validate_by_name=True,
|
|
39
|
+
validate_by_alias=True,
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
def to_str(self) -> str:
|
|
45
|
+
"""Returns the string representation of the model using alias"""
|
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
47
|
+
|
|
48
|
+
def to_json(self) -> str:
|
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
|
50
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of VolumeOutputStep from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of result
|
|
75
|
+
if self.result:
|
|
76
|
+
_dict["result"] = self.result.to_dict()
|
|
77
|
+
return _dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of VolumeOutputStep from a dict"""
|
|
82
|
+
if obj is None:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
if not isinstance(obj, dict):
|
|
86
|
+
return cls.model_validate(obj)
|
|
87
|
+
|
|
88
|
+
_obj = cls.model_validate(
|
|
89
|
+
{
|
|
90
|
+
"name": obj.get("name"),
|
|
91
|
+
"result": VolumeOutputStepResult.from_dict(obj["result"]) if obj.get("result") is not None else None,
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
return _obj
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
|
22
|
+
from pydantic_core import to_jsonable_python
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class VolumeOutputStepResult(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
VolumeOutputStepResult
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
|
|
31
|
+
kind: StrictStr
|
|
32
|
+
additional_properties: Dict[str, Any] = {}
|
|
33
|
+
__properties: ClassVar[List[str]] = ["kind"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
validate_by_name=True,
|
|
37
|
+
validate_by_alias=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of VolumeOutputStepResult from a JSON string"""
|
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
|
54
|
+
|
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
|
57
|
+
|
|
58
|
+
This has the following differences from calling pydantic's
|
|
59
|
+
`self.model_dump(by_alias=True)`:
|
|
60
|
+
|
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
|
62
|
+
were set at model initialization. Other fields with value `None`
|
|
63
|
+
are ignored.
|
|
64
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set(
|
|
67
|
+
[
|
|
68
|
+
"additional_properties",
|
|
69
|
+
]
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
_dict = self.model_dump(
|
|
73
|
+
by_alias=True,
|
|
74
|
+
exclude=excluded_fields,
|
|
75
|
+
exclude_none=True,
|
|
76
|
+
)
|
|
77
|
+
# puts key-value pairs in additional_properties in the top level
|
|
78
|
+
if self.additional_properties is not None:
|
|
79
|
+
for _key, _value in self.additional_properties.items():
|
|
80
|
+
_dict[_key] = _value
|
|
81
|
+
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of VolumeOutputStepResult 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({"kind": obj.get("kind")})
|
|
94
|
+
# store additional fields in additional_properties
|
|
95
|
+
for _key in obj.keys():
|
|
96
|
+
if _key not in cls.__properties:
|
|
97
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
98
|
+
|
|
99
|
+
return _obj
|
|
@@ -0,0 +1,118 @@
|
|
|
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 (
|
|
22
|
+
BaseModel,
|
|
23
|
+
ConfigDict,
|
|
24
|
+
Field,
|
|
25
|
+
StrictBool,
|
|
26
|
+
StrictStr,
|
|
27
|
+
)
|
|
28
|
+
from pydantic_core import to_jsonable_python
|
|
29
|
+
from typing_extensions import Self
|
|
30
|
+
|
|
31
|
+
from stackit.automation.models.snapshot_retention_policy import SnapshotRetentionPolicy
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class VolumeRecoveryPointManagementInput(BaseModel):
|
|
35
|
+
"""
|
|
36
|
+
VolumeRecoveryPointManagementInput
|
|
37
|
+
""" # noqa: E501
|
|
38
|
+
|
|
39
|
+
inherit_volume_labels: Optional[StrictBool] = Field(default=False, alias="inheritVolumeLabels")
|
|
40
|
+
kind: StrictStr
|
|
41
|
+
recovery_point_labels: Optional[Dict[str, StrictStr]] = Field(default=None, alias="recoveryPointLabels")
|
|
42
|
+
snapshot_retention_policy: SnapshotRetentionPolicy = Field(alias="snapshotRetentionPolicy")
|
|
43
|
+
volume_label_selector: Optional[StrictStr] = Field(default=None, alias="volumeLabelSelector")
|
|
44
|
+
__properties: ClassVar[List[str]] = [
|
|
45
|
+
"inheritVolumeLabels",
|
|
46
|
+
"kind",
|
|
47
|
+
"recoveryPointLabels",
|
|
48
|
+
"snapshotRetentionPolicy",
|
|
49
|
+
"volumeLabelSelector",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
model_config = ConfigDict(
|
|
53
|
+
validate_by_name=True,
|
|
54
|
+
validate_by_alias=True,
|
|
55
|
+
validate_assignment=True,
|
|
56
|
+
protected_namespaces=(),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
def to_str(self) -> str:
|
|
60
|
+
"""Returns the string representation of the model using alias"""
|
|
61
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
62
|
+
|
|
63
|
+
def to_json(self) -> str:
|
|
64
|
+
"""Returns the JSON representation of the model using alias"""
|
|
65
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
66
|
+
|
|
67
|
+
@classmethod
|
|
68
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
69
|
+
"""Create an instance of VolumeRecoveryPointManagementInput 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 snapshot_retention_policy
|
|
90
|
+
if self.snapshot_retention_policy:
|
|
91
|
+
_dict["snapshotRetentionPolicy"] = self.snapshot_retention_policy.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 VolumeRecoveryPointManagementInput 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
|
+
"inheritVolumeLabels": (
|
|
106
|
+
obj.get("inheritVolumeLabels") if obj.get("inheritVolumeLabels") is not None else False
|
|
107
|
+
),
|
|
108
|
+
"kind": obj.get("kind"),
|
|
109
|
+
"recoveryPointLabels": obj.get("recoveryPointLabels"),
|
|
110
|
+
"snapshotRetentionPolicy": (
|
|
111
|
+
SnapshotRetentionPolicy.from_dict(obj["snapshotRetentionPolicy"])
|
|
112
|
+
if obj.get("snapshotRetentionPolicy") is not None
|
|
113
|
+
else None
|
|
114
|
+
),
|
|
115
|
+
"volumeLabelSelector": obj.get("volumeLabelSelector"),
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
return _obj
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
|
|
26
|
+
class VolumeTemplateAutomationInput(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
VolumeTemplateAutomationInput
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
|
|
31
|
+
kind: StrictStr
|
|
32
|
+
__properties: ClassVar[List[str]] = ["kind"]
|
|
33
|
+
|
|
34
|
+
@field_validator("kind")
|
|
35
|
+
def kind_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in set(["VolumeRecoveryPointManagement"]):
|
|
38
|
+
raise ValueError("must be one of enum values ('VolumeRecoveryPointManagement')")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
validate_by_name=True,
|
|
43
|
+
validate_by_alias=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
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of VolumeTemplateAutomationInput from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([])
|
|
72
|
+
|
|
73
|
+
_dict = self.model_dump(
|
|
74
|
+
by_alias=True,
|
|
75
|
+
exclude=excluded_fields,
|
|
76
|
+
exclude_none=True,
|
|
77
|
+
)
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of VolumeTemplateAutomationInput from a dict"""
|
|
83
|
+
if obj is None:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
if not isinstance(obj, dict):
|
|
87
|
+
return cls.model_validate(obj)
|
|
88
|
+
|
|
89
|
+
_obj = cls.model_validate({"kind": obj.get("kind")})
|
|
90
|
+
return _obj
|
|
File without changes
|
|
@@ -0,0 +1,164 @@
|
|
|
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
|
+
import io
|
|
16
|
+
import json
|
|
17
|
+
import re
|
|
18
|
+
|
|
19
|
+
import requests
|
|
20
|
+
from stackit.core.authorization import Authorization
|
|
21
|
+
from stackit.core.configuration import Configuration
|
|
22
|
+
|
|
23
|
+
from stackit.automation.exceptions import ApiException, ApiValueError
|
|
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
|
+
@property
|
|
42
|
+
def headers(self):
|
|
43
|
+
"""Returns a dictionary of response headers."""
|
|
44
|
+
return self.response.headers
|
|
45
|
+
|
|
46
|
+
def getheaders(self):
|
|
47
|
+
"""Returns a dictionary of the response headers; use ``headers`` instead."""
|
|
48
|
+
return self.response.headers
|
|
49
|
+
|
|
50
|
+
def getheader(self, name, default=None):
|
|
51
|
+
"""Returns a given response header; use ``headers.get()`` instead."""
|
|
52
|
+
return self.response.headers.get(name, default)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class RESTClientObject:
|
|
56
|
+
def __init__(self, config: Configuration) -> None:
|
|
57
|
+
self.session = config.custom_http_session if config.custom_http_session else requests.Session()
|
|
58
|
+
authorization = Authorization(config)
|
|
59
|
+
self.session.auth = authorization.auth_method
|
|
60
|
+
|
|
61
|
+
def request(self, method, url, headers=None, body=None, post_params=None, _request_timeout=None):
|
|
62
|
+
"""Perform requests.
|
|
63
|
+
|
|
64
|
+
:param method: http request method
|
|
65
|
+
:param url: http request url
|
|
66
|
+
:param headers: http request headers
|
|
67
|
+
:param body: request json body, for `application/json`
|
|
68
|
+
:param post_params: request post parameters,
|
|
69
|
+
`application/x-www-form-urlencoded`
|
|
70
|
+
and `multipart/form-data`
|
|
71
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
72
|
+
number provided, it will be total request
|
|
73
|
+
timeout. It can also be a pair (tuple) of
|
|
74
|
+
(connection, read) timeouts.
|
|
75
|
+
"""
|
|
76
|
+
method = method.upper()
|
|
77
|
+
if method not in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"]:
|
|
78
|
+
raise ValueError("Method %s not allowed", method)
|
|
79
|
+
|
|
80
|
+
if post_params and body:
|
|
81
|
+
raise ApiValueError("body parameter cannot be used with post_params parameter.")
|
|
82
|
+
|
|
83
|
+
post_params = post_params or {}
|
|
84
|
+
headers = headers or {}
|
|
85
|
+
|
|
86
|
+
try:
|
|
87
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
88
|
+
if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
|
|
89
|
+
|
|
90
|
+
# no content type provided or payload is json
|
|
91
|
+
content_type = headers.get("Content-Type")
|
|
92
|
+
if not content_type or re.search("json", content_type, re.IGNORECASE):
|
|
93
|
+
request_body = None
|
|
94
|
+
if body is not None:
|
|
95
|
+
request_body = json.dumps(body)
|
|
96
|
+
r = self.session.request(
|
|
97
|
+
method,
|
|
98
|
+
url,
|
|
99
|
+
data=request_body,
|
|
100
|
+
headers=headers,
|
|
101
|
+
timeout=_request_timeout,
|
|
102
|
+
)
|
|
103
|
+
elif content_type == "application/x-www-form-urlencoded":
|
|
104
|
+
r = self.session.request(
|
|
105
|
+
method,
|
|
106
|
+
url,
|
|
107
|
+
params=post_params,
|
|
108
|
+
headers=headers,
|
|
109
|
+
timeout=_request_timeout,
|
|
110
|
+
)
|
|
111
|
+
elif content_type == "multipart/form-data":
|
|
112
|
+
# must del headers['Content-Type'], or the correct
|
|
113
|
+
# Content-Type which generated by urllib3 will be
|
|
114
|
+
# overwritten.
|
|
115
|
+
del headers["Content-Type"]
|
|
116
|
+
# Ensures that dict objects are serialized
|
|
117
|
+
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a, b) for a, b in post_params]
|
|
118
|
+
r = self.session.request(
|
|
119
|
+
method,
|
|
120
|
+
url,
|
|
121
|
+
files=post_params,
|
|
122
|
+
headers=headers,
|
|
123
|
+
timeout=_request_timeout,
|
|
124
|
+
)
|
|
125
|
+
# Pass a `string` parameter directly in the body to support
|
|
126
|
+
# other content types than JSON when `body` argument is
|
|
127
|
+
# provided in serialized form.
|
|
128
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
|
129
|
+
r = self.session.request(
|
|
130
|
+
method,
|
|
131
|
+
url,
|
|
132
|
+
data=body,
|
|
133
|
+
headers=headers,
|
|
134
|
+
timeout=_request_timeout,
|
|
135
|
+
)
|
|
136
|
+
elif headers["Content-Type"].startswith("text/") and isinstance(body, bool):
|
|
137
|
+
request_body = "true" if body else "false"
|
|
138
|
+
r = self.session.request(
|
|
139
|
+
method,
|
|
140
|
+
url,
|
|
141
|
+
data=request_body,
|
|
142
|
+
headers=headers,
|
|
143
|
+
timeout=_request_timeout,
|
|
144
|
+
)
|
|
145
|
+
else:
|
|
146
|
+
# Cannot generate the request from given parameters
|
|
147
|
+
msg = """Cannot prepare a request message for provided
|
|
148
|
+
arguments. Please check that your arguments match
|
|
149
|
+
declared content type."""
|
|
150
|
+
raise ApiException(status=0, reason=msg)
|
|
151
|
+
# For `GET`, `HEAD`
|
|
152
|
+
else:
|
|
153
|
+
r = self.session.request(
|
|
154
|
+
method,
|
|
155
|
+
url,
|
|
156
|
+
params={},
|
|
157
|
+
headers=headers,
|
|
158
|
+
timeout=_request_timeout,
|
|
159
|
+
)
|
|
160
|
+
except requests.exceptions.SSLError as e:
|
|
161
|
+
msg = "\n".join([type(e).__name__, str(e)])
|
|
162
|
+
raise ApiException(status=0, reason=msg)
|
|
163
|
+
|
|
164
|
+
return RESTResponse(r)
|