stackit-modelexperiments 0.1.0__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 (34) hide show
  1. src/stackit/modelexperiments/__init__.py +120 -0
  2. src/stackit/modelexperiments/api/__init__.py +4 -0
  3. src/stackit/modelexperiments/api/default_api.py +2913 -0
  4. src/stackit/modelexperiments/api_client.py +651 -0
  5. src/stackit/modelexperiments/api_response.py +23 -0
  6. src/stackit/modelexperiments/configuration.py +164 -0
  7. src/stackit/modelexperiments/exceptions.py +218 -0
  8. src/stackit/modelexperiments/models/__init__.py +61 -0
  9. src/stackit/modelexperiments/models/create_instance_payload.py +141 -0
  10. src/stackit/modelexperiments/models/create_instance_response.py +94 -0
  11. src/stackit/modelexperiments/models/create_instance_token_payload.py +124 -0
  12. src/stackit/modelexperiments/models/create_instance_token_response.py +94 -0
  13. src/stackit/modelexperiments/models/delete_instance_response.py +94 -0
  14. src/stackit/modelexperiments/models/delete_instance_token_response.py +94 -0
  15. src/stackit/modelexperiments/models/error_response.py +85 -0
  16. src/stackit/modelexperiments/models/get_instance_response.py +94 -0
  17. src/stackit/modelexperiments/models/get_instance_token_response.py +94 -0
  18. src/stackit/modelexperiments/models/instance.py +197 -0
  19. src/stackit/modelexperiments/models/list_instance_tokens_response.py +102 -0
  20. src/stackit/modelexperiments/models/list_instances_response.py +102 -0
  21. src/stackit/modelexperiments/models/partial_update_instance_payload.py +144 -0
  22. src/stackit/modelexperiments/models/partial_update_instance_response.py +94 -0
  23. src/stackit/modelexperiments/models/partial_update_instance_token_payload.py +117 -0
  24. src/stackit/modelexperiments/models/partial_update_instance_token_response.py +94 -0
  25. src/stackit/modelexperiments/models/token.py +164 -0
  26. src/stackit/modelexperiments/models/token_metadata.py +143 -0
  27. src/stackit/modelexperiments/models/token_state.py +39 -0
  28. src/stackit/modelexperiments/py.typed +0 -0
  29. src/stackit/modelexperiments/rest.py +165 -0
  30. stackit_modelexperiments-0.1.0.dist-info/METADATA +48 -0
  31. stackit_modelexperiments-0.1.0.dist-info/RECORD +34 -0
  32. stackit_modelexperiments-0.1.0.dist-info/WHEEL +4 -0
  33. stackit_modelexperiments-0.1.0.dist-info/licenses/LICENSE.md +201 -0
  34. stackit_modelexperiments-0.1.0.dist-info/licenses/NOTICE.txt +2 -0
@@ -0,0 +1,124 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT AI Model Experiments API
5
+
6
+ This API provides endpoints for the STACKIT AI Model Experiments api
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: stackit-model-experiments@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ import re # noqa: F401
20
+ from typing import Any, ClassVar, Dict, List, Optional, Set
21
+
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
23
+ from pydantic_core import to_jsonable_python
24
+ from typing_extensions import Annotated, Self
25
+
26
+
27
+ class CreateInstanceTokenPayload(BaseModel):
28
+ """
29
+ CreateInstanceTokenPayload
30
+ """ # noqa: E501
31
+
32
+ description: Optional[Annotated[str, Field(strict=True, max_length=160)]] = None
33
+ labels: Optional[Dict[str, Annotated[str, Field(strict=True, max_length=63)]]] = Field(
34
+ default=None,
35
+ description="Object that represents the labels of an object. Regex for keys: `^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. The `stackit-` prefix is reserved and cannot be used for Keys.",
36
+ )
37
+ name: Annotated[str, Field(min_length=1, strict=True, max_length=64)]
38
+ ttl_duration: Optional[StrictStr] = Field(
39
+ default=None,
40
+ description="time to live duration. Must be valid duration string. Maximum allowed duration is 6 months. If not set, defaults to 6 months. ",
41
+ alias="ttlDuration",
42
+ )
43
+ __properties: ClassVar[List[str]] = ["description", "labels", "name", "ttlDuration"]
44
+
45
+ @field_validator("description")
46
+ def description_validate_regular_expression(cls, value):
47
+ """Validates the regular expression"""
48
+ if value is None:
49
+ return value
50
+
51
+ if not isinstance(value, str):
52
+ value = str(value)
53
+
54
+ if not re.match(r"^[0-9a-zA-Z\s.:\/\-]*$", value):
55
+ raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]*$/")
56
+ return value
57
+
58
+ @field_validator("name")
59
+ def name_validate_regular_expression(cls, value):
60
+ """Validates the regular expression"""
61
+ if not isinstance(value, str):
62
+ value = str(value)
63
+
64
+ if not re.match(r"^[0-9a-zA-Z\s_-]+$", value):
65
+ raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]+$/")
66
+ return value
67
+
68
+ model_config = ConfigDict(
69
+ validate_by_name=True,
70
+ validate_by_alias=True,
71
+ validate_assignment=True,
72
+ protected_namespaces=(),
73
+ )
74
+
75
+ def to_str(self) -> str:
76
+ """Returns the string representation of the model using alias"""
77
+ return pprint.pformat(self.model_dump(by_alias=True))
78
+
79
+ def to_json(self) -> str:
80
+ """Returns the JSON representation of the model using alias"""
81
+ return json.dumps(to_jsonable_python(self.to_dict()))
82
+
83
+ @classmethod
84
+ def from_json(cls, json_str: str) -> Optional[Self]:
85
+ """Create an instance of CreateInstanceTokenPayload from a JSON string"""
86
+ return cls.from_dict(json.loads(json_str))
87
+
88
+ def to_dict(self) -> Dict[str, Any]:
89
+ """Return the dictionary representation of the model using alias.
90
+
91
+ This has the following differences from calling pydantic's
92
+ `self.model_dump(by_alias=True)`:
93
+
94
+ * `None` is only added to the output dict for nullable fields that
95
+ were set at model initialization. Other fields with value `None`
96
+ are ignored.
97
+ """
98
+ excluded_fields: Set[str] = set([])
99
+
100
+ _dict = self.model_dump(
101
+ by_alias=True,
102
+ exclude=excluded_fields,
103
+ exclude_none=True,
104
+ )
105
+ return _dict
106
+
107
+ @classmethod
108
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
109
+ """Create an instance of CreateInstanceTokenPayload from a dict"""
110
+ if obj is None:
111
+ return None
112
+
113
+ if not isinstance(obj, dict):
114
+ return cls.model_validate(obj)
115
+
116
+ _obj = cls.model_validate(
117
+ {
118
+ "description": obj.get("description"),
119
+ "labels": obj.get("labels"),
120
+ "name": obj.get("name"),
121
+ "ttlDuration": obj.get("ttlDuration"),
122
+ }
123
+ )
124
+ return _obj
@@ -0,0 +1,94 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT AI Model Experiments API
5
+
6
+ This API provides endpoints for the STACKIT AI Model Experiments api
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: stackit-model-experiments@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
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 pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+ from stackit.modelexperiments.models.token import Token
26
+
27
+
28
+ class CreateInstanceTokenResponse(BaseModel):
29
+ """
30
+ CreateInstanceTokenResponse
31
+ """ # noqa: E501
32
+
33
+ message: Optional[StrictStr] = None
34
+ token: Token
35
+ __properties: ClassVar[List[str]] = ["message", "token"]
36
+
37
+ model_config = ConfigDict(
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of CreateInstanceTokenResponse 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 token
75
+ if self.token:
76
+ _dict["token"] = self.token.to_dict()
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of CreateInstanceTokenResponse from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate(
89
+ {
90
+ "message": obj.get("message"),
91
+ "token": Token.from_dict(obj["token"]) if obj.get("token") is not None else None,
92
+ }
93
+ )
94
+ return _obj
@@ -0,0 +1,94 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT AI Model Experiments API
5
+
6
+ This API provides endpoints for the STACKIT AI Model Experiments api
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: stackit-model-experiments@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
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 pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+ from stackit.modelexperiments.models.instance import Instance
26
+
27
+
28
+ class DeleteInstanceResponse(BaseModel):
29
+ """
30
+ DeleteInstanceResponse
31
+ """ # noqa: E501
32
+
33
+ instance: Instance
34
+ message: Optional[StrictStr] = None
35
+ __properties: ClassVar[List[str]] = ["instance", "message"]
36
+
37
+ model_config = ConfigDict(
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of DeleteInstanceResponse 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 instance
75
+ if self.instance:
76
+ _dict["instance"] = self.instance.to_dict()
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of DeleteInstanceResponse from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate(
89
+ {
90
+ "instance": Instance.from_dict(obj["instance"]) if obj.get("instance") is not None else None,
91
+ "message": obj.get("message"),
92
+ }
93
+ )
94
+ return _obj
@@ -0,0 +1,94 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT AI Model Experiments API
5
+
6
+ This API provides endpoints for the STACKIT AI Model Experiments api
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: stackit-model-experiments@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
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 pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+ from stackit.modelexperiments.models.token_metadata import TokenMetadata
26
+
27
+
28
+ class DeleteInstanceTokenResponse(BaseModel):
29
+ """
30
+ DeleteInstanceTokenResponse
31
+ """ # noqa: E501
32
+
33
+ message: Optional[StrictStr] = None
34
+ token: TokenMetadata
35
+ __properties: ClassVar[List[str]] = ["message", "token"]
36
+
37
+ model_config = ConfigDict(
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of DeleteInstanceTokenResponse 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 token
75
+ if self.token:
76
+ _dict["token"] = self.token.to_dict()
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of DeleteInstanceTokenResponse from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate(
89
+ {
90
+ "message": obj.get("message"),
91
+ "token": TokenMetadata.from_dict(obj["token"]) if obj.get("token") is not None else None,
92
+ }
93
+ )
94
+ return _obj
@@ -0,0 +1,85 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT AI Model Experiments API
5
+
6
+ This API provides endpoints for the STACKIT AI Model Experiments api
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: stackit-model-experiments@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
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 pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+
26
+ class ErrorResponse(BaseModel):
27
+ """
28
+ ErrorResponse
29
+ """ # noqa: E501
30
+
31
+ code: StrictInt = Field(description="The HTTP status code.")
32
+ message: StrictStr = Field(description="User facing error message.")
33
+ status: Optional[StrictStr] = Field(default=None, description="The canonical error code.")
34
+ __properties: ClassVar[List[str]] = ["code", "message", "status"]
35
+
36
+ model_config = ConfigDict(
37
+ validate_by_name=True,
38
+ validate_by_alias=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
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of ErrorResponse 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
+ return _dict
74
+
75
+ @classmethod
76
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
+ """Create an instance of ErrorResponse from a dict"""
78
+ if obj is None:
79
+ return None
80
+
81
+ if not isinstance(obj, dict):
82
+ return cls.model_validate(obj)
83
+
84
+ _obj = cls.model_validate({"code": obj.get("code"), "message": obj.get("message"), "status": obj.get("status")})
85
+ return _obj
@@ -0,0 +1,94 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT AI Model Experiments API
5
+
6
+ This API provides endpoints for the STACKIT AI Model Experiments api
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: stackit-model-experiments@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
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 pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+ from stackit.modelexperiments.models.instance import Instance
26
+
27
+
28
+ class GetInstanceResponse(BaseModel):
29
+ """
30
+ GetInstanceResponse
31
+ """ # noqa: E501
32
+
33
+ instance: Instance
34
+ message: Optional[StrictStr] = None
35
+ __properties: ClassVar[List[str]] = ["instance", "message"]
36
+
37
+ model_config = ConfigDict(
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of GetInstanceResponse 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 instance
75
+ if self.instance:
76
+ _dict["instance"] = self.instance.to_dict()
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of GetInstanceResponse from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate(
89
+ {
90
+ "instance": Instance.from_dict(obj["instance"]) if obj.get("instance") is not None else None,
91
+ "message": obj.get("message"),
92
+ }
93
+ )
94
+ return _obj
@@ -0,0 +1,94 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT AI Model Experiments API
5
+
6
+ This API provides endpoints for the STACKIT AI Model Experiments api
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Contact: stackit-model-experiments@stackit.cloud
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
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 pydantic_core import to_jsonable_python
23
+ from typing_extensions import Self
24
+
25
+ from stackit.modelexperiments.models.token_metadata import TokenMetadata
26
+
27
+
28
+ class GetInstanceTokenResponse(BaseModel):
29
+ """
30
+ GetInstanceTokenResponse
31
+ """ # noqa: E501
32
+
33
+ message: Optional[StrictStr] = None
34
+ token: TokenMetadata
35
+ __properties: ClassVar[List[str]] = ["message", "token"]
36
+
37
+ model_config = ConfigDict(
38
+ validate_by_name=True,
39
+ validate_by_alias=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of GetInstanceTokenResponse 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 token
75
+ if self.token:
76
+ _dict["token"] = self.token.to_dict()
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of GetInstanceTokenResponse from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate(
89
+ {
90
+ "message": obj.get("message"),
91
+ "token": TokenMetadata.from_dict(obj["token"]) if obj.get("token") is not None else None,
92
+ }
93
+ )
94
+ return _obj