stackit-mongodbflex 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.
Files changed (64) hide show
  1. stackit/mongodbflex/__init__.py +103 -0
  2. stackit/mongodbflex/api/__init__.py +4 -0
  3. stackit/mongodbflex/api/default_api.py +6867 -0
  4. stackit/mongodbflex/api_client.py +627 -0
  5. stackit/mongodbflex/api_response.py +23 -0
  6. stackit/mongodbflex/configuration.py +112 -0
  7. stackit/mongodbflex/exceptions.py +199 -0
  8. stackit/mongodbflex/models/__init__.py +84 -0
  9. stackit/mongodbflex/models/acl.py +82 -0
  10. stackit/mongodbflex/models/backup.py +100 -0
  11. stackit/mongodbflex/models/backup_schedule.py +103 -0
  12. stackit/mongodbflex/models/clone_instance_payload.py +83 -0
  13. stackit/mongodbflex/models/clone_instance_response.py +82 -0
  14. stackit/mongodbflex/models/create_instance_payload.py +121 -0
  15. stackit/mongodbflex/models/create_instance_response.py +82 -0
  16. stackit/mongodbflex/models/create_user_payload.py +86 -0
  17. stackit/mongodbflex/models/create_user_response.py +87 -0
  18. stackit/mongodbflex/models/data_point.py +83 -0
  19. stackit/mongodbflex/models/error.py +92 -0
  20. stackit/mongodbflex/models/flavor.py +92 -0
  21. stackit/mongodbflex/models/get_backup_response.py +87 -0
  22. stackit/mongodbflex/models/get_instance_response.py +87 -0
  23. stackit/mongodbflex/models/get_user_response.py +89 -0
  24. stackit/mongodbflex/models/handlers_infra_flavor.py +94 -0
  25. stackit/mongodbflex/models/handlers_infra_get_flavors_response.py +99 -0
  26. stackit/mongodbflex/models/handlers_instances_get_instance_response.py +87 -0
  27. stackit/mongodbflex/models/handlers_instances_slow_queries_response.py +103 -0
  28. stackit/mongodbflex/models/handlers_instances_suggested_indexes_response.py +118 -0
  29. stackit/mongodbflex/models/host.py +101 -0
  30. stackit/mongodbflex/models/host_metric.py +103 -0
  31. stackit/mongodbflex/models/instance.py +128 -0
  32. stackit/mongodbflex/models/instance_list_instance.py +84 -0
  33. stackit/mongodbflex/models/instance_response_user.py +96 -0
  34. stackit/mongodbflex/models/list_backups_response.py +97 -0
  35. stackit/mongodbflex/models/list_flavors_response.py +99 -0
  36. stackit/mongodbflex/models/list_instances_response.py +101 -0
  37. stackit/mongodbflex/models/list_metrics_response.py +93 -0
  38. stackit/mongodbflex/models/list_restore_jobs_response.py +99 -0
  39. stackit/mongodbflex/models/list_storages_response.py +95 -0
  40. stackit/mongodbflex/models/list_user.py +83 -0
  41. stackit/mongodbflex/models/list_users_response.py +99 -0
  42. stackit/mongodbflex/models/list_versions_response.py +82 -0
  43. stackit/mongodbflex/models/mongodbatlas_operation.py +97 -0
  44. stackit/mongodbflex/models/mongodbatlas_stats.py +98 -0
  45. stackit/mongodbflex/models/partial_update_instance_payload.py +121 -0
  46. stackit/mongodbflex/models/partial_update_user_payload.py +83 -0
  47. stackit/mongodbflex/models/restore_instance_payload.py +83 -0
  48. stackit/mongodbflex/models/restore_instance_response.py +89 -0
  49. stackit/mongodbflex/models/restore_instance_status.py +94 -0
  50. stackit/mongodbflex/models/shape.py +122 -0
  51. stackit/mongodbflex/models/slow_query.py +83 -0
  52. stackit/mongodbflex/models/storage.py +83 -0
  53. stackit/mongodbflex/models/storage_range.py +83 -0
  54. stackit/mongodbflex/models/suggested_index.py +102 -0
  55. stackit/mongodbflex/models/update_backup_schedule_payload.py +103 -0
  56. stackit/mongodbflex/models/update_instance_payload.py +121 -0
  57. stackit/mongodbflex/models/update_instance_response.py +87 -0
  58. stackit/mongodbflex/models/update_user_payload.py +83 -0
  59. stackit/mongodbflex/models/user.py +100 -0
  60. stackit/mongodbflex/py.typed +0 -0
  61. stackit/mongodbflex/rest.py +149 -0
  62. stackit_mongodbflex-0.0.1a0.dist-info/METADATA +45 -0
  63. stackit_mongodbflex-0.0.1a0.dist-info/RECORD +64 -0
  64. stackit_mongodbflex-0.0.1a0.dist-info/WHEEL +4 -0
@@ -0,0 +1,87 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MongoDB Service API
5
+
6
+ This is the documentation for the STACKIT MongoDB Flex Service API
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@stackit.cloud
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.mongodbflex.models.instance import Instance
25
+
26
+
27
+ class HandlersInstancesGetInstanceResponse(BaseModel):
28
+ """
29
+ HandlersInstancesGetInstanceResponse
30
+ """
31
+
32
+ item: Optional[Instance] = None
33
+ __properties: ClassVar[List[str]] = ["item"]
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 HandlersInstancesGetInstanceResponse 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 item
73
+ if self.item:
74
+ _dict["item"] = self.item.to_dict()
75
+ return _dict
76
+
77
+ @classmethod
78
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
+ """Create an instance of HandlersInstancesGetInstanceResponse from a dict"""
80
+ if obj is None:
81
+ return None
82
+
83
+ if not isinstance(obj, dict):
84
+ return cls.model_validate(obj)
85
+
86
+ _obj = cls.model_validate({"item": Instance.from_dict(obj["item"]) if obj.get("item") is not None else None})
87
+ return _obj
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MongoDB Service API
5
+
6
+ This is the documentation for the STACKIT MongoDB Flex Service API
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@stackit.cloud
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
22
+ from typing_extensions import Self
23
+
24
+ from stackit.mongodbflex.models.slow_query import SlowQuery
25
+
26
+
27
+ class HandlersInstancesSlowQueriesResponse(BaseModel):
28
+ """
29
+ HandlersInstancesSlowQueriesResponse
30
+ """
31
+
32
+ slow_queries: Optional[List[SlowQuery]] = Field(
33
+ default=None,
34
+ description="A list of documents with information about slow queries as detected by the Performance Advisor.",
35
+ alias="slowQueries",
36
+ )
37
+ __properties: ClassVar[List[str]] = ["slowQueries"]
38
+
39
+ model_config = ConfigDict(
40
+ populate_by_name=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
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
+ return json.dumps(self.to_dict())
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of HandlersInstancesSlowQueriesResponse from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ excluded_fields: Set[str] = set([])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # override the default output from pydantic by calling `to_dict()` of each item in slow_queries (list)
77
+ _items = []
78
+ if self.slow_queries:
79
+ for _item in self.slow_queries:
80
+ if _item:
81
+ _items.append(_item.to_dict())
82
+ _dict["slowQueries"] = _items
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of HandlersInstancesSlowQueriesResponse 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
+ "slowQueries": (
97
+ [SlowQuery.from_dict(_item) for _item in obj["slowQueries"]]
98
+ if obj.get("slowQueries") is not None
99
+ else None
100
+ )
101
+ }
102
+ )
103
+ return _obj
@@ -0,0 +1,118 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MongoDB Service API
5
+
6
+ This is the documentation for the STACKIT MongoDB Flex Service API
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@stackit.cloud
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
22
+ from typing_extensions import Self
23
+
24
+ from stackit.mongodbflex.models.shape import Shape
25
+ from stackit.mongodbflex.models.suggested_index import SuggestedIndex
26
+
27
+
28
+ class HandlersInstancesSuggestedIndexesResponse(BaseModel):
29
+ """
30
+ HandlersInstancesSuggestedIndexesResponse
31
+ """
32
+
33
+ shapes: Optional[List[Shape]] = Field(
34
+ default=None,
35
+ description="Documents with information about the query shapes that are served by the suggested indexes.",
36
+ )
37
+ suggested_indexes: Optional[List[SuggestedIndex]] = Field(
38
+ default=None,
39
+ description="Documents with information about the indexes suggested by the Performance Advisor.",
40
+ alias="suggestedIndexes",
41
+ )
42
+ __properties: ClassVar[List[str]] = ["shapes", "suggestedIndexes"]
43
+
44
+ model_config = ConfigDict(
45
+ populate_by_name=True,
46
+ validate_assignment=True,
47
+ protected_namespaces=(),
48
+ )
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of HandlersInstancesSuggestedIndexesResponse from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ # override the default output from pydantic by calling `to_dict()` of each item in shapes (list)
82
+ _items = []
83
+ if self.shapes:
84
+ for _item in self.shapes:
85
+ if _item:
86
+ _items.append(_item.to_dict())
87
+ _dict["shapes"] = _items
88
+ # override the default output from pydantic by calling `to_dict()` of each item in suggested_indexes (list)
89
+ _items = []
90
+ if self.suggested_indexes:
91
+ for _item in self.suggested_indexes:
92
+ if _item:
93
+ _items.append(_item.to_dict())
94
+ _dict["suggestedIndexes"] = _items
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
+ """Create an instance of HandlersInstancesSuggestedIndexesResponse from a dict"""
100
+ if obj is None:
101
+ return None
102
+
103
+ if not isinstance(obj, dict):
104
+ return cls.model_validate(obj)
105
+
106
+ _obj = cls.model_validate(
107
+ {
108
+ "shapes": (
109
+ [Shape.from_dict(_item) for _item in obj["shapes"]] if obj.get("shapes") is not None else None
110
+ ),
111
+ "suggestedIndexes": (
112
+ [SuggestedIndex.from_dict(_item) for _item in obj["suggestedIndexes"]]
113
+ if obj.get("suggestedIndexes") is not None
114
+ else None
115
+ ),
116
+ }
117
+ )
118
+ return _obj
@@ -0,0 +1,101 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MongoDB Service API
5
+
6
+ This is the documentation for the STACKIT MongoDB Flex Service API
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@stackit.cloud
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
+ from stackit.mongodbflex.models.host_metric import HostMetric
25
+
26
+
27
+ class Host(BaseModel):
28
+ """
29
+ Host
30
+ """
31
+
32
+ host_metrics: Optional[List[HostMetric]] = Field(default=None, alias="hostMetrics")
33
+ id: Optional[StrictStr] = None
34
+ __properties: ClassVar[List[str]] = ["hostMetrics", "id"]
35
+
36
+ model_config = ConfigDict(
37
+ populate_by_name=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
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of Host 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 host_metrics (list)
74
+ _items = []
75
+ if self.host_metrics:
76
+ for _item in self.host_metrics:
77
+ if _item:
78
+ _items.append(_item.to_dict())
79
+ _dict["hostMetrics"] = _items
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of Host 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
+ "hostMetrics": (
94
+ [HostMetric.from_dict(_item) for _item in obj["hostMetrics"]]
95
+ if obj.get("hostMetrics") is not None
96
+ else None
97
+ ),
98
+ "id": obj.get("id"),
99
+ }
100
+ )
101
+ return _obj
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MongoDB Service API
5
+
6
+ This is the documentation for the STACKIT MongoDB Flex Service API
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@stackit.cloud
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, StrictStr
22
+ from typing_extensions import Self
23
+
24
+ from stackit.mongodbflex.models.data_point import DataPoint
25
+
26
+
27
+ class HostMetric(BaseModel):
28
+ """
29
+ HostMetric
30
+ """
31
+
32
+ datapoints: Optional[List[DataPoint]] = None
33
+ name: Optional[StrictStr] = None
34
+ units: Optional[StrictStr] = None
35
+ __properties: ClassVar[List[str]] = ["datapoints", "name", "units"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=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
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of HostMetric 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 each item in datapoints (list)
75
+ _items = []
76
+ if self.datapoints:
77
+ for _item in self.datapoints:
78
+ if _item:
79
+ _items.append(_item.to_dict())
80
+ _dict["datapoints"] = _items
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of HostMetric from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate(
93
+ {
94
+ "datapoints": (
95
+ [DataPoint.from_dict(_item) for _item in obj["datapoints"]]
96
+ if obj.get("datapoints") is not None
97
+ else None
98
+ ),
99
+ "name": obj.get("name"),
100
+ "units": obj.get("units"),
101
+ }
102
+ )
103
+ return _obj
@@ -0,0 +1,128 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT MongoDB Service API
5
+
6
+ This is the documentation for the STACKIT MongoDB Flex Service API
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: support@stackit.cloud
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
+ from stackit.mongodbflex.models.acl import ACL
25
+ from stackit.mongodbflex.models.flavor import Flavor
26
+ from stackit.mongodbflex.models.storage import Storage
27
+
28
+
29
+ class Instance(BaseModel):
30
+ """
31
+ Instance
32
+ """
33
+
34
+ acl: Optional[ACL] = None
35
+ backup_schedule: Optional[StrictStr] = Field(default=None, alias="backupSchedule")
36
+ flavor: Optional[Flavor] = None
37
+ id: Optional[StrictStr] = None
38
+ name: Optional[StrictStr] = None
39
+ options: Optional[Dict[str, StrictStr]] = None
40
+ replicas: Optional[StrictInt] = None
41
+ status: Optional[StrictStr] = None
42
+ storage: Optional[Storage] = None
43
+ version: Optional[StrictStr] = None
44
+ __properties: ClassVar[List[str]] = [
45
+ "acl",
46
+ "backupSchedule",
47
+ "flavor",
48
+ "id",
49
+ "name",
50
+ "options",
51
+ "replicas",
52
+ "status",
53
+ "storage",
54
+ "version",
55
+ ]
56
+
57
+ model_config = ConfigDict(
58
+ populate_by_name=True,
59
+ validate_assignment=True,
60
+ protected_namespaces=(),
61
+ )
62
+
63
+ def to_str(self) -> str:
64
+ """Returns the string representation of the model using alias"""
65
+ return pprint.pformat(self.model_dump(by_alias=True))
66
+
67
+ def to_json(self) -> str:
68
+ """Returns the JSON representation of the model using alias"""
69
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
70
+ return json.dumps(self.to_dict())
71
+
72
+ @classmethod
73
+ def from_json(cls, json_str: str) -> Optional[Self]:
74
+ """Create an instance of Instance from a JSON string"""
75
+ return cls.from_dict(json.loads(json_str))
76
+
77
+ def to_dict(self) -> Dict[str, Any]:
78
+ """Return the dictionary representation of the model using alias.
79
+
80
+ This has the following differences from calling pydantic's
81
+ `self.model_dump(by_alias=True)`:
82
+
83
+ * `None` is only added to the output dict for nullable fields that
84
+ were set at model initialization. Other fields with value `None`
85
+ are ignored.
86
+ """
87
+ excluded_fields: Set[str] = set([])
88
+
89
+ _dict = self.model_dump(
90
+ by_alias=True,
91
+ exclude=excluded_fields,
92
+ exclude_none=True,
93
+ )
94
+ # override the default output from pydantic by calling `to_dict()` of acl
95
+ if self.acl:
96
+ _dict["acl"] = self.acl.to_dict()
97
+ # override the default output from pydantic by calling `to_dict()` of flavor
98
+ if self.flavor:
99
+ _dict["flavor"] = self.flavor.to_dict()
100
+ # override the default output from pydantic by calling `to_dict()` of storage
101
+ if self.storage:
102
+ _dict["storage"] = self.storage.to_dict()
103
+ return _dict
104
+
105
+ @classmethod
106
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
107
+ """Create an instance of Instance from a dict"""
108
+ if obj is None:
109
+ return None
110
+
111
+ if not isinstance(obj, dict):
112
+ return cls.model_validate(obj)
113
+
114
+ _obj = cls.model_validate(
115
+ {
116
+ "acl": ACL.from_dict(obj["acl"]) if obj.get("acl") is not None else None,
117
+ "backupSchedule": obj.get("backupSchedule"),
118
+ "flavor": Flavor.from_dict(obj["flavor"]) if obj.get("flavor") is not None else None,
119
+ "id": obj.get("id"),
120
+ "name": obj.get("name"),
121
+ "options": obj.get("options"),
122
+ "replicas": obj.get("replicas"),
123
+ "status": obj.get("status"),
124
+ "storage": Storage.from_dict(obj["storage"]) if obj.get("storage") is not None else None,
125
+ "version": obj.get("version"),
126
+ }
127
+ )
128
+ return _obj