diff --git a/services/telemetryrouter/oas_commit b/services/telemetryrouter/oas_commit index 18a3d91ae..b695fcc0e 100644 --- a/services/telemetryrouter/oas_commit +++ b/services/telemetryrouter/oas_commit @@ -1 +1 @@ -915f82be0b0f434901fcedc91fafe58b652035ef +ce85c358fa92fa2943b3914b05bf1d2059d1d9b6 diff --git a/services/telemetryrouter/src/stackit/telemetryrouter/__init__.py b/services/telemetryrouter/src/stackit/telemetryrouter/__init__.py index f6b382809..529968f2b 100644 --- a/services/telemetryrouter/src/stackit/telemetryrouter/__init__.py +++ b/services/telemetryrouter/src/stackit/telemetryrouter/__init__.py @@ -48,6 +48,7 @@ "ListAccessTokensResponse", "ListDestinationsResponse", "ListTelemetryRoutersResponse", + "PartialUpdateTelemetryRouterPayload", "Response4xx", "TelemetryRouterResponse", "UpdateAccessTokenPayload", @@ -132,6 +133,9 @@ from stackit.telemetryrouter.models.list_telemetry_routers_response import ( ListTelemetryRoutersResponse as ListTelemetryRoutersResponse, ) +from stackit.telemetryrouter.models.partial_update_telemetry_router_payload import ( + PartialUpdateTelemetryRouterPayload as PartialUpdateTelemetryRouterPayload, +) from stackit.telemetryrouter.models.response4xx import Response4xx as Response4xx from stackit.telemetryrouter.models.telemetry_router_response import ( TelemetryRouterResponse as TelemetryRouterResponse, diff --git a/services/telemetryrouter/src/stackit/telemetryrouter/api/default_api.py b/services/telemetryrouter/src/stackit/telemetryrouter/api/default_api.py index b93daab26..aa2c1a51e 100644 --- a/services/telemetryrouter/src/stackit/telemetryrouter/api/default_api.py +++ b/services/telemetryrouter/src/stackit/telemetryrouter/api/default_api.py @@ -52,6 +52,9 @@ from stackit.telemetryrouter.models.list_telemetry_routers_response import ( ListTelemetryRoutersResponse, ) +from stackit.telemetryrouter.models.partial_update_telemetry_router_payload import ( + PartialUpdateTelemetryRouterPayload, +) from stackit.telemetryrouter.models.telemetry_router_response import ( TelemetryRouterResponse, ) @@ -3598,6 +3601,300 @@ def _list_telemetry_routers_serialize( _request_auth=_request_auth, ) + @validate_call + def partial_update_telemetry_router( + self, + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the resource is located in.")], + region_id: Annotated[StrictStr, Field(description="The STACKIT region name the resource is located in.")], + telemetry_router_id: Annotated[UUID, Field(description="The Telemetry Router UUID.")], + partial_update_telemetry_router_payload: PartialUpdateTelemetryRouterPayload, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> TelemetryRouterResponse: + """partial_update_telemetry_router + + Patches the given Telemetry Router. + + :param project_id: The STACKIT portal project UUID the resource is located in. (required) + :type project_id: UUID + :param region_id: The STACKIT region name the resource is located in. (required) + :type region_id: str + :param telemetry_router_id: The Telemetry Router UUID. (required) + :type telemetry_router_id: UUID + :param partial_update_telemetry_router_payload: (required) + :type partial_update_telemetry_router_payload: PartialUpdateTelemetryRouterPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._partial_update_telemetry_router_serialize( + project_id=project_id, + region_id=region_id, + telemetry_router_id=telemetry_router_id, + partial_update_telemetry_router_payload=partial_update_telemetry_router_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "TelemetryRouterResponse", + "400": "Response4xx", + "401": "Response4xx", + "404": None, + "409": "Response4xx", + "500": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def partial_update_telemetry_router_with_http_info( + self, + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the resource is located in.")], + region_id: Annotated[StrictStr, Field(description="The STACKIT region name the resource is located in.")], + telemetry_router_id: Annotated[UUID, Field(description="The Telemetry Router UUID.")], + partial_update_telemetry_router_payload: PartialUpdateTelemetryRouterPayload, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[TelemetryRouterResponse]: + """partial_update_telemetry_router + + Patches the given Telemetry Router. + + :param project_id: The STACKIT portal project UUID the resource is located in. (required) + :type project_id: UUID + :param region_id: The STACKIT region name the resource is located in. (required) + :type region_id: str + :param telemetry_router_id: The Telemetry Router UUID. (required) + :type telemetry_router_id: UUID + :param partial_update_telemetry_router_payload: (required) + :type partial_update_telemetry_router_payload: PartialUpdateTelemetryRouterPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._partial_update_telemetry_router_serialize( + project_id=project_id, + region_id=region_id, + telemetry_router_id=telemetry_router_id, + partial_update_telemetry_router_payload=partial_update_telemetry_router_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "TelemetryRouterResponse", + "400": "Response4xx", + "401": "Response4xx", + "404": None, + "409": "Response4xx", + "500": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def partial_update_telemetry_router_without_preload_content( + self, + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the resource is located in.")], + region_id: Annotated[StrictStr, Field(description="The STACKIT region name the resource is located in.")], + telemetry_router_id: Annotated[UUID, Field(description="The Telemetry Router UUID.")], + partial_update_telemetry_router_payload: PartialUpdateTelemetryRouterPayload, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """partial_update_telemetry_router + + Patches the given Telemetry Router. + + :param project_id: The STACKIT portal project UUID the resource is located in. (required) + :type project_id: UUID + :param region_id: The STACKIT region name the resource is located in. (required) + :type region_id: str + :param telemetry_router_id: The Telemetry Router UUID. (required) + :type telemetry_router_id: UUID + :param partial_update_telemetry_router_payload: (required) + :type partial_update_telemetry_router_payload: PartialUpdateTelemetryRouterPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._partial_update_telemetry_router_serialize( + project_id=project_id, + region_id=region_id, + telemetry_router_id=telemetry_router_id, + partial_update_telemetry_router_payload=partial_update_telemetry_router_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "TelemetryRouterResponse", + "400": "Response4xx", + "401": "Response4xx", + "404": None, + "409": "Response4xx", + "500": None, + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _partial_update_telemetry_router_serialize( + self, + project_id, + region_id, + telemetry_router_id, + partial_update_telemetry_router_payload, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if region_id is not None: + _path_params["regionId"] = region_id + if telemetry_router_id is not None: + _path_params["telemetryRouterId"] = telemetry_router_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if partial_update_telemetry_router_payload is not None: + _body_params = partial_update_telemetry_router_payload + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type(["application/json"]) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="PATCH", + resource_path="/v1/projects/{projectId}/regions/{regionId}/telemetry-routers/{telemetryRouterId}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + @validate_call def update_access_token( self, diff --git a/services/telemetryrouter/src/stackit/telemetryrouter/models/__init__.py b/services/telemetryrouter/src/stackit/telemetryrouter/models/__init__.py index eab5e0324..f32b40dbc 100644 --- a/services/telemetryrouter/src/stackit/telemetryrouter/models/__init__.py +++ b/services/telemetryrouter/src/stackit/telemetryrouter/models/__init__.py @@ -62,6 +62,9 @@ from stackit.telemetryrouter.models.list_telemetry_routers_response import ( ListTelemetryRoutersResponse, ) +from stackit.telemetryrouter.models.partial_update_telemetry_router_payload import ( + PartialUpdateTelemetryRouterPayload, +) from stackit.telemetryrouter.models.response4xx import Response4xx from stackit.telemetryrouter.models.telemetry_router_response import ( TelemetryRouterResponse, diff --git a/services/telemetryrouter/src/stackit/telemetryrouter/models/config_filter_attributes.py b/services/telemetryrouter/src/stackit/telemetryrouter/models/config_filter_attributes.py index daee44ff4..508f3c72a 100644 --- a/services/telemetryrouter/src/stackit/telemetryrouter/models/config_filter_attributes.py +++ b/services/telemetryrouter/src/stackit/telemetryrouter/models/config_filter_attributes.py @@ -15,9 +15,10 @@ import json import pprint +import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field +from pydantic import BaseModel, ConfigDict, Field, field_validator from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -38,6 +39,16 @@ class ConfigFilterAttributes(BaseModel): ] __properties: ClassVar[List[str]] = ["key", "level", "matcher", "values"] + @field_validator("key") + def key_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[^\0-\x1F\x7F-\x9F]+$", value): + raise ValueError(r"must validate the regular expression /^[^\0-\x1F\x7F-\x9F]+$/") + return value + model_config = ConfigDict( validate_by_name=True, validate_by_alias=True, diff --git a/services/telemetryrouter/src/stackit/telemetryrouter/models/create_telemetry_router_payload.py b/services/telemetryrouter/src/stackit/telemetryrouter/models/create_telemetry_router_payload.py index 57ce1d671..03483e404 100644 --- a/services/telemetryrouter/src/stackit/telemetryrouter/models/create_telemetry_router_payload.py +++ b/services/telemetryrouter/src/stackit/telemetryrouter/models/create_telemetry_router_payload.py @@ -18,7 +18,7 @@ import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, field_validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -38,7 +38,8 @@ class CreateTelemetryRouterPayload(BaseModel): description="The display name is a short name chosen by the user to identify the resource.", alias="displayName" ) filter: Optional[ConfigFilter] = None - __properties: ClassVar[List[str]] = ["description", "displayName", "filter"] + resource_labels: Optional[Dict[str, StrictStr]] = Field(default=None, alias="resourceLabels") + __properties: ClassVar[List[str]] = ["description", "displayName", "filter", "resourceLabels"] @field_validator("description") def description_validate_regular_expression(cls, value): @@ -119,6 +120,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "description": obj.get("description"), "displayName": obj.get("displayName"), "filter": ConfigFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None, + "resourceLabels": obj.get("resourceLabels"), } ) return _obj diff --git a/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_open_telemetry.py b/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_open_telemetry.py index 3d1f83bd9..ecc386167 100644 --- a/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_open_telemetry.py +++ b/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_open_telemetry.py @@ -15,9 +15,10 @@ import json import pprint +import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field +from pydantic import BaseModel, ConfigDict, Field, field_validator from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -38,6 +39,29 @@ class DestinationConfigOpenTelemetry(BaseModel): uri: Annotated[str, Field(strict=True, max_length=1024)] = Field(description="The URI for reaching the resource.") __properties: ClassVar[List[str]] = ["basicAuth", "bearerToken", "uri"] + @field_validator("bearer_token") + def bearer_token_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[^\0-\x1F\x7F-\x9F]+$", value): + raise ValueError(r"must validate the regular expression /^[^\0-\x1F\x7F-\x9F]+$/") + return value + + @field_validator("uri") + def uri_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[^\0-\x1F\x7F-\x9F]+$", value): + raise ValueError(r"must validate the regular expression /^[^\0-\x1F\x7F-\x9F]+$/") + return value + model_config = ConfigDict( validate_by_name=True, validate_by_alias=True, diff --git a/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_open_telemetry_basic_auth.py b/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_open_telemetry_basic_auth.py index 6089c8299..959f9f9c2 100644 --- a/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_open_telemetry_basic_auth.py +++ b/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_open_telemetry_basic_auth.py @@ -15,9 +15,10 @@ import json import pprint +import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field +from pydantic import BaseModel, ConfigDict, Field, field_validator from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -31,6 +32,26 @@ class DestinationConfigOpenTelemetryBasicAuth(BaseModel): username: Annotated[str, Field(min_length=1, strict=True, max_length=1024)] __properties: ClassVar[List[str]] = ["password", "username"] + @field_validator("password") + def password_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[^\0-\x1F\x7F-\x9F]+$", value): + raise ValueError(r"must validate the regular expression /^[^\0-\x1F\x7F-\x9F]+$/") + return value + + @field_validator("username") + def username_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[^\0-\x1F\x7F-\x9F]+$", value): + raise ValueError(r"must validate the regular expression /^[^\0-\x1F\x7F-\x9F]+$/") + return value + model_config = ConfigDict( validate_by_name=True, validate_by_alias=True, diff --git a/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_s3.py b/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_s3.py index 2f20a9ffb..535ae0b2f 100644 --- a/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_s3.py +++ b/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_s3.py @@ -15,9 +15,10 @@ import json import pprint +import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field +from pydantic import BaseModel, ConfigDict, Field, field_validator from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -38,6 +39,26 @@ class DestinationConfigS3(BaseModel): ) __properties: ClassVar[List[str]] = ["accessKey", "bucket", "endpoint"] + @field_validator("bucket") + def bucket_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[a-z0-9\-]+$", value): + raise ValueError(r"must validate the regular expression /^[a-z0-9\-]+$/") + return value + + @field_validator("endpoint") + def endpoint_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[^\0-\x1F\x7F-\x9F]+$", value): + raise ValueError(r"must validate the regular expression /^[^\0-\x1F\x7F-\x9F]+$/") + return value + model_config = ConfigDict( validate_by_name=True, validate_by_alias=True, diff --git a/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_s3_access_key.py b/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_s3_access_key.py index ecb82eef9..5399e3bdc 100644 --- a/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_s3_access_key.py +++ b/services/telemetryrouter/src/stackit/telemetryrouter/models/destination_config_s3_access_key.py @@ -15,9 +15,10 @@ import json import pprint +import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field +from pydantic import BaseModel, ConfigDict, Field, field_validator from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -31,6 +32,26 @@ class DestinationConfigS3AccessKey(BaseModel): secret: Annotated[str, Field(min_length=1, strict=True, max_length=1024)] __properties: ClassVar[List[str]] = ["id", "secret"] + @field_validator("id") + def id_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[^\0-\x1F\x7F-\x9F]+$", value): + raise ValueError(r"must validate the regular expression /^[^\0-\x1F\x7F-\x9F]+$/") + return value + + @field_validator("secret") + def secret_validate_regular_expression(cls, value): + """Validates the regular expression""" + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[^\0-\x1F\x7F-\x9F]+$", value): + raise ValueError(r"must validate the regular expression /^[^\0-\x1F\x7F-\x9F]+$/") + return value + model_config = ConfigDict( validate_by_name=True, validate_by_alias=True, diff --git a/services/telemetryrouter/src/stackit/telemetryrouter/models/partial_update_telemetry_router_payload.py b/services/telemetryrouter/src/stackit/telemetryrouter/models/partial_update_telemetry_router_payload.py new file mode 100644 index 000000000..a92157ff8 --- /dev/null +++ b/services/telemetryrouter/src/stackit/telemetryrouter/models/partial_update_telemetry_router_payload.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" +STACKIT Telemetry Router API + +This API provides endpoints for managing Telemetry Routers. + +The version of the OpenAPI document: 1.0 +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from pydantic_core import to_jsonable_python +from typing_extensions import Annotated, Self + +from stackit.telemetryrouter.models.config_filter import ConfigFilter + + +class PartialUpdateTelemetryRouterPayload(BaseModel): + """ + PartialUpdateTelemetryRouterPayload + """ # noqa: E501 + + description: Optional[Annotated[str, Field(strict=True, max_length=1024)]] = Field( + default=None, + description="The description is a longer text chosen by the user to provide more context for the resource.", + ) + display_name: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=32)]] = Field( + default=None, + description="The display name is a short name chosen by the user to identify the resource.", + alias="displayName", + ) + filter: Optional[ConfigFilter] = None + resource_labels: Optional[Dict[str, StrictStr]] = Field(default=None, alias="resourceLabels") + __properties: ClassVar[List[str]] = ["description", "displayName", "filter", "resourceLabels"] + + @field_validator("description") + def description_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^([a-zA-Z0-9][a-zA-Z0-9 \-]*)?$", value): + raise ValueError(r"must validate the regular expression /^([a-zA-Z0-9][a-zA-Z0-9 \-]*)?$/") + return value + + @field_validator("display_name") + def display_name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not isinstance(value, str): + value = str(value) + + if not re.match(r"^[a-zA-Z0-9][a-zA-Z0-9 \-]*$", value): + raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9][a-zA-Z0-9 \-]*$/") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PartialUpdateTelemetryRouterPayload from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of filter + if self.filter: + _dict["filter"] = self.filter.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PartialUpdateTelemetryRouterPayload from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "description": obj.get("description"), + "displayName": obj.get("displayName"), + "filter": ConfigFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None, + "resourceLabels": obj.get("resourceLabels"), + } + ) + return _obj diff --git a/services/telemetryrouter/src/stackit/telemetryrouter/models/telemetry_router_response.py b/services/telemetryrouter/src/stackit/telemetryrouter/models/telemetry_router_response.py index 7c4e59b1c..a691d9575 100644 --- a/services/telemetryrouter/src/stackit/telemetryrouter/models/telemetry_router_response.py +++ b/services/telemetryrouter/src/stackit/telemetryrouter/models/telemetry_router_response.py @@ -37,14 +37,30 @@ class TelemetryRouterResponse(BaseModel): default=None, description="The description is a longer text chosen by the user to provide more context for the resource.", ) + destination_count: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field( + default=None, + description="The number of destinations configured for the telemetry router.", + alias="destinationCount", + ) display_name: Annotated[str, Field(min_length=1, strict=True, max_length=32)] = Field( description="The display name is a short name chosen by the user to identify the resource.", alias="displayName" ) filter: Optional[ConfigFilter] = None id: UUID = Field(description="A auto generated unique id which identifies the resource.") + resource_labels: Optional[Dict[str, StrictStr]] = Field(default=None, alias="resourceLabels") status: StrictStr = Field(description="The current status of the resource.") uri: Annotated[str, Field(strict=True, max_length=1024)] = Field(description="The URI for reaching the resource.") - __properties: ClassVar[List[str]] = ["creationTime", "description", "displayName", "filter", "id", "status", "uri"] + __properties: ClassVar[List[str]] = [ + "creationTime", + "description", + "destinationCount", + "displayName", + "filter", + "id", + "resourceLabels", + "status", + "uri", + ] @field_validator("creation_time", mode="before") def creation_time_change_year_zero_to_one(cls, value): @@ -144,9 +160,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: { "creationTime": obj.get("creationTime"), "description": obj.get("description"), + "destinationCount": obj.get("destinationCount"), "displayName": obj.get("displayName"), "filter": ConfigFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None, "id": obj.get("id"), + "resourceLabels": obj.get("resourceLabels"), "status": obj.get("status"), "uri": obj.get("uri"), } diff --git a/services/telemetryrouter/src/stackit/telemetryrouter/models/update_telemetry_router_payload.py b/services/telemetryrouter/src/stackit/telemetryrouter/models/update_telemetry_router_payload.py index 47fc47dcb..2d2766c7e 100644 --- a/services/telemetryrouter/src/stackit/telemetryrouter/models/update_telemetry_router_payload.py +++ b/services/telemetryrouter/src/stackit/telemetryrouter/models/update_telemetry_router_payload.py @@ -18,7 +18,7 @@ import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, field_validator +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from pydantic_core import to_jsonable_python from typing_extensions import Annotated, Self @@ -40,7 +40,8 @@ class UpdateTelemetryRouterPayload(BaseModel): alias="displayName", ) filter: Optional[ConfigFilter] = None - __properties: ClassVar[List[str]] = ["description", "displayName", "filter"] + resource_labels: Optional[Dict[str, StrictStr]] = Field(default=None, alias="resourceLabels") + __properties: ClassVar[List[str]] = ["description", "displayName", "filter", "resourceLabels"] @field_validator("description") def description_validate_regular_expression(cls, value): @@ -124,6 +125,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "description": obj.get("description"), "displayName": obj.get("displayName"), "filter": ConfigFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None, + "resourceLabels": obj.get("resourceLabels"), } ) return _obj