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,147 @@
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, StrictStr, field_validator
21
+ from typing_extensions import Self
22
+
23
+ from stackit.logme.models.instance_last_operation import InstanceLastOperation
24
+
25
+
26
+ class Instance(BaseModel):
27
+ """
28
+ Instance
29
+ """
30
+
31
+ cf_guid: StrictStr = Field(alias="cfGuid")
32
+ cf_organization_guid: StrictStr = Field(alias="cfOrganizationGuid")
33
+ cf_space_guid: StrictStr = Field(alias="cfSpaceGuid")
34
+ dashboard_url: StrictStr = Field(alias="dashboardUrl")
35
+ image_url: StrictStr = Field(alias="imageUrl")
36
+ instance_id: Optional[StrictStr] = Field(default=None, alias="instanceId")
37
+ last_operation: InstanceLastOperation = Field(alias="lastOperation")
38
+ name: StrictStr
39
+ offering_name: StrictStr = Field(alias="offeringName")
40
+ offering_version: StrictStr = Field(alias="offeringVersion")
41
+ parameters: Dict[str, Any]
42
+ plan_id: StrictStr = Field(alias="planId")
43
+ plan_name: StrictStr = Field(alias="planName")
44
+ status: Optional[StrictStr] = None
45
+ __properties: ClassVar[List[str]] = [
46
+ "cfGuid",
47
+ "cfOrganizationGuid",
48
+ "cfSpaceGuid",
49
+ "dashboardUrl",
50
+ "imageUrl",
51
+ "instanceId",
52
+ "lastOperation",
53
+ "name",
54
+ "offeringName",
55
+ "offeringVersion",
56
+ "parameters",
57
+ "planId",
58
+ "planName",
59
+ "status",
60
+ ]
61
+
62
+ @field_validator("status")
63
+ def status_validate_enum(cls, value):
64
+ """Validates the enum"""
65
+ if value is None:
66
+ return value
67
+
68
+ if value not in set(["active", "failed", "stopped", "creating", "deleting", "updating"]):
69
+ raise ValueError(
70
+ "must be one of enum values ('active', 'failed', 'stopped', 'creating', 'deleting', 'updating')"
71
+ )
72
+ return value
73
+
74
+ model_config = ConfigDict(
75
+ populate_by_name=True,
76
+ validate_assignment=True,
77
+ protected_namespaces=(),
78
+ )
79
+
80
+ def to_str(self) -> str:
81
+ """Returns the string representation of the model using alias"""
82
+ return pprint.pformat(self.model_dump(by_alias=True))
83
+
84
+ def to_json(self) -> str:
85
+ """Returns the JSON representation of the model using alias"""
86
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
87
+ return json.dumps(self.to_dict())
88
+
89
+ @classmethod
90
+ def from_json(cls, json_str: str) -> Optional[Self]:
91
+ """Create an instance of Instance from a JSON string"""
92
+ return cls.from_dict(json.loads(json_str))
93
+
94
+ def to_dict(self) -> Dict[str, Any]:
95
+ """Return the dictionary representation of the model using alias.
96
+
97
+ This has the following differences from calling pydantic's
98
+ `self.model_dump(by_alias=True)`:
99
+
100
+ * `None` is only added to the output dict for nullable fields that
101
+ were set at model initialization. Other fields with value `None`
102
+ are ignored.
103
+ """
104
+ excluded_fields: Set[str] = set([])
105
+
106
+ _dict = self.model_dump(
107
+ by_alias=True,
108
+ exclude=excluded_fields,
109
+ exclude_none=True,
110
+ )
111
+ # override the default output from pydantic by calling `to_dict()` of last_operation
112
+ if self.last_operation:
113
+ _dict["lastOperation"] = self.last_operation.to_dict()
114
+ return _dict
115
+
116
+ @classmethod
117
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
118
+ """Create an instance of Instance from a dict"""
119
+ if obj is None:
120
+ return None
121
+
122
+ if not isinstance(obj, dict):
123
+ return cls.model_validate(obj)
124
+
125
+ _obj = cls.model_validate(
126
+ {
127
+ "cfGuid": obj.get("cfGuid"),
128
+ "cfOrganizationGuid": obj.get("cfOrganizationGuid"),
129
+ "cfSpaceGuid": obj.get("cfSpaceGuid"),
130
+ "dashboardUrl": obj.get("dashboardUrl"),
131
+ "imageUrl": obj.get("imageUrl"),
132
+ "instanceId": obj.get("instanceId"),
133
+ "lastOperation": (
134
+ InstanceLastOperation.from_dict(obj["lastOperation"])
135
+ if obj.get("lastOperation") is not None
136
+ else None
137
+ ),
138
+ "name": obj.get("name"),
139
+ "offeringName": obj.get("offeringName"),
140
+ "offeringVersion": obj.get("offeringVersion"),
141
+ "parameters": obj.get("parameters"),
142
+ "planId": obj.get("planId"),
143
+ "planName": obj.get("planName"),
144
+ "status": obj.get("status"),
145
+ }
146
+ )
147
+ return _obj
@@ -0,0 +1,99 @@
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, StrictStr, field_validator
21
+ from typing_extensions import Self
22
+
23
+
24
+ class InstanceLastOperation(BaseModel):
25
+ """
26
+ InstanceLastOperation
27
+ """
28
+
29
+ description: StrictStr
30
+ state: StrictStr
31
+ type: StrictStr
32
+ __properties: ClassVar[List[str]] = ["description", "state", "type"]
33
+
34
+ @field_validator("state")
35
+ def state_validate_enum(cls, value):
36
+ """Validates the enum"""
37
+ if value not in set(["in progress", "succeeded", "failed"]):
38
+ raise ValueError("must be one of enum values ('in progress', 'succeeded', 'failed')")
39
+ return value
40
+
41
+ @field_validator("type")
42
+ def type_validate_enum(cls, value):
43
+ """Validates the enum"""
44
+ if value not in set(["create", "update", "delete"]):
45
+ raise ValueError("must be one of enum values ('create', 'update', 'delete')")
46
+ return value
47
+
48
+ model_config = ConfigDict(
49
+ populate_by_name=True,
50
+ validate_assignment=True,
51
+ protected_namespaces=(),
52
+ )
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.model_dump(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
+ return json.dumps(self.to_dict())
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of InstanceLastOperation from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ """
78
+ excluded_fields: Set[str] = set([])
79
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of InstanceLastOperation from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate(
97
+ {"description": obj.get("description"), "state": obj.get("state"), "type": obj.get("type")}
98
+ )
99
+ return _obj
@@ -0,0 +1,229 @@
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, Union
19
+
20
+ from pydantic import (
21
+ BaseModel,
22
+ ConfigDict,
23
+ Field,
24
+ StrictBool,
25
+ StrictFloat,
26
+ StrictInt,
27
+ StrictStr,
28
+ field_validator,
29
+ )
30
+ from typing_extensions import Annotated, Self
31
+
32
+ from stackit.logme.models.instance_parameters_groks_inner import (
33
+ InstanceParametersGroksInner,
34
+ )
35
+
36
+
37
+ class InstanceParameters(BaseModel):
38
+ """
39
+ InstanceParameters
40
+ """
41
+
42
+ enable_monitoring: Optional[StrictBool] = False
43
+ fluentd_tcp: Optional[StrictInt] = Field(default=0, alias="fluentd-tcp")
44
+ fluentd_tls: Optional[StrictInt] = Field(default=6514, alias="fluentd-tls")
45
+ fluentd_tls_ciphers: Optional[StrictStr] = Field(default=None, alias="fluentd-tls-ciphers")
46
+ fluentd_tls_max_version: Optional[StrictStr] = Field(default=None, alias="fluentd-tls-max-version")
47
+ fluentd_tls_min_version: Optional[StrictStr] = Field(default=None, alias="fluentd-tls-min-version")
48
+ fluentd_tls_version: Optional[StrictStr] = Field(default=None, alias="fluentd-tls-version")
49
+ fluentd_udp: Optional[StrictInt] = Field(default=514, alias="fluentd-udp")
50
+ graphite: Optional[StrictStr] = Field(
51
+ default=None,
52
+ description="If you want to monitor your service with Graphite, you can set the custom parameter graphite. It expects the host and port where the Graphite metrics should be sent to.",
53
+ )
54
+ groks: Optional[List[InstanceParametersGroksInner]] = None
55
+ ism_deletion_after: Optional[StrictStr] = Field(
56
+ default="30d",
57
+ description="Combination of an integer and a timerange when an index will be considered 'd' and can be deleted from OpenSearch. Possible values for the timerange are s, m, h and d.",
58
+ )
59
+ ism_jitter: Optional[Union[StrictFloat, StrictInt]] = 0.6
60
+ ism_job_interval: Optional[StrictInt] = 5
61
+ java_heapspace: Optional[Annotated[int, Field(strict=True, ge=256)]] = Field(
62
+ default=None,
63
+ description="Default: not set, 46% of available memory will be used. The amount of memory (in MB) allocated as heap by the JVM for OpenSearch.",
64
+ )
65
+ java_maxmetaspace: Optional[Annotated[int, Field(le=1024, strict=True, ge=256)]] = Field(
66
+ default=512, description="The amount of memory (in MB) used by the JVM to store metadata for OpenSearch."
67
+ )
68
+ max_disk_threshold: Optional[StrictInt] = Field(
69
+ default=80,
70
+ description="This component monitors ephemeral and persistent disk usage. If one of these disk usages reaches the default configured threshold of 80%, the a9s Parachute stops all processes on that node.",
71
+ )
72
+ metrics_frequency: Optional[StrictInt] = Field(
73
+ default=10, description="Frequency of metrics being emitted in seconds"
74
+ )
75
+ metrics_prefix: Optional[StrictStr] = Field(
76
+ default=None,
77
+ description="Depending on your graphite provider, you might need to prefix the metrics with a certain value, like an API key for example.",
78
+ )
79
+ monitoring_instance_id: Optional[StrictStr] = None
80
+ opensearch_tls_ciphers: Optional[List[StrictStr]] = Field(default=None, alias="opensearch-tls-ciphers")
81
+ opensearch_tls_protocols: Optional[List[StrictStr]] = Field(default=None, alias="opensearch-tls-protocols")
82
+ sgw_acl: Optional[StrictStr] = Field(
83
+ default=None,
84
+ description="Comma separated list of IP networks in CIDR notation which are allowed to access this instance.",
85
+ )
86
+ syslog: Optional[List[StrictStr]] = None
87
+ syslog_use_udp: Optional[StrictStr] = Field(default=None, alias="syslog-use-udp")
88
+ __properties: ClassVar[List[str]] = [
89
+ "enable_monitoring",
90
+ "fluentd-tcp",
91
+ "fluentd-tls",
92
+ "fluentd-tls-ciphers",
93
+ "fluentd-tls-max-version",
94
+ "fluentd-tls-min-version",
95
+ "fluentd-tls-version",
96
+ "fluentd-udp",
97
+ "graphite",
98
+ "groks",
99
+ "ism_deletion_after",
100
+ "ism_jitter",
101
+ "ism_job_interval",
102
+ "java_heapspace",
103
+ "java_maxmetaspace",
104
+ "max_disk_threshold",
105
+ "metrics_frequency",
106
+ "metrics_prefix",
107
+ "monitoring_instance_id",
108
+ "opensearch-tls-ciphers",
109
+ "opensearch-tls-protocols",
110
+ "sgw_acl",
111
+ "syslog",
112
+ "syslog-use-udp",
113
+ ]
114
+
115
+ @field_validator("opensearch_tls_ciphers")
116
+ def opensearch_tls_ciphers_validate_enum(cls, value):
117
+ """Validates the enum"""
118
+ if value is None:
119
+ return value
120
+
121
+ for i in value:
122
+ if i not in set(["TLSv1.2", "TLSv1.3"]):
123
+ raise ValueError("each list item must be one of ('TLSv1.2', 'TLSv1.3')")
124
+ return value
125
+
126
+ @field_validator("syslog_use_udp")
127
+ def syslog_use_udp_validate_enum(cls, value):
128
+ """Validates the enum"""
129
+ if value is None:
130
+ return value
131
+
132
+ if value not in set(["yes", "no"]):
133
+ raise ValueError("must be one of enum values ('yes', 'no')")
134
+ return value
135
+
136
+ model_config = ConfigDict(
137
+ populate_by_name=True,
138
+ validate_assignment=True,
139
+ protected_namespaces=(),
140
+ )
141
+
142
+ def to_str(self) -> str:
143
+ """Returns the string representation of the model using alias"""
144
+ return pprint.pformat(self.model_dump(by_alias=True))
145
+
146
+ def to_json(self) -> str:
147
+ """Returns the JSON representation of the model using alias"""
148
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
149
+ return json.dumps(self.to_dict())
150
+
151
+ @classmethod
152
+ def from_json(cls, json_str: str) -> Optional[Self]:
153
+ """Create an instance of InstanceParameters from a JSON string"""
154
+ return cls.from_dict(json.loads(json_str))
155
+
156
+ def to_dict(self) -> Dict[str, Any]:
157
+ """Return the dictionary representation of the model using alias.
158
+
159
+ This has the following differences from calling pydantic's
160
+ `self.model_dump(by_alias=True)`:
161
+
162
+ * `None` is only added to the output dict for nullable fields that
163
+ were set at model initialization. Other fields with value `None`
164
+ are ignored.
165
+ """
166
+ excluded_fields: Set[str] = set([])
167
+
168
+ _dict = self.model_dump(
169
+ by_alias=True,
170
+ exclude=excluded_fields,
171
+ exclude_none=True,
172
+ )
173
+ # override the default output from pydantic by calling `to_dict()` of each item in groks (list)
174
+ _items = []
175
+ if self.groks:
176
+ for _item in self.groks:
177
+ if _item:
178
+ _items.append(_item.to_dict())
179
+ _dict["groks"] = _items
180
+ return _dict
181
+
182
+ @classmethod
183
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
184
+ """Create an instance of InstanceParameters from a dict"""
185
+ if obj is None:
186
+ return None
187
+
188
+ if not isinstance(obj, dict):
189
+ return cls.model_validate(obj)
190
+
191
+ _obj = cls.model_validate(
192
+ {
193
+ "enable_monitoring": (
194
+ obj.get("enable_monitoring") if obj.get("enable_monitoring") is not None else False
195
+ ),
196
+ "fluentd-tcp": obj.get("fluentd-tcp") if obj.get("fluentd-tcp") is not None else 0,
197
+ "fluentd-tls": obj.get("fluentd-tls") if obj.get("fluentd-tls") is not None else 6514,
198
+ "fluentd-tls-ciphers": obj.get("fluentd-tls-ciphers"),
199
+ "fluentd-tls-max-version": obj.get("fluentd-tls-max-version"),
200
+ "fluentd-tls-min-version": obj.get("fluentd-tls-min-version"),
201
+ "fluentd-tls-version": obj.get("fluentd-tls-version"),
202
+ "fluentd-udp": obj.get("fluentd-udp") if obj.get("fluentd-udp") is not None else 514,
203
+ "graphite": obj.get("graphite"),
204
+ "groks": (
205
+ [InstanceParametersGroksInner.from_dict(_item) for _item in obj["groks"]]
206
+ if obj.get("groks") is not None
207
+ else None
208
+ ),
209
+ "ism_deletion_after": (
210
+ obj.get("ism_deletion_after") if obj.get("ism_deletion_after") is not None else "30d"
211
+ ),
212
+ "ism_jitter": obj.get("ism_jitter") if obj.get("ism_jitter") is not None else 0.6,
213
+ "ism_job_interval": obj.get("ism_job_interval") if obj.get("ism_job_interval") is not None else 5,
214
+ "java_heapspace": obj.get("java_heapspace"),
215
+ "java_maxmetaspace": obj.get("java_maxmetaspace") if obj.get("java_maxmetaspace") is not None else 512,
216
+ "max_disk_threshold": (
217
+ obj.get("max_disk_threshold") if obj.get("max_disk_threshold") is not None else 80
218
+ ),
219
+ "metrics_frequency": obj.get("metrics_frequency") if obj.get("metrics_frequency") is not None else 10,
220
+ "metrics_prefix": obj.get("metrics_prefix"),
221
+ "monitoring_instance_id": obj.get("monitoring_instance_id"),
222
+ "opensearch-tls-ciphers": obj.get("opensearch-tls-ciphers"),
223
+ "opensearch-tls-protocols": obj.get("opensearch-tls-protocols"),
224
+ "sgw_acl": obj.get("sgw_acl"),
225
+ "syslog": obj.get("syslog"),
226
+ "syslog-use-udp": obj.get("syslog-use-udp"),
227
+ }
228
+ )
229
+ 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, StrictStr
21
+ from typing_extensions import Self
22
+
23
+
24
+ class InstanceParametersGroksInner(BaseModel):
25
+ """
26
+ InstanceParametersGroksInner
27
+ """
28
+
29
+ pattern: Optional[StrictStr] = None
30
+ __properties: ClassVar[List[str]] = ["pattern"]
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 InstanceParametersGroksInner 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 InstanceParametersGroksInner 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({"pattern": obj.get("pattern")})
81
+ return _obj
@@ -0,0 +1,95 @@
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.model_schema import ModelSchema
24
+
25
+
26
+ class InstanceSchema(BaseModel):
27
+ """
28
+ InstanceSchema
29
+ """
30
+
31
+ create: ModelSchema
32
+ update: ModelSchema
33
+ __properties: ClassVar[List[str]] = ["create", "update"]
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 InstanceSchema 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 create
73
+ if self.create:
74
+ _dict["create"] = self.create.to_dict()
75
+ # override the default output from pydantic by calling `to_dict()` of update
76
+ if self.update:
77
+ _dict["update"] = self.update.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 InstanceSchema 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
+ "create": ModelSchema.from_dict(obj["create"]) if obj.get("create") is not None else None,
92
+ "update": ModelSchema.from_dict(obj["update"]) if obj.get("update") is not None else None,
93
+ }
94
+ )
95
+ return _obj