From a582054437252d3bd600e65ebbe7604e10b8b261 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Fri, 13 Mar 2026 16:13:17 +0000 Subject: [PATCH] Generate edge --- services/edge/oas_commit | 1 + .../edge/src/stackit/edge/api/default_api.py | 157 +++++++++--------- services/edge/src/stackit/edge/api_client.py | 31 +++- services/edge/src/stackit/edge/exceptions.py | 2 +- .../edge/src/stackit/edge/models/__init__.py | 1 - .../edge/models/create_instance_payload.py | 5 +- .../edge/src/stackit/edge/models/instance.py | 3 +- .../src/stackit/edge/models/instance_list.py | 6 +- services/edge/src/stackit/edge/models/plan.py | 3 +- .../edge/src/stackit/edge/models/plan_list.py | 6 +- .../models/update_instance_by_name_payload.py | 5 +- .../edge/models/update_instance_payload.py | 5 +- services/edge/src/stackit/edge/models/user.py | 3 +- services/edge/src/stackit/edge/rest.py | 22 ++- 14 files changed, 143 insertions(+), 107 deletions(-) create mode 100644 services/edge/oas_commit diff --git a/services/edge/oas_commit b/services/edge/oas_commit new file mode 100644 index 000000000..e3713dde3 --- /dev/null +++ b/services/edge/oas_commit @@ -0,0 +1 @@ +0e64886dd0847341800d7191ed193b75413be998 diff --git a/services/edge/src/stackit/edge/api/default_api.py b/services/edge/src/stackit/edge/api/default_api.py index b19b4bb2e..b6f37f20d 100644 --- a/services/edge/src/stackit/edge/api/default_api.py +++ b/services/edge/src/stackit/edge/api/default_api.py @@ -13,6 +13,7 @@ import warnings from typing import Any, Dict, List, Optional, Tuple, Union +from uuid import UUID from pydantic import ( Field, @@ -55,7 +56,7 @@ def __init__(self, configuration: Configuration = None) -> None: @validate_call def create_instance( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], create_instance_payload: CreateInstancePayload, _request_timeout: Union[ @@ -73,7 +74,7 @@ def create_instance( Creates a new instance within the project. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param create_instance_payload: (required) @@ -127,7 +128,7 @@ def create_instance( @validate_call def create_instance_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], create_instance_payload: CreateInstancePayload, _request_timeout: Union[ @@ -145,7 +146,7 @@ def create_instance_with_http_info( Creates a new instance within the project. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param create_instance_payload: (required) @@ -199,7 +200,7 @@ def create_instance_with_http_info( @validate_call def create_instance_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], create_instance_payload: CreateInstancePayload, _request_timeout: Union[ @@ -217,7 +218,7 @@ def create_instance_without_preload_content( Creates a new instance within the project. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param create_instance_payload: (required) @@ -331,7 +332,7 @@ def _create_instance_serialize( @validate_call def delete_instance( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[ str, @@ -354,7 +355,7 @@ def delete_instance( Deletes the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The full ID of the instance, -. (required) @@ -409,7 +410,7 @@ def delete_instance( @validate_call def delete_instance_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[ str, @@ -432,7 +433,7 @@ def delete_instance_with_http_info( Deletes the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The full ID of the instance, -. (required) @@ -487,7 +488,7 @@ def delete_instance_with_http_info( @validate_call def delete_instance_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[ str, @@ -510,7 +511,7 @@ def delete_instance_without_preload_content( Deletes the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The full ID of the instance, -. (required) @@ -617,7 +618,7 @@ def _delete_instance_serialize( @validate_call def delete_instance_by_name( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], _request_timeout: Union[ @@ -635,7 +636,7 @@ def delete_instance_by_name( Deletes the given instance by name. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -690,7 +691,7 @@ def delete_instance_by_name( @validate_call def delete_instance_by_name_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], _request_timeout: Union[ @@ -708,7 +709,7 @@ def delete_instance_by_name_with_http_info( Deletes the given instance by name. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -763,7 +764,7 @@ def delete_instance_by_name_with_http_info( @validate_call def delete_instance_by_name_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], _request_timeout: Union[ @@ -781,7 +782,7 @@ def delete_instance_by_name_without_preload_content( Deletes the given instance by name. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -888,7 +889,7 @@ def _delete_instance_by_name_serialize( @validate_call def get_instance( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[ str, @@ -911,7 +912,7 @@ def get_instance( Returns the details for the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The full ID of the instance, -. (required) @@ -965,7 +966,7 @@ def get_instance( @validate_call def get_instance_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[ str, @@ -988,7 +989,7 @@ def get_instance_with_http_info( Returns the details for the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The full ID of the instance, -. (required) @@ -1042,7 +1043,7 @@ def get_instance_with_http_info( @validate_call def get_instance_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[ str, @@ -1065,7 +1066,7 @@ def get_instance_without_preload_content( Returns the details for the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The full ID of the instance, -. (required) @@ -1171,7 +1172,7 @@ def _get_instance_serialize( @validate_call def get_instance_by_name( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], _request_timeout: Union[ @@ -1189,7 +1190,7 @@ def get_instance_by_name( Returns the details for the given instance by name. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -1243,7 +1244,7 @@ def get_instance_by_name( @validate_call def get_instance_by_name_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], _request_timeout: Union[ @@ -1261,7 +1262,7 @@ def get_instance_by_name_with_http_info( Returns the details for the given instance by name. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -1315,7 +1316,7 @@ def get_instance_by_name_with_http_info( @validate_call def get_instance_by_name_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], _request_timeout: Union[ @@ -1333,7 +1334,7 @@ def get_instance_by_name_without_preload_content( Returns the details for the given instance by name. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -1439,7 +1440,7 @@ def _get_instance_by_name_serialize( @validate_call def get_kubeconfig_by_instance_id( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[ str, @@ -1466,7 +1467,7 @@ def get_kubeconfig_by_instance_id( Returns the kubeconfig for the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The full ID of the instance, -. (required) @@ -1523,7 +1524,7 @@ def get_kubeconfig_by_instance_id( @validate_call def get_kubeconfig_by_instance_id_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[ str, @@ -1550,7 +1551,7 @@ def get_kubeconfig_by_instance_id_with_http_info( Returns the kubeconfig for the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The full ID of the instance, -. (required) @@ -1607,7 +1608,7 @@ def get_kubeconfig_by_instance_id_with_http_info( @validate_call def get_kubeconfig_by_instance_id_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[ str, @@ -1634,7 +1635,7 @@ def get_kubeconfig_by_instance_id_without_preload_content( Returns the kubeconfig for the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The full ID of the instance, -. (required) @@ -1748,7 +1749,7 @@ def _get_kubeconfig_by_instance_id_serialize( @validate_call def get_kubeconfig_by_instance_name( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], expiration_seconds: Annotated[ @@ -1770,7 +1771,7 @@ def get_kubeconfig_by_instance_name( Returns the kubeconfig for the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -1827,7 +1828,7 @@ def get_kubeconfig_by_instance_name( @validate_call def get_kubeconfig_by_instance_name_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], expiration_seconds: Annotated[ @@ -1849,7 +1850,7 @@ def get_kubeconfig_by_instance_name_with_http_info( Returns the kubeconfig for the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -1906,7 +1907,7 @@ def get_kubeconfig_by_instance_name_with_http_info( @validate_call def get_kubeconfig_by_instance_name_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], expiration_seconds: Annotated[ @@ -1928,7 +1929,7 @@ def get_kubeconfig_by_instance_name_without_preload_content( Returns the kubeconfig for the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -2042,7 +2043,7 @@ def _get_kubeconfig_by_instance_name_serialize( @validate_call def get_token_by_instance_id( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[str, Field(strict=True, max_length=16, description="The instance UUID.")], expiration_seconds: Annotated[ @@ -2064,7 +2065,7 @@ def get_token_by_instance_id( Returns an ServiceAccount token. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The instance UUID. (required) @@ -2121,7 +2122,7 @@ def get_token_by_instance_id( @validate_call def get_token_by_instance_id_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[str, Field(strict=True, max_length=16, description="The instance UUID.")], expiration_seconds: Annotated[ @@ -2143,7 +2144,7 @@ def get_token_by_instance_id_with_http_info( Returns an ServiceAccount token. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The instance UUID. (required) @@ -2200,7 +2201,7 @@ def get_token_by_instance_id_with_http_info( @validate_call def get_token_by_instance_id_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[str, Field(strict=True, max_length=16, description="The instance UUID.")], expiration_seconds: Annotated[ @@ -2222,7 +2223,7 @@ def get_token_by_instance_id_without_preload_content( Returns an ServiceAccount token. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The instance UUID. (required) @@ -2336,7 +2337,7 @@ def _get_token_by_instance_id_serialize( @validate_call def get_token_by_instance_name( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], expiration_seconds: Annotated[ @@ -2358,7 +2359,7 @@ def get_token_by_instance_name( Returns an ServiceAccount token. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -2415,7 +2416,7 @@ def get_token_by_instance_name( @validate_call def get_token_by_instance_name_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], expiration_seconds: Annotated[ @@ -2437,7 +2438,7 @@ def get_token_by_instance_name_with_http_info( Returns an ServiceAccount token. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -2494,7 +2495,7 @@ def get_token_by_instance_name_with_http_info( @validate_call def get_token_by_instance_name_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], expiration_seconds: Annotated[ @@ -2516,7 +2517,7 @@ def get_token_by_instance_name_without_preload_content( Returns an ServiceAccount token. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -2630,7 +2631,7 @@ def _get_token_by_instance_name_serialize( @validate_call def list_instances( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], _request_timeout: Union[ None, @@ -2647,7 +2648,7 @@ def list_instances( Returns a list of all instances within the project. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param _request_timeout: timeout setting for this request. If one @@ -2697,7 +2698,7 @@ def list_instances( @validate_call def list_instances_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], _request_timeout: Union[ None, @@ -2714,7 +2715,7 @@ def list_instances_with_http_info( Returns a list of all instances within the project. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param _request_timeout: timeout setting for this request. If one @@ -2764,7 +2765,7 @@ def list_instances_with_http_info( @validate_call def list_instances_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], _request_timeout: Union[ None, @@ -2781,7 +2782,7 @@ def list_instances_without_preload_content( Returns a list of all instances within the project. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param _request_timeout: timeout setting for this request. If one @@ -3094,7 +3095,7 @@ def _list_plans_global_serialize( @validate_call def list_plans_project( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the plan is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the plan is part of.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3110,7 +3111,7 @@ def list_plans_project( List all possible plans for the project. :param project_id: The STACKIT portal project UUID the plan is part of. (required) - :type project_id: str + :type project_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 @@ -3157,7 +3158,7 @@ def list_plans_project( @validate_call def list_plans_project_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the plan is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the plan is part of.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3173,7 +3174,7 @@ def list_plans_project_with_http_info( List all possible plans for the project. :param project_id: The STACKIT portal project UUID the plan is part of. (required) - :type project_id: str + :type project_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 @@ -3220,7 +3221,7 @@ def list_plans_project_with_http_info( @validate_call def list_plans_project_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the plan is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the plan is part of.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3236,7 +3237,7 @@ def list_plans_project_without_preload_content( List all possible plans for the project. :param project_id: The STACKIT portal project UUID the plan is part of. (required) - :type project_id: str + :type project_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 @@ -3329,7 +3330,7 @@ def _list_plans_project_serialize( @validate_call def update_instance( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[ str, @@ -3353,7 +3354,7 @@ def update_instance( Updates the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The full ID of the instance, -. (required) @@ -3411,7 +3412,7 @@ def update_instance( @validate_call def update_instance_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[ str, @@ -3435,7 +3436,7 @@ def update_instance_with_http_info( Updates the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The full ID of the instance, -. (required) @@ -3493,7 +3494,7 @@ def update_instance_with_http_info( @validate_call def update_instance_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], instance_id: Annotated[ str, @@ -3517,7 +3518,7 @@ def update_instance_without_preload_content( Updates the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param instance_id: The full ID of the instance, -. (required) @@ -3638,7 +3639,7 @@ def _update_instance_serialize( @validate_call def update_instance_by_name( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], update_instance_by_name_payload: UpdateInstanceByNamePayload, @@ -3657,7 +3658,7 @@ def update_instance_by_name( Updates the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -3715,7 +3716,7 @@ def update_instance_by_name( @validate_call def update_instance_by_name_with_http_info( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], update_instance_by_name_payload: UpdateInstanceByNamePayload, @@ -3734,7 +3735,7 @@ def update_instance_by_name_with_http_info( Updates the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) @@ -3792,7 +3793,7 @@ def update_instance_by_name_with_http_info( @validate_call def update_instance_by_name_without_preload_content( self, - project_id: Annotated[StrictStr, Field(description="The STACKIT portal project UUID the instance is part of.")], + project_id: Annotated[UUID, Field(description="The STACKIT portal project UUID the instance is part of.")], region_id: Annotated[StrictStr, Field(description="The STACKIT region the instance is part of.")], display_name: Annotated[str, Field(strict=True, max_length=8, description="The instance display name.")], update_instance_by_name_payload: UpdateInstanceByNamePayload, @@ -3811,7 +3812,7 @@ def update_instance_by_name_without_preload_content( Updates the given instance. :param project_id: The STACKIT portal project UUID the instance is part of. (required) - :type project_id: str + :type project_id: UUID :param region_id: The STACKIT region the instance is part of. (required) :type region_id: str :param display_name: The instance display name. (required) diff --git a/services/edge/src/stackit/edge/api_client.py b/services/edge/src/stackit/edge/api_client.py index 2865729a3..57b6ea31a 100644 --- a/services/edge/src/stackit/edge/api_client.py +++ b/services/edge/src/stackit/edge/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/edge/src/stackit/edge/exceptions.py b/services/edge/src/stackit/edge/exceptions.py index e6b313156..0089ededb 100644 --- a/services/edge/src/stackit/edge/exceptions.py +++ b/services/edge/src/stackit/edge/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/edge/src/stackit/edge/models/__init__.py b/services/edge/src/stackit/edge/models/__init__.py index c33746284..ae6007c0b 100644 --- a/services/edge/src/stackit/edge/models/__init__.py +++ b/services/edge/src/stackit/edge/models/__init__.py @@ -12,7 +12,6 @@ Do not edit the class manually. """ # noqa: E501 - # import models into model package from stackit.edge.models.bad_request import BadRequest from stackit.edge.models.create_instance_payload import CreateInstancePayload diff --git a/services/edge/src/stackit/edge/models/create_instance_payload.py b/services/edge/src/stackit/edge/models/create_instance_payload.py index 5d0e1c3ee..b497a592e 100644 --- a/services/edge/src/stackit/edge/models/create_instance_payload.py +++ b/services/edge/src/stackit/edge/models/create_instance_payload.py @@ -16,8 +16,9 @@ import json import pprint from typing import Any, ClassVar, Dict, List, Optional, Set +from uuid import UUID -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field from typing_extensions import Annotated, Self @@ -32,7 +33,7 @@ class CreateInstancePayload(BaseModel): display_name: Annotated[str, Field(min_length=4, strict=True, max_length=8)] = Field( description="The displayed name to distinguish multiple instances.", alias="displayName" ) - plan_id: StrictStr = Field(description="Service Plan configures the size of the Instance.", alias="planId") + plan_id: UUID = Field(description="Service Plan configures the size of the Instance.", alias="planId") __properties: ClassVar[List[str]] = ["description", "displayName", "planId"] model_config = ConfigDict( diff --git a/services/edge/src/stackit/edge/models/instance.py b/services/edge/src/stackit/edge/models/instance.py index 23adbe9f6..a6589c2bb 100644 --- a/services/edge/src/stackit/edge/models/instance.py +++ b/services/edge/src/stackit/edge/models/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 @@ -39,7 +40,7 @@ class Instance(BaseModel): id: Annotated[str, Field(strict=True, max_length=16)] = Field( description="A auto generated unique id which identifies the instance." ) - plan_id: StrictStr = Field(description="Service Plan configures the size of the Instance.", alias="planId") + plan_id: UUID = Field(description="Service Plan configures the size of the Instance.", alias="planId") status: StrictStr = Field(description="The current status of the instance.") __properties: ClassVar[List[str]] = [ "created", diff --git a/services/edge/src/stackit/edge/models/instance_list.py b/services/edge/src/stackit/edge/models/instance_list.py index 8a4a9906b..644929223 100644 --- a/services/edge/src/stackit/edge/models/instance_list.py +++ b/services/edge/src/stackit/edge/models/instance_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/edge/src/stackit/edge/models/plan.py b/services/edge/src/stackit/edge/models/plan.py index c5d6eed9d..268b296d1 100644 --- a/services/edge/src/stackit/edge/models/plan.py +++ b/services/edge/src/stackit/edge/models/plan.py @@ -16,6 +16,7 @@ import json import pprint from typing import Any, ClassVar, Dict, List, Optional, Set +from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing_extensions import Self @@ -27,7 +28,7 @@ class Plan(BaseModel): """ # noqa: E501 description: Optional[StrictStr] = Field(default=None, description="Description") - id: Optional[StrictStr] = Field(default=None, description="Service Plan Identifier") + id: Optional[UUID] = Field(default=None, description="Service Plan Identifier") max_edge_hosts: Optional[StrictInt] = Field( default=None, description="Maximum number of EdgeHosts", alias="maxEdgeHosts" ) diff --git a/services/edge/src/stackit/edge/models/plan_list.py b/services/edge/src/stackit/edge/models/plan_list.py index d311d50f1..649684919 100644 --- a/services/edge/src/stackit/edge/models/plan_list.py +++ b/services/edge/src/stackit/edge/models/plan_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 valid_plans (list) _items = [] if self.valid_plans: - for _item in self.valid_plans: - if _item: - _items.append(_item.to_dict()) + for _item_valid_plans in self.valid_plans: + if _item_valid_plans: + _items.append(_item_valid_plans.to_dict()) _dict["validPlans"] = _items return _dict diff --git a/services/edge/src/stackit/edge/models/update_instance_by_name_payload.py b/services/edge/src/stackit/edge/models/update_instance_by_name_payload.py index 58f81a508..6c4293086 100644 --- a/services/edge/src/stackit/edge/models/update_instance_by_name_payload.py +++ b/services/edge/src/stackit/edge/models/update_instance_by_name_payload.py @@ -16,8 +16,9 @@ import json import pprint from typing import Any, ClassVar, Dict, List, Optional, Set +from uuid import UUID -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field from typing_extensions import Annotated, Self @@ -29,7 +30,7 @@ class UpdateInstanceByNamePayload(BaseModel): description: Optional[Annotated[str, Field(strict=True, max_length=256)]] = Field( default=None, description="A user chosen description to distinguish multiple instances." ) - plan_id: Optional[StrictStr] = Field( + plan_id: Optional[UUID] = Field( default=None, description="Service Plan configures the size of the Instance.", alias="planId" ) __properties: ClassVar[List[str]] = ["description", "planId"] diff --git a/services/edge/src/stackit/edge/models/update_instance_payload.py b/services/edge/src/stackit/edge/models/update_instance_payload.py index 4d8f3468d..1304f4c90 100644 --- a/services/edge/src/stackit/edge/models/update_instance_payload.py +++ b/services/edge/src/stackit/edge/models/update_instance_payload.py @@ -16,8 +16,9 @@ import json import pprint from typing import Any, ClassVar, Dict, List, Optional, Set +from uuid import UUID -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field from typing_extensions import Annotated, Self @@ -29,7 +30,7 @@ class UpdateInstancePayload(BaseModel): description: Optional[Annotated[str, Field(strict=True, max_length=256)]] = Field( default=None, description="A user chosen description to distinguish multiple instances." ) - plan_id: Optional[StrictStr] = Field( + plan_id: Optional[UUID] = Field( default=None, description="Service Plan configures the size of the Instance.", alias="planId" ) __properties: ClassVar[List[str]] = ["description", "planId"] diff --git a/services/edge/src/stackit/edge/models/user.py b/services/edge/src/stackit/edge/models/user.py index 250c48e22..952b1bb3b 100644 --- a/services/edge/src/stackit/edge/models/user.py +++ b/services/edge/src/stackit/edge/models/user.py @@ -16,6 +16,7 @@ import json import pprint from typing import Any, ClassVar, Dict, List, Optional, Set +from uuid import UUID from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing_extensions import Self @@ -27,7 +28,7 @@ class User(BaseModel): """ # noqa: E501 email: StrictStr = Field(description="The email of the user.") - internal_id: StrictStr = Field(description="The UUID of the user.", alias="internalId") + internal_id: UUID = Field(description="The UUID of the user.", alias="internalId") __properties: ClassVar[List[str]] = ["email", "internalId"] model_config = ConfigDict( diff --git a/services/edge/src/stackit/edge/rest.py b/services/edge/src/stackit/edge/rest.py index b8ff50ae9..1512ccc03 100644 --- a/services/edge/src/stackit/edge/rest.py +++ b/services/edge/src/stackit/edge/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)])