From a64b60cacc9223ab8713ad8cdb9ee68c9f6bd962 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Fri, 4 Sep 2026 15:04:44 +0000 Subject: [PATCH 1/2] Generate serviceaccount --- services/serviceaccount/oas_commit | 2 +- .../src/stackit/serviceaccount/__init__.py | 10 - .../stackit/serviceaccount/api/default_api.py | 850 +----------------- .../stackit/serviceaccount/models/__init__.py | 7 - .../serviceaccount/models/access_token.py | 135 --- .../models/create_access_token_payload.py | 84 -- .../models/list_access_tokens_response.py | 99 -- 7 files changed, 18 insertions(+), 1169 deletions(-) delete mode 100644 services/serviceaccount/src/stackit/serviceaccount/models/access_token.py delete mode 100644 services/serviceaccount/src/stackit/serviceaccount/models/create_access_token_payload.py delete mode 100644 services/serviceaccount/src/stackit/serviceaccount/models/list_access_tokens_response.py diff --git a/services/serviceaccount/oas_commit b/services/serviceaccount/oas_commit index c08a6770d..5542f81cd 100644 --- a/services/serviceaccount/oas_commit +++ b/services/serviceaccount/oas_commit @@ -1 +1 @@ -4407196dbbef4e53e6798809e856725cbc84ae05 +1ecc5ee263a36af12f8c9314dbed780cabe4deb2 diff --git a/services/serviceaccount/src/stackit/serviceaccount/__init__.py b/services/serviceaccount/src/stackit/serviceaccount/__init__.py index 47991e287..515da944b 100644 --- a/services/serviceaccount/src/stackit/serviceaccount/__init__.py +++ b/services/serviceaccount/src/stackit/serviceaccount/__init__.py @@ -27,11 +27,9 @@ "ApiKeyError", "ApiAttributeError", "ApiException", - "AccessToken", "AccessTokenMetadata", "AuthError", "AuthErrorError", - "CreateAccessTokenPayload", "CreateFederatedIdentityProviderPayload", "CreateFederatedIdentityProviderPayloadAssertionsInner", "CreateServiceAccountKeyPayload", @@ -47,7 +45,6 @@ "GetServiceAccountKeyResponseCredentials", "JWK", "JWKS", - "ListAccessTokensResponse", "ListServiceAccountKeysResponse", "ListServiceAccountsResponse", "PartialUpdateServiceAccountFederatedIdentityProviderPayload", @@ -72,7 +69,6 @@ from stackit.serviceaccount.exceptions import OpenApiException as OpenApiException # import models into sdk package -from stackit.serviceaccount.models.access_token import AccessToken as AccessToken from stackit.serviceaccount.models.access_token_metadata import ( AccessTokenMetadata as AccessTokenMetadata, ) @@ -80,9 +76,6 @@ from stackit.serviceaccount.models.auth_error_error import ( AuthErrorError as AuthErrorError, ) -from stackit.serviceaccount.models.create_access_token_payload import ( - CreateAccessTokenPayload as CreateAccessTokenPayload, -) from stackit.serviceaccount.models.create_federated_identity_provider_payload import ( CreateFederatedIdentityProviderPayload as CreateFederatedIdentityProviderPayload, ) @@ -122,9 +115,6 @@ ) 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 ( - ListAccessTokensResponse as ListAccessTokensResponse, -) from stackit.serviceaccount.models.list_service_account_keys_response import ( ListServiceAccountKeysResponse as ListServiceAccountKeysResponse, ) 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..76d55bcbe 100644 --- a/services/serviceaccount/src/stackit/serviceaccount/models/__init__.py +++ b/services/serviceaccount/src/stackit/serviceaccount/models/__init__.py @@ -13,13 +13,9 @@ """ # noqa: E501 # import models into model package -from stackit.serviceaccount.models.access_token import AccessToken from stackit.serviceaccount.models.access_token_metadata import AccessTokenMetadata from stackit.serviceaccount.models.auth_error import AuthError from stackit.serviceaccount.models.auth_error_error import AuthErrorError -from stackit.serviceaccount.models.create_access_token_payload import ( - CreateAccessTokenPayload, -) from stackit.serviceaccount.models.create_federated_identity_provider_payload import ( CreateFederatedIdentityProviderPayload, ) @@ -59,9 +55,6 @@ ) from stackit.serviceaccount.models.jwk import JWK 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, ) diff --git a/services/serviceaccount/src/stackit/serviceaccount/models/access_token.py b/services/serviceaccount/src/stackit/serviceaccount/models/access_token.py deleted file mode 100644 index 50583c06c..000000000 --- a/services/serviceaccount/src/stackit/serviceaccount/models/access_token.py +++ /dev/null @@ -1,135 +0,0 @@ -# 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 -import re # noqa: F401 -from datetime import datetime -from typing import Any, ClassVar, Dict, List, Optional, Set -from uuid import UUID - -from pydantic import ( - BaseModel, - ConfigDict, - Field, - StrictBool, - StrictStr, - field_validator, -) -from pydantic_core import to_jsonable_python -from typing_extensions import Self - - -class AccessToken(BaseModel): - """ - Contains token metadata and actual token. - """ # noqa: E501 - - active: StrictBool = Field(description="Newly created access tokens are valid, and can be revoked if needed.") - created_at: datetime = Field(description="Creation time of the access token.", alias="createdAt") - id: UUID = Field(description="Unique ID of the access token. Also used as JTI field.") - token: StrictStr = Field( - description="The access token in JWT format. Use this with `Bearer` prefix for API calls. Store it, as it is not recoverable later." - ) - valid_until: datetime = Field( - description="Approximate expiration time of the access token. Check the JWT for actual validity date.", - alias="validUntil", - ) - __properties: ClassVar[List[str]] = ["active", "createdAt", "id", "token", "validUntil"] - - @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 - - @field_validator("valid_until", mode="before") - def valid_until_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( - 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 AccessToken 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 AccessToken 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"), - "createdAt": obj.get("createdAt"), - "id": obj.get("id"), - "token": obj.get("token"), - "validUntil": obj.get("validUntil"), - } - ) - return _obj diff --git a/services/serviceaccount/src/stackit/serviceaccount/models/create_access_token_payload.py b/services/serviceaccount/src/stackit/serviceaccount/models/create_access_token_payload.py deleted file mode 100644 index e39b06eda..000000000 --- a/services/serviceaccount/src/stackit/serviceaccount/models/create_access_token_payload.py +++ /dev/null @@ -1,84 +0,0 @@ -# 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, Field -from pydantic_core import to_jsonable_python -from typing_extensions import Annotated, Self - - -class CreateAccessTokenPayload(BaseModel): - """ - CreateAccessTokenPayload - """ # noqa: E501 - - ttl_days: Annotated[int, Field(le=180, strict=True, ge=1)] = Field( - description="The duration in days for how long the new Access Token should be valid.", alias="ttlDays" - ) - __properties: ClassVar[List[str]] = ["ttlDays"] - - 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 CreateAccessTokenPayload 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 CreateAccessTokenPayload from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({"ttlDays": obj.get("ttlDays")}) - return _obj diff --git a/services/serviceaccount/src/stackit/serviceaccount/models/list_access_tokens_response.py b/services/serviceaccount/src/stackit/serviceaccount/models/list_access_tokens_response.py deleted file mode 100644 index 2cc41cbd1..000000000 --- a/services/serviceaccount/src/stackit/serviceaccount/models/list_access_tokens_response.py +++ /dev/null @@ -1,99 +0,0 @@ -# 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 -from pydantic_core import to_jsonable_python -from typing_extensions import Self - -from stackit.serviceaccount.models.access_token_metadata import AccessTokenMetadata - - -class ListAccessTokensResponse(BaseModel): - """ - ListAccessTokensResponse - """ # noqa: E501 - - items: Optional[List[AccessTokenMetadata]] = None - __properties: ClassVar[List[str]] = ["items"] - - 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 ListAccessTokensResponse 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 items (list) - _items = [] - if self.items: - for _item_items in self.items: - if _item_items: - _items.append(_item_items.to_dict()) - _dict["items"] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ListAccessTokensResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate( - { - "items": ( - [AccessTokenMetadata.from_dict(_item) for _item in obj["items"]] - if obj.get("items") is not None - else None - ) - } - ) - return _obj From e7d387f912f91d2b56953d876bfb772fbbe6dde7 Mon Sep 17 00:00:00 2001 From: Ruben Hoenle Date: Fri, 4 Sep 2026 18:30:54 +0200 Subject: [PATCH 2/2] changelogs --- CHANGELOG.md | 4 ++++ services/serviceaccount/CHANGELOG.md | 4 ++++ services/serviceaccount/pyproject.toml | 2 +- services/serviceaccount/uv.lock | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b9f6d664..cbaa5364d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,10 @@ - `secretsmanager`: - [v0.7.0](services/secretsmanager/CHANGELOG.md#v070) - **Feature:** Add support for managing AppRoles and their secret IDs: new `Approle`, `ApproleList`, `ApproleSecret`, `ApproleSecretList`, `CreateApprolePayload`, `CreateApproleSecretIdPayload`, `UpdateApprolePayload` and `UpdateApproleSecretIdPayload` models, plus new `create_approle`, `get_approle`, `get_approles`, `update_approle`, `delete_approle`, `create_approle_secret_id`, `get_approle_secret_id`, `list_approle_secret_ids`, `update_approle_secret_id` and `delete_approle_secret_id` operations +- `serviceaccount` + - [v0.11.0](services/serviceaccount/CHANGELOG.md#v0110) + - **Breaking change:** Removal of API client methods: `create_access_token`, `delete_access_token`, `list_access_tokens` + - **Breaking change:** Removal of model classes: `AccessToken`, `CreateAccessTokenPayload`, `ListAccessTokensResponse` - `telemetrylink`: - [v0.4.2](services/telemetrylink/CHANGELOG.md#v042) - **Fix:** Corrected an invalid `pyproject.toml` build configuration (`wheel-sources` instead of `wheel.sources`) that caused `import stackit.telemetrylink` to fail with `ModuleNotFoundError` diff --git a/services/serviceaccount/CHANGELOG.md b/services/serviceaccount/CHANGELOG.md index 2f25a75b5..b8a946d52 100644 --- a/services/serviceaccount/CHANGELOG.md +++ b/services/serviceaccount/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.11.0 +- **Breaking change:** Removal of API client methods: `create_access_token`, `delete_access_token`, `list_access_tokens` +- **Breaking change:** Removal of model classes: `AccessToken`, `CreateAccessTokenPayload`, `ListAccessTokensResponse` + ## v0.10.0 - **Chore:** Bump minimum Python version to 3.10 - **Chore:** Update dependencies diff --git a/services/serviceaccount/pyproject.toml b/services/serviceaccount/pyproject.toml index ff9a2cdd9..4c1e364fa 100644 --- a/services/serviceaccount/pyproject.toml +++ b/services/serviceaccount/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "stackit-serviceaccount" -version = "v0.10.0" +version = "v0.11.0" description = "Service Account API" authors = [{ name = "STACKIT Developer Tools", email = "developer-tools@stackit.cloud" }] requires-python = ">=3.10,<4.0" diff --git a/services/serviceaccount/uv.lock b/services/serviceaccount/uv.lock index 4b427726f..3cdcea92a 100644 --- a/services/serviceaccount/uv.lock +++ b/services/serviceaccount/uv.lock @@ -1057,7 +1057,7 @@ dev = [ [[package]] name = "stackit-serviceaccount" -version = "0.10.0" +version = "0.11.0" source = { editable = "." } dependencies = [ { name = "pydantic" },