diff --git a/services/logs/oas_commit b/services/logs/oas_commit new file mode 100644 index 000000000..e3713dde3 --- /dev/null +++ b/services/logs/oas_commit @@ -0,0 +1 @@ +0e64886dd0847341800d7191ed193b75413be998 diff --git a/services/logs/src/stackit/logs/api/default_api.py b/services/logs/src/stackit/logs/api/default_api.py index 90544bfd2..d498fe2ab 100644 --- a/services/logs/src/stackit/logs/api/default_api.py +++ b/services/logs/src/stackit/logs/api/default_api.py @@ -12,6 +12,7 @@ """ # noqa: E501 from typing import Any, Dict, List, Optional, Tuple, Union +from uuid import UUID from pydantic import ( Field, @@ -52,11 +53,9 @@ def __init__(self, configuration: Configuration = None) -> None: @validate_call def create_access_token( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], create_access_token_payload: CreateAccessTokenPayload, _request_timeout: Union[ None, @@ -73,11 +72,11 @@ def create_access_token( Create a new Logs instance access token :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param create_access_token_payload: (required) :type create_access_token_payload: CreateAccessTokenPayload :param _request_timeout: timeout setting for this request. If one @@ -131,11 +130,9 @@ def create_access_token( @validate_call def create_access_token_with_http_info( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], create_access_token_payload: CreateAccessTokenPayload, _request_timeout: Union[ None, @@ -152,11 +149,11 @@ def create_access_token_with_http_info( Create a new Logs instance access token :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param create_access_token_payload: (required) :type create_access_token_payload: CreateAccessTokenPayload :param _request_timeout: timeout setting for this request. If one @@ -210,11 +207,9 @@ def create_access_token_with_http_info( @validate_call def create_access_token_without_preload_content( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], create_access_token_payload: CreateAccessTokenPayload, _request_timeout: Union[ None, @@ -231,11 +226,11 @@ def create_access_token_without_preload_content( Create a new Logs instance access token :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param create_access_token_payload: (required) :type create_access_token_payload: CreateAccessTokenPayload :param _request_timeout: timeout setting for this request. If one @@ -352,9 +347,7 @@ def _create_access_token_serialize( @validate_call def create_logs_instance( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], create_logs_instance_payload: CreateLogsInstancePayload, _request_timeout: Union[ @@ -372,7 +365,7 @@ def create_logs_instance( Creates a new Logs instance within the project. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param create_logs_instance_payload: (required) @@ -427,9 +420,7 @@ def create_logs_instance( @validate_call def create_logs_instance_with_http_info( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], create_logs_instance_payload: CreateLogsInstancePayload, _request_timeout: Union[ @@ -447,7 +438,7 @@ def create_logs_instance_with_http_info( Creates a new Logs instance within the project. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param create_logs_instance_payload: (required) @@ -502,9 +493,7 @@ def create_logs_instance_with_http_info( @validate_call def create_logs_instance_without_preload_content( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], create_logs_instance_payload: CreateLogsInstancePayload, _request_timeout: Union[ @@ -522,7 +511,7 @@ def create_logs_instance_without_preload_content( Creates a new Logs instance within the project. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param create_logs_instance_payload: (required) @@ -637,12 +626,10 @@ def _create_logs_instance_serialize( @validate_call def delete_access_token( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], - t_id: Annotated[StrictStr, Field(description="The access token UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], + t_id: Annotated[UUID, Field(description="The access token UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -658,13 +645,13 @@ def delete_access_token( Deletes a Logs instance access token :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param t_id: The access token UUID. (required) - :type t_id: str + :type t_id: UUID :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 @@ -716,12 +703,10 @@ def delete_access_token( @validate_call def delete_access_token_with_http_info( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], - t_id: Annotated[StrictStr, Field(description="The access token UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], + t_id: Annotated[UUID, Field(description="The access token UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -737,13 +722,13 @@ def delete_access_token_with_http_info( Deletes a Logs instance access token :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param t_id: The access token UUID. (required) - :type t_id: str + :type t_id: UUID :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 @@ -795,12 +780,10 @@ def delete_access_token_with_http_info( @validate_call def delete_access_token_without_preload_content( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], - t_id: Annotated[StrictStr, Field(description="The access token UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], + t_id: Annotated[UUID, Field(description="The access token UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -816,13 +799,13 @@ def delete_access_token_without_preload_content( Deletes a Logs instance access token :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param t_id: The access token UUID. (required) - :type t_id: str + :type t_id: UUID :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 @@ -929,11 +912,9 @@ def _delete_access_token_serialize( @validate_call def delete_all_access_tokens( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -949,11 +930,11 @@ def delete_all_access_tokens( Deletes all access tokens available for a Logs instance :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -1004,11 +985,9 @@ def delete_all_access_tokens( @validate_call def delete_all_access_tokens_with_http_info( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1024,11 +1003,11 @@ def delete_all_access_tokens_with_http_info( Deletes all access tokens available for a Logs instance :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -1079,11 +1058,9 @@ def delete_all_access_tokens_with_http_info( @validate_call def delete_all_access_tokens_without_preload_content( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1099,11 +1076,11 @@ def delete_all_access_tokens_without_preload_content( Deletes all access tokens available for a Logs instance :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -1206,11 +1183,9 @@ def _delete_all_access_tokens_serialize( @validate_call def delete_all_expired_access_tokens( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1226,11 +1201,11 @@ def delete_all_expired_access_tokens( Deletes all expired access tokens :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -1281,11 +1256,9 @@ def delete_all_expired_access_tokens( @validate_call def delete_all_expired_access_tokens_with_http_info( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1301,11 +1274,11 @@ def delete_all_expired_access_tokens_with_http_info( Deletes all expired access tokens :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -1356,11 +1329,9 @@ def delete_all_expired_access_tokens_with_http_info( @validate_call def delete_all_expired_access_tokens_without_preload_content( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1376,11 +1347,11 @@ def delete_all_expired_access_tokens_without_preload_content( Deletes all expired access tokens :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -1483,11 +1454,9 @@ def _delete_all_expired_access_tokens_serialize( @validate_call def delete_logs_instance( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1503,11 +1472,11 @@ def delete_logs_instance( Deletes the given Logs instance. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -1558,11 +1527,9 @@ def delete_logs_instance( @validate_call def delete_logs_instance_with_http_info( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1578,11 +1545,11 @@ def delete_logs_instance_with_http_info( Deletes the given Logs instance. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -1633,11 +1600,9 @@ def delete_logs_instance_with_http_info( @validate_call def delete_logs_instance_without_preload_content( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1653,11 +1618,11 @@ def delete_logs_instance_without_preload_content( Deletes the given Logs instance. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -1760,12 +1725,10 @@ def _delete_logs_instance_serialize( @validate_call def get_access_token( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], - t_id: Annotated[StrictStr, Field(description="The access token UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], + t_id: Annotated[UUID, Field(description="The access token UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1781,13 +1744,13 @@ def get_access_token( Get the information of the given access token. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param t_id: The access token UUID. (required) - :type t_id: str + :type t_id: UUID :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 @@ -1839,12 +1802,10 @@ def get_access_token( @validate_call def get_access_token_with_http_info( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], - t_id: Annotated[StrictStr, Field(description="The access token UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], + t_id: Annotated[UUID, Field(description="The access token UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1860,13 +1821,13 @@ def get_access_token_with_http_info( Get the information of the given access token. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param t_id: The access token UUID. (required) - :type t_id: str + :type t_id: UUID :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 @@ -1918,12 +1879,10 @@ def get_access_token_with_http_info( @validate_call def get_access_token_without_preload_content( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], - t_id: Annotated[StrictStr, Field(description="The access token UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], + t_id: Annotated[UUID, Field(description="The access token UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1939,13 +1898,13 @@ def get_access_token_without_preload_content( Get the information of the given access token. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param t_id: The access token UUID. (required) - :type t_id: str + :type t_id: UUID :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 @@ -2052,11 +2011,9 @@ def _get_access_token_serialize( @validate_call def get_logs_instance( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2072,11 +2029,11 @@ def get_logs_instance( Returns the details for the given Logs instance. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -2126,11 +2083,9 @@ def get_logs_instance( @validate_call def get_logs_instance_with_http_info( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2146,11 +2101,11 @@ def get_logs_instance_with_http_info( Returns the details for the given Logs instance. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -2200,11 +2155,9 @@ def get_logs_instance_with_http_info( @validate_call def get_logs_instance_without_preload_content( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2220,11 +2173,11 @@ def get_logs_instance_without_preload_content( Returns the details for the given Logs instance. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -2326,11 +2279,9 @@ def _get_logs_instance_serialize( @validate_call def list_access_tokens( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2346,11 +2297,11 @@ def list_access_tokens( Returns a list of access tokens created for a Logs instance :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -2401,11 +2352,9 @@ def list_access_tokens( @validate_call def list_access_tokens_with_http_info( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2421,11 +2370,11 @@ def list_access_tokens_with_http_info( Returns a list of access tokens created for a Logs instance :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -2476,11 +2425,9 @@ def list_access_tokens_with_http_info( @validate_call def list_access_tokens_without_preload_content( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2496,11 +2443,11 @@ def list_access_tokens_without_preload_content( Returns a list of access tokens created for a Logs instance :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :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 @@ -2603,9 +2550,7 @@ def _list_access_tokens_serialize( @validate_call def list_logs_instances( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], _request_timeout: Union[ None, @@ -2622,7 +2567,7 @@ def list_logs_instances( Returns a list of all Logs instances within the project. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param _request_timeout: timeout setting for this request. If one @@ -2672,9 +2617,7 @@ def list_logs_instances( @validate_call def list_logs_instances_with_http_info( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], _request_timeout: Union[ None, @@ -2691,7 +2634,7 @@ def list_logs_instances_with_http_info( Returns a list of all Logs instances within the project. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param _request_timeout: timeout setting for this request. If one @@ -2741,9 +2684,7 @@ def list_logs_instances_with_http_info( @validate_call def list_logs_instances_without_preload_content( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], _request_timeout: Union[ None, @@ -2760,7 +2701,7 @@ def list_logs_instances_without_preload_content( Returns a list of all Logs instances within the project. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param _request_timeout: timeout setting for this request. If one @@ -2859,12 +2800,10 @@ def _list_logs_instances_serialize( @validate_call def update_access_token( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], - t_id: Annotated[StrictStr, Field(description="The access token UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], + t_id: Annotated[UUID, Field(description="The access token UUID.")], update_access_token_payload: UpdateAccessTokenPayload, _request_timeout: Union[ None, @@ -2881,13 +2820,13 @@ def update_access_token( Updates the given access token. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param t_id: The access token UUID. (required) - :type t_id: str + :type t_id: UUID :param update_access_token_payload: (required) :type update_access_token_payload: UpdateAccessTokenPayload :param _request_timeout: timeout setting for this request. If one @@ -2942,12 +2881,10 @@ def update_access_token( @validate_call def update_access_token_with_http_info( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], - t_id: Annotated[StrictStr, Field(description="The access token UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], + t_id: Annotated[UUID, Field(description="The access token UUID.")], update_access_token_payload: UpdateAccessTokenPayload, _request_timeout: Union[ None, @@ -2964,13 +2901,13 @@ def update_access_token_with_http_info( Updates the given access token. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param t_id: The access token UUID. (required) - :type t_id: str + :type t_id: UUID :param update_access_token_payload: (required) :type update_access_token_payload: UpdateAccessTokenPayload :param _request_timeout: timeout setting for this request. If one @@ -3025,12 +2962,10 @@ def update_access_token_with_http_info( @validate_call def update_access_token_without_preload_content( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], - t_id: Annotated[StrictStr, Field(description="The access token UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], + t_id: Annotated[UUID, Field(description="The access token UUID.")], update_access_token_payload: UpdateAccessTokenPayload, _request_timeout: Union[ None, @@ -3047,13 +2982,13 @@ def update_access_token_without_preload_content( Updates the given access token. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param t_id: The access token UUID. (required) - :type t_id: str + :type t_id: UUID :param update_access_token_payload: (required) :type update_access_token_payload: UpdateAccessTokenPayload :param _request_timeout: timeout setting for this request. If one @@ -3174,11 +3109,9 @@ def _update_access_token_serialize( @validate_call def update_logs_instance( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], update_logs_instance_payload: UpdateLogsInstancePayload, _request_timeout: Union[ None, @@ -3195,11 +3128,11 @@ def update_logs_instance( Updates the given Logs instance. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param update_logs_instance_payload: (required) :type update_logs_instance_payload: UpdateLogsInstancePayload :param _request_timeout: timeout setting for this request. If one @@ -3253,11 +3186,9 @@ def update_logs_instance( @validate_call def update_logs_instance_with_http_info( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], update_logs_instance_payload: UpdateLogsInstancePayload, _request_timeout: Union[ None, @@ -3274,11 +3205,11 @@ def update_logs_instance_with_http_info( Updates the given Logs instance. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param update_logs_instance_payload: (required) :type update_logs_instance_payload: UpdateLogsInstancePayload :param _request_timeout: timeout setting for this request. If one @@ -3332,11 +3263,9 @@ def update_logs_instance_with_http_info( @validate_call def update_logs_instance_without_preload_content( self, - project_id: Annotated[ - StrictStr, Field(description="The STACKIT portal project UUID the resource is located in.") - ], + 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.")], - instance_id: Annotated[StrictStr, Field(description="The Logs Instance UUID.")], + instance_id: Annotated[UUID, Field(description="The Logs Instance UUID.")], update_logs_instance_payload: UpdateLogsInstancePayload, _request_timeout: Union[ None, @@ -3353,11 +3282,11 @@ def update_logs_instance_without_preload_content( Updates the given Logs instance. :param project_id: The STACKIT portal project UUID the resource is located in. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region name the resource is located in. (required) :type region_id: str :param instance_id: The Logs Instance UUID. (required) - :type instance_id: str + :type instance_id: UUID :param update_logs_instance_payload: (required) :type update_logs_instance_payload: UpdateLogsInstancePayload :param _request_timeout: timeout setting for this request. If one diff --git a/services/logs/src/stackit/logs/api_client.py b/services/logs/src/stackit/logs/api_client.py index 8cc461e7c..07bd934b4 100644 --- a/services/logs/src/stackit/logs/api_client.py +++ b/services/logs/src/stackit/logs/api_client.py @@ -12,11 +12,13 @@ """ # noqa: E501 import datetime +import decimal import json import mimetypes import os import re import tempfile +import uuid from enum import Enum from typing import Dict, List, Optional, Tuple, Union from urllib.parse import quote @@ -63,8 +65,10 @@ class ApiClient: "bool": bool, "date": datetime.date, "datetime": datetime.datetime, + "decimal": decimal.Decimal, "object": object, } + _pool = None def __init__(self, configuration, header_name=None, header_value=None, cookie=None) -> None: self.config: Configuration = configuration @@ -267,7 +271,7 @@ def response_deserialize( return_data = self.__deserialize_file(response_data) elif response_type is not None: match = None - content_type = response_data.getheader("content-type") + content_type = response_data.headers.get("content-type") if content_type is not None: match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) encoding = match.group(1) if match else "utf-8" @@ -284,7 +288,7 @@ def response_deserialize( return ApiResponse( status_code=response_data.status, data=return_data, - headers=response_data.getheaders(), + headers=response_data.headers, raw_data=response_data.data, ) @@ -296,6 +300,7 @@ def sanitize_for_serialization(self, obj): If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is OpenAPI model, return the properties dict. @@ -311,12 +316,16 @@ def sanitize_for_serialization(self, obj): return obj.get_secret_value() elif isinstance(obj, self.PRIMITIVE_TYPES): return obj + elif isinstance(obj, uuid.UUID): + return str(obj) elif isinstance(obj, list): return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj] elif isinstance(obj, tuple): return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() + elif isinstance(obj, decimal.Decimal): + return str(obj) elif isinstance(obj, dict): obj_dict = obj @@ -326,7 +335,7 @@ def sanitize_for_serialization(self, obj): # and attributes which value is not None. # Convert attribute name to json key in # model definition for request. - if hasattr(obj, "to_dict") and callable(obj.to_dict): + if hasattr(obj, "to_dict") and callable(getattr(obj, "to_dict")): # noqa: B009 obj_dict = obj.to_dict() else: obj_dict = obj.__dict__ @@ -354,7 +363,7 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti data = json.loads(response_text) except ValueError: data = response_text - elif re.match(r"^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE): + elif re.match(r"^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE): if response_text == "": data = "" else: @@ -400,12 +409,14 @@ def __deserialize(self, data, klass): if klass in self.PRIMITIVE_TYPES: return self.__deserialize_primitive(data, klass) - elif klass == object: + elif klass is object: return self.__deserialize_object(data) - elif klass == datetime.date: + elif klass is datetime.date: return self.__deserialize_date(data) - elif klass == datetime.datetime: + elif klass is datetime.datetime: return self.__deserialize_datetime(data) + elif klass is decimal.Decimal: + return decimal.Decimal(data) elif issubclass(klass, Enum): return self.__deserialize_enum(data, klass) else: @@ -553,12 +564,14 @@ def __deserialize_file(self, response): os.close(fd) os.remove(path) - content_disposition = response.getheader("Content-Disposition") + content_disposition = response.headers.get("Content-Disposition") if content_disposition: m = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition) if m is None: raise ValueError("Unexpected 'content-disposition' header value") - filename = m.group(1) + filename = os.path.basename(m.group(1)) # Strip any directory traversal + if filename in ("", ".", ".."): # fall back to tmp filename + filename = os.path.basename(path) path = os.path.join(os.path.dirname(path), filename) with open(path, "wb") as f: diff --git a/services/logs/src/stackit/logs/exceptions.py b/services/logs/src/stackit/logs/exceptions.py index 80698cd68..465b08682 100644 --- a/services/logs/src/stackit/logs/exceptions.py +++ b/services/logs/src/stackit/logs/exceptions.py @@ -129,7 +129,7 @@ def __init__( self.body = http_resp.data.decode("utf-8") except Exception: # noqa: S110 pass - self.headers = http_resp.getheaders() + self.headers = http_resp.headers @classmethod def from_response( diff --git a/services/logs/src/stackit/logs/models/__init__.py b/services/logs/src/stackit/logs/models/__init__.py index 340662aa7..5bf2bad91 100644 --- a/services/logs/src/stackit/logs/models/__init__.py +++ b/services/logs/src/stackit/logs/models/__init__.py @@ -12,7 +12,6 @@ Do not edit the class manually. """ # noqa: E501 - # import models into model package from stackit.logs.models.access_token import AccessToken from stackit.logs.models.access_token_list import AccessTokenList diff --git a/services/logs/src/stackit/logs/models/access_token.py b/services/logs/src/stackit/logs/models/access_token.py index ed59ed18f..4dc83b2d8 100644 --- a/services/logs/src/stackit/logs/models/access_token.py +++ b/services/logs/src/stackit/logs/models/access_token.py @@ -18,6 +18,7 @@ import re # noqa: F401 from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set +from uuid import UUID from pydantic import ( BaseModel, @@ -46,7 +47,7 @@ class AccessToken(BaseModel): description="The displayed name of the access token.", alias="displayName" ) expires: StrictBool = Field(description="Indicates if the access token can expire.") - id: StrictStr = Field(description="An auto generated unique id which identifies the access token.") + id: UUID = Field(description="An auto generated unique id which identifies the access token.") permissions: List[StrictStr] = Field(description="The access permissions granted to the access token.") status: StrictStr valid_until: Optional[datetime] = Field( diff --git a/services/logs/src/stackit/logs/models/access_token_list.py b/services/logs/src/stackit/logs/models/access_token_list.py index d34460664..60f6fe16b 100644 --- a/services/logs/src/stackit/logs/models/access_token_list.py +++ b/services/logs/src/stackit/logs/models/access_token_list.py @@ -71,9 +71,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in tokens (list) _items = [] if self.tokens: - for _item in self.tokens: - if _item: - _items.append(_item.to_dict()) + for _item_tokens in self.tokens: + if _item_tokens: + _items.append(_item_tokens.to_dict()) _dict["tokens"] = _items return _dict diff --git a/services/logs/src/stackit/logs/models/logs_instance.py b/services/logs/src/stackit/logs/models/logs_instance.py index 798ad2c2f..056f19f4f 100644 --- a/services/logs/src/stackit/logs/models/logs_instance.py +++ b/services/logs/src/stackit/logs/models/logs_instance.py @@ -18,6 +18,7 @@ import re # noqa: F401 from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set +from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from typing_extensions import Annotated, Self @@ -41,7 +42,7 @@ class LogsInstance(BaseModel): display_name: Annotated[str, Field(min_length=1, strict=True, max_length=32)] = Field( description="The displayed name of the Logs instance.", alias="displayName" ) - id: StrictStr = Field(description="A auto generated unique id which identifies the Logs instance.") + id: UUID = Field(description="A auto generated unique id which identifies the Logs instance.") ingest_otlp_url: Optional[StrictStr] = Field( default=None, description="The Logs instance's ingest logs via OTLP URL", alias="ingestOtlpUrl" ) diff --git a/services/logs/src/stackit/logs/models/logs_instances_list.py b/services/logs/src/stackit/logs/models/logs_instances_list.py index 276ff89f2..029676079 100644 --- a/services/logs/src/stackit/logs/models/logs_instances_list.py +++ b/services/logs/src/stackit/logs/models/logs_instances_list.py @@ -71,9 +71,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in instances (list) _items = [] if self.instances: - for _item in self.instances: - if _item: - _items.append(_item.to_dict()) + for _item_instances in self.instances: + if _item_instances: + _items.append(_item_instances.to_dict()) _dict["instances"] = _items return _dict diff --git a/services/logs/src/stackit/logs/rest.py b/services/logs/src/stackit/logs/rest.py index d5e37965e..257da36fd 100644 --- a/services/logs/src/stackit/logs/rest.py +++ b/services/logs/src/stackit/logs/rest.py @@ -38,12 +38,17 @@ def read(self): self.data = self.response.content return self.data + @property + def headers(self): + """Returns a dictionary of response headers.""" + return self.response.headers + def getheaders(self): - """Returns a dictionary of the response headers.""" + """Returns a dictionary of the response headers; use ``headers`` instead.""" return self.response.headers def getheader(self, name, default=None): - """Returns a given response header.""" + """Returns a given response header; use ``headers.get()`` instead.""" return self.response.headers.get(name, default) @@ -93,6 +98,7 @@ def request(self, method, url, headers=None, body=None, post_params=None, _reque url, data=request_body, headers=headers, + timeout=_request_timeout, ) elif content_type == "application/x-www-form-urlencoded": r = self.session.request( @@ -100,6 +106,7 @@ def request(self, method, url, headers=None, body=None, post_params=None, _reque url, params=post_params, headers=headers, + timeout=_request_timeout, ) elif content_type == "multipart/form-data": # must del headers['Content-Type'], or the correct @@ -113,6 +120,7 @@ def request(self, method, url, headers=None, body=None, post_params=None, _reque url, files=post_params, headers=headers, + timeout=_request_timeout, ) # Pass a `string` parameter directly in the body to support # other content types than JSON when `body` argument is @@ -123,10 +131,17 @@ def request(self, method, url, headers=None, body=None, post_params=None, _reque url, data=body, headers=headers, + timeout=_request_timeout, ) elif headers["Content-Type"].startswith("text/") and isinstance(body, bool): request_body = "true" if body else "false" - r = self.session.request(method, url, data=request_body, headers=headers) + r = self.session.request( + method, + url, + data=request_body, + headers=headers, + timeout=_request_timeout, + ) else: # Cannot generate the request from given parameters msg = """Cannot prepare a request message for provided @@ -140,6 +155,7 @@ def request(self, method, url, headers=None, body=None, post_params=None, _reque url, params={}, headers=headers, + timeout=_request_timeout, ) except requests.exceptions.SSLError as e: msg = "\n".join([type(e).__name__, str(e)])