diff --git a/services/git/src/stackit/git/__init__.py b/services/git/src/stackit/git/__init__.py index 27e86a369..e9370b0a1 100644 --- a/services/git/src/stackit/git/__init__.py +++ b/services/git/src/stackit/git/__init__.py @@ -29,19 +29,24 @@ "ApiKeyError", "ApiAttributeError", "ApiException", + "Authentication", + "AuthenticationList", + "CreateAuthenticationPayload", "CreateInstancePayload", + "CreateRunnerPayload", + "FeatureToggle", "Flavor", + "FlavorsList", "GenericErrorResponse", "Instance", - "InstanceFlavor", + "InstanceList", "InternalServerErrorResponse", - "ListFlavors", - "ListInstances", - "ListRunnerLabels", + "PatchAuthenticationPayload", "PatchInstancePayload", "PatchOperation", - "RunnerLabel", - "UnauthorizedResponse", + "Runner", + "RunnerRuntime", + "RunnerRuntimeList", ] # import apis into sdk package @@ -59,26 +64,39 @@ from stackit.git.exceptions import OpenApiException as OpenApiException # import models into sdk package +from stackit.git.models.authentication import Authentication as Authentication +from stackit.git.models.authentication_list import ( + AuthenticationList as AuthenticationList, +) +from stackit.git.models.create_authentication_payload import ( + CreateAuthenticationPayload as CreateAuthenticationPayload, +) from stackit.git.models.create_instance_payload import ( CreateInstancePayload as CreateInstancePayload, ) +from stackit.git.models.create_runner_payload import ( + CreateRunnerPayload as CreateRunnerPayload, +) +from stackit.git.models.feature_toggle import FeatureToggle as FeatureToggle from stackit.git.models.flavor import Flavor as Flavor +from stackit.git.models.flavors_list import FlavorsList as FlavorsList from stackit.git.models.generic_error_response import ( GenericErrorResponse as GenericErrorResponse, ) from stackit.git.models.instance import Instance as Instance -from stackit.git.models.instance_flavor import InstanceFlavor as InstanceFlavor +from stackit.git.models.instance_list import InstanceList as InstanceList from stackit.git.models.internal_server_error_response import ( 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.list_runner_labels import ListRunnerLabels as ListRunnerLabels +from stackit.git.models.patch_authentication_payload import ( + PatchAuthenticationPayload as PatchAuthenticationPayload, +) from stackit.git.models.patch_instance_payload import ( PatchInstancePayload as PatchInstancePayload, ) from stackit.git.models.patch_operation import PatchOperation as PatchOperation -from stackit.git.models.runner_label import RunnerLabel as RunnerLabel -from stackit.git.models.unauthorized_response import ( - UnauthorizedResponse as UnauthorizedResponse, +from stackit.git.models.runner import Runner as Runner +from stackit.git.models.runner_runtime import RunnerRuntime as RunnerRuntime +from stackit.git.models.runner_runtime_list import ( + RunnerRuntimeList as RunnerRuntimeList, ) diff --git a/services/git/src/stackit/git/api/default_api.py b/services/git/src/stackit/git/api/default_api.py index 7f85cabdf..82b70f6e6 100644 --- a/services/git/src/stackit/git/api/default_api.py +++ b/services/git/src/stackit/git/api/default_api.py @@ -26,12 +26,18 @@ from stackit.git.api_client import ApiClient, RequestSerialized from stackit.git.api_response import ApiResponse +from stackit.git.models.authentication import Authentication +from stackit.git.models.authentication_list import AuthenticationList +from stackit.git.models.create_authentication_payload import CreateAuthenticationPayload from stackit.git.models.create_instance_payload import CreateInstancePayload +from stackit.git.models.create_runner_payload import CreateRunnerPayload +from stackit.git.models.flavors_list import FlavorsList from stackit.git.models.instance import Instance -from stackit.git.models.list_flavors import ListFlavors -from stackit.git.models.list_instances import ListInstances -from stackit.git.models.list_runner_labels import ListRunnerLabels +from stackit.git.models.instance_list import InstanceList +from stackit.git.models.patch_authentication_payload import PatchAuthenticationPayload from stackit.git.models.patch_instance_payload import PatchInstancePayload +from stackit.git.models.runner import Runner +from stackit.git.models.runner_runtime_list import RunnerRuntimeList from stackit.git.rest import RESTResponseType @@ -48,11 +54,2184 @@ def __init__(self, configuration: Configuration = None) -> None: self.configuration = configuration self.api_client = ApiClient(self.configuration) + @validate_call + def create_authentication( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + create_authentication_payload: Annotated[ + CreateAuthenticationPayload, Field(description="Authentication Definition configuration data.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Authentication: + """Creates an authentication source + + Creates an authentication source for the corresponding STACKIT Git instance + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param create_authentication_payload: Authentication Definition configuration data. (required) + :type create_authentication_payload: CreateAuthenticationPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_authentication_serialize( + project_id=project_id, + instance_id=instance_id, + create_authentication_payload=create_authentication_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "Authentication", + "400": "GenericErrorResponse", + "401": None, + "404": "GenericErrorResponse", + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def create_authentication_with_http_info( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + create_authentication_payload: Annotated[ + CreateAuthenticationPayload, Field(description="Authentication Definition configuration data.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Authentication]: + """Creates an authentication source + + Creates an authentication source for the corresponding STACKIT Git instance + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param create_authentication_payload: Authentication Definition configuration data. (required) + :type create_authentication_payload: CreateAuthenticationPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_authentication_serialize( + project_id=project_id, + instance_id=instance_id, + create_authentication_payload=create_authentication_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "Authentication", + "400": "GenericErrorResponse", + "401": None, + "404": "GenericErrorResponse", + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def create_authentication_without_preload_content( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + create_authentication_payload: Annotated[ + CreateAuthenticationPayload, Field(description="Authentication Definition configuration data.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Creates an authentication source + + Creates an authentication source for the corresponding STACKIT Git instance + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param create_authentication_payload: Authentication Definition configuration data. (required) + :type create_authentication_payload: CreateAuthenticationPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_authentication_serialize( + project_id=project_id, + instance_id=instance_id, + create_authentication_payload=create_authentication_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "Authentication", + "400": "GenericErrorResponse", + "401": None, + "404": "GenericErrorResponse", + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _create_authentication_serialize( + self, + project_id, + instance_id, + create_authentication_payload, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if instance_id is not None: + _path_params["instanceId"] = instance_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if create_authentication_payload is not None: + _body_params = create_authentication_payload + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type(["application/json"]) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/v1beta/projects/{projectId}/instances/{instanceId}/authentications", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + @validate_call def create_instance( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], - create_instance_payload: Annotated[CreateInstancePayload, Field(description="Instance configuration options.")], + create_instance_payload: Annotated[CreateInstancePayload, Field(description="Instance configuration options.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Instance: + """Create an Instance. + + Creates a new STACKIT Git instance as a project resource. + + :param project_id: Project identifier. (required) + :type project_id: str + :param create_instance_payload: Instance configuration options. (required) + :type create_instance_payload: CreateInstancePayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_instance_serialize( + project_id=project_id, + create_instance_payload=create_instance_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "Instance", + "400": "GenericErrorResponse", + "401": None, + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def create_instance_with_http_info( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + create_instance_payload: Annotated[CreateInstancePayload, Field(description="Instance configuration options.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Instance]: + """Create an Instance. + + Creates a new STACKIT Git instance as a project resource. + + :param project_id: Project identifier. (required) + :type project_id: str + :param create_instance_payload: Instance configuration options. (required) + :type create_instance_payload: CreateInstancePayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_instance_serialize( + project_id=project_id, + create_instance_payload=create_instance_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "Instance", + "400": "GenericErrorResponse", + "401": None, + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def create_instance_without_preload_content( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + create_instance_payload: Annotated[CreateInstancePayload, Field(description="Instance configuration options.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create an Instance. + + Creates a new STACKIT Git instance as a project resource. + + :param project_id: Project identifier. (required) + :type project_id: str + :param create_instance_payload: Instance configuration options. (required) + :type create_instance_payload: CreateInstancePayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_instance_serialize( + project_id=project_id, + create_instance_payload=create_instance_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "Instance", + "400": "GenericErrorResponse", + "401": None, + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _create_instance_serialize( + self, + project_id, + create_instance_payload, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if create_instance_payload is not None: + _body_params = create_instance_payload + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type(["application/json"]) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/v1beta/projects/{projectId}/instances", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def create_runner( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + create_runner_payload: Annotated[CreateRunnerPayload, Field(description="Runner configuration options.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Runner: + """Create the runner associated to this instance. + + Creates the runner associated to this STACKIT Git instance. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param create_runner_payload: Runner configuration options. (required) + :type create_runner_payload: CreateRunnerPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_runner_serialize( + project_id=project_id, + instance_id=instance_id, + create_runner_payload=create_runner_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "Runner", + "400": "GenericErrorResponse", + "401": None, + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def create_runner_with_http_info( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + create_runner_payload: Annotated[CreateRunnerPayload, Field(description="Runner configuration options.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Runner]: + """Create the runner associated to this instance. + + Creates the runner associated to this STACKIT Git instance. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param create_runner_payload: Runner configuration options. (required) + :type create_runner_payload: CreateRunnerPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_runner_serialize( + project_id=project_id, + instance_id=instance_id, + create_runner_payload=create_runner_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "Runner", + "400": "GenericErrorResponse", + "401": None, + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def create_runner_without_preload_content( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + create_runner_payload: Annotated[CreateRunnerPayload, Field(description="Runner configuration options.")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create the runner associated to this instance. + + Creates the runner associated to this STACKIT Git instance. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param create_runner_payload: Runner configuration options. (required) + :type create_runner_payload: CreateRunnerPayload + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_runner_serialize( + project_id=project_id, + instance_id=instance_id, + create_runner_payload=create_runner_payload, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "202": "Runner", + "400": "GenericErrorResponse", + "401": None, + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _create_runner_serialize( + self, + project_id, + instance_id, + create_runner_payload, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if instance_id is not None: + _path_params["instanceId"] = instance_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if create_runner_payload is not None: + _body_params = create_runner_payload + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type(["application/json"]) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="POST", + resource_path="/v1beta/projects/{projectId}/instances/{instanceId}/runner", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def delete_authentication( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + authentication_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Authentication Source identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Authentication Source + + Deletes the authentication source associated to this STACKIT Git instance. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param authentication_id: Authentication Source identifier. (required) + :type authentication_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_authentication_serialize( + project_id=project_id, + instance_id=instance_id, + authentication_id=authentication_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "GenericErrorResponse", + "401": None, + "404": "GenericErrorResponse", + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def delete_authentication_with_http_info( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + authentication_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Authentication Source identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Authentication Source + + Deletes the authentication source associated to this STACKIT Git instance. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param authentication_id: Authentication Source identifier. (required) + :type authentication_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_authentication_serialize( + project_id=project_id, + instance_id=instance_id, + authentication_id=authentication_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "GenericErrorResponse", + "401": None, + "404": "GenericErrorResponse", + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def delete_authentication_without_preload_content( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + authentication_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Authentication Source identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Authentication Source + + Deletes the authentication source associated to this STACKIT Git instance. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param authentication_id: Authentication Source identifier. (required) + :type authentication_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_authentication_serialize( + project_id=project_id, + instance_id=instance_id, + authentication_id=authentication_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "GenericErrorResponse", + "401": None, + "404": "GenericErrorResponse", + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _delete_authentication_serialize( + self, + project_id, + instance_id, + authentication_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if instance_id is not None: + _path_params["instanceId"] = instance_id + if authentication_id is not None: + _path_params["authenticationId"] = authentication_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def delete_instance( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Instance. + + Deletes a STACKIT Git instance and destroys all associated data. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_instance_serialize( + project_id=project_id, + instance_id=instance_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "GenericErrorResponse", + "401": None, + "404": "GenericErrorResponse", + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def delete_instance_with_http_info( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Instance. + + Deletes a STACKIT Git instance and destroys all associated data. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_instance_serialize( + project_id=project_id, + instance_id=instance_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "GenericErrorResponse", + "401": None, + "404": "GenericErrorResponse", + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def delete_instance_without_preload_content( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Instance. + + Deletes a STACKIT Git instance and destroys all associated data. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_instance_serialize( + project_id=project_id, + instance_id=instance_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "GenericErrorResponse", + "401": None, + "404": "GenericErrorResponse", + "409": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _delete_instance_serialize( + self, + project_id, + instance_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if instance_id is not None: + _path_params["instanceId"] = instance_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/v1beta/projects/{projectId}/instances/{instanceId}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def delete_runner( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> None: + """Delete Runner. + + Deletes the runner associated to this STACKIT Git instance and destroys all associated data. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_runner_serialize( + project_id=project_id, + instance_id=instance_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "GenericErrorResponse", + "401": None, + "404": None, + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def delete_runner_with_http_info( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[None]: + """Delete Runner. + + Deletes the runner associated to this STACKIT Git instance and destroys all associated data. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_runner_serialize( + project_id=project_id, + instance_id=instance_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "GenericErrorResponse", + "401": None, + "404": None, + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def delete_runner_without_preload_content( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Delete Runner. + + Deletes the runner associated to this STACKIT Git instance and destroys all associated data. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_runner_serialize( + project_id=project_id, + instance_id=instance_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "204": None, + "400": "GenericErrorResponse", + "401": None, + "404": None, + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _delete_runner_serialize( + self, + project_id, + instance_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if instance_id is not None: + _path_params["instanceId"] = instance_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="DELETE", + resource_path="/v1beta/projects/{projectId}/instances/{instanceId}/runner", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_authentication( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + authentication_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Authentication Source identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Authentication: + """Get authentication provider + + Get authentication provider + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param authentication_id: Authentication Source identifier. (required) + :type authentication_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_authentication_serialize( + project_id=project_id, + instance_id=instance_id, + authentication_id=authentication_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Authentication", + "400": "GenericErrorResponse", + "401": None, + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def get_authentication_with_http_info( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + authentication_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Authentication Source identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Authentication]: + """Get authentication provider + + Get authentication provider + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param authentication_id: Authentication Source identifier. (required) + :type authentication_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_authentication_serialize( + project_id=project_id, + instance_id=instance_id, + authentication_id=authentication_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Authentication", + "400": "GenericErrorResponse", + "401": None, + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_authentication_without_preload_content( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + authentication_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Authentication Source identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get authentication provider + + Get authentication provider + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param authentication_id: Authentication Source identifier. (required) + :type authentication_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_authentication_serialize( + project_id=project_id, + instance_id=instance_id, + authentication_id=authentication_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Authentication", + "400": "GenericErrorResponse", + "401": None, + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_authentication_serialize( + self, + project_id, + instance_id, + authentication_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if instance_id is not None: + _path_params["instanceId"] = instance_id + if authentication_id is not None: + _path_params["authenticationId"] = authentication_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_instance( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Instance: + """Get Instance information. + + Retrieves information about a STACKIT Git instance. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_instance_serialize( + project_id=project_id, + instance_id=instance_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Instance", + "400": "GenericErrorResponse", + "401": None, + "404": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + def get_instance_with_http_info( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Instance]: + """Get Instance information. + + Retrieves information about a STACKIT Git instance. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_instance_serialize( + project_id=project_id, + instance_id=instance_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Instance", + "400": "GenericErrorResponse", + "401": None, + "404": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + def get_instance_without_preload_content( + self, + project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Instance information. + + Retrieves information about a STACKIT Git instance. + + :param project_id: Project identifier. (required) + :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_instance_serialize( + project_id=project_id, + instance_id=instance_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Instance", + "400": "GenericErrorResponse", + "401": None, + "404": "GenericErrorResponse", + "500": "GenericErrorResponse", + } + response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) + return response_data.response + + def _get_instance_serialize( + self, + project_id, + instance_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if project_id is not None: + _path_params["projectId"] = project_id + if instance_id is not None: + _path_params["instanceId"] = instance_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + if "Accept" not in _header_params: + _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + + # authentication setting + _auth_settings: List[str] = [] + + return self.api_client.param_serialize( + method="GET", + resource_path="/v1beta/projects/{projectId}/instances/{instanceId}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + + @validate_call + def get_instances( + self, + 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)], @@ -62,15 +2241,13 @@ def create_instance( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> Instance: - """Create an Instance. + ) -> InstanceList: + """List Instances. - Creates a new STACKIT Git instance as a project resource. + Lists all STACKIT Git instances within a project. :param project_id: Project identifier. (required) :type project_id: str - :param create_instance_payload: Instance configuration options. (required) - :type create_instance_payload: CreateInstancePayload :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 @@ -93,9 +2270,8 @@ def create_instance( :return: Returns the result object. """ # noqa: E501 - _param = self._create_instance_serialize( + _param = self._get_instances_serialize( project_id=project_id, - create_instance_payload=create_instance_payload, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -103,10 +2279,9 @@ def create_instance( ) _response_types_map: Dict[str, Optional[str]] = { - "201": "Instance", + "200": "InstanceList", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", - "409": "GenericErrorResponse", + "401": None, "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) @@ -117,10 +2292,9 @@ def create_instance( ).data @validate_call - def create_instance_with_http_info( + def get_instances_with_http_info( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], - create_instance_payload: Annotated[CreateInstancePayload, Field(description="Instance configuration options.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -130,15 +2304,13 @@ def create_instance_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Instance]: - """Create an Instance. + ) -> ApiResponse[InstanceList]: + """List Instances. - Creates a new STACKIT Git instance as a project resource. + Lists all STACKIT Git instances within a project. :param project_id: Project identifier. (required) :type project_id: str - :param create_instance_payload: Instance configuration options. (required) - :type create_instance_payload: CreateInstancePayload :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 @@ -161,9 +2333,8 @@ def create_instance_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._create_instance_serialize( + _param = self._get_instances_serialize( project_id=project_id, - create_instance_payload=create_instance_payload, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -171,10 +2342,9 @@ def create_instance_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "201": "Instance", + "200": "InstanceList", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", - "409": "GenericErrorResponse", + "401": None, "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) @@ -185,10 +2355,9 @@ def create_instance_with_http_info( ) @validate_call - def create_instance_without_preload_content( + def get_instances_without_preload_content( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], - create_instance_payload: Annotated[CreateInstancePayload, Field(description="Instance configuration options.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -199,14 +2368,12 @@ def create_instance_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Create an Instance. + """List Instances. - Creates a new STACKIT Git instance as a project resource. + Lists all STACKIT Git instances within a project. :param project_id: Project identifier. (required) :type project_id: str - :param create_instance_payload: Instance configuration options. (required) - :type create_instance_payload: CreateInstancePayload :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 @@ -229,9 +2396,8 @@ def create_instance_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._create_instance_serialize( + _param = self._get_instances_serialize( project_id=project_id, - create_instance_payload=create_instance_payload, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -239,19 +2405,17 @@ def create_instance_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "201": "Instance", + "200": "InstanceList", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", - "409": "GenericErrorResponse", + "401": None, "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _create_instance_serialize( + def _get_instances_serialize( self, project_id, - create_instance_payload, _request_auth, _content_type, _headers, @@ -276,26 +2440,16 @@ def _create_instance_serialize( # process the header parameters # process the form parameters # process the body parameter - if create_instance_payload is not None: - _body_params = create_instance_payload # set the HTTP header `Accept` if "Accept" not in _header_params: _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) - # set the HTTP header `Content-Type` - if _content_type: - _header_params["Content-Type"] = _content_type - else: - _default_content_type = self.api_client.select_header_content_type(["application/json"]) - if _default_content_type is not None: - _header_params["Content-Type"] = _default_content_type - # authentication setting _auth_settings: List[str] = [] return self.api_client.param_serialize( - method="POST", + method="GET", resource_path="/v1beta/projects/{projectId}/instances", path_params=_path_params, query_params=_query_params, @@ -310,7 +2464,7 @@ def _create_instance_serialize( ) @validate_call - def delete_instance( + def get_runner( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], instance_id: Annotated[ @@ -325,10 +2479,10 @@ def delete_instance( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> None: - """Delete Instance. + ) -> Runner: + """Get Runner information. - Deletes a STACKIT Git instance and destroys all associated data. + Retrieves information about a runner in a STACKIT Git instance. :param project_id: Project identifier. (required) :type project_id: str @@ -356,7 +2510,7 @@ def delete_instance( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_instance_serialize( + _param = self._get_runner_serialize( project_id=project_id, instance_id=instance_id, _request_auth=_request_auth, @@ -366,11 +2520,10 @@ def delete_instance( ) _response_types_map: Dict[str, Optional[str]] = { - "202": None, + "200": "Runner", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", + "401": None, "404": None, - "409": None, "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) @@ -381,7 +2534,7 @@ def delete_instance( ).data @validate_call - def delete_instance_with_http_info( + def get_runner_with_http_info( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], instance_id: Annotated[ @@ -396,10 +2549,10 @@ def delete_instance_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: - """Delete Instance. + ) -> ApiResponse[Runner]: + """Get Runner information. - Deletes a STACKIT Git instance and destroys all associated data. + Retrieves information about a runner in a STACKIT Git instance. :param project_id: Project identifier. (required) :type project_id: str @@ -427,7 +2580,7 @@ def delete_instance_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_instance_serialize( + _param = self._get_runner_serialize( project_id=project_id, instance_id=instance_id, _request_auth=_request_auth, @@ -437,11 +2590,10 @@ def delete_instance_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "202": None, + "200": "Runner", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", + "401": None, "404": None, - "409": None, "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) @@ -452,7 +2604,7 @@ def delete_instance_with_http_info( ) @validate_call - def delete_instance_without_preload_content( + def get_runner_without_preload_content( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], instance_id: Annotated[ @@ -468,9 +2620,9 @@ def delete_instance_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Delete Instance. + """Get Runner information. - Deletes a STACKIT Git instance and destroys all associated data. + Retrieves information about a runner in a STACKIT Git instance. :param project_id: Project identifier. (required) :type project_id: str @@ -498,7 +2650,7 @@ def delete_instance_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._delete_instance_serialize( + _param = self._get_runner_serialize( project_id=project_id, instance_id=instance_id, _request_auth=_request_auth, @@ -508,17 +2660,16 @@ def delete_instance_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "202": None, + "200": "Runner", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", + "401": None, "404": None, - "409": None, "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _delete_instance_serialize( + def _get_runner_serialize( self, project_id, instance_id, @@ -557,8 +2708,8 @@ def _delete_instance_serialize( _auth_settings: List[str] = [] return self.api_client.param_serialize( - method="DELETE", - resource_path="/v1beta/projects/{projectId}/instances/{instanceId}", + method="GET", + resource_path="/v1beta/projects/{projectId}/instances/{instanceId}/runner", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -572,7 +2723,7 @@ def _delete_instance_serialize( ) @validate_call - def get_instance( + def list_authentication( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], instance_id: Annotated[ @@ -587,10 +2738,10 @@ def get_instance( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> Instance: - """Get Instance information. + ) -> AuthenticationList: + """List authentication sources - Retrieves information about a STACKIT Git instance. + Lists all authentication sources belonging to a specific instance :param project_id: Project identifier. (required) :type project_id: str @@ -618,7 +2769,7 @@ def get_instance( :return: Returns the result object. """ # noqa: E501 - _param = self._get_instance_serialize( + _param = self._list_authentication_serialize( project_id=project_id, instance_id=instance_id, _request_auth=_request_auth, @@ -628,10 +2779,9 @@ def get_instance( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "Instance", + "200": "AuthenticationList", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", - "404": None, + "401": None, "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) @@ -642,7 +2792,7 @@ def get_instance( ).data @validate_call - def get_instance_with_http_info( + def list_authentication_with_http_info( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], instance_id: Annotated[ @@ -657,10 +2807,10 @@ def get_instance_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Instance]: - """Get Instance information. + ) -> ApiResponse[AuthenticationList]: + """List authentication sources - Retrieves information about a STACKIT Git instance. + Lists all authentication sources belonging to a specific instance :param project_id: Project identifier. (required) :type project_id: str @@ -688,7 +2838,7 @@ def get_instance_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_instance_serialize( + _param = self._list_authentication_serialize( project_id=project_id, instance_id=instance_id, _request_auth=_request_auth, @@ -698,10 +2848,9 @@ def get_instance_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "Instance", + "200": "AuthenticationList", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", - "404": None, + "401": None, "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) @@ -712,7 +2861,7 @@ def get_instance_with_http_info( ) @validate_call - def get_instance_without_preload_content( + def list_authentication_without_preload_content( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], instance_id: Annotated[ @@ -728,9 +2877,9 @@ def get_instance_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Get Instance information. + """List authentication sources - Retrieves information about a STACKIT Git instance. + Lists all authentication sources belonging to a specific instance :param project_id: Project identifier. (required) :type project_id: str @@ -758,7 +2907,7 @@ def get_instance_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_instance_serialize( + _param = self._list_authentication_serialize( project_id=project_id, instance_id=instance_id, _request_auth=_request_auth, @@ -768,16 +2917,15 @@ def get_instance_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "Instance", + "200": "AuthenticationList", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", - "404": None, + "401": None, "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _get_instance_serialize( + def _list_authentication_serialize( self, project_id, instance_id, @@ -817,7 +2965,7 @@ def _get_instance_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta/projects/{projectId}/instances/{instanceId}", + resource_path="/v1beta/projects/{projectId}/instances/{instanceId}/authentications", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -843,7 +2991,7 @@ def list_flavors( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ListFlavors: + ) -> FlavorsList: """Returns the details for the given STACKIT Git flavors. Provides detailed information about possible Git Flavors. @@ -881,9 +3029,9 @@ def list_flavors( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListFlavors", + "200": "FlavorsList", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", + "401": None, "404": None, "500": "GenericErrorResponse", } @@ -907,7 +3055,7 @@ def list_flavors_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ListFlavors]: + ) -> ApiResponse[FlavorsList]: """Returns the details for the given STACKIT Git flavors. Provides detailed information about possible Git Flavors. @@ -945,9 +3093,9 @@ def list_flavors_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListFlavors", + "200": "FlavorsList", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", + "401": None, "404": None, "500": "GenericErrorResponse", } @@ -1009,9 +3157,9 @@ def list_flavors_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListFlavors", + "200": "FlavorsList", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", + "401": None, "404": None, "500": "GenericErrorResponse", } @@ -1069,7 +3217,7 @@ def _list_flavors_serialize( ) @validate_call - def list_instances( + def list_runner_runtimes( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], _request_timeout: Union[ @@ -1081,10 +3229,10 @@ def list_instances( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ListInstances: - """List Instances. + ) -> RunnerRuntimeList: + """list_runner_runtimes - Lists all STACKIT Git instances within a project. + A list of runner runtimes that are available to be enabled for the project. :param project_id: Project identifier. (required) :type project_id: str @@ -1110,7 +3258,7 @@ def list_instances( :return: Returns the result object. """ # noqa: E501 - _param = self._list_instances_serialize( + _param = self._list_runner_runtimes_serialize( project_id=project_id, _request_auth=_request_auth, _content_type=_content_type, @@ -1119,9 +3267,10 @@ def list_instances( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListInstances", + "200": "RunnerRuntimeList", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", + "401": None, + "404": "GenericErrorResponse", "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) @@ -1132,7 +3281,7 @@ def list_instances( ).data @validate_call - def list_instances_with_http_info( + def list_runner_runtimes_with_http_info( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], _request_timeout: Union[ @@ -1144,10 +3293,10 @@ def list_instances_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ListInstances]: - """List Instances. + ) -> ApiResponse[RunnerRuntimeList]: + """list_runner_runtimes - Lists all STACKIT Git instances within a project. + A list of runner runtimes that are available to be enabled for the project. :param project_id: Project identifier. (required) :type project_id: str @@ -1173,7 +3322,7 @@ def list_instances_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_instances_serialize( + _param = self._list_runner_runtimes_serialize( project_id=project_id, _request_auth=_request_auth, _content_type=_content_type, @@ -1182,9 +3331,10 @@ def list_instances_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListInstances", + "200": "RunnerRuntimeList", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", + "401": None, + "404": "GenericErrorResponse", "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) @@ -1195,7 +3345,7 @@ def list_instances_with_http_info( ) @validate_call - def list_instances_without_preload_content( + def list_runner_runtimes_without_preload_content( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], _request_timeout: Union[ @@ -1208,9 +3358,9 @@ def list_instances_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """List Instances. + """list_runner_runtimes - Lists all STACKIT Git instances within a project. + A list of runner runtimes that are available to be enabled for the project. :param project_id: Project identifier. (required) :type project_id: str @@ -1236,7 +3386,7 @@ def list_instances_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_instances_serialize( + _param = self._list_runner_runtimes_serialize( project_id=project_id, _request_auth=_request_auth, _content_type=_content_type, @@ -1245,15 +3395,16 @@ def list_instances_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListInstances", + "200": "RunnerRuntimeList", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", + "401": None, + "404": "GenericErrorResponse", "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _list_instances_serialize( + def _list_runner_runtimes_serialize( self, project_id, _request_auth, @@ -1290,7 +3441,7 @@ def _list_instances_serialize( return self.api_client.param_serialize( method="GET", - resource_path="/v1beta/projects/{projectId}/instances", + resource_path="/v1beta/projects/{projectId}/runner-runtimes", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1304,9 +3455,18 @@ def _list_instances_serialize( ) @validate_call - def list_runner_labels( + def patch_authentication( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + authentication_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Authentication Source identifier.") + ], + patch_authentication_payload: Annotated[ + PatchAuthenticationPayload, Field(description="Authentication Definition configuration data.") + ], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1316,13 +3476,19 @@ def list_runner_labels( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ListRunnerLabels: - """Returns the details for the given STACKIT Git RunnerLabels. + ) -> Authentication: + """Patch Authentication. - Type of runners we can use for running jobs. + Patches the Authentication Provider. :param project_id: Project identifier. (required) :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param authentication_id: Authentication Source identifier. (required) + :type authentication_id: str + :param patch_authentication_payload: Authentication Definition configuration data. (required) + :type patch_authentication_payload: PatchAuthenticationPayload :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 @@ -1345,8 +3511,11 @@ def list_runner_labels( :return: Returns the result object. """ # noqa: E501 - _param = self._list_runner_labels_serialize( + _param = self._patch_authentication_serialize( project_id=project_id, + instance_id=instance_id, + authentication_id=authentication_id, + patch_authentication_payload=patch_authentication_payload, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1354,10 +3523,10 @@ def list_runner_labels( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListRunnerLabels", + "202": "Authentication", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", - "404": None, + "401": None, + "404": "GenericErrorResponse", "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) @@ -1368,9 +3537,18 @@ def list_runner_labels( ).data @validate_call - def list_runner_labels_with_http_info( + def patch_authentication_with_http_info( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + authentication_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Authentication Source identifier.") + ], + patch_authentication_payload: Annotated[ + PatchAuthenticationPayload, Field(description="Authentication Definition configuration data.") + ], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1380,13 +3558,19 @@ def list_runner_labels_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ListRunnerLabels]: - """Returns the details for the given STACKIT Git RunnerLabels. + ) -> ApiResponse[Authentication]: + """Patch Authentication. - Type of runners we can use for running jobs. + Patches the Authentication Provider. :param project_id: Project identifier. (required) :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param authentication_id: Authentication Source identifier. (required) + :type authentication_id: str + :param patch_authentication_payload: Authentication Definition configuration data. (required) + :type patch_authentication_payload: PatchAuthenticationPayload :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 @@ -1409,8 +3593,11 @@ def list_runner_labels_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._list_runner_labels_serialize( + _param = self._patch_authentication_serialize( project_id=project_id, + instance_id=instance_id, + authentication_id=authentication_id, + patch_authentication_payload=patch_authentication_payload, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1418,10 +3605,10 @@ def list_runner_labels_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListRunnerLabels", + "202": "Authentication", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", - "404": None, + "401": None, + "404": "GenericErrorResponse", "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) @@ -1432,9 +3619,18 @@ def list_runner_labels_with_http_info( ) @validate_call - def list_runner_labels_without_preload_content( + def patch_authentication_without_preload_content( self, project_id: Annotated[str, Field(min_length=36, strict=True, max_length=36, description="Project identifier.")], + instance_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Instance identifier.") + ], + authentication_id: Annotated[ + str, Field(min_length=36, strict=True, max_length=36, description="Authentication Source identifier.") + ], + patch_authentication_payload: Annotated[ + PatchAuthenticationPayload, Field(description="Authentication Definition configuration data.") + ], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1445,12 +3641,18 @@ def list_runner_labels_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Returns the details for the given STACKIT Git RunnerLabels. + """Patch Authentication. - Type of runners we can use for running jobs. + Patches the Authentication Provider. :param project_id: Project identifier. (required) :type project_id: str + :param instance_id: Instance identifier. (required) + :type instance_id: str + :param authentication_id: Authentication Source identifier. (required) + :type authentication_id: str + :param patch_authentication_payload: Authentication Definition configuration data. (required) + :type patch_authentication_payload: PatchAuthenticationPayload :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 @@ -1473,8 +3675,11 @@ def list_runner_labels_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._list_runner_labels_serialize( + _param = self._patch_authentication_serialize( project_id=project_id, + instance_id=instance_id, + authentication_id=authentication_id, + patch_authentication_payload=patch_authentication_payload, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1482,18 +3687,21 @@ def list_runner_labels_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - "200": "ListRunnerLabels", + "202": "Authentication", "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", - "404": None, + "401": None, + "404": "GenericErrorResponse", "500": "GenericErrorResponse", } response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) return response_data.response - def _list_runner_labels_serialize( + def _patch_authentication_serialize( self, project_id, + instance_id, + authentication_id, + patch_authentication_payload, _request_auth, _content_type, _headers, @@ -1514,21 +3722,35 @@ def _list_runner_labels_serialize( # process the path parameters if project_id is not None: _path_params["projectId"] = project_id + if instance_id is not None: + _path_params["instanceId"] = instance_id + if authentication_id is not None: + _path_params["authenticationId"] = authentication_id # process the query parameters # process the header parameters # process the form parameters # process the body parameter + if patch_authentication_payload is not None: + _body_params = patch_authentication_payload # set the HTTP header `Accept` if "Accept" not in _header_params: _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type(["application/json"]) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + # authentication setting _auth_settings: List[str] = [] return self.api_client.param_serialize( - method="GET", - resource_path="/v1beta/projects/{projectId}/runner-labels", + method="PATCH", + resource_path="/v1beta/projects/{projectId}/instances/{instanceId}/authentications/{authenticationId}", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1605,7 +3827,7 @@ def patch_instance( "200": "Instance", "202": None, "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", + "401": None, "404": None, "409": None, "500": "GenericErrorResponse", @@ -1681,7 +3903,7 @@ def patch_instance_with_http_info( "200": "Instance", "202": None, "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", + "401": None, "404": None, "409": None, "500": "GenericErrorResponse", @@ -1757,7 +3979,7 @@ def patch_instance_without_preload_content( "200": "Instance", "202": None, "400": "GenericErrorResponse", - "401": "UnauthorizedResponse", + "401": None, "404": None, "409": None, "500": "GenericErrorResponse", diff --git a/services/git/src/stackit/git/models/__init__.py b/services/git/src/stackit/git/models/__init__.py index d8d85ea58..c1b8fab4d 100644 --- a/services/git/src/stackit/git/models/__init__.py +++ b/services/git/src/stackit/git/models/__init__.py @@ -15,18 +15,23 @@ # import models into model package +from stackit.git.models.authentication import Authentication +from stackit.git.models.authentication_list import AuthenticationList +from stackit.git.models.create_authentication_payload import CreateAuthenticationPayload from stackit.git.models.create_instance_payload import CreateInstancePayload +from stackit.git.models.create_runner_payload import CreateRunnerPayload +from stackit.git.models.feature_toggle import FeatureToggle from stackit.git.models.flavor import Flavor +from stackit.git.models.flavors_list import FlavorsList from stackit.git.models.generic_error_response import GenericErrorResponse from stackit.git.models.instance import Instance -from stackit.git.models.instance_flavor import InstanceFlavor +from stackit.git.models.instance_list import InstanceList from stackit.git.models.internal_server_error_response import ( InternalServerErrorResponse, ) -from stackit.git.models.list_flavors import ListFlavors -from stackit.git.models.list_instances import ListInstances -from stackit.git.models.list_runner_labels import ListRunnerLabels +from stackit.git.models.patch_authentication_payload import PatchAuthenticationPayload from stackit.git.models.patch_instance_payload import PatchInstancePayload from stackit.git.models.patch_operation import PatchOperation -from stackit.git.models.runner_label import RunnerLabel -from stackit.git.models.unauthorized_response import UnauthorizedResponse +from stackit.git.models.runner import Runner +from stackit.git.models.runner_runtime import RunnerRuntime +from stackit.git.models.runner_runtime_list import RunnerRuntimeList diff --git a/services/git/src/stackit/git/models/authentication.py b/services/git/src/stackit/git/models/authentication.py new file mode 100644 index 000000000..db19ba118 --- /dev/null +++ b/services/git/src/stackit/git/models/authentication.py @@ -0,0 +1,133 @@ +# coding: utf-8 + +""" + STACKIT Git API + + STACKIT Git management API. + + The version of the OpenAPI document: 1beta.0.4 + Contact: git@stackit.cloud + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from datetime import datetime +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing_extensions import Annotated, Self + + +class Authentication(BaseModel): + """ + Describes an authentication definition associated to a STACKIT Git instance. The provider type will be an openidConnect type. + """ # noqa: E501 + + auto_discover_url: StrictStr = Field( + description="The well-known configuration url to use for this authentication definition." + ) + client_id: StrictStr = Field(description="The IDP client id to use.") + created_at: datetime + icon_url: StrictStr = Field(description="The url of the icon to use for this authentication definition.") + id: Annotated[str, Field(strict=True, max_length=36)] = Field( + description="An auto generated unique uuid which identifies the authentication definition in STACKIT Git instances." + ) + name: Annotated[str, Field(strict=True, max_length=32)] = Field( + description="The name to identify an authentication definition associated with a STACKIT Git instance." + ) + provider: StrictStr = Field(description="The Oauth2 provider to use.") + scopes: StrictStr = Field(description="Scopes defines the OIDC scopes to request.") + status: StrictStr = Field(description="The current status of the authentication definition.") + __properties: ClassVar[List[str]] = [ + "auto_discover_url", + "client_id", + "created_at", + "icon_url", + "id", + "name", + "provider", + "scopes", + "status", + ] + + @field_validator("created_at", mode="before") + def created_at_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Authentication from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Authentication from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "auto_discover_url": obj.get("auto_discover_url"), + "client_id": obj.get("client_id"), + "created_at": obj.get("created_at"), + "icon_url": obj.get("icon_url"), + "id": obj.get("id"), + "name": obj.get("name"), + "provider": obj.get("provider"), + "scopes": obj.get("scopes"), + "status": obj.get("status"), + } + ) + return _obj diff --git a/services/git/src/stackit/git/models/authentication_list.py b/services/git/src/stackit/git/models/authentication_list.py new file mode 100644 index 000000000..4da4670d2 --- /dev/null +++ b/services/git/src/stackit/git/models/authentication_list.py @@ -0,0 +1,99 @@ +# coding: utf-8 + +""" + STACKIT Git API + + STACKIT Git management API. + + The version of the OpenAPI document: 1beta.0.4 + Contact: git@stackit.cloud + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field +from typing_extensions import Annotated, Self + +from stackit.git.models.authentication import Authentication + + +class AuthenticationList(BaseModel): + """ + A list of authentications belonging to an Instance. + """ # noqa: E501 + + authentication: Annotated[List[Authentication], Field(max_length=50)] + __properties: ClassVar[List[str]] = ["authentication"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AuthenticationList from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in authentication (list) + _items = [] + if self.authentication: + for _item in self.authentication: + if _item: + _items.append(_item.to_dict()) + _dict["authentication"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AuthenticationList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "authentication": ( + [Authentication.from_dict(_item) for _item in obj["authentication"]] + if obj.get("authentication") is not None + else None + ) + } + ) + return _obj diff --git a/services/git/src/stackit/git/models/create_authentication_payload.py b/services/git/src/stackit/git/models/create_authentication_payload.py new file mode 100644 index 000000000..b7b0eeae6 --- /dev/null +++ b/services/git/src/stackit/git/models/create_authentication_payload.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + STACKIT Git API + + STACKIT Git management API. + + The version of the OpenAPI document: 1beta.0.4 + Contact: git@stackit.cloud + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing_extensions import Annotated, Self + + +class CreateAuthenticationPayload(BaseModel): + """ + Properties to patch on an authentication. All fields are optional. + """ # noqa: E501 + + auto_discover_url: StrictStr = Field( + description="The well-known configuration url to use for this authentication definition." + ) + client_id: StrictStr = Field(description="The IDP client id to use.") + client_secret: StrictStr = Field(description="The IDP client secret to use.") + icon_url: Optional[StrictStr] = Field( + default=None, description="The url of the icon to use for this authentication definition." + ) + name: Annotated[str, Field(strict=True, max_length=32)] = Field( + description="The name to identify an authentication definition associated with a STACKIT Git instance." + ) + provider: Optional[StrictStr] = Field(default="openidConnect", description="The Oauth2 provider to use.") + scopes: Optional[StrictStr] = Field( + default="openid profile email", description="Scopes defines the OIDC scopes to request." + ) + __properties: ClassVar[List[str]] = [ + "auto_discover_url", + "client_id", + "client_secret", + "icon_url", + "name", + "provider", + "scopes", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CreateAuthenticationPayload from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CreateAuthenticationPayload from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "auto_discover_url": obj.get("auto_discover_url"), + "client_id": obj.get("client_id"), + "client_secret": obj.get("client_secret"), + "icon_url": obj.get("icon_url"), + "name": obj.get("name"), + "provider": obj.get("provider") if obj.get("provider") is not None else "openidConnect", + "scopes": obj.get("scopes") if obj.get("scopes") is not None else "openid profile email", + } + ) + return _obj 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 3fe888e5c..75fa6e001 100644 --- a/services/git/src/stackit/git/models/create_instance_payload.py +++ b/services/git/src/stackit/git/models/create_instance_payload.py @@ -22,8 +22,6 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from typing_extensions import Annotated, Self -from stackit.git.models.instance_flavor import InstanceFlavor - class CreateInstancePayload(BaseModel): """ @@ -33,12 +31,22 @@ class CreateInstancePayload(BaseModel): acl: Optional[Annotated[List[StrictStr], Field(max_length=50)]] = Field( default=None, description="A list of CIDR network addresses that are allowed to access the instance." ) - flavor: Optional[InstanceFlavor] = None + flavor: Optional[StrictStr] = None 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""" diff --git a/services/git/src/stackit/git/models/unauthorized_response.py b/services/git/src/stackit/git/models/create_runner_payload.py similarity index 84% rename from services/git/src/stackit/git/models/unauthorized_response.py rename to services/git/src/stackit/git/models/create_runner_payload.py index 40b83963a..6d3f1d4c7 100644 --- a/services/git/src/stackit/git/models/unauthorized_response.py +++ b/services/git/src/stackit/git/models/create_runner_payload.py @@ -22,13 +22,13 @@ from typing_extensions import Self -class UnauthorizedResponse(BaseModel): +class CreateRunnerPayload(BaseModel): """ - The request could not be authorized. + Request a runner to be created supporting the requested list of runtime labels. """ # noqa: E501 - error: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["error"] + labels: List[StrictStr] + __properties: ClassVar[List[str]] = ["labels"] model_config = ConfigDict( populate_by_name=True, @@ -47,7 +47,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of UnauthorizedResponse from a JSON string""" + """Create an instance of CreateRunnerPayload from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -71,12 +71,12 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of UnauthorizedResponse from a dict""" + """Create an instance of CreateRunnerPayload from a dict""" if obj is None: return None if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_validate({"error": obj.get("error")}) + _obj = cls.model_validate({"labels": obj.get("labels")}) return _obj diff --git a/services/git/src/stackit/git/models/feature_toggle.py b/services/git/src/stackit/git/models/feature_toggle.py new file mode 100644 index 000000000..80987381d --- /dev/null +++ b/services/git/src/stackit/git/models/feature_toggle.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + STACKIT Git API + + STACKIT Git management API. + + The version of the OpenAPI document: 1beta.0.4 + Contact: git@stackit.cloud + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import ( + BaseModel, + ConfigDict, + Field, + StrictBool, + StrictStr, + field_validator, +) +from typing_extensions import Self + + +class FeatureToggle(BaseModel): + """ + Feature toggles for the instance. + """ # noqa: E501 + + default_email_notifications: Optional[StrictStr] = Field(default=None, description="Default email notifications.") + enable_commit_signatures: Optional[StrictBool] = Field(default=None, description="Enable commit signatures.") + enable_local_login: Optional[StrictBool] = Field(default=None, description="Enable local login.") + __properties: ClassVar[List[str]] = [ + "default_email_notifications", + "enable_commit_signatures", + "enable_local_login", + ] + + @field_validator("default_email_notifications") + def default_email_notifications_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(["enabled", "disabled", "onmention", "andyourown"]): + raise ValueError("must be one of enum values ('enabled', 'disabled', 'onmention', 'andyourown')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FeatureToggle from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if default_email_notifications (nullable) is None + # and model_fields_set contains the field + if self.default_email_notifications is None and "default_email_notifications" in self.model_fields_set: + _dict["default_email_notifications"] = None + + # set to None if enable_commit_signatures (nullable) is None + # and model_fields_set contains the field + if self.enable_commit_signatures is None and "enable_commit_signatures" in self.model_fields_set: + _dict["enable_commit_signatures"] = None + + # set to None if enable_local_login (nullable) is None + # and model_fields_set contains the field + if self.enable_local_login is None and "enable_local_login" in self.model_fields_set: + _dict["enable_local_login"] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FeatureToggle from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "default_email_notifications": obj.get("default_email_notifications"), + "enable_commit_signatures": obj.get("enable_commit_signatures"), + "enable_local_login": obj.get("enable_local_login"), + } + ) + return _obj diff --git a/services/git/src/stackit/git/models/list_flavors.py b/services/git/src/stackit/git/models/flavors_list.py similarity index 94% rename from services/git/src/stackit/git/models/list_flavors.py rename to services/git/src/stackit/git/models/flavors_list.py index babb918bd..4a6cc0181 100644 --- a/services/git/src/stackit/git/models/list_flavors.py +++ b/services/git/src/stackit/git/models/flavors_list.py @@ -24,7 +24,7 @@ from stackit.git.models.flavor import Flavor -class ListFlavors(BaseModel): +class FlavorsList(BaseModel): """ A list of STACKIT Git Flavors. """ # noqa: E501 @@ -49,7 +49,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ListFlavors from a JSON string""" + """Create an instance of FlavorsList from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ListFlavors from a dict""" + """Create an instance of FlavorsList from a dict""" if obj is None: return None diff --git a/services/git/src/stackit/git/models/instance.py b/services/git/src/stackit/git/models/instance.py index e665b27a7..899b661f4 100644 --- a/services/git/src/stackit/git/models/instance.py +++ b/services/git/src/stackit/git/models/instance.py @@ -23,6 +23,8 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator from typing_extensions import Annotated, Self +from stackit.git.models.feature_toggle import FeatureToggle + class Instance(BaseModel): """ @@ -33,7 +35,8 @@ class Instance(BaseModel): 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="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") + feature_toggle: FeatureToggle + flavor: StrictStr = Field(description="Instance flavor.") id: Annotated[str, Field(strict=True, max_length=36)] = Field( description="A auto generated unique id which identifies the STACKIT Git instances." ) @@ -54,6 +57,7 @@ class Instance(BaseModel): "consumed_disk", "consumed_object_storage", "created", + "feature_toggle", "flavor", "id", "name", @@ -121,6 +125,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of feature_toggle + if self.feature_toggle: + _dict["feature_toggle"] = self.feature_toggle.to_dict() return _dict @classmethod @@ -138,6 +145,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "consumed_disk": obj.get("consumed_disk"), "consumed_object_storage": obj.get("consumed_object_storage"), "created": obj.get("created"), + "feature_toggle": ( + FeatureToggle.from_dict(obj["feature_toggle"]) if obj.get("feature_toggle") is not None else None + ), "flavor": obj.get("flavor"), "id": obj.get("id"), "name": obj.get("name"), diff --git a/services/git/src/stackit/git/models/instance_flavor.py b/services/git/src/stackit/git/models/instance_flavor.py deleted file mode 100644 index 356c3d42a..000000000 --- a/services/git/src/stackit/git/models/instance_flavor.py +++ /dev/null @@ -1,37 +0,0 @@ -# coding: utf-8 - -""" - STACKIT Git API - - STACKIT Git management API. - - The version of the OpenAPI document: 1beta.0.4 - Contact: git@stackit.cloud - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - -from __future__ import annotations - -import json -from enum import Enum - -from typing_extensions import Self - - -class InstanceFlavor(str, Enum): - """ - Desired instance flavor. Must be one of the defined enum values. - """ - - """ - allowed enum values - """ - GIT_MINUS_10 = "git-10" - GIT_MINUS_100 = "git-100" - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Create an instance of InstanceFlavor from a JSON string""" - return cls(json.loads(json_str)) diff --git a/services/git/src/stackit/git/models/list_instances.py b/services/git/src/stackit/git/models/instance_list.py similarity index 94% rename from services/git/src/stackit/git/models/list_instances.py rename to services/git/src/stackit/git/models/instance_list.py index 2f48730b7..ce54420a7 100644 --- a/services/git/src/stackit/git/models/list_instances.py +++ b/services/git/src/stackit/git/models/instance_list.py @@ -24,7 +24,7 @@ from stackit.git.models.instance import Instance -class ListInstances(BaseModel): +class InstanceList(BaseModel): """ A list of STACKIT Git instances. """ # noqa: E501 @@ -49,7 +49,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ListInstances from a JSON string""" + """Create an instance of InstanceList from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ListInstances from a dict""" + """Create an instance of InstanceList from a dict""" if obj is None: return None diff --git a/services/git/src/stackit/git/models/patch_authentication_payload.py b/services/git/src/stackit/git/models/patch_authentication_payload.py new file mode 100644 index 000000000..d32cc521b --- /dev/null +++ b/services/git/src/stackit/git/models/patch_authentication_payload.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + STACKIT Git API + + STACKIT Git management API. + + The version of the OpenAPI document: 1beta.0.4 + Contact: git@stackit.cloud + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing_extensions import Self + + +class PatchAuthenticationPayload(BaseModel): + """ + Properties to patch on an authentication. All fields are optional. + """ # noqa: E501 + + auto_discover_url: Optional[StrictStr] = Field( + default=None, description="The well-known configuration url to use for this authentication definition." + ) + client_id: Optional[StrictStr] = Field(default=None, description="The IDP client id to use.") + client_secret: Optional[StrictStr] = Field(default=None, description="The IDP client secret to use.") + icon_url: Optional[StrictStr] = Field( + default=None, description="The url of the icon to use for this authentication definition." + ) + provider: Optional[StrictStr] = Field(default=None, description="The Oauth2 provider to use.") + scopes: Optional[StrictStr] = Field(default=None, description="Scopes defines the OIDC scopes to request.") + __properties: ClassVar[List[str]] = [ + "auto_discover_url", + "client_id", + "client_secret", + "icon_url", + "provider", + "scopes", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PatchAuthenticationPayload from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PatchAuthenticationPayload from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "auto_discover_url": obj.get("auto_discover_url"), + "client_id": obj.get("client_id"), + "client_secret": obj.get("client_secret"), + "icon_url": obj.get("icon_url"), + "provider": obj.get("provider"), + "scopes": obj.get("scopes"), + } + ) + return _obj diff --git a/services/git/src/stackit/git/models/patch_instance_payload.py b/services/git/src/stackit/git/models/patch_instance_payload.py index 617766a13..6e2e7c594 100644 --- a/services/git/src/stackit/git/models/patch_instance_payload.py +++ b/services/git/src/stackit/git/models/patch_instance_payload.py @@ -21,6 +21,8 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing_extensions import Annotated, Self +from stackit.git.models.feature_toggle import FeatureToggle + class PatchInstancePayload(BaseModel): """ @@ -30,7 +32,8 @@ class PatchInstancePayload(BaseModel): acl: Optional[Annotated[List[StrictStr], Field(max_length=50)]] = Field( default=None, description="A list of CIDR network addresses that are allowed to access the instance." ) - __properties: ClassVar[List[str]] = ["acl"] + feature_toggle: Optional[FeatureToggle] = None + __properties: ClassVar[List[str]] = ["acl", "feature_toggle"] model_config = ConfigDict( populate_by_name=True, @@ -69,6 +72,9 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of feature_toggle + if self.feature_toggle: + _dict["feature_toggle"] = self.feature_toggle.to_dict() # set to None if acl (nullable) is None # and model_fields_set contains the field if self.acl is None and "acl" in self.model_fields_set: @@ -85,5 +91,12 @@ 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")}) + _obj = cls.model_validate( + { + "acl": obj.get("acl"), + "feature_toggle": ( + FeatureToggle.from_dict(obj["feature_toggle"]) if obj.get("feature_toggle") is not None else None + ), + } + ) return _obj diff --git a/services/git/src/stackit/git/models/runner.py b/services/git/src/stackit/git/models/runner.py new file mode 100644 index 000000000..f6520304b --- /dev/null +++ b/services/git/src/stackit/git/models/runner.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + STACKIT Git API + + STACKIT Git management API. + + The version of the OpenAPI document: 1beta.0.4 + Contact: git@stackit.cloud + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from datetime import datetime +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing_extensions import Annotated, Self + + +class Runner(BaseModel): + """ + Describes a runner associated to a STACKIT Git instance. + """ # noqa: E501 + + created_at: datetime + id: Annotated[str, Field(strict=True, max_length=36)] + labels: List[StrictStr] + status: StrictStr = Field(description="The current status of the runner.") + __properties: ClassVar[List[str]] = ["created_at", "id", "labels", "status"] + + @field_validator("created_at", mode="before") + def created_at_change_year_zero_to_one(cls, value): + """Workaround which prevents year 0 issue""" + if isinstance(value, str): + # Check for year "0000" at the beginning of the string + # This assumes common date formats like YYYY-MM-DDTHH:MM:SS+00:00 or YYYY-MM-DDTHH:MM:SSZ + if value.startswith("0000-01-01T") and re.match( + r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d{2}:\d{2}|Z)$", value + ): + # Workaround: Replace "0000" with "0001" + return "0001" + value[4:] # Take "0001" and append the rest of the string + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Runner from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Runner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "created_at": obj.get("created_at"), + "id": obj.get("id"), + "labels": obj.get("labels"), + "status": obj.get("status"), + } + ) + return _obj diff --git a/services/git/src/stackit/git/models/runner_label.py b/services/git/src/stackit/git/models/runner_runtime.py similarity index 66% rename from services/git/src/stackit/git/models/runner_label.py rename to services/git/src/stackit/git/models/runner_runtime.py index aac476f6b..65c1ef237 100644 --- a/services/git/src/stackit/git/models/runner_label.py +++ b/services/git/src/stackit/git/models/runner_runtime.py @@ -19,18 +19,20 @@ from typing import Any, ClassVar, Dict, List, Optional, Set from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing_extensions import Annotated, Self +from typing_extensions import Self -class RunnerLabel(BaseModel): +class RunnerRuntime(BaseModel): """ - Describes a STACKIT Git RunnerLabel. + Describes a STACKIT Git Runner runtime. """ # noqa: E501 - description: StrictStr = Field(description="RunnerLabel description.") - id: Annotated[str, Field(strict=True, max_length=36)] = Field(description="RunnerLabel id.") - label: Annotated[str, Field(strict=True, max_length=64)] = Field(description="RunnerLabel label.") - __properties: ClassVar[List[str]] = ["description", "id", "label"] + availability: StrictStr = Field(description="Indicates the availability of the runner label") + description: StrictStr = Field(description="Human-friendly description of the runtime and it's capabilities.") + display_name: StrictStr = Field(description="Human-friendly name of the runtime.") + id: StrictStr = Field(description="Runtime identifier.") + label: StrictStr = Field(description="Runtime label.") + __properties: ClassVar[List[str]] = ["availability", "description", "display_name", "id", "label"] model_config = ConfigDict( populate_by_name=True, @@ -49,7 +51,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of RunnerLabel from a JSON string""" + """Create an instance of RunnerRuntime from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -73,7 +75,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of RunnerLabel from a dict""" + """Create an instance of RunnerRuntime from a dict""" if obj is None: return None @@ -81,6 +83,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate( - {"description": obj.get("description"), "id": obj.get("id"), "label": obj.get("label")} + { + "availability": obj.get("availability"), + "description": obj.get("description"), + "display_name": obj.get("display_name"), + "id": obj.get("id"), + "label": obj.get("label"), + } ) return _obj diff --git a/services/git/src/stackit/git/models/list_runner_labels.py b/services/git/src/stackit/git/models/runner_runtime_list.py similarity index 74% rename from services/git/src/stackit/git/models/list_runner_labels.py rename to services/git/src/stackit/git/models/runner_runtime_list.py index 040bc7c66..421d537f9 100644 --- a/services/git/src/stackit/git/models/list_runner_labels.py +++ b/services/git/src/stackit/git/models/runner_runtime_list.py @@ -18,19 +18,19 @@ import pprint from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field +from pydantic import BaseModel, ConfigDict from typing_extensions import Self -from stackit.git.models.runner_label import RunnerLabel +from stackit.git.models.runner_runtime import RunnerRuntime -class ListRunnerLabels(BaseModel): +class RunnerRuntimeList(BaseModel): """ A list of STACKIT Git RunnerLabels. """ # noqa: E501 - runner_labels: List[RunnerLabel] = Field(alias="runner-labels") - __properties: ClassVar[List[str]] = ["runner-labels"] + items: List[RunnerRuntime] + __properties: ClassVar[List[str]] = ["items"] model_config = ConfigDict( populate_by_name=True, @@ -49,7 +49,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ListRunnerLabels from a JSON string""" + """Create an instance of RunnerRuntimeList from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -69,18 +69,18 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of each item in runner_labels (list) + # override the default output from pydantic by calling `to_dict()` of each item in items (list) _items = [] - if self.runner_labels: - for _item in self.runner_labels: + if self.items: + for _item in self.items: if _item: _items.append(_item.to_dict()) - _dict["runner-labels"] = _items + _dict["items"] = _items return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ListRunnerLabels from a dict""" + """Create an instance of RunnerRuntimeList from a dict""" if obj is None: return None @@ -89,10 +89,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate( { - "runner-labels": ( - [RunnerLabel.from_dict(_item) for _item in obj["runner-labels"]] - if obj.get("runner-labels") is not None - else None + "items": ( + [RunnerRuntime.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None ) } )