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.
- src/stackit/modelexperiments/__init__.py +120 -0
- src/stackit/modelexperiments/api/__init__.py +4 -0
- src/stackit/modelexperiments/api/default_api.py +2913 -0
- src/stackit/modelexperiments/api_client.py +651 -0
- src/stackit/modelexperiments/api_response.py +23 -0
- src/stackit/modelexperiments/configuration.py +164 -0
- src/stackit/modelexperiments/exceptions.py +218 -0
- src/stackit/modelexperiments/models/__init__.py +61 -0
- src/stackit/modelexperiments/models/create_instance_payload.py +141 -0
- src/stackit/modelexperiments/models/create_instance_response.py +94 -0
- src/stackit/modelexperiments/models/create_instance_token_payload.py +124 -0
- src/stackit/modelexperiments/models/create_instance_token_response.py +94 -0
- src/stackit/modelexperiments/models/delete_instance_response.py +94 -0
- src/stackit/modelexperiments/models/delete_instance_token_response.py +94 -0
- src/stackit/modelexperiments/models/error_response.py +85 -0
- src/stackit/modelexperiments/models/get_instance_response.py +94 -0
- src/stackit/modelexperiments/models/get_instance_token_response.py +94 -0
- src/stackit/modelexperiments/models/instance.py +197 -0
- src/stackit/modelexperiments/models/list_instance_tokens_response.py +102 -0
- src/stackit/modelexperiments/models/list_instances_response.py +102 -0
- src/stackit/modelexperiments/models/partial_update_instance_payload.py +144 -0
- src/stackit/modelexperiments/models/partial_update_instance_response.py +94 -0
- src/stackit/modelexperiments/models/partial_update_instance_token_payload.py +117 -0
- src/stackit/modelexperiments/models/partial_update_instance_token_response.py +94 -0
- src/stackit/modelexperiments/models/token.py +164 -0
- src/stackit/modelexperiments/models/token_metadata.py +143 -0
- src/stackit/modelexperiments/models/token_state.py +39 -0
- src/stackit/modelexperiments/py.typed +0 -0
- src/stackit/modelexperiments/rest.py +165 -0
- stackit_modelexperiments-0.1.0.dist-info/METADATA +48 -0
- stackit_modelexperiments-0.1.0.dist-info/RECORD +34 -0
- stackit_modelexperiments-0.1.0.dist-info/WHEEL +4 -0
- stackit_modelexperiments-0.1.0.dist-info/licenses/LICENSE.md +201 -0
- stackit_modelexperiments-0.1.0.dist-info/licenses/NOTICE.txt +2 -0
|
@@ -0,0 +1,117 @@
|
|
|
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, field_validator
|
|
23
|
+
from pydantic_core import to_jsonable_python
|
|
24
|
+
from typing_extensions import Annotated, Self
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class PartialUpdateInstanceTokenPayload(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
PartialUpdateInstanceTokenPayload
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
|
|
32
|
+
description: Optional[Annotated[str, Field(strict=True, max_length=2000)]] = None
|
|
33
|
+
labels: Optional[Dict[str, Optional[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: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=200)]] = None
|
|
38
|
+
__properties: ClassVar[List[str]] = ["description", "labels", "name"]
|
|
39
|
+
|
|
40
|
+
@field_validator("description")
|
|
41
|
+
def description_validate_regular_expression(cls, value):
|
|
42
|
+
"""Validates the regular expression"""
|
|
43
|
+
if value is None:
|
|
44
|
+
return value
|
|
45
|
+
|
|
46
|
+
if not isinstance(value, str):
|
|
47
|
+
value = str(value)
|
|
48
|
+
|
|
49
|
+
if not re.match(r"^[0-9a-zA-Z\s.:\/\-]*$", value):
|
|
50
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]*$/")
|
|
51
|
+
return value
|
|
52
|
+
|
|
53
|
+
@field_validator("name")
|
|
54
|
+
def name_validate_regular_expression(cls, value):
|
|
55
|
+
"""Validates the regular expression"""
|
|
56
|
+
if value is None:
|
|
57
|
+
return value
|
|
58
|
+
|
|
59
|
+
if not isinstance(value, str):
|
|
60
|
+
value = str(value)
|
|
61
|
+
|
|
62
|
+
if not re.match(r"^[0-9a-zA-Z\s_-]*$", value):
|
|
63
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]*$/")
|
|
64
|
+
return value
|
|
65
|
+
|
|
66
|
+
model_config = ConfigDict(
|
|
67
|
+
validate_by_name=True,
|
|
68
|
+
validate_by_alias=True,
|
|
69
|
+
validate_assignment=True,
|
|
70
|
+
protected_namespaces=(),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
def to_str(self) -> str:
|
|
74
|
+
"""Returns the string representation of the model using alias"""
|
|
75
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
76
|
+
|
|
77
|
+
def to_json(self) -> str:
|
|
78
|
+
"""Returns the JSON representation of the model using alias"""
|
|
79
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of PartialUpdateInstanceTokenPayload from a JSON string"""
|
|
84
|
+
return cls.from_dict(json.loads(json_str))
|
|
85
|
+
|
|
86
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
87
|
+
"""Return the dictionary representation of the model using alias.
|
|
88
|
+
|
|
89
|
+
This has the following differences from calling pydantic's
|
|
90
|
+
`self.model_dump(by_alias=True)`:
|
|
91
|
+
|
|
92
|
+
* `None` is only added to the output dict for nullable fields that
|
|
93
|
+
were set at model initialization. Other fields with value `None`
|
|
94
|
+
are ignored.
|
|
95
|
+
"""
|
|
96
|
+
excluded_fields: Set[str] = set([])
|
|
97
|
+
|
|
98
|
+
_dict = self.model_dump(
|
|
99
|
+
by_alias=True,
|
|
100
|
+
exclude=excluded_fields,
|
|
101
|
+
exclude_none=True,
|
|
102
|
+
)
|
|
103
|
+
return _dict
|
|
104
|
+
|
|
105
|
+
@classmethod
|
|
106
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
107
|
+
"""Create an instance of PartialUpdateInstanceTokenPayload 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
|
+
{"description": obj.get("description"), "labels": obj.get("labels"), "name": obj.get("name")}
|
|
116
|
+
)
|
|
117
|
+
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 PartialUpdateInstanceTokenResponse(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
PartialUpdateInstanceTokenResponse
|
|
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 PartialUpdateInstanceTokenResponse 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 PartialUpdateInstanceTokenResponse 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,164 @@
|
|
|
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 datetime import datetime
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
22
|
+
from uuid import UUID
|
|
23
|
+
|
|
24
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
from typing_extensions import Annotated, Self
|
|
27
|
+
|
|
28
|
+
from stackit.modelexperiments.models.token_state import TokenState
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Token(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
Token
|
|
34
|
+
""" # noqa: E501
|
|
35
|
+
|
|
36
|
+
content: Annotated[str, Field(min_length=1, strict=True)]
|
|
37
|
+
description: Optional[Annotated[str, Field(strict=True, max_length=160)]] = None
|
|
38
|
+
id: UUID
|
|
39
|
+
labels: Optional[Dict[str, Annotated[str, Field(strict=True, max_length=63)]]] = Field(
|
|
40
|
+
default=None,
|
|
41
|
+
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.",
|
|
42
|
+
)
|
|
43
|
+
name: Annotated[str, Field(min_length=1, strict=True, max_length=64)]
|
|
44
|
+
region: StrictStr
|
|
45
|
+
state: TokenState
|
|
46
|
+
valid_until: datetime = Field(alias="validUntil")
|
|
47
|
+
__properties: ClassVar[List[str]] = [
|
|
48
|
+
"content",
|
|
49
|
+
"description",
|
|
50
|
+
"id",
|
|
51
|
+
"labels",
|
|
52
|
+
"name",
|
|
53
|
+
"region",
|
|
54
|
+
"state",
|
|
55
|
+
"validUntil",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
@field_validator("content")
|
|
59
|
+
def content_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"^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+$", value):
|
|
65
|
+
raise ValueError(r"must validate the regular expression /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+$/")
|
|
66
|
+
return value
|
|
67
|
+
|
|
68
|
+
@field_validator("description")
|
|
69
|
+
def description_validate_regular_expression(cls, value):
|
|
70
|
+
"""Validates the regular expression"""
|
|
71
|
+
if value is None:
|
|
72
|
+
return value
|
|
73
|
+
|
|
74
|
+
if not isinstance(value, str):
|
|
75
|
+
value = str(value)
|
|
76
|
+
|
|
77
|
+
if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
|
|
78
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
|
|
79
|
+
return value
|
|
80
|
+
|
|
81
|
+
@field_validator("name")
|
|
82
|
+
def name_validate_regular_expression(cls, value):
|
|
83
|
+
"""Validates the regular expression"""
|
|
84
|
+
if not isinstance(value, str):
|
|
85
|
+
value = str(value)
|
|
86
|
+
|
|
87
|
+
if not re.match(r"^[0-9a-zA-Z\s_-]+$", value):
|
|
88
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]+$/")
|
|
89
|
+
return value
|
|
90
|
+
|
|
91
|
+
@field_validator("valid_until", mode="before")
|
|
92
|
+
def valid_until_change_year_zero_to_one(cls, value):
|
|
93
|
+
"""Workaround which prevents year 0 issue"""
|
|
94
|
+
if isinstance(value, str):
|
|
95
|
+
# Check for year "0000" at the beginning of the string
|
|
96
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
97
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
98
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
99
|
+
):
|
|
100
|
+
# Workaround: Replace "0000" with "0001"
|
|
101
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
102
|
+
return value
|
|
103
|
+
|
|
104
|
+
model_config = ConfigDict(
|
|
105
|
+
validate_by_name=True,
|
|
106
|
+
validate_by_alias=True,
|
|
107
|
+
validate_assignment=True,
|
|
108
|
+
protected_namespaces=(),
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
def to_str(self) -> str:
|
|
112
|
+
"""Returns the string representation of the model using alias"""
|
|
113
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
114
|
+
|
|
115
|
+
def to_json(self) -> str:
|
|
116
|
+
"""Returns the JSON representation of the model using alias"""
|
|
117
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
118
|
+
|
|
119
|
+
@classmethod
|
|
120
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
121
|
+
"""Create an instance of Token from a JSON string"""
|
|
122
|
+
return cls.from_dict(json.loads(json_str))
|
|
123
|
+
|
|
124
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
125
|
+
"""Return the dictionary representation of the model using alias.
|
|
126
|
+
|
|
127
|
+
This has the following differences from calling pydantic's
|
|
128
|
+
`self.model_dump(by_alias=True)`:
|
|
129
|
+
|
|
130
|
+
* `None` is only added to the output dict for nullable fields that
|
|
131
|
+
were set at model initialization. Other fields with value `None`
|
|
132
|
+
are ignored.
|
|
133
|
+
"""
|
|
134
|
+
excluded_fields: Set[str] = set([])
|
|
135
|
+
|
|
136
|
+
_dict = self.model_dump(
|
|
137
|
+
by_alias=True,
|
|
138
|
+
exclude=excluded_fields,
|
|
139
|
+
exclude_none=True,
|
|
140
|
+
)
|
|
141
|
+
return _dict
|
|
142
|
+
|
|
143
|
+
@classmethod
|
|
144
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
145
|
+
"""Create an instance of Token from a dict"""
|
|
146
|
+
if obj is None:
|
|
147
|
+
return None
|
|
148
|
+
|
|
149
|
+
if not isinstance(obj, dict):
|
|
150
|
+
return cls.model_validate(obj)
|
|
151
|
+
|
|
152
|
+
_obj = cls.model_validate(
|
|
153
|
+
{
|
|
154
|
+
"content": obj.get("content"),
|
|
155
|
+
"description": obj.get("description"),
|
|
156
|
+
"id": obj.get("id"),
|
|
157
|
+
"labels": obj.get("labels"),
|
|
158
|
+
"name": obj.get("name"),
|
|
159
|
+
"region": obj.get("region"),
|
|
160
|
+
"state": obj.get("state"),
|
|
161
|
+
"validUntil": obj.get("validUntil"),
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
return _obj
|
|
@@ -0,0 +1,143 @@
|
|
|
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 datetime import datetime
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
22
|
+
from uuid import UUID
|
|
23
|
+
|
|
24
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
from typing_extensions import Annotated, Self
|
|
27
|
+
|
|
28
|
+
from stackit.modelexperiments.models.token_state import TokenState
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class TokenMetadata(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
TokenMetadata
|
|
34
|
+
""" # noqa: E501
|
|
35
|
+
|
|
36
|
+
description: Optional[Annotated[str, Field(strict=True, max_length=160)]] = None
|
|
37
|
+
id: UUID
|
|
38
|
+
labels: Optional[Dict[str, Annotated[str, Field(strict=True, max_length=63)]]] = Field(
|
|
39
|
+
default=None,
|
|
40
|
+
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.",
|
|
41
|
+
)
|
|
42
|
+
name: Annotated[str, Field(min_length=1, strict=True, max_length=64)]
|
|
43
|
+
region: StrictStr
|
|
44
|
+
state: TokenState
|
|
45
|
+
valid_until: datetime = Field(alias="validUntil")
|
|
46
|
+
__properties: ClassVar[List[str]] = ["description", "id", "labels", "name", "region", "state", "validUntil"]
|
|
47
|
+
|
|
48
|
+
@field_validator("description")
|
|
49
|
+
def description_validate_regular_expression(cls, value):
|
|
50
|
+
"""Validates the regular expression"""
|
|
51
|
+
if value is None:
|
|
52
|
+
return value
|
|
53
|
+
|
|
54
|
+
if not isinstance(value, str):
|
|
55
|
+
value = str(value)
|
|
56
|
+
|
|
57
|
+
if not re.match(r"^[0-9a-zA-Z\s.:\/\-]+$", value):
|
|
58
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s.:\/\-]+$/")
|
|
59
|
+
return value
|
|
60
|
+
|
|
61
|
+
@field_validator("name")
|
|
62
|
+
def name_validate_regular_expression(cls, value):
|
|
63
|
+
"""Validates the regular expression"""
|
|
64
|
+
if not isinstance(value, str):
|
|
65
|
+
value = str(value)
|
|
66
|
+
|
|
67
|
+
if not re.match(r"^[0-9a-zA-Z\s_-]+$", value):
|
|
68
|
+
raise ValueError(r"must validate the regular expression /^[0-9a-zA-Z\s_-]+$/")
|
|
69
|
+
return value
|
|
70
|
+
|
|
71
|
+
@field_validator("valid_until", mode="before")
|
|
72
|
+
def valid_until_change_year_zero_to_one(cls, value):
|
|
73
|
+
"""Workaround which prevents year 0 issue"""
|
|
74
|
+
if isinstance(value, str):
|
|
75
|
+
# Check for year "0000" at the beginning of the string
|
|
76
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
77
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
78
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
79
|
+
):
|
|
80
|
+
# Workaround: Replace "0000" with "0001"
|
|
81
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
82
|
+
return value
|
|
83
|
+
|
|
84
|
+
model_config = ConfigDict(
|
|
85
|
+
validate_by_name=True,
|
|
86
|
+
validate_by_alias=True,
|
|
87
|
+
validate_assignment=True,
|
|
88
|
+
protected_namespaces=(),
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
def to_str(self) -> str:
|
|
92
|
+
"""Returns the string representation of the model using alias"""
|
|
93
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
94
|
+
|
|
95
|
+
def to_json(self) -> str:
|
|
96
|
+
"""Returns the JSON representation of the model using alias"""
|
|
97
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
98
|
+
|
|
99
|
+
@classmethod
|
|
100
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
101
|
+
"""Create an instance of TokenMetadata from a JSON string"""
|
|
102
|
+
return cls.from_dict(json.loads(json_str))
|
|
103
|
+
|
|
104
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
105
|
+
"""Return the dictionary representation of the model using alias.
|
|
106
|
+
|
|
107
|
+
This has the following differences from calling pydantic's
|
|
108
|
+
`self.model_dump(by_alias=True)`:
|
|
109
|
+
|
|
110
|
+
* `None` is only added to the output dict for nullable fields that
|
|
111
|
+
were set at model initialization. Other fields with value `None`
|
|
112
|
+
are ignored.
|
|
113
|
+
"""
|
|
114
|
+
excluded_fields: Set[str] = set([])
|
|
115
|
+
|
|
116
|
+
_dict = self.model_dump(
|
|
117
|
+
by_alias=True,
|
|
118
|
+
exclude=excluded_fields,
|
|
119
|
+
exclude_none=True,
|
|
120
|
+
)
|
|
121
|
+
return _dict
|
|
122
|
+
|
|
123
|
+
@classmethod
|
|
124
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
125
|
+
"""Create an instance of TokenMetadata from a dict"""
|
|
126
|
+
if obj is None:
|
|
127
|
+
return None
|
|
128
|
+
|
|
129
|
+
if not isinstance(obj, dict):
|
|
130
|
+
return cls.model_validate(obj)
|
|
131
|
+
|
|
132
|
+
_obj = cls.model_validate(
|
|
133
|
+
{
|
|
134
|
+
"description": obj.get("description"),
|
|
135
|
+
"id": obj.get("id"),
|
|
136
|
+
"labels": obj.get("labels"),
|
|
137
|
+
"name": obj.get("name"),
|
|
138
|
+
"region": obj.get("region"),
|
|
139
|
+
"state": obj.get("state"),
|
|
140
|
+
"validUntil": obj.get("validUntil"),
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
return _obj
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
from enum import Enum
|
|
19
|
+
|
|
20
|
+
from typing_extensions import Self
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class TokenState(str, Enum):
|
|
24
|
+
"""
|
|
25
|
+
The lifecycle state of the token.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
"""
|
|
29
|
+
allowed enum values
|
|
30
|
+
"""
|
|
31
|
+
CREATING = "creating"
|
|
32
|
+
ACTIVE = "active"
|
|
33
|
+
DELETING = "deleting"
|
|
34
|
+
INACTIVE = "inactive"
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def from_json(cls, json_str: str) -> Self:
|
|
38
|
+
"""Create an instance of TokenState from a JSON string"""
|
|
39
|
+
return cls(json.loads(json_str))
|
|
File without changes
|