diff --git a/services/git/src/stackit/git/__init__.py b/services/git/src/stackit/git/__init__.py index 8f166806..6a47768c 100644 --- a/services/git/src/stackit/git/__init__.py +++ b/services/git/src/stackit/git/__init__.py @@ -12,35 +12,61 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 __version__ = "1.0.0" +# Define package exports +__all__ = [ + "DefaultApi", + "ApiResponse", + "ApiClient", + "HostConfiguration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "CreateInstancePayload", + "Flavor", + "GenericErrorResponse", + "Instance", + "InternalServerErrorResponse", + "ListFlavors", + "ListInstances", + "UnauthorizedResponse", +] + # import apis into sdk package -from stackit.git.api.default_api import DefaultApi -from stackit.git.api_client import ApiClient +from stackit.git.api.default_api import DefaultApi as DefaultApi +from stackit.git.api_client import ApiClient as ApiClient # import ApiClient -from stackit.git.api_response import ApiResponse -from stackit.git.configuration import HostConfiguration -from stackit.git.exceptions import ( - ApiAttributeError, - ApiException, - ApiKeyError, - ApiTypeError, - ApiValueError, - OpenApiException, -) +from stackit.git.api_response import ApiResponse as ApiResponse +from stackit.git.configuration import HostConfiguration as HostConfiguration +from stackit.git.exceptions import ApiAttributeError as ApiAttributeError +from stackit.git.exceptions import ApiException as ApiException +from stackit.git.exceptions import ApiKeyError as ApiKeyError +from stackit.git.exceptions import ApiTypeError as ApiTypeError +from stackit.git.exceptions import ApiValueError as ApiValueError +from stackit.git.exceptions import OpenApiException as OpenApiException # import models into sdk package -from stackit.git.models.create_instance_payload import CreateInstancePayload -from stackit.git.models.flavor import Flavor -from stackit.git.models.generic_error_response import GenericErrorResponse -from stackit.git.models.instance import Instance +from stackit.git.models.create_instance_payload import ( + CreateInstancePayload as CreateInstancePayload, +) +from stackit.git.models.flavor import Flavor as Flavor +from stackit.git.models.generic_error_response import ( + GenericErrorResponse as GenericErrorResponse, +) +from stackit.git.models.instance import Instance as Instance from stackit.git.models.internal_server_error_response import ( - InternalServerErrorResponse, + InternalServerErrorResponse as InternalServerErrorResponse, +) +from stackit.git.models.list_flavors import ListFlavors as ListFlavors +from stackit.git.models.list_instances import ListInstances as ListInstances +from stackit.git.models.unauthorized_response import ( + UnauthorizedResponse as UnauthorizedResponse, ) -from stackit.git.models.list_flavors import ListFlavors -from stackit.git.models.list_instances import ListInstances -from stackit.git.models.unauthorized_response import UnauthorizedResponse diff --git a/services/git/src/stackit/git/api/default_api.py b/services/git/src/stackit/git/api/default_api.py index 80fdffec..ab0ea8bf 100644 --- a/services/git/src/stackit/git/api/default_api.py +++ b/services/git/src/stackit/git/api/default_api.py @@ -10,7 +10,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from typing import Any, Dict, List, Optional, Tuple, Union @@ -89,7 +89,7 @@ def create_instance( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._create_instance_serialize( project_id=project_id, @@ -157,7 +157,7 @@ def create_instance_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._create_instance_serialize( project_id=project_id, @@ -225,7 +225,7 @@ def create_instance_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._create_instance_serialize( project_id=project_id, @@ -264,7 +264,7 @@ def _create_instance_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -352,7 +352,7 @@ def delete_instance( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._delete_instance_serialize( project_id=project_id, @@ -423,7 +423,7 @@ def delete_instance_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._delete_instance_serialize( project_id=project_id, @@ -494,7 +494,7 @@ def delete_instance_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._delete_instance_serialize( project_id=project_id, @@ -534,7 +534,7 @@ def _delete_instance_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -614,7 +614,7 @@ def get_instance( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._get_instance_serialize( project_id=project_id, @@ -684,7 +684,7 @@ def get_instance_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._get_instance_serialize( project_id=project_id, @@ -754,7 +754,7 @@ def get_instance_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._get_instance_serialize( project_id=project_id, @@ -793,7 +793,7 @@ def _get_instance_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -831,14 +831,7 @@ def _get_instance_serialize( @validate_call def list_flavors( self, - project_id: Annotated[ - str, - Field( - strict=True, - max_length=36, - description="The STACKIT portal project UUID the STACKIT Git instance is part of.", - ), - ], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -853,7 +846,7 @@ def list_flavors( Provides detailed information about possible Git Flavors. - :param project_id: The STACKIT portal project UUID the STACKIT Git instance is part of. (required) + :param project_id: Project identifier. (required) :type project_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -875,7 +868,7 @@ def list_flavors( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_flavors_serialize( project_id=project_id, @@ -887,10 +880,10 @@ def list_flavors( _response_types_map: Dict[str, Optional[str]] = { "200": "ListFlavors", - "400": None, + "400": "GenericErrorResponse", "401": "UnauthorizedResponse", "404": None, - "500": "InternalServerErrorResponse", + "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -902,14 +895,7 @@ def list_flavors( @validate_call def list_flavors_with_http_info( self, - project_id: Annotated[ - str, - Field( - strict=True, - max_length=36, - description="The STACKIT portal project UUID the STACKIT Git instance is part of.", - ), - ], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -924,7 +910,7 @@ def list_flavors_with_http_info( Provides detailed information about possible Git Flavors. - :param project_id: The STACKIT portal project UUID the STACKIT Git instance is part of. (required) + :param project_id: Project identifier. (required) :type project_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -946,7 +932,7 @@ def list_flavors_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_flavors_serialize( project_id=project_id, @@ -958,10 +944,10 @@ def list_flavors_with_http_info( _response_types_map: Dict[str, Optional[str]] = { "200": "ListFlavors", - "400": None, + "400": "GenericErrorResponse", "401": "UnauthorizedResponse", "404": None, - "500": "InternalServerErrorResponse", + "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) response_data.read() @@ -973,14 +959,7 @@ def list_flavors_with_http_info( @validate_call def list_flavors_without_preload_content( self, - project_id: Annotated[ - str, - Field( - strict=True, - max_length=36, - description="The STACKIT portal project UUID the STACKIT Git instance is part of.", - ), - ], + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -995,7 +974,7 @@ def list_flavors_without_preload_content( Provides detailed information about possible Git Flavors. - :param project_id: The STACKIT portal project UUID the STACKIT Git instance is part of. (required) + :param project_id: Project identifier. (required) :type project_id: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -1017,7 +996,7 @@ def list_flavors_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_flavors_serialize( project_id=project_id, @@ -1029,10 +1008,10 @@ def list_flavors_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { "200": "ListFlavors", - "400": None, + "400": "GenericErrorResponse", "401": "UnauthorizedResponse", "404": None, - "500": "InternalServerErrorResponse", + "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response @@ -1054,7 +1033,7 @@ def _list_flavors_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1127,7 +1106,7 @@ def list_instances( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_instances_serialize( project_id=project_id, @@ -1190,7 +1169,7 @@ def list_instances_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_instances_serialize( project_id=project_id, @@ -1253,7 +1232,7 @@ def list_instances_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 docstring might be too long + """ # noqa: E501 _param = self._list_instances_serialize( project_id=project_id, @@ -1289,7 +1268,7 @@ def _list_instances_serialize( _query_params: List[Tuple[str, str]] = [] _header_params: Dict[str, Optional[str]] = _headers or {} _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/services/git/src/stackit/git/api_client.py b/services/git/src/stackit/git/api_client.py index 59ef9b98..8ca96a1e 100644 --- a/services/git/src/stackit/git/api_client.py +++ b/services/git/src/stackit/git/api_client.py @@ -10,7 +10,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 import datetime import json @@ -332,6 +332,10 @@ def sanitize_for_serialization(self, obj): else: obj_dict = obj.__dict__ + if isinstance(obj_dict, list): + # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() # noqa: E501 + return self.sanitize_for_serialization(obj_dict) + return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()} def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): @@ -351,12 +355,12 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti data = json.loads(response_text) except ValueError: data = response_text - elif content_type.startswith("application/json"): + elif re.match(r"^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)", content_type, re.IGNORECASE): if response_text == "": data = "" else: data = json.loads(response_text) - elif content_type.startswith("text/plain"): + elif re.match(r"^text\/[a-z.+-]+\s*(;|$)", content_type, re.IGNORECASE): data = response_text else: raise ApiException(status=0, reason="Unsupported content type: {0}".format(content_type)) @@ -458,7 +462,7 @@ def parameters_to_url_query(self, params, collection_formats): if k in collection_formats: collection_format = collection_formats[k] if collection_format == "multi": - new_params.extend((k, str(value)) for value in v) + new_params.extend((k, quote(str(value))) for value in v) else: if collection_format == "ssv": delimiter = " " @@ -474,7 +478,10 @@ def parameters_to_url_query(self, params, collection_formats): return "&".join(["=".join(map(str, item)) for item in new_params]) - def files_parameters(self, files: Dict[str, Union[str, bytes]]): + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): """Builds form parameters. :param files: File parameters. @@ -489,6 +496,12 @@ def files_parameters(self, files: Dict[str, Union[str, bytes]]): elif isinstance(v, bytes): filename = k filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue else: raise ValueError("Unsupported file value") mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream" diff --git a/services/git/src/stackit/git/configuration.py b/services/git/src/stackit/git/configuration.py index a4b58c22..f46e9af9 100644 --- a/services/git/src/stackit/git/configuration.py +++ b/services/git/src/stackit/git/configuration.py @@ -1,10 +1,5 @@ # coding: utf-8 -import sys - -import os - - """ STACKIT Git API @@ -15,7 +10,29 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 + +import sys +from typing import Dict, List, Optional, TypedDict + +from typing_extensions import NotRequired + +import os + + +ServerVariablesT = Dict[str, str] + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] class HostConfiguration: @@ -54,7 +71,7 @@ def __init__( """Ignore operation servers """ - def get_host_settings(self): + def get_host_settings(self) -> List[HostSetting]: """Gets an array of host settings :return: An array of host settings @@ -72,7 +89,12 @@ def get_host_settings(self): } ] - def get_host_from_settings(self, index, variables=None, servers=None): + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT] = None, + servers: Optional[List[HostSetting]] = None, + ) -> str: """Gets host URL based on the index and variables :param index: array index of the host settings :param variables: hash of variable and the corresponding value @@ -112,7 +134,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): and variables.get(variable_name) is not None ): raise ValueError( - "this API does not support setting a region in the the client configuration, " + "this API does not support setting a region in the client configuration, " "please check if the region can be specified as a function parameter" ) used_value = variables.get(variable_name, variable["default_value"]) @@ -131,12 +153,12 @@ def get_host_from_settings(self, index, variables=None, servers=None): return url @property - def host(self): + def host(self) -> str: """Return generated host.""" return self.get_host_from_settings(self.server_index, variables=self.server_variables) @host.setter - def host(self, value): + def host(self, value: str) -> None: """Fix base path.""" self._base_path = value self.server_index = None diff --git a/services/git/src/stackit/git/exceptions.py b/services/git/src/stackit/git/exceptions.py index 38d6acf3..6173d7dc 100644 --- a/services/git/src/stackit/git/exceptions.py +++ b/services/git/src/stackit/git/exceptions.py @@ -10,7 +10,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from typing import Any, Optional @@ -152,6 +152,13 @@ def from_response( if http_resp.status == 404: raise NotFoundException(http_resp=http_resp, body=body, data=data) + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + if 500 <= http_resp.status <= 599: raise ServiceException(http_resp=http_resp, body=body, data=data) raise ApiException(http_resp=http_resp, body=body, data=data) @@ -188,6 +195,18 @@ class ServiceException(ApiException): pass +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + + pass + + def render_path(path_to_item): """Returns a string representation of a path""" result = "" diff --git a/services/git/src/stackit/git/models/__init__.py b/services/git/src/stackit/git/models/__init__.py index 66afcf29..36c3a8cb 100644 --- a/services/git/src/stackit/git/models/__init__.py +++ b/services/git/src/stackit/git/models/__init__.py @@ -11,7 +11,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 # import models into model package diff --git a/services/git/src/stackit/git/models/create_instance_payload.py b/services/git/src/stackit/git/models/create_instance_payload.py index ab930f32..0c266f78 100644 --- a/services/git/src/stackit/git/models/create_instance_payload.py +++ b/services/git/src/stackit/git/models/create_instance_payload.py @@ -10,13 +10,13 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations import json import pprint -import re +import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator @@ -25,20 +25,30 @@ class CreateInstancePayload(BaseModel): """ - Instance creation configuration options. - """ + Request a STACKIT Git instance to be created with these properties. + """ # noqa: E501 acl: Optional[Annotated[List[StrictStr], Field(max_length=5)]] = Field( default=None, description="Restricted ACL for instance access." ) - flavor: Optional[StrictStr] = Field( - default="git-100", description="Instance flavor. Defaults to git-100 if not specified." + flavor: Optional[Annotated[str, Field(strict=True, max_length=255)]] = Field( + default=None, description="Desired instance flavor. Must be one of the defined enum values" ) name: Annotated[str, Field(min_length=5, strict=True, max_length=32)] = Field( description="A user chosen name to distinguish multiple STACKIT Git instances." ) __properties: ClassVar[List[str]] = ["acl", "flavor", "name"] + @field_validator("flavor") + def flavor_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(["git-10", "git-100"]): + raise ValueError("must be one of enum values ('git-10', 'git-100')") + return value + @field_validator("name") def name_validate_regular_expression(cls, value): """Validates the regular expression""" @@ -94,11 +104,5 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate( - { - "acl": obj.get("acl"), - "flavor": obj.get("flavor") if obj.get("flavor") is not None else "git-100", - "name": obj.get("name"), - } - ) + _obj = cls.model_validate({"acl": obj.get("acl"), "flavor": obj.get("flavor"), "name": obj.get("name")}) return _obj diff --git a/services/git/src/stackit/git/models/flavor.py b/services/git/src/stackit/git/models/flavor.py index 5475660f..80fc07a6 100644 --- a/services/git/src/stackit/git/models/flavor.py +++ b/services/git/src/stackit/git/models/flavor.py @@ -10,7 +10,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -25,13 +25,14 @@ class Flavor(BaseModel): """ Describes a STACKIT Git Flavor. - """ + """ # noqa: E501 availability: StrictStr = Field(description="Defines the flavor availability.") description: StrictStr = Field(description="Flavor description.") display_name: StrictStr = Field(description="The display name that will be shown in the Portal.") id: Annotated[str, Field(strict=True, max_length=36)] = Field(description="Flavor id.") - __properties: ClassVar[List[str]] = ["availability", "description", "display_name", "id"] + sku: StrictStr = Field(description="SAP article number.") + __properties: ClassVar[List[str]] = ["availability", "description", "display_name", "id", "sku"] @field_validator("availability") def availability_validate_enum(cls, value): @@ -94,6 +95,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "description": obj.get("description"), "display_name": obj.get("display_name"), "id": obj.get("id"), + "sku": obj.get("sku"), } ) return _obj diff --git a/services/git/src/stackit/git/models/generic_error_response.py b/services/git/src/stackit/git/models/generic_error_response.py index 36ffb1b6..945532c5 100644 --- a/services/git/src/stackit/git/models/generic_error_response.py +++ b/services/git/src/stackit/git/models/generic_error_response.py @@ -10,7 +10,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -25,7 +25,7 @@ class GenericErrorResponse(BaseModel): """ Generic Error Response. - """ + """ # noqa: E501 details: Optional[List[StrictStr]] = None message: StrictStr diff --git a/services/git/src/stackit/git/models/instance.py b/services/git/src/stackit/git/models/instance.py index aeabd26e..2d71925e 100644 --- a/services/git/src/stackit/git/models/instance.py +++ b/services/git/src/stackit/git/models/instance.py @@ -10,13 +10,12 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations import json import pprint -import re from datetime import datetime from typing import Any, ClassVar, Dict, List, Optional, Set @@ -26,21 +25,29 @@ class Instance(BaseModel): """ - Information about an Instance. - """ + Describes a STACKIT Git instance. + """ # noqa: E501 acl: List[StrictStr] = Field(description="Restricted ACL for instance access.") consumed_disk: StrictStr = Field(description="How many bytes of disk space is consumed. Read Only.") consumed_object_storage: StrictStr = Field(description="How many bytes of Object Storage is consumed. Read Only.") - created: datetime = Field(description="Instance creation timestamp in RFC3339 format.") - flavor: StrictStr = Field(description="Instance flavor.") - id: Annotated[str, Field(min_length=36, strict=True, max_length=36)] = Field(description="Instance identifier.") - name: Annotated[str, Field(strict=True, max_length=32)] = Field(description="Instance name.") + created: datetime = Field(description="The date and time the creation of the STACKIT Git instance was triggered.") + flavor: StrictStr = Field(description="Desired instance flavor. Must be one of the defined enum values") + id: Annotated[str, Field(strict=True, max_length=36)] = Field( + description="A auto generated unique id which identifies the STACKIT Git instances." + ) + name: Annotated[str, Field(strict=True, max_length=32)] = Field( + description="A user chosen name to distinguish multiple STACKIT Git instances." + ) state: Annotated[str, Field(strict=True, max_length=32)] = Field( - description="Indicate the readiness state of the instance." + description="The current state of the STACKIT Git instance." + ) + url: Annotated[str, Field(strict=True, max_length=2048)] = Field( + description="The URL for reaching the STACKIT Git instance." + ) + version: Annotated[str, Field(strict=True, max_length=20)] = Field( + description="The current version of STACKIT Git deployed to the instance." ) - url: Annotated[str, Field(strict=True, max_length=512)] = Field(description="Instance url.") - version: Annotated[str, Field(strict=True, max_length=20)] = Field(description="STACKIT Git version indicator.") __properties: ClassVar[List[str]] = [ "acl", "consumed_disk", @@ -54,15 +61,6 @@ class Instance(BaseModel): "version", ] - @field_validator("id") - def id_validate_regular_expression(cls, value): - """Validates the regular expression""" - if not re.match(r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$", value): - raise ValueError( - r"must validate the regular expression /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/" - ) - return value - @field_validator("state") def state_validate_enum(cls, value): """Validates the enum""" diff --git a/services/git/src/stackit/git/models/internal_server_error_response.py b/services/git/src/stackit/git/models/internal_server_error_response.py index 0789f80c..8e3784f7 100644 --- a/services/git/src/stackit/git/models/internal_server_error_response.py +++ b/services/git/src/stackit/git/models/internal_server_error_response.py @@ -10,7 +10,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -25,7 +25,7 @@ class InternalServerErrorResponse(BaseModel): """ Internal server error. - """ + """ # noqa: E501 error: Optional[StrictStr] = None __properties: ClassVar[List[str]] = ["error"] diff --git a/services/git/src/stackit/git/models/list_flavors.py b/services/git/src/stackit/git/models/list_flavors.py index 1d2fb2d8..22ba5e1c 100644 --- a/services/git/src/stackit/git/models/list_flavors.py +++ b/services/git/src/stackit/git/models/list_flavors.py @@ -10,7 +10,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -27,7 +27,7 @@ class ListFlavors(BaseModel): """ A list of STACKIT Git flavors. - """ + """ # noqa: E501 flavors: List[Flavor] __properties: ClassVar[List[str]] = ["flavors"] diff --git a/services/git/src/stackit/git/models/list_instances.py b/services/git/src/stackit/git/models/list_instances.py index f4afc5bf..2f48730b 100644 --- a/services/git/src/stackit/git/models/list_instances.py +++ b/services/git/src/stackit/git/models/list_instances.py @@ -10,7 +10,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -26,10 +26,10 @@ class ListInstances(BaseModel): """ - List of Instances. - """ + A list of STACKIT Git instances. + """ # noqa: E501 - instances: Annotated[List[Instance], Field(max_length=100)] + instances: Annotated[List[Instance], Field(max_length=50)] __properties: ClassVar[List[str]] = ["instances"] model_config = ConfigDict( diff --git a/services/git/src/stackit/git/models/unauthorized_response.py b/services/git/src/stackit/git/models/unauthorized_response.py index caeb666d..40b83963 100644 --- a/services/git/src/stackit/git/models/unauthorized_response.py +++ b/services/git/src/stackit/git/models/unauthorized_response.py @@ -10,7 +10,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 from __future__ import annotations @@ -25,7 +25,7 @@ class UnauthorizedResponse(BaseModel): """ The request could not be authorized. - """ + """ # noqa: E501 error: Optional[StrictStr] = None __properties: ClassVar[List[str]] = ["error"] diff --git a/services/git/src/stackit/git/rest.py b/services/git/src/stackit/git/rest.py index 6d2aaf59..bcf1f39f 100644 --- a/services/git/src/stackit/git/rest.py +++ b/services/git/src/stackit/git/rest.py @@ -10,7 +10,7 @@ Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" # noqa: E501 docstring might be too long +""" # noqa: E501 import io import json @@ -125,7 +125,7 @@ def request(self, method, url, headers=None, body=None, post_params=None, _reque data=body, headers=headers, ) - elif headers["Content-Type"] == "text/plain" and isinstance(body, bool): + 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) else: