stackit-serverbackup 0.0.1a0__tar.gz → 0.2.0__tar.gz

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.
Files changed (30) hide show
  1. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/PKG-INFO +1 -1
  2. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/pyproject.toml +4 -1
  3. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/__init__.py +7 -0
  4. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/api/default_api.py +232 -0
  5. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/configuration.py +28 -1
  6. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/__init__.py +7 -0
  7. stackit_serverbackup-0.2.0/src/stackit/serverbackup/models/backup_policy.py +109 -0
  8. stackit_serverbackup-0.2.0/src/stackit/serverbackup/models/backup_policy_backup_properties.py +83 -0
  9. stackit_serverbackup-0.2.0/src/stackit/serverbackup/models/get_backup_policies_response.py +97 -0
  10. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/README.md +0 -0
  11. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/api/__init__.py +0 -0
  12. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/api_client.py +0 -0
  13. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/api_response.py +0 -0
  14. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/exceptions.py +0 -0
  15. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/backup.py +0 -0
  16. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/backup_job.py +0 -0
  17. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/backup_properties.py +0 -0
  18. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/backup_schedule.py +0 -0
  19. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/backup_volume_backups_inner.py +0 -0
  20. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/create_backup_payload.py +0 -0
  21. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/create_backup_schedule_payload.py +0 -0
  22. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/enable_service_payload.py +0 -0
  23. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/enable_service_resource_payload.py +0 -0
  24. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/get_backup_schedules_response.py +0 -0
  25. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/get_backups_list_response.py +0 -0
  26. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/restore_backup_payload.py +0 -0
  27. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/restore_volume_backup_payload.py +0 -0
  28. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/models/update_backup_schedule_payload.py +0 -0
  29. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/py.typed +0 -0
  30. {stackit_serverbackup-0.0.1a0 → stackit_serverbackup-0.2.0}/src/stackit/serverbackup/rest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stackit-serverbackup
3
- Version: 0.0.1a0
3
+ Version: 0.2.0
4
4
  Summary: STACKIT Server Backup Management API
5
5
  Author: STACKIT Developer Tools
6
6
  Author-email: developer-tools@stackit.cloud
@@ -1,6 +1,9 @@
1
+ [project]
2
+ name = "stackit-serverbackup"
3
+
1
4
  [tool.poetry]
2
5
  name = "stackit-serverbackup"
3
- version = "v0.0.1a"
6
+ version = "v0.2.0"
4
7
  authors = [
5
8
  "STACKIT Developer Tools <developer-tools@stackit.cloud>",
6
9
  ]
@@ -36,6 +36,10 @@ from stackit.serverbackup.exceptions import (
36
36
  # import models into sdk package
37
37
  from stackit.serverbackup.models.backup import Backup
38
38
  from stackit.serverbackup.models.backup_job import BackupJob
39
+ from stackit.serverbackup.models.backup_policy import BackupPolicy
40
+ from stackit.serverbackup.models.backup_policy_backup_properties import (
41
+ BackupPolicyBackupProperties,
42
+ )
39
43
  from stackit.serverbackup.models.backup_properties import BackupProperties
40
44
  from stackit.serverbackup.models.backup_schedule import BackupSchedule
41
45
  from stackit.serverbackup.models.backup_volume_backups_inner import (
@@ -49,6 +53,9 @@ from stackit.serverbackup.models.enable_service_payload import EnableServicePayl
49
53
  from stackit.serverbackup.models.enable_service_resource_payload import (
50
54
  EnableServiceResourcePayload,
51
55
  )
56
+ from stackit.serverbackup.models.get_backup_policies_response import (
57
+ GetBackupPoliciesResponse,
58
+ )
52
59
  from stackit.serverbackup.models.get_backup_schedules_response import (
53
60
  GetBackupSchedulesResponse,
54
61
  )
@@ -32,6 +32,9 @@ from stackit.serverbackup.models.enable_service_payload import EnableServicePayl
32
32
  from stackit.serverbackup.models.enable_service_resource_payload import (
33
33
  EnableServiceResourcePayload,
34
34
  )
35
+ from stackit.serverbackup.models.get_backup_policies_response import (
36
+ GetBackupPoliciesResponse,
37
+ )
35
38
  from stackit.serverbackup.models.get_backup_schedules_response import (
36
39
  GetBackupSchedulesResponse,
37
40
  )
@@ -2888,6 +2891,235 @@ class DefaultApi:
2888
2891
  _request_auth=_request_auth,
2889
2892
  )
2890
2893
 
2894
+ @validate_call
2895
+ def list_backup_policies(
2896
+ self,
2897
+ project_id: Annotated[StrictStr, Field(description="project id")],
2898
+ _request_timeout: Union[
2899
+ None,
2900
+ Annotated[StrictFloat, Field(gt=0)],
2901
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2902
+ ] = None,
2903
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2904
+ _content_type: Optional[StrictStr] = None,
2905
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2906
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2907
+ ) -> GetBackupPoliciesResponse:
2908
+ """get list of backup policies
2909
+
2910
+
2911
+ :param project_id: project id (required)
2912
+ :type project_id: str
2913
+ :param _request_timeout: timeout setting for this request. If one
2914
+ number provided, it will be total request
2915
+ timeout. It can also be a pair (tuple) of
2916
+ (connection, read) timeouts.
2917
+ :type _request_timeout: int, tuple(int, int), optional
2918
+ :param _request_auth: set to override the auth_settings for an a single
2919
+ request; this effectively ignores the
2920
+ authentication in the spec for a single request.
2921
+ :type _request_auth: dict, optional
2922
+ :param _content_type: force content-type for the request.
2923
+ :type _content_type: str, Optional
2924
+ :param _headers: set to override the headers for a single
2925
+ request; this effectively ignores the headers
2926
+ in the spec for a single request.
2927
+ :type _headers: dict, optional
2928
+ :param _host_index: set to override the host_index for a single
2929
+ request; this effectively ignores the host_index
2930
+ in the spec for a single request.
2931
+ :type _host_index: int, optional
2932
+ :return: Returns the result object.
2933
+ """ # noqa: E501 docstring might be too long
2934
+
2935
+ _param = self._list_backup_policies_serialize(
2936
+ project_id=project_id,
2937
+ _request_auth=_request_auth,
2938
+ _content_type=_content_type,
2939
+ _headers=_headers,
2940
+ _host_index=_host_index,
2941
+ )
2942
+
2943
+ _response_types_map: Dict[str, Optional[str]] = {
2944
+ "200": "GetBackupPoliciesResponse",
2945
+ "400": None,
2946
+ "404": None,
2947
+ }
2948
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
2949
+ response_data.read()
2950
+ return self.api_client.response_deserialize(
2951
+ response_data=response_data,
2952
+ response_types_map=_response_types_map,
2953
+ ).data
2954
+
2955
+ @validate_call
2956
+ def list_backup_policies_with_http_info(
2957
+ self,
2958
+ project_id: Annotated[StrictStr, Field(description="project id")],
2959
+ _request_timeout: Union[
2960
+ None,
2961
+ Annotated[StrictFloat, Field(gt=0)],
2962
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
2963
+ ] = None,
2964
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2965
+ _content_type: Optional[StrictStr] = None,
2966
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2967
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2968
+ ) -> ApiResponse[GetBackupPoliciesResponse]:
2969
+ """get list of backup policies
2970
+
2971
+
2972
+ :param project_id: project id (required)
2973
+ :type project_id: str
2974
+ :param _request_timeout: timeout setting for this request. If one
2975
+ number provided, it will be total request
2976
+ timeout. It can also be a pair (tuple) of
2977
+ (connection, read) timeouts.
2978
+ :type _request_timeout: int, tuple(int, int), optional
2979
+ :param _request_auth: set to override the auth_settings for an a single
2980
+ request; this effectively ignores the
2981
+ authentication in the spec for a single request.
2982
+ :type _request_auth: dict, optional
2983
+ :param _content_type: force content-type for the request.
2984
+ :type _content_type: str, Optional
2985
+ :param _headers: set to override the headers for a single
2986
+ request; this effectively ignores the headers
2987
+ in the spec for a single request.
2988
+ :type _headers: dict, optional
2989
+ :param _host_index: set to override the host_index for a single
2990
+ request; this effectively ignores the host_index
2991
+ in the spec for a single request.
2992
+ :type _host_index: int, optional
2993
+ :return: Returns the result object.
2994
+ """ # noqa: E501 docstring might be too long
2995
+
2996
+ _param = self._list_backup_policies_serialize(
2997
+ project_id=project_id,
2998
+ _request_auth=_request_auth,
2999
+ _content_type=_content_type,
3000
+ _headers=_headers,
3001
+ _host_index=_host_index,
3002
+ )
3003
+
3004
+ _response_types_map: Dict[str, Optional[str]] = {
3005
+ "200": "GetBackupPoliciesResponse",
3006
+ "400": None,
3007
+ "404": None,
3008
+ }
3009
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3010
+ response_data.read()
3011
+ return self.api_client.response_deserialize(
3012
+ response_data=response_data,
3013
+ response_types_map=_response_types_map,
3014
+ )
3015
+
3016
+ @validate_call
3017
+ def list_backup_policies_without_preload_content(
3018
+ self,
3019
+ project_id: Annotated[StrictStr, Field(description="project id")],
3020
+ _request_timeout: Union[
3021
+ None,
3022
+ Annotated[StrictFloat, Field(gt=0)],
3023
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
3024
+ ] = None,
3025
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3026
+ _content_type: Optional[StrictStr] = None,
3027
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3028
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3029
+ ) -> RESTResponseType:
3030
+ """get list of backup policies
3031
+
3032
+
3033
+ :param project_id: project id (required)
3034
+ :type project_id: str
3035
+ :param _request_timeout: timeout setting for this request. If one
3036
+ number provided, it will be total request
3037
+ timeout. It can also be a pair (tuple) of
3038
+ (connection, read) timeouts.
3039
+ :type _request_timeout: int, tuple(int, int), optional
3040
+ :param _request_auth: set to override the auth_settings for an a single
3041
+ request; this effectively ignores the
3042
+ authentication in the spec for a single request.
3043
+ :type _request_auth: dict, optional
3044
+ :param _content_type: force content-type for the request.
3045
+ :type _content_type: str, Optional
3046
+ :param _headers: set to override the headers for a single
3047
+ request; this effectively ignores the headers
3048
+ in the spec for a single request.
3049
+ :type _headers: dict, optional
3050
+ :param _host_index: set to override the host_index for a single
3051
+ request; this effectively ignores the host_index
3052
+ in the spec for a single request.
3053
+ :type _host_index: int, optional
3054
+ :return: Returns the result object.
3055
+ """ # noqa: E501 docstring might be too long
3056
+
3057
+ _param = self._list_backup_policies_serialize(
3058
+ project_id=project_id,
3059
+ _request_auth=_request_auth,
3060
+ _content_type=_content_type,
3061
+ _headers=_headers,
3062
+ _host_index=_host_index,
3063
+ )
3064
+
3065
+ _response_types_map: Dict[str, Optional[str]] = {
3066
+ "200": "GetBackupPoliciesResponse",
3067
+ "400": None,
3068
+ "404": None,
3069
+ }
3070
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
3071
+ return response_data.response
3072
+
3073
+ def _list_backup_policies_serialize(
3074
+ self,
3075
+ project_id,
3076
+ _request_auth,
3077
+ _content_type,
3078
+ _headers,
3079
+ _host_index,
3080
+ ) -> RequestSerialized:
3081
+
3082
+ _host = None
3083
+
3084
+ _collection_formats: Dict[str, str] = {}
3085
+
3086
+ _path_params: Dict[str, str] = {}
3087
+ _query_params: List[Tuple[str, str]] = []
3088
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3089
+ _form_params: List[Tuple[str, str]] = []
3090
+ _files: Dict[str, Union[str, bytes]] = {}
3091
+ _body_params: Optional[bytes] = None
3092
+
3093
+ # process the path parameters
3094
+ if project_id is not None:
3095
+ _path_params["projectId"] = project_id
3096
+ # process the query parameters
3097
+ # process the header parameters
3098
+ # process the form parameters
3099
+ # process the body parameter
3100
+
3101
+ # set the HTTP header `Accept`
3102
+ if "Accept" not in _header_params:
3103
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
3104
+
3105
+ # authentication setting
3106
+ _auth_settings: List[str] = []
3107
+
3108
+ return self.api_client.param_serialize(
3109
+ method="GET",
3110
+ resource_path="/v1/projects/{projectId}/backup-policies",
3111
+ path_params=_path_params,
3112
+ query_params=_query_params,
3113
+ header_params=_header_params,
3114
+ body=_body_params,
3115
+ post_params=_form_params,
3116
+ files=_files,
3117
+ auth_settings=_auth_settings,
3118
+ collection_formats=_collection_formats,
3119
+ _host=_host,
3120
+ _request_auth=_request_auth,
3121
+ )
3122
+
2891
3123
  @validate_call
2892
3124
  def list_backup_schedules(
2893
3125
  self,
@@ -12,6 +12,8 @@
12
12
  Do not edit the class manually.
13
13
  """ # noqa: E501 docstring might be too long
14
14
 
15
+ import os
16
+
15
17
 
16
18
  class HostConfiguration:
17
19
  def __init__(
@@ -23,7 +25,14 @@ class HostConfiguration:
23
25
  server_operation_variables=None,
24
26
  ignore_operation_servers=False,
25
27
  ) -> None:
26
- """Constructor"""
28
+ print(
29
+ "WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n",
30
+ "as a function argument instead of being set in the client configuration.\n"
31
+ "Once all services have migrated, the methods to specify the region in the client configuration "
32
+ "will be removed.",
33
+ )
34
+ """Constructor
35
+ """
27
36
  self._base_path = "https://server-backup.api.eu01.stackit.cloud"
28
37
  """Default Base url
29
38
  """
@@ -65,6 +74,7 @@ class HostConfiguration:
65
74
  :param index: array index of the host settings
66
75
  :param variables: hash of variable and the corresponding value
67
76
  :param servers: an array of host settings or None
77
+ :error: if a region is given for a global url
68
78
  :return: URL based on host settings
69
79
  """
70
80
  if index is None:
@@ -83,8 +93,25 @@ class HostConfiguration:
83
93
 
84
94
  url = server["url"]
85
95
 
96
+ # check if environment variable was provided for region
97
+ # if nothing was set this is None
98
+ region_env = os.environ.get("STACKIT_REGION")
99
+
86
100
  # go through variables and replace placeholders
87
101
  for variable_name, variable in server.get("variables", {}).items():
102
+ # If a region is provided by the user for a global url
103
+ # return an error (except for providing via environment variable).
104
+ # The region is provided as a function argument instead of being set in the client configuration.
105
+ if (
106
+ variable_name == "region"
107
+ and (variable["default_value"] == "global" or variable["default_value"] == "")
108
+ and region_env is None
109
+ and variables.get(variable_name) is not None
110
+ ):
111
+ raise ValueError(
112
+ "this API does not support setting a region in the the client configuration, "
113
+ "please check if the region can be specified as a function parameter"
114
+ )
88
115
  used_value = variables.get(variable_name, variable["default_value"])
89
116
 
90
117
  if "enum_values" in variable and used_value not in variable["enum_values"]:
@@ -17,6 +17,10 @@
17
17
  # import models into model package
18
18
  from stackit.serverbackup.models.backup import Backup
19
19
  from stackit.serverbackup.models.backup_job import BackupJob
20
+ from stackit.serverbackup.models.backup_policy import BackupPolicy
21
+ from stackit.serverbackup.models.backup_policy_backup_properties import (
22
+ BackupPolicyBackupProperties,
23
+ )
20
24
  from stackit.serverbackup.models.backup_properties import BackupProperties
21
25
  from stackit.serverbackup.models.backup_schedule import BackupSchedule
22
26
  from stackit.serverbackup.models.backup_volume_backups_inner import (
@@ -30,6 +34,9 @@ from stackit.serverbackup.models.enable_service_payload import EnableServicePayl
30
34
  from stackit.serverbackup.models.enable_service_resource_payload import (
31
35
  EnableServiceResourcePayload,
32
36
  )
37
+ from stackit.serverbackup.models.get_backup_policies_response import (
38
+ GetBackupPoliciesResponse,
39
+ )
33
40
  from stackit.serverbackup.models.get_backup_schedules_response import (
34
41
  GetBackupSchedulesResponse,
35
42
  )
@@ -0,0 +1,109 @@
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_policy_backup_properties import (
25
+ BackupPolicyBackupProperties,
26
+ )
27
+
28
+
29
+ class BackupPolicy(BaseModel):
30
+ """
31
+ BackupPolicy
32
+ """
33
+
34
+ backup_properties: Optional[BackupPolicyBackupProperties] = Field(default=None, alias="backupProperties")
35
+ default: Optional[StrictBool] = None
36
+ description: Optional[StrictStr] = None
37
+ enabled: Optional[StrictBool] = None
38
+ id: Optional[StrictStr] = None
39
+ name: Optional[StrictStr] = None
40
+ rrule: Optional[StrictStr] = None
41
+ __properties: ClassVar[List[str]] = ["backupProperties", "default", "description", "enabled", "id", "name", "rrule"]
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
+ return json.dumps(self.to_dict())
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of BackupPolicy from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
72
+ """
73
+ excluded_fields: Set[str] = set([])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # override the default output from pydantic by calling `to_dict()` of backup_properties
81
+ if self.backup_properties:
82
+ _dict["backupProperties"] = self.backup_properties.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 BackupPolicy 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
+ "backupProperties": (
97
+ BackupPolicyBackupProperties.from_dict(obj["backupProperties"])
98
+ if obj.get("backupProperties") is not None
99
+ else None
100
+ ),
101
+ "default": obj.get("default"),
102
+ "description": obj.get("description"),
103
+ "enabled": obj.get("enabled"),
104
+ "id": obj.get("id"),
105
+ "name": obj.get("name"),
106
+ "rrule": obj.get("rrule"),
107
+ }
108
+ )
109
+ return _obj
@@ -0,0 +1,83 @@
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, StrictInt, StrictStr
22
+ from typing_extensions import Self
23
+
24
+
25
+ class BackupPolicyBackupProperties(BaseModel):
26
+ """
27
+ BackupPolicyBackupProperties
28
+ """
29
+
30
+ name: Optional[StrictStr] = None
31
+ retention_period: Optional[StrictInt] = Field(default=None, alias="retentionPeriod")
32
+ __properties: ClassVar[List[str]] = ["name", "retentionPeriod"]
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 BackupPolicyBackupProperties 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 BackupPolicyBackupProperties 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({"name": obj.get("name"), "retentionPeriod": obj.get("retentionPeriod")})
83
+ return _obj
@@ -0,0 +1,97 @@
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_policy import BackupPolicy
25
+
26
+
27
+ class GetBackupPoliciesResponse(BaseModel):
28
+ """
29
+ GetBackupPoliciesResponse
30
+ """
31
+
32
+ items: Optional[List[BackupPolicy]] = 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 GetBackupPoliciesResponse 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 GetBackupPoliciesResponse 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
+ {
92
+ "items": (
93
+ [BackupPolicy.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None
94
+ )
95
+ }
96
+ )
97
+ return _obj