From eb1abb9e8b9706392725bb9aed9d4037dddd12cb Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Fri, 28 Aug 2026 11:29:05 +0000 Subject: [PATCH] Generate serviceaccount --- services/serviceaccount/oas_commit | 2 +- .../src/stackit/serviceaccount/__init__.py | 8 + .../stackit/serviceaccount/api/default_api.py | 850 +----------------- .../stackit/serviceaccount/models/__init__.py | 2 + .../models/introspect_jwt_payload.py | 83 ++ .../models/introspect_jwt_response.py | 124 +++ 6 files changed, 235 insertions(+), 834 deletions(-) create mode 100644 services/serviceaccount/src/stackit/serviceaccount/models/introspect_jwt_payload.py create mode 100644 services/serviceaccount/src/stackit/serviceaccount/models/introspect_jwt_response.py diff --git a/services/serviceaccount/oas_commit b/services/serviceaccount/oas_commit index c08a6770d..fc3f2e0cd 100644 --- a/services/serviceaccount/oas_commit +++ b/services/serviceaccount/oas_commit @@ -1 +1 @@ -4407196dbbef4e53e6798809e856725cbc84ae05 +3495dec9dec80e7ef859725d8161fdb7940238a6 diff --git a/services/serviceaccount/src/stackit/serviceaccount/__init__.py b/services/serviceaccount/src/stackit/serviceaccount/__init__.py index 47991e287..f3d415018 100644 --- a/services/serviceaccount/src/stackit/serviceaccount/__init__.py +++ b/services/serviceaccount/src/stackit/serviceaccount/__init__.py @@ -45,6 +45,8 @@ "FederatedListFederatedIdentityProvidersResponse", "GetServiceAccountKeyResponse", "GetServiceAccountKeyResponseCredentials", + "IntrospectJWTPayload", + "IntrospectJWTResponse", "JWK", "JWKS", "ListAccessTokensResponse", @@ -120,6 +122,12 @@ from stackit.serviceaccount.models.get_service_account_key_response_credentials import ( GetServiceAccountKeyResponseCredentials as GetServiceAccountKeyResponseCredentials, ) +from stackit.serviceaccount.models.introspect_jwt_payload import ( + IntrospectJWTPayload as IntrospectJWTPayload, +) +from stackit.serviceaccount.models.introspect_jwt_response import ( + IntrospectJWTResponse as IntrospectJWTResponse, +) from stackit.serviceaccount.models.jwk import JWK as JWK from stackit.serviceaccount.models.jwks import JWKS as JWKS from stackit.serviceaccount.models.list_access_tokens_response import ( diff --git a/services/serviceaccount/src/stackit/serviceaccount/api/default_api.py b/services/serviceaccount/src/stackit/serviceaccount/api/default_api.py index ce8207bfd..b0cae048d 100644 --- a/services/serviceaccount/src/stackit/serviceaccount/api/default_api.py +++ b/services/serviceaccount/src/stackit/serviceaccount/api/default_api.py @@ -26,10 +26,6 @@ from stackit.serviceaccount.api_client import ApiClient, RequestSerialized from stackit.serviceaccount.api_response import ApiResponse -from stackit.serviceaccount.models.access_token import AccessToken -from stackit.serviceaccount.models.create_access_token_payload import ( - CreateAccessTokenPayload, -) from stackit.serviceaccount.models.create_federated_identity_provider_payload import ( CreateFederatedIdentityProviderPayload, ) @@ -55,9 +51,6 @@ GetServiceAccountKeyResponse, ) from stackit.serviceaccount.models.jwks import JWKS -from stackit.serviceaccount.models.list_access_tokens_response import ( - ListAccessTokensResponse, -) from stackit.serviceaccount.models.list_service_account_keys_response import ( ListServiceAccountKeysResponse, ) @@ -90,291 +83,6 @@ def __init__(self, configuration: Configuration = None) -> None: self.configuration = configuration self.api_client = ApiClient(self.configuration) - @validate_call - def create_access_token( - self, - project_id: Annotated[StrictStr, Field(description="The ID of the project.")], - service_account_email: Annotated[StrictStr, Field(description="The email of the Service Account.")], - create_access_token_payload: Annotated[ - Optional[CreateAccessTokenPayload], - Field(description="Token request. Optional. If not specified the access token will be valid for 90days."), - ] = None, - _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, - ) -> AccessToken: - """Create a new Access Token - - Create an Access Token for a Service Account. The service token can be then used for API calls. Save the response token, as it is not recoverable later. Token metadata can be requested until the token is not expired. A token cannot be created using another token from the same service account. Consider using service account keys instead as a more secure and automation friendly solution. - - :param project_id: The ID of the project. (required) - :type project_id: str - :param service_account_email: The email of the Service Account. (required) - :type service_account_email: str - :param create_access_token_payload: Token request. Optional. If not specified the access token will be valid for 90days. - :type create_access_token_payload: CreateAccessTokenPayload - :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_access_token_serialize( - project_id=project_id, - service_account_email=service_account_email, - create_access_token_payload=create_access_token_payload, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "201": "AccessToken", - "400": "Error", - "401": "AuthError", - "403": "Error", - "404": "Error", - } - 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_access_token_with_http_info( - self, - project_id: Annotated[StrictStr, Field(description="The ID of the project.")], - service_account_email: Annotated[StrictStr, Field(description="The email of the Service Account.")], - create_access_token_payload: Annotated[ - Optional[CreateAccessTokenPayload], - Field(description="Token request. Optional. If not specified the access token will be valid for 90days."), - ] = None, - _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[AccessToken]: - """Create a new Access Token - - Create an Access Token for a Service Account. The service token can be then used for API calls. Save the response token, as it is not recoverable later. Token metadata can be requested until the token is not expired. A token cannot be created using another token from the same service account. Consider using service account keys instead as a more secure and automation friendly solution. - - :param project_id: The ID of the project. (required) - :type project_id: str - :param service_account_email: The email of the Service Account. (required) - :type service_account_email: str - :param create_access_token_payload: Token request. Optional. If not specified the access token will be valid for 90days. - :type create_access_token_payload: CreateAccessTokenPayload - :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_access_token_serialize( - project_id=project_id, - service_account_email=service_account_email, - create_access_token_payload=create_access_token_payload, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "201": "AccessToken", - "400": "Error", - "401": "AuthError", - "403": "Error", - "404": "Error", - } - 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_access_token_without_preload_content( - self, - project_id: Annotated[StrictStr, Field(description="The ID of the project.")], - service_account_email: Annotated[StrictStr, Field(description="The email of the Service Account.")], - create_access_token_payload: Annotated[ - Optional[CreateAccessTokenPayload], - Field(description="Token request. Optional. If not specified the access token will be valid for 90days."), - ] = None, - _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 a new Access Token - - Create an Access Token for a Service Account. The service token can be then used for API calls. Save the response token, as it is not recoverable later. Token metadata can be requested until the token is not expired. A token cannot be created using another token from the same service account. Consider using service account keys instead as a more secure and automation friendly solution. - - :param project_id: The ID of the project. (required) - :type project_id: str - :param service_account_email: The email of the Service Account. (required) - :type service_account_email: str - :param create_access_token_payload: Token request. Optional. If not specified the access token will be valid for 90days. - :type create_access_token_payload: CreateAccessTokenPayload - :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_access_token_serialize( - project_id=project_id, - service_account_email=service_account_email, - create_access_token_payload=create_access_token_payload, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "201": "AccessToken", - "400": "Error", - "401": "AuthError", - "403": "Error", - "404": "Error", - } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) - return response_data.response - - def _create_access_token_serialize( - self, - project_id, - service_account_email, - create_access_token_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 service_account_email is not None: - _path_params["serviceAccountEmail"] = service_account_email - # process the query parameters - # process the header parameters - # process the form parameters - # process the body parameter - if create_access_token_payload is not None: - _body_params = create_access_token_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="/v2/projects/{projectId}/service-accounts/{serviceAccountEmail}/access-tokens", - 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_federated_identity_provider( self, @@ -1464,286 +1172,7 @@ def _create_short_lived_access_token_serialize( self, grant_type, assertion, - refresh_token, - _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 - # process the query parameters - # process the header parameters - # process the form parameters - if assertion is not None: - _form_params.append(("assertion", assertion)) - if grant_type is not None: - _form_params.append(("grant_type", grant_type)) - if refresh_token is not None: - _form_params.append(("refresh_token", refresh_token)) - # 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"]) - - # 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/x-www-form-urlencoded"]) - 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="/token", - 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_access_token( - self, - project_id: Annotated[StrictStr, Field(description="The ID of the project.")], - service_account_email: Annotated[StrictStr, Field(description="The ID of the Service Account.")], - access_token_id: Annotated[UUID, Field(description="The ID of the Access Token.")], - _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: - """Revoke Access Token - - Revoke an Access Token. The access token is instantly revoked, any following calls with the token will be unauthorized. The token metadata is still stored until the expiration time. - - :param project_id: The ID of the project. (required) - :type project_id: str - :param service_account_email: The ID of the Service Account. (required) - :type service_account_email: str - :param access_token_id: The ID of the Access Token. (required) - :type access_token_id: UUID - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (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_access_token_serialize( - project_id=project_id, - service_account_email=service_account_email, - access_token_id=access_token_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": None, - "400": "Error", - "401": "AuthError", - "403": "Error", - "404": "Error", - "409": "Error", - } - 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_access_token_with_http_info( - self, - project_id: Annotated[StrictStr, Field(description="The ID of the project.")], - service_account_email: Annotated[StrictStr, Field(description="The ID of the Service Account.")], - access_token_id: Annotated[UUID, Field(description="The ID of the Access Token.")], - _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]: - """Revoke Access Token - - Revoke an Access Token. The access token is instantly revoked, any following calls with the token will be unauthorized. The token metadata is still stored until the expiration time. - - :param project_id: The ID of the project. (required) - :type project_id: str - :param service_account_email: The ID of the Service Account. (required) - :type service_account_email: str - :param access_token_id: The ID of the Access Token. (required) - :type access_token_id: UUID - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (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_access_token_serialize( - project_id=project_id, - service_account_email=service_account_email, - access_token_id=access_token_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": None, - "400": "Error", - "401": "AuthError", - "403": "Error", - "404": "Error", - "409": "Error", - } - 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_access_token_without_preload_content( - self, - project_id: Annotated[StrictStr, Field(description="The ID of the project.")], - service_account_email: Annotated[StrictStr, Field(description="The ID of the Service Account.")], - access_token_id: Annotated[UUID, Field(description="The ID of the Access Token.")], - _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: - """Revoke Access Token - - Revoke an Access Token. The access token is instantly revoked, any following calls with the token will be unauthorized. The token metadata is still stored until the expiration time. - - :param project_id: The ID of the project. (required) - :type project_id: str - :param service_account_email: The ID of the Service Account. (required) - :type service_account_email: str - :param access_token_id: The ID of the Access Token. (required) - :type access_token_id: UUID - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (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_access_token_serialize( - project_id=project_id, - service_account_email=service_account_email, - access_token_id=access_token_id, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": None, - "400": "Error", - "401": "AuthError", - "403": "Error", - "404": "Error", - "409": "Error", - } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) - return response_data.response - - def _delete_access_token_serialize( - self, - project_id, - service_account_email, - access_token_id, + refresh_token, _request_auth, _content_type, _headers, @@ -1762,27 +1191,35 @@ def _delete_access_token_serialize( _body_params: Optional[bytes] = None # process the path parameters - if project_id is not None: - _path_params["projectId"] = project_id - if service_account_email is not None: - _path_params["serviceAccountEmail"] = service_account_email - if access_token_id is not None: - _path_params["accessTokenId"] = access_token_id # process the query parameters # process the header parameters # process the form parameters + if assertion is not None: + _form_params.append(("assertion", assertion)) + if grant_type is not None: + _form_params.append(("grant_type", grant_type)) + if refresh_token is not None: + _form_params.append(("refresh_token", refresh_token)) # 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"]) + # 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/x-www-form-urlencoded"]) + 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="DELETE", - resource_path="/v2/projects/{projectId}/service-accounts/{serviceAccountEmail}/access-tokens/{accessTokenId}", + method="POST", + resource_path="/token", path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3360,259 +2797,6 @@ def _get_service_account_key_serialize( _request_auth=_request_auth, ) - @validate_call - def list_access_tokens( - self, - project_id: Annotated[StrictStr, Field(description="The ID of the project.")], - service_account_email: Annotated[StrictStr, Field(description="The email of the Service Account.")], - _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, - ) -> ListAccessTokensResponse: - """List Access Tokens of Service Account - - Get all Access Tokens of a Service Account. The token itself is not returned, only the metadata about the access tokens. Access tokens are listed until they are expired. Revoked tokens are returned until expired. - - :param project_id: The ID of the project. (required) - :type project_id: str - :param service_account_email: The email of the Service Account. (required) - :type service_account_email: 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._list_access_tokens_serialize( - project_id=project_id, - service_account_email=service_account_email, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "ListAccessTokensResponse", - "400": "Error", - "401": "AuthError", - "403": "Error", - "404": "Error", - } - 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 list_access_tokens_with_http_info( - self, - project_id: Annotated[StrictStr, Field(description="The ID of the project.")], - service_account_email: Annotated[StrictStr, Field(description="The email of the Service Account.")], - _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[ListAccessTokensResponse]: - """List Access Tokens of Service Account - - Get all Access Tokens of a Service Account. The token itself is not returned, only the metadata about the access tokens. Access tokens are listed until they are expired. Revoked tokens are returned until expired. - - :param project_id: The ID of the project. (required) - :type project_id: str - :param service_account_email: The email of the Service Account. (required) - :type service_account_email: 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._list_access_tokens_serialize( - project_id=project_id, - service_account_email=service_account_email, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "ListAccessTokensResponse", - "400": "Error", - "401": "AuthError", - "403": "Error", - "404": "Error", - } - 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 list_access_tokens_without_preload_content( - self, - project_id: Annotated[StrictStr, Field(description="The ID of the project.")], - service_account_email: Annotated[StrictStr, Field(description="The email of the Service Account.")], - _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: - """List Access Tokens of Service Account - - Get all Access Tokens of a Service Account. The token itself is not returned, only the metadata about the access tokens. Access tokens are listed until they are expired. Revoked tokens are returned until expired. - - :param project_id: The ID of the project. (required) - :type project_id: str - :param service_account_email: The email of the Service Account. (required) - :type service_account_email: 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._list_access_tokens_serialize( - project_id=project_id, - service_account_email=service_account_email, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index, - ) - - _response_types_map: Dict[str, Optional[str]] = { - "200": "ListAccessTokensResponse", - "400": "Error", - "401": "AuthError", - "403": "Error", - "404": "Error", - } - response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout) - return response_data.response - - def _list_access_tokens_serialize( - self, - project_id, - service_account_email, - _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 service_account_email is not None: - _path_params["serviceAccountEmail"] = service_account_email - # 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="/v2/projects/{projectId}/service-accounts/{serviceAccountEmail}/access-tokens", - 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 list_federated_identity_providers( self, diff --git a/services/serviceaccount/src/stackit/serviceaccount/models/__init__.py b/services/serviceaccount/src/stackit/serviceaccount/models/__init__.py index 9d3c86b2f..2ed481d68 100644 --- a/services/serviceaccount/src/stackit/serviceaccount/models/__init__.py +++ b/services/serviceaccount/src/stackit/serviceaccount/models/__init__.py @@ -57,6 +57,8 @@ from stackit.serviceaccount.models.get_service_account_key_response_credentials import ( GetServiceAccountKeyResponseCredentials, ) +from stackit.serviceaccount.models.introspect_jwt_payload import IntrospectJWTPayload +from stackit.serviceaccount.models.introspect_jwt_response import IntrospectJWTResponse from stackit.serviceaccount.models.jwk import JWK from stackit.serviceaccount.models.jwks import JWKS from stackit.serviceaccount.models.list_access_tokens_response import ( diff --git a/services/serviceaccount/src/stackit/serviceaccount/models/introspect_jwt_payload.py b/services/serviceaccount/src/stackit/serviceaccount/models/introspect_jwt_payload.py new file mode 100644 index 000000000..42923fe46 --- /dev/null +++ b/services/serviceaccount/src/stackit/serviceaccount/models/introspect_jwt_payload.py @@ -0,0 +1,83 @@ +# coding: utf-8 + +""" +STACKIT Service Account API + +API to manage Service Accounts and their Access Tokens. ### System for Cross-domain Identity Management (SCIM) Service Account Service offers SCIM APIs to query state. The SCIM protocol was created as standard for automating the exchange of user identity information between identity domains, or IT systems. Service accounts are be handled as indentites similar to SCIM users. A custom SCIM schema has been created: `/ServiceAccounts` #### Syntax ##### Attribute operators | OPERATOR | DESCRIPTION | |----------|--------------------------| | eq | equal | | ne | not equal | | co | contains | | sw | starts with | | ew | ends with | ##### Logical operators | OPERATOR | DESCRIPTION | |----------|--------------------------| | and | logical \"and\" | | or | logical \"or\" | ##### Grouping operators | OPERATOR | DESCRIPTION | |----------|--------------------------| | () | precending grouping | ##### Example ``` filter=email eq \"my-service-account-aBc2defg@sa.stackit.cloud\" filter=email ne \"my-service-account-aBc2defg@sa.stackit.cloud\" filter=email co \"my-service-account\" filter=name sw \"my\" filter=name ew \"account\" filter=email co \"my-service-account\" and name sw \"my\" filter=email co \"my-service-account\" and (name sw \"my\" or name ew \"account\") ``` #### Sorting > Sorting is optional | PARAMETER | DESCRIPTION | |-----------|--------------------------------------| | sortBy | attribute response is ordered by | | sortOrder | 'ASCENDING' (default) or 'DESCENDING'| #### Pagination | PARAMETER | DESCRIPTION | |--------------|----------------------------------------------| | startIndex | index of first query result, default: 1 | | count | maximum number of query results, default: 100| + +The version of the OpenAPI document: 2.0 +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic_core import to_jsonable_python +from typing_extensions import Self + + +class IntrospectJWTPayload(BaseModel): + """ + IntrospectJWTPayload + """ # noqa: E501 + + token: StrictStr + token_type_hint: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["token", "token_type_hint"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of IntrospectJWTPayload 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 IntrospectJWTPayload from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"token": obj.get("token"), "token_type_hint": obj.get("token_type_hint")}) + return _obj diff --git a/services/serviceaccount/src/stackit/serviceaccount/models/introspect_jwt_response.py b/services/serviceaccount/src/stackit/serviceaccount/models/introspect_jwt_response.py new file mode 100644 index 000000000..54c2927da --- /dev/null +++ b/services/serviceaccount/src/stackit/serviceaccount/models/introspect_jwt_response.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" +STACKIT Service Account API + +API to manage Service Accounts and their Access Tokens. ### System for Cross-domain Identity Management (SCIM) Service Account Service offers SCIM APIs to query state. The SCIM protocol was created as standard for automating the exchange of user identity information between identity domains, or IT systems. Service accounts are be handled as indentites similar to SCIM users. A custom SCIM schema has been created: `/ServiceAccounts` #### Syntax ##### Attribute operators | OPERATOR | DESCRIPTION | |----------|--------------------------| | eq | equal | | ne | not equal | | co | contains | | sw | starts with | | ew | ends with | ##### Logical operators | OPERATOR | DESCRIPTION | |----------|--------------------------| | and | logical \"and\" | | or | logical \"or\" | ##### Grouping operators | OPERATOR | DESCRIPTION | |----------|--------------------------| | () | precending grouping | ##### Example ``` filter=email eq \"my-service-account-aBc2defg@sa.stackit.cloud\" filter=email ne \"my-service-account-aBc2defg@sa.stackit.cloud\" filter=email co \"my-service-account\" filter=name sw \"my\" filter=name ew \"account\" filter=email co \"my-service-account\" and name sw \"my\" filter=email co \"my-service-account\" and (name sw \"my\" or name ew \"account\") ``` #### Sorting > Sorting is optional | PARAMETER | DESCRIPTION | |-----------|--------------------------------------| | sortBy | attribute response is ordered by | | sortOrder | 'ASCENDING' (default) or 'DESCENDING'| #### Pagination | PARAMETER | DESCRIPTION | |--------------|----------------------------------------------| | startIndex | index of first query result, default: 1 | | count | maximum number of query results, default: 100| + +The version of the OpenAPI document: 2.0 +Generated by OpenAPI Generator (https://openapi-generator.tech) + +Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations + +import json +import pprint +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import ( + BaseModel, + ConfigDict, + StrictBool, + StrictInt, + StrictStr, +) +from pydantic_core import to_jsonable_python +from typing_extensions import Self + + +class IntrospectJWTResponse(BaseModel): + """ + IntrospectJWTResponse + """ # noqa: E501 + + active: StrictBool + aud: Optional[List[StrictStr]] = None + client_id: Optional[StrictStr] = None + exp: Optional[StrictInt] = None + iat: Optional[StrictInt] = None + iss: Optional[StrictStr] = None + jti: Optional[StrictStr] = None + scope: Optional[StrictStr] = None + sub: Optional[StrictStr] = None + token_type: Optional[StrictStr] = None + username: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = [ + "active", + "aud", + "client_id", + "exp", + "iat", + "iss", + "jti", + "scope", + "sub", + "token_type", + "username", + ] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of IntrospectJWTResponse 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 IntrospectJWTResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "active": obj.get("active"), + "aud": obj.get("aud"), + "client_id": obj.get("client_id"), + "exp": obj.get("exp"), + "iat": obj.get("iat"), + "iss": obj.get("iss"), + "jti": obj.get("jti"), + "scope": obj.get("scope"), + "sub": obj.get("sub"), + "token_type": obj.get("token_type"), + "username": obj.get("username"), + } + ) + return _obj