stackit-telemetryrouter 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/telemetryrouter/__init__.py +151 -0
- src/stackit/telemetryrouter/api/__init__.py +4 -0
- src/stackit/telemetryrouter/api/default_api.py +4511 -0
- src/stackit/telemetryrouter/api_client.py +652 -0
- src/stackit/telemetryrouter/api_response.py +23 -0
- src/stackit/telemetryrouter/configuration.py +163 -0
- src/stackit/telemetryrouter/exceptions.py +217 -0
- src/stackit/telemetryrouter/models/__init__.py +80 -0
- src/stackit/telemetryrouter/models/access_token_base_request.py +105 -0
- src/stackit/telemetryrouter/models/access_token_base_response.py +138 -0
- src/stackit/telemetryrouter/models/config_filter.py +100 -0
- src/stackit/telemetryrouter/models/config_filter_attributes.py +96 -0
- src/stackit/telemetryrouter/models/config_filter_level.py +37 -0
- src/stackit/telemetryrouter/models/config_filter_matcher.py +36 -0
- src/stackit/telemetryrouter/models/create_access_token_payload.py +105 -0
- src/stackit/telemetryrouter/models/create_access_token_response.py +148 -0
- src/stackit/telemetryrouter/models/create_destination_payload.py +107 -0
- src/stackit/telemetryrouter/models/create_telemetry_router_payload.py +107 -0
- src/stackit/telemetryrouter/models/destination_config.py +111 -0
- src/stackit/telemetryrouter/models/destination_config_open_telemetry.py +102 -0
- src/stackit/telemetryrouter/models/destination_config_open_telemetry_basic_auth.py +82 -0
- src/stackit/telemetryrouter/models/destination_config_s3.py +102 -0
- src/stackit/telemetryrouter/models/destination_config_s3_access_key.py +82 -0
- src/stackit/telemetryrouter/models/destination_config_type.py +36 -0
- src/stackit/telemetryrouter/models/destination_response.py +152 -0
- src/stackit/telemetryrouter/models/get_access_token_response.py +138 -0
- src/stackit/telemetryrouter/models/list_access_tokens_response.py +104 -0
- src/stackit/telemetryrouter/models/list_destinations_response.py +102 -0
- src/stackit/telemetryrouter/models/list_telemetry_routers_response.py +104 -0
- src/stackit/telemetryrouter/models/response4xx.py +81 -0
- src/stackit/telemetryrouter/models/telemetry_router_response.py +137 -0
- src/stackit/telemetryrouter/models/update_access_token_payload.py +105 -0
- src/stackit/telemetryrouter/models/update_access_token_response.py +138 -0
- src/stackit/telemetryrouter/models/update_destination_payload.py +112 -0
- src/stackit/telemetryrouter/models/update_telemetry_router_payload.py +112 -0
- src/stackit/telemetryrouter/py.typed +0 -0
- src/stackit/telemetryrouter/rest.py +164 -0
- stackit_telemetryrouter-0.1.0.dist-info/METADATA +48 -0
- stackit_telemetryrouter-0.1.0.dist-info/RECORD +42 -0
- stackit_telemetryrouter-0.1.0.dist-info/WHEEL +4 -0
- stackit_telemetryrouter-0.1.0.dist-info/licenses/LICENSE.md +201 -0
- stackit_telemetryrouter-0.1.0.dist-info/licenses/NOTICE.txt +2 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Telemetry Router API
|
|
5
|
+
|
|
6
|
+
This API provides endpoints for managing Telemetry Routers.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from datetime import datetime
|
|
20
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
21
|
+
from uuid import UUID
|
|
22
|
+
|
|
23
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
24
|
+
from typing_extensions import Annotated, Self
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class AccessTokenBaseResponse(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
AccessTokenBaseResponse
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
|
|
32
|
+
creator_id: StrictStr = Field(description="The user ID of the creator of the access token.", alias="creatorId")
|
|
33
|
+
description: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(
|
|
34
|
+
default=None, description="The description of the access token."
|
|
35
|
+
)
|
|
36
|
+
display_name: Annotated[str, Field(min_length=1, strict=True, max_length=32)] = Field(
|
|
37
|
+
description="The selected display name of the access token.", alias="displayName"
|
|
38
|
+
)
|
|
39
|
+
expiration_time: Optional[datetime] = Field(
|
|
40
|
+
default=None,
|
|
41
|
+
description="The date and time until the access token is valid to (inclusively).",
|
|
42
|
+
alias="expirationTime",
|
|
43
|
+
)
|
|
44
|
+
id: UUID = Field(description="An auto generated unique id which identifies the access token.")
|
|
45
|
+
status: StrictStr
|
|
46
|
+
__properties: ClassVar[List[str]] = ["creatorId", "description", "displayName", "expirationTime", "id", "status"]
|
|
47
|
+
|
|
48
|
+
@field_validator("display_name")
|
|
49
|
+
def display_name_validate_regular_expression(cls, value):
|
|
50
|
+
"""Validates the regular expression"""
|
|
51
|
+
if not re.match(r"^[a-zA-Z0-9][a-zA-Z0-9 ]*$", value):
|
|
52
|
+
raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9][a-zA-Z0-9 ]*$/")
|
|
53
|
+
return value
|
|
54
|
+
|
|
55
|
+
@field_validator("expiration_time", mode="before")
|
|
56
|
+
def expiration_time_change_year_zero_to_one(cls, value):
|
|
57
|
+
"""Workaround which prevents year 0 issue"""
|
|
58
|
+
if isinstance(value, str):
|
|
59
|
+
# Check for year "0000" at the beginning of the string
|
|
60
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
61
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
62
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
63
|
+
):
|
|
64
|
+
# Workaround: Replace "0000" with "0001"
|
|
65
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
66
|
+
return value
|
|
67
|
+
|
|
68
|
+
@field_validator("status")
|
|
69
|
+
def status_validate_enum(cls, value):
|
|
70
|
+
"""Validates the enum"""
|
|
71
|
+
if value not in set(["active", "expired", "deleting"]):
|
|
72
|
+
raise ValueError("must be one of enum values ('active', 'expired', 'deleting')")
|
|
73
|
+
return value
|
|
74
|
+
|
|
75
|
+
model_config = ConfigDict(
|
|
76
|
+
populate_by_name=True,
|
|
77
|
+
validate_assignment=True,
|
|
78
|
+
protected_namespaces=(),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
def to_str(self) -> str:
|
|
82
|
+
"""Returns the string representation of the model using alias"""
|
|
83
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
84
|
+
|
|
85
|
+
def to_json(self) -> str:
|
|
86
|
+
"""Returns the JSON representation of the model using alias"""
|
|
87
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
88
|
+
return json.dumps(self.to_dict())
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
92
|
+
"""Create an instance of AccessTokenBaseResponse from a JSON string"""
|
|
93
|
+
return cls.from_dict(json.loads(json_str))
|
|
94
|
+
|
|
95
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
96
|
+
"""Return the dictionary representation of the model using alias.
|
|
97
|
+
|
|
98
|
+
This has the following differences from calling pydantic's
|
|
99
|
+
`self.model_dump(by_alias=True)`:
|
|
100
|
+
|
|
101
|
+
* `None` is only added to the output dict for nullable fields that
|
|
102
|
+
were set at model initialization. Other fields with value `None`
|
|
103
|
+
are ignored.
|
|
104
|
+
"""
|
|
105
|
+
excluded_fields: Set[str] = set([])
|
|
106
|
+
|
|
107
|
+
_dict = self.model_dump(
|
|
108
|
+
by_alias=True,
|
|
109
|
+
exclude=excluded_fields,
|
|
110
|
+
exclude_none=True,
|
|
111
|
+
)
|
|
112
|
+
# set to None if expiration_time (nullable) is None
|
|
113
|
+
# and model_fields_set contains the field
|
|
114
|
+
if self.expiration_time is None and "expiration_time" in self.model_fields_set:
|
|
115
|
+
_dict["expirationTime"] = None
|
|
116
|
+
|
|
117
|
+
return _dict
|
|
118
|
+
|
|
119
|
+
@classmethod
|
|
120
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
121
|
+
"""Create an instance of AccessTokenBaseResponse from a dict"""
|
|
122
|
+
if obj is None:
|
|
123
|
+
return None
|
|
124
|
+
|
|
125
|
+
if not isinstance(obj, dict):
|
|
126
|
+
return cls.model_validate(obj)
|
|
127
|
+
|
|
128
|
+
_obj = cls.model_validate(
|
|
129
|
+
{
|
|
130
|
+
"creatorId": obj.get("creatorId"),
|
|
131
|
+
"description": obj.get("description"),
|
|
132
|
+
"displayName": obj.get("displayName"),
|
|
133
|
+
"expirationTime": obj.get("expirationTime"),
|
|
134
|
+
"id": obj.get("id"),
|
|
135
|
+
"status": obj.get("status"),
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
return _obj
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Telemetry Router API
|
|
5
|
+
|
|
6
|
+
This API provides endpoints for managing Telemetry Routers.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
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 Annotated, Self
|
|
22
|
+
|
|
23
|
+
from stackit.telemetryrouter.models.config_filter_attributes import (
|
|
24
|
+
ConfigFilterAttributes,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ConfigFilter(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
ConfigFilter
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
|
|
33
|
+
attributes: Annotated[List[ConfigFilterAttributes], Field(min_length=1, max_length=100)]
|
|
34
|
+
__properties: ClassVar[List[str]] = ["attributes"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of ConfigFilter from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([])
|
|
67
|
+
|
|
68
|
+
_dict = self.model_dump(
|
|
69
|
+
by_alias=True,
|
|
70
|
+
exclude=excluded_fields,
|
|
71
|
+
exclude_none=True,
|
|
72
|
+
)
|
|
73
|
+
# override the default output from pydantic by calling `to_dict()` of each item in attributes (list)
|
|
74
|
+
_items = []
|
|
75
|
+
if self.attributes:
|
|
76
|
+
for _item_attributes in self.attributes:
|
|
77
|
+
if _item_attributes:
|
|
78
|
+
_items.append(_item_attributes.to_dict())
|
|
79
|
+
_dict["attributes"] = _items
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of ConfigFilter from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate(
|
|
92
|
+
{
|
|
93
|
+
"attributes": (
|
|
94
|
+
[ConfigFilterAttributes.from_dict(_item) for _item in obj["attributes"]]
|
|
95
|
+
if obj.get("attributes") is not None
|
|
96
|
+
else None
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
return _obj
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Telemetry Router API
|
|
5
|
+
|
|
6
|
+
This API provides endpoints for managing Telemetry Routers.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
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 Annotated, Self
|
|
22
|
+
|
|
23
|
+
from stackit.telemetryrouter.models.config_filter_level import ConfigFilterLevel
|
|
24
|
+
from stackit.telemetryrouter.models.config_filter_matcher import ConfigFilterMatcher
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ConfigFilterAttributes(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
ConfigFilterAttributes
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
|
|
32
|
+
key: Annotated[str, Field(min_length=1, strict=True, max_length=1024)]
|
|
33
|
+
level: ConfigFilterLevel
|
|
34
|
+
matcher: ConfigFilterMatcher
|
|
35
|
+
values: Annotated[
|
|
36
|
+
List[Annotated[str, Field(min_length=1, strict=True, max_length=1024)]], Field(min_length=1, max_length=100)
|
|
37
|
+
]
|
|
38
|
+
__properties: ClassVar[List[str]] = ["key", "level", "matcher", "values"]
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
populate_by_name=True,
|
|
42
|
+
validate_assignment=True,
|
|
43
|
+
protected_namespaces=(),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
def to_str(self) -> str:
|
|
47
|
+
"""Returns the string representation of the model using alias"""
|
|
48
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
49
|
+
|
|
50
|
+
def to_json(self) -> str:
|
|
51
|
+
"""Returns the JSON representation of the model using alias"""
|
|
52
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
53
|
+
return json.dumps(self.to_dict())
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
|
+
"""Create an instance of ConfigFilterAttributes from a JSON string"""
|
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
|
59
|
+
|
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
|
62
|
+
|
|
63
|
+
This has the following differences from calling pydantic's
|
|
64
|
+
`self.model_dump(by_alias=True)`:
|
|
65
|
+
|
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
|
67
|
+
were set at model initialization. Other fields with value `None`
|
|
68
|
+
are ignored.
|
|
69
|
+
"""
|
|
70
|
+
excluded_fields: Set[str] = set([])
|
|
71
|
+
|
|
72
|
+
_dict = self.model_dump(
|
|
73
|
+
by_alias=True,
|
|
74
|
+
exclude=excluded_fields,
|
|
75
|
+
exclude_none=True,
|
|
76
|
+
)
|
|
77
|
+
return _dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of ConfigFilterAttributes 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
|
+
"key": obj.get("key"),
|
|
91
|
+
"level": obj.get("level"),
|
|
92
|
+
"matcher": obj.get("matcher"),
|
|
93
|
+
"values": obj.get("values"),
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
return _obj
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Telemetry Router API
|
|
5
|
+
|
|
6
|
+
This API provides endpoints for managing Telemetry Routers.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
from enum import Enum
|
|
18
|
+
|
|
19
|
+
from typing_extensions import Self
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ConfigFilterLevel(str, Enum):
|
|
23
|
+
"""
|
|
24
|
+
ConfigFilterLevel
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
allowed enum values
|
|
29
|
+
"""
|
|
30
|
+
RESOURCE = "resource"
|
|
31
|
+
SCOPE = "scope"
|
|
32
|
+
LOGRECORD = "logRecord"
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def from_json(cls, json_str: str) -> Self:
|
|
36
|
+
"""Create an instance of ConfigFilterLevel from a JSON string"""
|
|
37
|
+
return cls(json.loads(json_str))
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Telemetry Router API
|
|
5
|
+
|
|
6
|
+
This API provides endpoints for managing Telemetry Routers.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
from enum import Enum
|
|
18
|
+
|
|
19
|
+
from typing_extensions import Self
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ConfigFilterMatcher(str, Enum):
|
|
23
|
+
"""
|
|
24
|
+
ConfigFilterMatcher
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
allowed enum values
|
|
29
|
+
"""
|
|
30
|
+
EQUAL = "="
|
|
31
|
+
EXCLAMATION_EQUAL = "!="
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def from_json(cls, json_str: str) -> Self:
|
|
35
|
+
"""Create an instance of ConfigFilterMatcher from a JSON string"""
|
|
36
|
+
return cls(json.loads(json_str))
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Telemetry Router API
|
|
5
|
+
|
|
6
|
+
This API provides endpoints for managing Telemetry Routers.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
|
22
|
+
from typing_extensions import Annotated, Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class CreateAccessTokenPayload(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
CreateAccessTokenPayload
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
|
|
30
|
+
description: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(
|
|
31
|
+
default=None, description="The description of the access token."
|
|
32
|
+
)
|
|
33
|
+
display_name: Annotated[str, Field(min_length=1, strict=True, max_length=32)] = Field(
|
|
34
|
+
description="The selected display name of the access token.", alias="displayName"
|
|
35
|
+
)
|
|
36
|
+
ttl: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(
|
|
37
|
+
default=None,
|
|
38
|
+
description="The time-to-live (TTL) in days for the access token. If not set, token will not expire.",
|
|
39
|
+
)
|
|
40
|
+
__properties: ClassVar[List[str]] = ["description", "displayName", "ttl"]
|
|
41
|
+
|
|
42
|
+
@field_validator("display_name")
|
|
43
|
+
def display_name_validate_regular_expression(cls, value):
|
|
44
|
+
"""Validates the regular expression"""
|
|
45
|
+
if not re.match(r"^[a-zA-Z0-9][a-zA-Z0-9 \-]*$", value):
|
|
46
|
+
raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9][a-zA-Z0-9 \-]*$/")
|
|
47
|
+
return value
|
|
48
|
+
|
|
49
|
+
model_config = ConfigDict(
|
|
50
|
+
populate_by_name=True,
|
|
51
|
+
validate_assignment=True,
|
|
52
|
+
protected_namespaces=(),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
def to_str(self) -> str:
|
|
56
|
+
"""Returns the string representation of the model using alias"""
|
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
58
|
+
|
|
59
|
+
def to_json(self) -> str:
|
|
60
|
+
"""Returns the JSON representation of the model using alias"""
|
|
61
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
62
|
+
return json.dumps(self.to_dict())
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
66
|
+
"""Create an instance of CreateAccessTokenPayload from a JSON string"""
|
|
67
|
+
return cls.from_dict(json.loads(json_str))
|
|
68
|
+
|
|
69
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
70
|
+
"""Return the dictionary representation of the model using alias.
|
|
71
|
+
|
|
72
|
+
This has the following differences from calling pydantic's
|
|
73
|
+
`self.model_dump(by_alias=True)`:
|
|
74
|
+
|
|
75
|
+
* `None` is only added to the output dict for nullable fields that
|
|
76
|
+
were set at model initialization. Other fields with value `None`
|
|
77
|
+
are ignored.
|
|
78
|
+
"""
|
|
79
|
+
excluded_fields: Set[str] = set([])
|
|
80
|
+
|
|
81
|
+
_dict = self.model_dump(
|
|
82
|
+
by_alias=True,
|
|
83
|
+
exclude=excluded_fields,
|
|
84
|
+
exclude_none=True,
|
|
85
|
+
)
|
|
86
|
+
# set to None if ttl (nullable) is None
|
|
87
|
+
# and model_fields_set contains the field
|
|
88
|
+
if self.ttl is None and "ttl" in self.model_fields_set:
|
|
89
|
+
_dict["ttl"] = None
|
|
90
|
+
|
|
91
|
+
return _dict
|
|
92
|
+
|
|
93
|
+
@classmethod
|
|
94
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
95
|
+
"""Create an instance of CreateAccessTokenPayload from a dict"""
|
|
96
|
+
if obj is None:
|
|
97
|
+
return None
|
|
98
|
+
|
|
99
|
+
if not isinstance(obj, dict):
|
|
100
|
+
return cls.model_validate(obj)
|
|
101
|
+
|
|
102
|
+
_obj = cls.model_validate(
|
|
103
|
+
{"description": obj.get("description"), "displayName": obj.get("displayName"), "ttl": obj.get("ttl")}
|
|
104
|
+
)
|
|
105
|
+
return _obj
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Telemetry Router API
|
|
5
|
+
|
|
6
|
+
This API provides endpoints for managing Telemetry Routers.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
from datetime import datetime
|
|
20
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
21
|
+
from uuid import UUID
|
|
22
|
+
|
|
23
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
24
|
+
from typing_extensions import Annotated, Self
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class CreateAccessTokenResponse(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
CreateAccessTokenResponse
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
|
|
32
|
+
creator_id: StrictStr = Field(description="The user ID of the creator of the access token.", alias="creatorId")
|
|
33
|
+
description: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field(
|
|
34
|
+
default=None, description="The description of the access token."
|
|
35
|
+
)
|
|
36
|
+
display_name: Annotated[str, Field(min_length=1, strict=True, max_length=32)] = Field(
|
|
37
|
+
description="The selected display name of the access token.", alias="displayName"
|
|
38
|
+
)
|
|
39
|
+
expiration_time: Optional[datetime] = Field(
|
|
40
|
+
default=None,
|
|
41
|
+
description="The date and time until the access token is valid to (inclusively).",
|
|
42
|
+
alias="expirationTime",
|
|
43
|
+
)
|
|
44
|
+
id: UUID = Field(description="An auto generated unique id which identifies the access token.")
|
|
45
|
+
status: StrictStr
|
|
46
|
+
access_token: StrictStr = Field(description="The generated access token.", alias="accessToken")
|
|
47
|
+
__properties: ClassVar[List[str]] = [
|
|
48
|
+
"creatorId",
|
|
49
|
+
"description",
|
|
50
|
+
"displayName",
|
|
51
|
+
"expirationTime",
|
|
52
|
+
"id",
|
|
53
|
+
"status",
|
|
54
|
+
"accessToken",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
@field_validator("display_name")
|
|
58
|
+
def display_name_validate_regular_expression(cls, value):
|
|
59
|
+
"""Validates the regular expression"""
|
|
60
|
+
if not re.match(r"^[a-zA-Z0-9][a-zA-Z0-9 ]*$", value):
|
|
61
|
+
raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9][a-zA-Z0-9 ]*$/")
|
|
62
|
+
return value
|
|
63
|
+
|
|
64
|
+
@field_validator("expiration_time", mode="before")
|
|
65
|
+
def expiration_time_change_year_zero_to_one(cls, value):
|
|
66
|
+
"""Workaround which prevents year 0 issue"""
|
|
67
|
+
if isinstance(value, str):
|
|
68
|
+
# Check for year "0000" at the beginning of the string
|
|
69
|
+
# This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ
|
|
70
|
+
if value.startswith("0000-01-01T") and re.match(
|
|
71
|
+
r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value
|
|
72
|
+
):
|
|
73
|
+
# Workaround: Replace "0000" with "0001"
|
|
74
|
+
return "0001" + value[4:] # Take "0001" and append the rest of the string
|
|
75
|
+
return value
|
|
76
|
+
|
|
77
|
+
@field_validator("status")
|
|
78
|
+
def status_validate_enum(cls, value):
|
|
79
|
+
"""Validates the enum"""
|
|
80
|
+
if value not in set(["active", "expired", "deleting"]):
|
|
81
|
+
raise ValueError("must be one of enum values ('active', 'expired', 'deleting')")
|
|
82
|
+
return value
|
|
83
|
+
|
|
84
|
+
model_config = ConfigDict(
|
|
85
|
+
populate_by_name=True,
|
|
86
|
+
validate_assignment=True,
|
|
87
|
+
protected_namespaces=(),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
def to_str(self) -> str:
|
|
91
|
+
"""Returns the string representation of the model using alias"""
|
|
92
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
93
|
+
|
|
94
|
+
def to_json(self) -> str:
|
|
95
|
+
"""Returns the JSON representation of the model using alias"""
|
|
96
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
97
|
+
return json.dumps(self.to_dict())
|
|
98
|
+
|
|
99
|
+
@classmethod
|
|
100
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
101
|
+
"""Create an instance of CreateAccessTokenResponse 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
|
+
# set to None if expiration_time (nullable) is None
|
|
122
|
+
# and model_fields_set contains the field
|
|
123
|
+
if self.expiration_time is None and "expiration_time" in self.model_fields_set:
|
|
124
|
+
_dict["expirationTime"] = None
|
|
125
|
+
|
|
126
|
+
return _dict
|
|
127
|
+
|
|
128
|
+
@classmethod
|
|
129
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
130
|
+
"""Create an instance of CreateAccessTokenResponse from a dict"""
|
|
131
|
+
if obj is None:
|
|
132
|
+
return None
|
|
133
|
+
|
|
134
|
+
if not isinstance(obj, dict):
|
|
135
|
+
return cls.model_validate(obj)
|
|
136
|
+
|
|
137
|
+
_obj = cls.model_validate(
|
|
138
|
+
{
|
|
139
|
+
"creatorId": obj.get("creatorId"),
|
|
140
|
+
"description": obj.get("description"),
|
|
141
|
+
"displayName": obj.get("displayName"),
|
|
142
|
+
"expirationTime": obj.get("expirationTime"),
|
|
143
|
+
"id": obj.get("id"),
|
|
144
|
+
"status": obj.get("status"),
|
|
145
|
+
"accessToken": obj.get("accessToken"),
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
return _obj
|