stackit-logme 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 (41) hide show
  1. stackit/logme/__init__.py +71 -0
  2. stackit/logme/api/__init__.py +4 -0
  3. stackit/logme/api/default_api.py +4812 -0
  4. stackit/logme/api_client.py +626 -0
  5. stackit/logme/api_response.py +23 -0
  6. stackit/logme/configuration.py +111 -0
  7. stackit/logme/exceptions.py +198 -0
  8. stackit/logme/models/__init__.py +52 -0
  9. stackit/logme/models/backup.py +95 -0
  10. stackit/logme/models/create_backup_response_item.py +82 -0
  11. stackit/logme/models/create_instance_payload.py +96 -0
  12. stackit/logme/models/create_instance_response.py +81 -0
  13. stackit/logme/models/credentials.py +95 -0
  14. stackit/logme/models/credentials_list_item.py +81 -0
  15. stackit/logme/models/credentials_response.py +94 -0
  16. stackit/logme/models/error.py +82 -0
  17. stackit/logme/models/get_metrics_response.py +164 -0
  18. stackit/logme/models/instance.py +147 -0
  19. stackit/logme/models/instance_last_operation.py +99 -0
  20. stackit/logme/models/instance_parameters.py +229 -0
  21. stackit/logme/models/instance_parameters_groks_inner.py +81 -0
  22. stackit/logme/models/instance_schema.py +95 -0
  23. stackit/logme/models/list_backups_response.py +98 -0
  24. stackit/logme/models/list_credentials_response.py +98 -0
  25. stackit/logme/models/list_instances_response.py +98 -0
  26. stackit/logme/models/list_offerings_response.py +98 -0
  27. stackit/logme/models/list_restores_response.py +98 -0
  28. stackit/logme/models/model_schema.py +81 -0
  29. stackit/logme/models/offering.py +127 -0
  30. stackit/logme/models/partial_update_instance_payload.py +96 -0
  31. stackit/logme/models/plan.py +93 -0
  32. stackit/logme/models/raw_credentials.py +88 -0
  33. stackit/logme/models/restore.py +93 -0
  34. stackit/logme/models/trigger_restore_response.py +81 -0
  35. stackit/logme/models/update_backups_config_payload.py +81 -0
  36. stackit/logme/models/update_backups_config_response.py +81 -0
  37. stackit/logme/py.typed +0 -0
  38. stackit/logme/rest.py +148 -0
  39. stackit_logme-0.0.1a0.dist-info/METADATA +45 -0
  40. stackit_logme-0.0.1a0.dist-info/RECORD +41 -0
  41. stackit_logme-0.0.1a0.dist-info/WHEEL +4 -0
@@ -0,0 +1,98 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT LogMe API
5
+
6
+ The STACKIT LogMe API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field
21
+ from typing_extensions import Self
22
+
23
+ from stackit.logme.models.backup import Backup
24
+
25
+
26
+ class ListBackupsResponse(BaseModel):
27
+ """
28
+ ListBackupsResponse
29
+ """
30
+
31
+ instance_backups: List[Backup] = Field(alias="instanceBackups")
32
+ __properties: ClassVar[List[str]] = ["instanceBackups"]
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 ListBackupsResponse 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
+ # override the default output from pydantic by calling `to_dict()` of each item in instance_backups (list)
72
+ _items = []
73
+ if self.instance_backups:
74
+ for _item in self.instance_backups:
75
+ if _item:
76
+ _items.append(_item.to_dict())
77
+ _dict["instanceBackups"] = _items
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of ListBackupsResponse 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
+ "instanceBackups": (
92
+ [Backup.from_dict(_item) for _item in obj["instanceBackups"]]
93
+ if obj.get("instanceBackups") is not None
94
+ else None
95
+ )
96
+ }
97
+ )
98
+ return _obj
@@ -0,0 +1,98 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT LogMe API
5
+
6
+ The STACKIT LogMe API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field
21
+ from typing_extensions import Self
22
+
23
+ from stackit.logme.models.credentials_list_item import CredentialsListItem
24
+
25
+
26
+ class ListCredentialsResponse(BaseModel):
27
+ """
28
+ ListCredentialsResponse
29
+ """
30
+
31
+ credentials_list: List[CredentialsListItem] = Field(alias="credentialsList")
32
+ __properties: ClassVar[List[str]] = ["credentialsList"]
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 ListCredentialsResponse 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
+ # override the default output from pydantic by calling `to_dict()` of each item in credentials_list (list)
72
+ _items = []
73
+ if self.credentials_list:
74
+ for _item in self.credentials_list:
75
+ if _item:
76
+ _items.append(_item.to_dict())
77
+ _dict["credentialsList"] = _items
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of ListCredentialsResponse 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
+ "credentialsList": (
92
+ [CredentialsListItem.from_dict(_item) for _item in obj["credentialsList"]]
93
+ if obj.get("credentialsList") is not None
94
+ else None
95
+ )
96
+ }
97
+ )
98
+ return _obj
@@ -0,0 +1,98 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT LogMe API
5
+
6
+ The STACKIT LogMe API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict
21
+ from typing_extensions import Self
22
+
23
+ from stackit.logme.models.instance import Instance
24
+
25
+
26
+ class ListInstancesResponse(BaseModel):
27
+ """
28
+ ListInstancesResponse
29
+ """
30
+
31
+ instances: List[Instance]
32
+ __properties: ClassVar[List[str]] = ["instances"]
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 ListInstancesResponse 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
+ # override the default output from pydantic by calling `to_dict()` of each item in instances (list)
72
+ _items = []
73
+ if self.instances:
74
+ for _item in self.instances:
75
+ if _item:
76
+ _items.append(_item.to_dict())
77
+ _dict["instances"] = _items
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of ListInstancesResponse 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
+ "instances": (
92
+ [Instance.from_dict(_item) for _item in obj["instances"]]
93
+ if obj.get("instances") is not None
94
+ else None
95
+ )
96
+ }
97
+ )
98
+ return _obj
@@ -0,0 +1,98 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT LogMe API
5
+
6
+ The STACKIT LogMe API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict
21
+ from typing_extensions import Self
22
+
23
+ from stackit.logme.models.offering import Offering
24
+
25
+
26
+ class ListOfferingsResponse(BaseModel):
27
+ """
28
+ ListOfferingsResponse
29
+ """
30
+
31
+ offerings: List[Offering]
32
+ __properties: ClassVar[List[str]] = ["offerings"]
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 ListOfferingsResponse 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
+ # override the default output from pydantic by calling `to_dict()` of each item in offerings (list)
72
+ _items = []
73
+ if self.offerings:
74
+ for _item in self.offerings:
75
+ if _item:
76
+ _items.append(_item.to_dict())
77
+ _dict["offerings"] = _items
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of ListOfferingsResponse 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
+ "offerings": (
92
+ [Offering.from_dict(_item) for _item in obj["offerings"]]
93
+ if obj.get("offerings") is not None
94
+ else None
95
+ )
96
+ }
97
+ )
98
+ return _obj
@@ -0,0 +1,98 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT LogMe API
5
+
6
+ The STACKIT LogMe API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field
21
+ from typing_extensions import Self
22
+
23
+ from stackit.logme.models.restore import Restore
24
+
25
+
26
+ class ListRestoresResponse(BaseModel):
27
+ """
28
+ ListRestoresResponse
29
+ """
30
+
31
+ instance_restores: List[Restore] = Field(alias="instanceRestores")
32
+ __properties: ClassVar[List[str]] = ["instanceRestores"]
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 ListRestoresResponse 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
+ # override the default output from pydantic by calling `to_dict()` of each item in instance_restores (list)
72
+ _items = []
73
+ if self.instance_restores:
74
+ for _item in self.instance_restores:
75
+ if _item:
76
+ _items.append(_item.to_dict())
77
+ _dict["instanceRestores"] = _items
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of ListRestoresResponse 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
+ "instanceRestores": (
92
+ [Restore.from_dict(_item) for _item in obj["instanceRestores"]]
93
+ if obj.get("instanceRestores") is not None
94
+ else None
95
+ )
96
+ }
97
+ )
98
+ return _obj
@@ -0,0 +1,81 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT LogMe API
5
+
6
+ The STACKIT LogMe API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict
21
+ from typing_extensions import Self
22
+
23
+
24
+ class ModelSchema(BaseModel):
25
+ """
26
+ ModelSchema
27
+ """
28
+
29
+ parameters: Dict[str, Any]
30
+ __properties: ClassVar[List[str]] = ["parameters"]
31
+
32
+ model_config = ConfigDict(
33
+ populate_by_name=True,
34
+ validate_assignment=True,
35
+ protected_namespaces=(),
36
+ )
37
+
38
+ def to_str(self) -> str:
39
+ """Returns the string representation of the model using alias"""
40
+ return pprint.pformat(self.model_dump(by_alias=True))
41
+
42
+ def to_json(self) -> str:
43
+ """Returns the JSON representation of the model using alias"""
44
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
45
+ return json.dumps(self.to_dict())
46
+
47
+ @classmethod
48
+ def from_json(cls, json_str: str) -> Optional[Self]:
49
+ """Create an instance of ModelSchema from a JSON string"""
50
+ return cls.from_dict(json.loads(json_str))
51
+
52
+ def to_dict(self) -> Dict[str, Any]:
53
+ """Return the dictionary representation of the model using alias.
54
+
55
+ This has the following differences from calling pydantic's
56
+ `self.model_dump(by_alias=True)`:
57
+
58
+ * `None` is only added to the output dict for nullable fields that
59
+ were set at model initialization. Other fields with value `None`
60
+ are ignored.
61
+ """
62
+ excluded_fields: Set[str] = set([])
63
+
64
+ _dict = self.model_dump(
65
+ by_alias=True,
66
+ exclude=excluded_fields,
67
+ exclude_none=True,
68
+ )
69
+ return _dict
70
+
71
+ @classmethod
72
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
73
+ """Create an instance of ModelSchema from a dict"""
74
+ if obj is None:
75
+ return None
76
+
77
+ if not isinstance(obj, dict):
78
+ return cls.model_validate(obj)
79
+
80
+ _obj = cls.model_validate({"parameters": obj.get("parameters")})
81
+ return _obj
@@ -0,0 +1,127 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT LogMe API
5
+
6
+ The STACKIT LogMe API provides endpoints to list service offerings, manage service instances and service credentials within STACKIT portal projects.
7
+
8
+ The version of the OpenAPI document: 1.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501 docstring might be too long
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import pprint
18
+ from typing import Any, ClassVar, Dict, List, Optional, Set
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
21
+ from typing_extensions import Self
22
+
23
+ from stackit.logme.models.instance_schema import InstanceSchema
24
+ from stackit.logme.models.plan import Plan
25
+
26
+
27
+ class Offering(BaseModel):
28
+ """
29
+ Offering
30
+ """
31
+
32
+ description: StrictStr
33
+ documentation_url: StrictStr = Field(alias="documentationUrl")
34
+ image_url: StrictStr = Field(alias="imageUrl")
35
+ latest: StrictBool
36
+ lifecycle: Optional[StrictStr] = None
37
+ name: StrictStr
38
+ plans: List[Plan]
39
+ quota_count: StrictInt = Field(alias="quotaCount")
40
+ var_schema: Optional[InstanceSchema] = Field(default=None, alias="schema")
41
+ version: StrictStr
42
+ __properties: ClassVar[List[str]] = [
43
+ "description",
44
+ "documentationUrl",
45
+ "imageUrl",
46
+ "latest",
47
+ "lifecycle",
48
+ "name",
49
+ "plans",
50
+ "quotaCount",
51
+ "schema",
52
+ "version",
53
+ ]
54
+
55
+ model_config = ConfigDict(
56
+ populate_by_name=True,
57
+ validate_assignment=True,
58
+ protected_namespaces=(),
59
+ )
60
+
61
+ def to_str(self) -> str:
62
+ """Returns the string representation of the model using alias"""
63
+ return pprint.pformat(self.model_dump(by_alias=True))
64
+
65
+ def to_json(self) -> str:
66
+ """Returns the JSON representation of the model using alias"""
67
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
68
+ return json.dumps(self.to_dict())
69
+
70
+ @classmethod
71
+ def from_json(cls, json_str: str) -> Optional[Self]:
72
+ """Create an instance of Offering from a JSON string"""
73
+ return cls.from_dict(json.loads(json_str))
74
+
75
+ def to_dict(self) -> Dict[str, Any]:
76
+ """Return the dictionary representation of the model using alias.
77
+
78
+ This has the following differences from calling pydantic's
79
+ `self.model_dump(by_alias=True)`:
80
+
81
+ * `None` is only added to the output dict for nullable fields that
82
+ were set at model initialization. Other fields with value `None`
83
+ are ignored.
84
+ """
85
+ excluded_fields: Set[str] = set([])
86
+
87
+ _dict = self.model_dump(
88
+ by_alias=True,
89
+ exclude=excluded_fields,
90
+ exclude_none=True,
91
+ )
92
+ # override the default output from pydantic by calling `to_dict()` of each item in plans (list)
93
+ _items = []
94
+ if self.plans:
95
+ for _item in self.plans:
96
+ if _item:
97
+ _items.append(_item.to_dict())
98
+ _dict["plans"] = _items
99
+ # override the default output from pydantic by calling `to_dict()` of var_schema
100
+ if self.var_schema:
101
+ _dict["schema"] = self.var_schema.to_dict()
102
+ return _dict
103
+
104
+ @classmethod
105
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
106
+ """Create an instance of Offering from a dict"""
107
+ if obj is None:
108
+ return None
109
+
110
+ if not isinstance(obj, dict):
111
+ return cls.model_validate(obj)
112
+
113
+ _obj = cls.model_validate(
114
+ {
115
+ "description": obj.get("description"),
116
+ "documentationUrl": obj.get("documentationUrl"),
117
+ "imageUrl": obj.get("imageUrl"),
118
+ "latest": obj.get("latest"),
119
+ "lifecycle": obj.get("lifecycle"),
120
+ "name": obj.get("name"),
121
+ "plans": [Plan.from_dict(_item) for _item in obj["plans"]] if obj.get("plans") is not None else None,
122
+ "quotaCount": obj.get("quotaCount"),
123
+ "schema": InstanceSchema.from_dict(obj["schema"]) if obj.get("schema") is not None else None,
124
+ "version": obj.get("version"),
125
+ }
126
+ )
127
+ return _obj