stackit-serverbackup 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/serverbackup/__init__.py +62 -0
- stackit/serverbackup/api/__init__.py +4 -0
- stackit/serverbackup/api/default_api.py +4224 -0
- stackit/serverbackup/api_client.py +627 -0
- stackit/serverbackup/api_response.py +23 -0
- stackit/serverbackup/configuration.py +112 -0
- stackit/serverbackup/exceptions.py +199 -0
- stackit/serverbackup/models/__init__.py +43 -0
- stackit/serverbackup/models/backup.py +145 -0
- stackit/serverbackup/models/backup_job.py +82 -0
- stackit/serverbackup/models/backup_properties.py +88 -0
- stackit/serverbackup/models/backup_schedule.py +103 -0
- stackit/serverbackup/models/backup_volume_backups_inner.py +110 -0
- stackit/serverbackup/models/create_backup_payload.py +88 -0
- stackit/serverbackup/models/create_backup_schedule_payload.py +101 -0
- stackit/serverbackup/models/enable_service_payload.py +82 -0
- stackit/serverbackup/models/enable_service_resource_payload.py +82 -0
- stackit/serverbackup/models/get_backup_schedules_response.py +99 -0
- stackit/serverbackup/models/get_backups_list_response.py +93 -0
- stackit/serverbackup/models/restore_backup_payload.py +85 -0
- stackit/serverbackup/models/restore_volume_backup_payload.py +82 -0
- stackit/serverbackup/models/update_backup_schedule_payload.py +101 -0
- stackit/serverbackup/py.typed +0 -0
- stackit/serverbackup/rest.py +149 -0
- stackit_serverbackup-0.0.1a0.dist-info/METADATA +44 -0
- stackit_serverbackup-0.0.1a0.dist-info/RECORD +27 -0
- stackit_serverbackup-0.0.1a0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Server Backup Management API
|
|
5
|
+
|
|
6
|
+
API endpoints for Server Backup Operations on STACKIT Servers.
|
|
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 docstring might be too long
|
|
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 typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
from stackit.serverbackup.models.backup import Backup
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class GetBackupsListResponse(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
GetBackupsListResponse
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
items: Optional[List[Backup]] = None
|
|
33
|
+
__properties: ClassVar[List[str]] = ["items"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
48
|
+
return json.dumps(self.to_dict())
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
52
|
+
"""Create an instance of GetBackupsListResponse 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
|
+
"""
|
|
65
|
+
excluded_fields: Set[str] = set([])
|
|
66
|
+
|
|
67
|
+
_dict = self.model_dump(
|
|
68
|
+
by_alias=True,
|
|
69
|
+
exclude=excluded_fields,
|
|
70
|
+
exclude_none=True,
|
|
71
|
+
)
|
|
72
|
+
# override the default output from pydantic by calling `to_dict()` of each item in items (list)
|
|
73
|
+
_items = []
|
|
74
|
+
if self.items:
|
|
75
|
+
for _item in self.items:
|
|
76
|
+
if _item:
|
|
77
|
+
_items.append(_item.to_dict())
|
|
78
|
+
_dict["items"] = _items
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of GetBackupsListResponse from a dict"""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(obj, dict):
|
|
88
|
+
return cls.model_validate(obj)
|
|
89
|
+
|
|
90
|
+
_obj = cls.model_validate(
|
|
91
|
+
{"items": [Backup.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None}
|
|
92
|
+
)
|
|
93
|
+
return _obj
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Server Backup Management API
|
|
5
|
+
|
|
6
|
+
API endpoints for Server Backup Operations on STACKIT Servers.
|
|
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 docstring might be too long
|
|
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, Field, StrictBool, StrictStr
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class RestoreBackupPayload(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
RestoreBackupPayload
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
start_server_after_restore: StrictBool = Field(alias="startServerAfterRestore")
|
|
31
|
+
volume_ids: Optional[List[StrictStr]] = Field(default=None, alias="volumeIds")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["startServerAfterRestore", "volumeIds"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
populate_by_name=True,
|
|
36
|
+
validate_assignment=True,
|
|
37
|
+
protected_namespaces=(),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of RestoreBackupPayload from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
return _dict
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of RestoreBackupPayload from a dict"""
|
|
76
|
+
if obj is None:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
if not isinstance(obj, dict):
|
|
80
|
+
return cls.model_validate(obj)
|
|
81
|
+
|
|
82
|
+
_obj = cls.model_validate(
|
|
83
|
+
{"startServerAfterRestore": obj.get("startServerAfterRestore"), "volumeIds": obj.get("volumeIds")}
|
|
84
|
+
)
|
|
85
|
+
return _obj
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Server Backup Management API
|
|
5
|
+
|
|
6
|
+
API endpoints for Server Backup Operations on STACKIT Servers.
|
|
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 docstring might be too long
|
|
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, Field, StrictStr
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class RestoreVolumeBackupPayload(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
RestoreVolumeBackupPayload
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
restore_volume_id: StrictStr = Field(alias="restoreVolumeId")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["restoreVolumeId"]
|
|
32
|
+
|
|
33
|
+
model_config = ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
def to_str(self) -> str:
|
|
40
|
+
"""Returns the string representation of the model using alias"""
|
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
42
|
+
|
|
43
|
+
def to_json(self) -> str:
|
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
46
|
+
return json.dumps(self.to_dict())
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
50
|
+
"""Create an instance of RestoreVolumeBackupPayload from a JSON string"""
|
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
|
52
|
+
|
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
|
55
|
+
|
|
56
|
+
This has the following differences from calling pydantic's
|
|
57
|
+
`self.model_dump(by_alias=True)`:
|
|
58
|
+
|
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
|
60
|
+
were set at model initialization. Other fields with value `None`
|
|
61
|
+
are ignored.
|
|
62
|
+
"""
|
|
63
|
+
excluded_fields: Set[str] = set([])
|
|
64
|
+
|
|
65
|
+
_dict = self.model_dump(
|
|
66
|
+
by_alias=True,
|
|
67
|
+
exclude=excluded_fields,
|
|
68
|
+
exclude_none=True,
|
|
69
|
+
)
|
|
70
|
+
return _dict
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
74
|
+
"""Create an instance of RestoreVolumeBackupPayload from a dict"""
|
|
75
|
+
if obj is None:
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
if not isinstance(obj, dict):
|
|
79
|
+
return cls.model_validate(obj)
|
|
80
|
+
|
|
81
|
+
_obj = cls.model_validate({"restoreVolumeId": obj.get("restoreVolumeId")})
|
|
82
|
+
return _obj
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Server Backup Management API
|
|
5
|
+
|
|
6
|
+
API endpoints for Server Backup Operations on STACKIT Servers.
|
|
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 docstring might be too long
|
|
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, Field, StrictBool, StrictStr
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
from stackit.serverbackup.models.backup_properties import BackupProperties
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class UpdateBackupSchedulePayload(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
UpdateBackupSchedulePayload
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
backup_properties: Optional[BackupProperties] = Field(default=None, alias="backupProperties")
|
|
33
|
+
enabled: StrictBool
|
|
34
|
+
name: StrictStr = Field(description="Max 255 characters")
|
|
35
|
+
rrule: StrictStr
|
|
36
|
+
__properties: ClassVar[List[str]] = ["backupProperties", "enabled", "name", "rrule"]
|
|
37
|
+
|
|
38
|
+
model_config = ConfigDict(
|
|
39
|
+
populate_by_name=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
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
51
|
+
return json.dumps(self.to_dict())
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
+
"""Create an instance of UpdateBackupSchedulePayload 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 backup_properties
|
|
76
|
+
if self.backup_properties:
|
|
77
|
+
_dict["backupProperties"] = self.backup_properties.to_dict()
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of UpdateBackupSchedulePayload 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(
|
|
90
|
+
{
|
|
91
|
+
"backupProperties": (
|
|
92
|
+
BackupProperties.from_dict(obj["backupProperties"])
|
|
93
|
+
if obj.get("backupProperties") is not None
|
|
94
|
+
else None
|
|
95
|
+
),
|
|
96
|
+
"enabled": obj.get("enabled"),
|
|
97
|
+
"name": obj.get("name"),
|
|
98
|
+
"rrule": obj.get("rrule"),
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
return _obj
|
|
File without changes
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Server Backup Management API
|
|
5
|
+
|
|
6
|
+
API endpoints for Server Backup Operations on STACKIT Servers.
|
|
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 docstring might be too long
|
|
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.serverbackup.exceptions import ApiException, ApiValueError
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
RESTResponseType = requests.Response
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class RESTResponse(io.IOBase):
|
|
30
|
+
|
|
31
|
+
def __init__(self, resp) -> None:
|
|
32
|
+
self.response = resp
|
|
33
|
+
self.status = resp.status_code
|
|
34
|
+
self.reason = resp.reason
|
|
35
|
+
self.data = None
|
|
36
|
+
|
|
37
|
+
def read(self):
|
|
38
|
+
if self.data is None:
|
|
39
|
+
self.data = self.response.content
|
|
40
|
+
return self.data
|
|
41
|
+
|
|
42
|
+
def getheaders(self):
|
|
43
|
+
"""Returns a dictionary of the response headers."""
|
|
44
|
+
return self.response.headers
|
|
45
|
+
|
|
46
|
+
def getheader(self, name, default=None):
|
|
47
|
+
"""Returns a given response header."""
|
|
48
|
+
return self.response.headers.get(name, default)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class RESTClientObject:
|
|
52
|
+
def __init__(self, config: Configuration) -> None:
|
|
53
|
+
self.session = config.custom_http_session if config.custom_http_session else requests.Session()
|
|
54
|
+
authorization = Authorization(config)
|
|
55
|
+
self.session.auth = authorization.auth_method
|
|
56
|
+
|
|
57
|
+
def request(self, method, url, headers=None, body=None, post_params=None, _request_timeout=None):
|
|
58
|
+
"""Perform requests.
|
|
59
|
+
|
|
60
|
+
:param method: http request method
|
|
61
|
+
:param url: http request url
|
|
62
|
+
:param headers: http request headers
|
|
63
|
+
:param body: request json body, for `application/json`
|
|
64
|
+
:param post_params: request post parameters,
|
|
65
|
+
`application/x-www-form-urlencoded`
|
|
66
|
+
and `multipart/form-data`
|
|
67
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
68
|
+
number provided, it will be total request
|
|
69
|
+
timeout. It can also be a pair (tuple) of
|
|
70
|
+
(connection, read) timeouts.
|
|
71
|
+
"""
|
|
72
|
+
method = method.upper()
|
|
73
|
+
if method not in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"]:
|
|
74
|
+
raise ValueError("Method %s not allowed", method)
|
|
75
|
+
|
|
76
|
+
if post_params and body:
|
|
77
|
+
raise ApiValueError("body parameter cannot be used with post_params parameter.")
|
|
78
|
+
|
|
79
|
+
post_params = post_params or {}
|
|
80
|
+
headers = headers or {}
|
|
81
|
+
|
|
82
|
+
try:
|
|
83
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
84
|
+
if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
|
|
85
|
+
|
|
86
|
+
# no content type provided or payload is json
|
|
87
|
+
content_type = headers.get("Content-Type")
|
|
88
|
+
if not content_type or re.search("json", content_type, re.IGNORECASE):
|
|
89
|
+
request_body = None
|
|
90
|
+
if body is not None:
|
|
91
|
+
request_body = json.dumps(body)
|
|
92
|
+
r = self.session.request(
|
|
93
|
+
method,
|
|
94
|
+
url,
|
|
95
|
+
data=request_body,
|
|
96
|
+
headers=headers,
|
|
97
|
+
)
|
|
98
|
+
elif content_type == "application/x-www-form-urlencoded":
|
|
99
|
+
r = self.session.request(
|
|
100
|
+
method,
|
|
101
|
+
url,
|
|
102
|
+
params=post_params,
|
|
103
|
+
headers=headers,
|
|
104
|
+
)
|
|
105
|
+
elif content_type == "multipart/form-data":
|
|
106
|
+
# must del headers['Content-Type'], or the correct
|
|
107
|
+
# Content-Type which generated by urllib3 will be
|
|
108
|
+
# overwritten.
|
|
109
|
+
del headers["Content-Type"]
|
|
110
|
+
# Ensures that dict objects are serialized
|
|
111
|
+
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a, b) for a, b in post_params]
|
|
112
|
+
r = self.session.request(
|
|
113
|
+
method,
|
|
114
|
+
url,
|
|
115
|
+
files=post_params,
|
|
116
|
+
headers=headers,
|
|
117
|
+
)
|
|
118
|
+
# Pass a `string` parameter directly in the body to support
|
|
119
|
+
# other content types than JSON when `body` argument is
|
|
120
|
+
# provided in serialized form.
|
|
121
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
|
122
|
+
r = self.session.request(
|
|
123
|
+
method,
|
|
124
|
+
url,
|
|
125
|
+
data=body,
|
|
126
|
+
headers=headers,
|
|
127
|
+
)
|
|
128
|
+
elif headers["Content-Type"] == "text/plain" and isinstance(body, bool):
|
|
129
|
+
request_body = "true" if body else "false"
|
|
130
|
+
r = self.session.request(method, url, data=request_body, headers=headers)
|
|
131
|
+
else:
|
|
132
|
+
# Cannot generate the request from given parameters
|
|
133
|
+
msg = """Cannot prepare a request message for provided
|
|
134
|
+
arguments. Please check that your arguments match
|
|
135
|
+
declared content type."""
|
|
136
|
+
raise ApiException(status=0, reason=msg)
|
|
137
|
+
# For `GET`, `HEAD`
|
|
138
|
+
else:
|
|
139
|
+
r = self.session.request(
|
|
140
|
+
method,
|
|
141
|
+
url,
|
|
142
|
+
params={},
|
|
143
|
+
headers=headers,
|
|
144
|
+
)
|
|
145
|
+
except requests.exceptions.SSLError as e:
|
|
146
|
+
msg = "\n".join([type(e).__name__, str(e)])
|
|
147
|
+
raise ApiException(status=0, reason=msg)
|
|
148
|
+
|
|
149
|
+
return RESTResponse(r)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: stackit-serverbackup
|
|
3
|
+
Version: 0.0.1a0
|
|
4
|
+
Summary: STACKIT Server Backup Management API
|
|
5
|
+
Author: STACKIT Developer Tools
|
|
6
|
+
Author-email: developer-tools@stackit.cloud
|
|
7
|
+
Requires-Python: >=3.8,<4.0
|
|
8
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Dist: pydantic (>=2.9.2)
|
|
18
|
+
Requires-Dist: python-dateutil (>=2.9.0.post0)
|
|
19
|
+
Requires-Dist: requests (>=2.32.3)
|
|
20
|
+
Requires-Dist: stackit-core (>=0.0.1a)
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# stackit.serverbackup
|
|
24
|
+
API endpoints for Server Backup Operations on STACKIT Servers.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
This package is part of the STACKIT Python SDK. For additional information, please visit the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-python) of the SDK.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Installation & Usage
|
|
31
|
+
### pip install
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
pip install stackit-serverbackup
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then import the package:
|
|
38
|
+
```python
|
|
39
|
+
import stackit.serverbackup
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Getting Started
|
|
43
|
+
|
|
44
|
+
[Examples](https://github.com/stackitcloud/stackit-sdk-python/tree/main/examples) for the usage of the package can be found in the [GitHub repository](https://github.com/stackitcloud/stackit-sdk-python) of the SDK.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
stackit/serverbackup/__init__.py,sha256=flLO2FX-BS47IIBeWOI6vquCnaMsiXvtJWy3cYwdAEY,2127
|
|
2
|
+
stackit/serverbackup/api/__init__.py,sha256=4gnwP89FX1nQYLr9Mg7TDzyxbWvl2JNyavFrb9moimM,107
|
|
3
|
+
stackit/serverbackup/api/default_api.py,sha256=JW4ZaKpmx2TPwu0pTD_SpdWqSxkTg9NvjEHtBjNGsU4,183191
|
|
4
|
+
stackit/serverbackup/api_client.py,sha256=JSxSMcTubxw69Nbk-mucWm1HRjg2oTkdZgz1fqM_cJs,22755
|
|
5
|
+
stackit/serverbackup/api_response.py,sha256=HRYkVqMNIlfODacTQPTbiVj2YdcnutpQrKJdeAoCSpM,642
|
|
6
|
+
stackit/serverbackup/configuration.py,sha256=isWE7YCCuRSuHSw6EL4YOryiL94zGYxpIEgtc-JBWnA,3877
|
|
7
|
+
stackit/serverbackup/exceptions.py,sha256=vjtVdAr-XQTib-d5nUzxA4MHYVghrEZgbUkMQvHwcQg,5964
|
|
8
|
+
stackit/serverbackup/models/__init__.py,sha256=VRbDIeY0XdFYkddneiRjFaDLjvP43pW2u72WG0WZK_4,1651
|
|
9
|
+
stackit/serverbackup/models/backup.py,sha256=KqI1erxHPFUuC85j79y3cdgaHu_6oxUdZb6UJXQdnMU,4655
|
|
10
|
+
stackit/serverbackup/models/backup_job.py,sha256=tSAX7wYFIkFCCO3nm27Mmm5cRtih9RPJCIuOjHignKw,2400
|
|
11
|
+
stackit/serverbackup/models/backup_properties.py,sha256=HrHAzvRx26IKYjgwMgTMFWzdtS-D9NdQ84LTVAJVxgw,2883
|
|
12
|
+
stackit/serverbackup/models/backup_schedule.py,sha256=1SKnNIoK4JCv3JgPAJgpzveiFTjYy-qsq8WKQBZS6NY,3347
|
|
13
|
+
stackit/serverbackup/models/backup_volume_backups_inner.py,sha256=HV593d7EXru7DqqBYyIQIP6wBjT24xiD894ZCYnsy2M,3759
|
|
14
|
+
stackit/serverbackup/models/create_backup_payload.py,sha256=wLj0B-1qFkvbSpMFTvnEDlOgWYEvbIfSXPUSoQyoXFo,2895
|
|
15
|
+
stackit/serverbackup/models/create_backup_schedule_payload.py,sha256=fDAFCwe_K8rh3WG-pHCG1QXVcKnXmZMyPZzLuaHb3sc,3369
|
|
16
|
+
stackit/serverbackup/models/enable_service_payload.py,sha256=y8G95msb_-5JQBWk_cKonoX-RCDvHuShUP8_nGOLe8U,2557
|
|
17
|
+
stackit/serverbackup/models/enable_service_resource_payload.py,sha256=43PUWZoy3d8Ab2cbVWVQCkxF0Jo3T2HJe5_7YljDvX0,2589
|
|
18
|
+
stackit/serverbackup/models/get_backup_schedules_response.py,sha256=vNnmc4WQlXln4XqLt8_vWiwuF27M4M7VFGcCEpl02GI,3083
|
|
19
|
+
stackit/serverbackup/models/get_backups_list_response.py,sha256=ydULDd-a02ujqp-Fe8Cp5ERowoyRHAbSV_GuOfZAcFw,2924
|
|
20
|
+
stackit/serverbackup/models/restore_backup_payload.py,sha256=G-Lvabd0GPlzf8D7sakVrvuNx4gDMgILRLirGW_6aEg,2745
|
|
21
|
+
stackit/serverbackup/models/restore_volume_backup_payload.py,sha256=NSo9b4kx0k4XswnWc1uo4tGTxhJ2qLE79RGnNyJm84M,2562
|
|
22
|
+
stackit/serverbackup/models/update_backup_schedule_payload.py,sha256=C8hsXbzIcGwBir8Xe2TKcOtILRROVSQvSX17i7QhkcY,3369
|
|
23
|
+
stackit/serverbackup/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
+
stackit/serverbackup/rest.py,sha256=1cYtCnzhaaof-FrtXBjvL0Z01DydPjCvdjaYbDTfn9M,5849
|
|
25
|
+
stackit_serverbackup-0.0.1a0.dist-info/METADATA,sha256=3x_pPg61wsseZsqvzZgmcqL1FGvkliKXO9LcO_mAwO4,1529
|
|
26
|
+
stackit_serverbackup-0.0.1a0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
27
|
+
stackit_serverbackup-0.0.1a0.dist-info/RECORD,,
|