From e0ac6d0c53cbb6c6a5ba788cdb0d8d158c8767a3 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Fri, 28 Aug 2026 11:30:23 +0000 Subject: [PATCH] Generate serviceaccount --- services/serviceaccount/api_default.go | 653 +--------------- .../model_introspect_jwt_payload.go | 207 +++++ .../model_introspect_jwt_payload_test.go | 11 + .../model_introspect_jwt_response.go | 729 ++++++++++++++++++ .../model_introspect_jwt_response_test.go | 11 + services/serviceaccount/oas_commit | 2 +- services/serviceaccount/v2api/api_default.go | 545 ------------- .../serviceaccount/v2api/api_default_mock.go | 63 -- .../v2api/model_introspect_jwt_payload.go | 203 +++++ .../v2api/model_introspect_jwt_response.go | 536 +++++++++++++ 10 files changed, 1716 insertions(+), 1244 deletions(-) create mode 100644 services/serviceaccount/model_introspect_jwt_payload.go create mode 100644 services/serviceaccount/model_introspect_jwt_payload_test.go create mode 100644 services/serviceaccount/model_introspect_jwt_response.go create mode 100644 services/serviceaccount/model_introspect_jwt_response_test.go create mode 100644 services/serviceaccount/v2api/model_introspect_jwt_payload.go create mode 100644 services/serviceaccount/v2api/model_introspect_jwt_response.go diff --git a/services/serviceaccount/api_default.go b/services/serviceaccount/api_default.go index 06c3bbdd6..90c4a4e75 100644 --- a/services/serviceaccount/api_default.go +++ b/services/serviceaccount/api_default.go @@ -26,29 +26,6 @@ import ( // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DefaultApi interface { - /* - CreateAccessToken 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 ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The email of the Service Account. - @return ApiCreateAccessTokenRequest - - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead - */ - CreateAccessToken(ctx context.Context, projectId string, serviceAccountEmail string) ApiCreateAccessTokenRequest - /* - CreateAccessTokenExecute executes the request - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The email of the Service Account. - @return AccessToken - - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead - */ - CreateAccessTokenExecute(ctx context.Context, projectId string, serviceAccountEmail string) (*AccessToken, error) /* CreateFederatedIdentityProvider Create a new Federated Identity Provider Federate the service account with an identity provider. @@ -136,25 +113,6 @@ type DefaultApi interface { // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ CreateShortLivedAccessTokenExecute(ctx context.Context) (*CreateShortLivedAccessTokenResponse, error) - /* - DeleteAccessToken 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 ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The ID of the Service Account. - @param accessTokenId The ID of the Access Token. - @return ApiDeleteAccessTokenRequest - - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead - */ - DeleteAccessToken(ctx context.Context, projectId string, serviceAccountEmail string, accessTokenId string) ApiDeleteAccessTokenRequest - /* - DeleteAccessTokenExecute executes the request - - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead - */ - DeleteAccessTokenExecute(ctx context.Context, projectId string, serviceAccountEmail string, accessTokenId string) error /* DeleteServiceAccount Delete Service Account Delete a Service Account. @@ -282,29 +240,6 @@ type DefaultApi interface { // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ GetServiceAccountKeyExecute(ctx context.Context, projectId string, serviceAccountEmail string, keyId string) (*GetServiceAccountKeyResponse, error) - /* - ListAccessTokens 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 ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The email of the Service Account. - @return ApiListAccessTokensRequest - - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead - */ - ListAccessTokens(ctx context.Context, projectId string, serviceAccountEmail string) ApiListAccessTokensRequest - /* - ListAccessTokensExecute executes the request - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The email of the Service Account. - @return ListAccessTokensResponse - - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead - */ - ListAccessTokensExecute(ctx context.Context, projectId string, serviceAccountEmail string) (*ListAccessTokensResponse, error) /* ListFederatedIdentityProviders List all federated identity providers List all the identity providers the service account is federated with. @@ -424,15 +359,6 @@ type DefaultApi interface { PartialUpdateServiceAccountKeyExecute(ctx context.Context, projectId string, serviceAccountEmail string, keyId string) (*PartialUpdateServiceAccountKeyResponse, error) } -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type ApiCreateAccessTokenRequest interface { - // Token request. Optional. If not specified the access token will be valid for 90days. - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead - CreateAccessTokenPayload(createAccessTokenPayload CreateAccessTokenPayload) ApiCreateAccessTokenRequest - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead - Execute() (*AccessToken, error) -} - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiCreateFederatedIdentityProviderRequest interface { // Federated identity provider request @@ -475,12 +401,6 @@ type ApiCreateShortLivedAccessTokenRequest interface { Execute() (*CreateShortLivedAccessTokenResponse, error) } -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type ApiDeleteAccessTokenRequest interface { - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead - Execute() error -} - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiDeleteServiceAccountRequest interface { // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @@ -520,12 +440,6 @@ type ApiGetServiceAccountKeyRequest interface { Execute() (*GetServiceAccountKeyResponse, error) } -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type ApiListAccessTokensRequest interface { - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead - Execute() (*ListAccessTokensResponse, error) -} - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiListFederatedIdentityProvidersRequest interface { // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @@ -566,188 +480,6 @@ type ApiPartialUpdateServiceAccountKeyRequest interface { // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DefaultApiService service -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type CreateAccessTokenRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serviceAccountEmail string - createAccessTokenPayload *CreateAccessTokenPayload -} - -// Token request. Optional. If not specified the access token will be valid for 90days. -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (r CreateAccessTokenRequest) CreateAccessTokenPayload(createAccessTokenPayload CreateAccessTokenPayload) ApiCreateAccessTokenRequest { - r.createAccessTokenPayload = &createAccessTokenPayload - return r -} - -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (r CreateAccessTokenRequest) Execute() (*AccessToken, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *AccessToken - ) - a := r.apiService - client, ok := a.client.(*APIClient) - if !ok { - return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") - } - localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateAccessToken") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v2/projects/{projectId}/service-accounts/{serviceAccountEmail}/access-tokens" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountEmail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountEmail, "serviceAccountEmail")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.createAccessTokenPayload - req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, err - } - - contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) - if ok { - *contextHTTPRequest = req - } - - localVarHTTPResponse, err := client.callAPI(req) - contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) - if ok { - *contextHTTPResponse = localVarHTTPResponse - } - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v Error - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v AuthError - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v Error - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v Error - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - } - return localVarReturnValue, newErr - } - - err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, newErr - } - - return localVarReturnValue, nil -} - -/* -CreateAccessToken: Create a new Access Token - -Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The email of the Service Account. - @return ApiCreateAccessTokenRequest -*/ -func (a *APIClient) CreateAccessToken(ctx context.Context, projectId string, serviceAccountEmail string) ApiCreateAccessTokenRequest { - return CreateAccessTokenRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serviceAccountEmail: serviceAccountEmail, - } -} - -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (a *APIClient) CreateAccessTokenExecute(ctx context.Context, projectId string, serviceAccountEmail string) (*AccessToken, error) { - r := CreateAccessTokenRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serviceAccountEmail: serviceAccountEmail, - } - return r.Execute() -} - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateFederatedIdentityProviderRequest struct { ctx context.Context @@ -1475,16 +1207,15 @@ func (a *APIClient) CreateShortLivedAccessTokenExecute(ctx context.Context) (*Cr } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type DeleteAccessTokenRequest struct { +type DeleteServiceAccountRequest struct { ctx context.Context apiService *DefaultApiService projectId string serviceAccountEmail string - accessTokenId string } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (r DeleteAccessTokenRequest) Execute() error { +func (r DeleteServiceAccountRequest) Execute() error { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} @@ -1495,15 +1226,14 @@ func (r DeleteAccessTokenRequest) Execute() error { if !ok { return fmt.Errorf("could not parse client to type APIClient") } - localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAccessToken") + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteServiceAccount") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v2/projects/{projectId}/service-accounts/{serviceAccountEmail}/access-tokens/{accessTokenId}" + localVarPath := localBasePath + "/v2/projects/{projectId}/service-accounts/{serviceAccountEmail}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountEmail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountEmail, "serviceAccountEmail")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"accessTokenId"+"}", url.PathEscape(ParameterValueToString(r.accessTokenId, "accessTokenId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1600,17 +1330,6 @@ func (r DeleteAccessTokenRequest) Execute() error { } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return newErr - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v } return newErr } @@ -1619,48 +1338,46 @@ func (r DeleteAccessTokenRequest) Execute() error { } /* -DeleteAccessToken: Revoke Access Token +DeleteServiceAccount: Delete Service Account Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The ID of the project. - @param serviceAccountEmail The ID of the Service Account. - @param accessTokenId The ID of the Access Token. - @return ApiDeleteAccessTokenRequest + @param serviceAccountEmail The email of the Service Account. + @return ApiDeleteServiceAccountRequest */ -func (a *APIClient) DeleteAccessToken(ctx context.Context, projectId string, serviceAccountEmail string, accessTokenId string) ApiDeleteAccessTokenRequest { - return DeleteAccessTokenRequest{ +func (a *APIClient) DeleteServiceAccount(ctx context.Context, projectId string, serviceAccountEmail string) ApiDeleteServiceAccountRequest { + return DeleteServiceAccountRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serviceAccountEmail: serviceAccountEmail, - accessTokenId: accessTokenId, } } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (a *APIClient) DeleteAccessTokenExecute(ctx context.Context, projectId string, serviceAccountEmail string, accessTokenId string) error { - r := DeleteAccessTokenRequest{ +func (a *APIClient) DeleteServiceAccountExecute(ctx context.Context, projectId string, serviceAccountEmail string) error { + r := DeleteServiceAccountRequest{ apiService: a.defaultApi, ctx: ctx, projectId: projectId, serviceAccountEmail: serviceAccountEmail, - accessTokenId: accessTokenId, } return r.Execute() } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type DeleteServiceAccountRequest struct { +type DeleteServiceAccountKeyRequest struct { ctx context.Context apiService *DefaultApiService projectId string serviceAccountEmail string + keyId string } // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (r DeleteServiceAccountRequest) Execute() error { +func (r DeleteServiceAccountKeyRequest) Execute() error { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} @@ -1671,14 +1388,15 @@ func (r DeleteServiceAccountRequest) Execute() error { if !ok { return fmt.Errorf("could not parse client to type APIClient") } - localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteServiceAccount") + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteServiceAccountKey") if err != nil { return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v2/projects/{projectId}/service-accounts/{serviceAccountEmail}" + localVarPath := localBasePath + "/v2/projects/{projectId}/service-accounts/{serviceAccountEmail}/keys/{keyId}" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountEmail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountEmail, "serviceAccountEmail")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1756,170 +1474,7 @@ func (r DeleteServiceAccountRequest) Execute() error { return newErr } if localVarHTTPResponse.StatusCode == 403 { - var v Error - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v Error - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - } - return newErr - } - - return nil -} - -/* -DeleteServiceAccount: Delete Service Account - -Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The email of the Service Account. - @return ApiDeleteServiceAccountRequest -*/ -func (a *APIClient) DeleteServiceAccount(ctx context.Context, projectId string, serviceAccountEmail string) ApiDeleteServiceAccountRequest { - return DeleteServiceAccountRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serviceAccountEmail: serviceAccountEmail, - } -} - -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (a *APIClient) DeleteServiceAccountExecute(ctx context.Context, projectId string, serviceAccountEmail string) error { - r := DeleteServiceAccountRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serviceAccountEmail: serviceAccountEmail, - } - return r.Execute() -} - -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type DeleteServiceAccountKeyRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serviceAccountEmail string - keyId string -} - -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (r DeleteServiceAccountKeyRequest) Execute() error { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - ) - a := r.apiService - client, ok := a.client.(*APIClient) - if !ok { - return fmt.Errorf("could not parse client to type APIClient") - } - localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteServiceAccountKey") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v2/projects/{projectId}/service-accounts/{serviceAccountEmail}/keys/{keyId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountEmail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountEmail, "serviceAccountEmail")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(ParameterValueToString(r.keyId, "keyId")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return err - } - - contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) - if ok { - *contextHTTPRequest = req - } - - localVarHTTPResponse, err := client.callAPI(req) - contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) - if ok { - *contextHTTPResponse = localVarHTTPResponse - } - if err != nil || localVarHTTPResponse == nil { - return err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v Error - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v AuthError - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v AuthError + var v AuthError err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() @@ -2622,178 +2177,6 @@ func (a *APIClient) GetServiceAccountKeyExecute(ctx context.Context, projectId s return r.Execute() } -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -type ListAccessTokensRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - serviceAccountEmail string -} - -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (r ListAccessTokensRequest) Execute() (*ListAccessTokensResponse, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ListAccessTokensResponse - ) - a := r.apiService - client, ok := a.client.(*APIClient) - if !ok { - return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") - } - localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAccessTokens") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v2/projects/{projectId}/service-accounts/{serviceAccountEmail}/access-tokens" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountEmail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountEmail, "serviceAccountEmail")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, err - } - - contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) - if ok { - *contextHTTPRequest = req - } - - localVarHTTPResponse, err := client.callAPI(req) - contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) - if ok { - *contextHTTPResponse = localVarHTTPResponse - } - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - } - if localVarHTTPResponse.StatusCode == 400 { - var v Error - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v AuthError - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v Error - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v Error - err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - } - return localVarReturnValue, newErr - } - - err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, newErr - } - - return localVarReturnValue, nil -} - -/* -ListAccessTokens: List Access Tokens of Service Account - -Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The email of the Service Account. - @return ApiListAccessTokensRequest -*/ -func (a *APIClient) ListAccessTokens(ctx context.Context, projectId string, serviceAccountEmail string) ApiListAccessTokensRequest { - return ListAccessTokensRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serviceAccountEmail: serviceAccountEmail, - } -} - -// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead -func (a *APIClient) ListAccessTokensExecute(ctx context.Context, projectId string, serviceAccountEmail string) (*ListAccessTokensResponse, error) { - r := ListAccessTokensRequest{ - apiService: a.defaultApi, - ctx: ctx, - projectId: projectId, - serviceAccountEmail: serviceAccountEmail, - } - return r.Execute() -} - // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ListFederatedIdentityProvidersRequest struct { ctx context.Context diff --git a/services/serviceaccount/model_introspect_jwt_payload.go b/services/serviceaccount/model_introspect_jwt_payload.go new file mode 100644 index 000000000..92ffe146c --- /dev/null +++ b/services/serviceaccount/model_introspect_jwt_payload.go @@ -0,0 +1,207 @@ +/* +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| + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package serviceaccount + +import ( + "encoding/json" +) + +// checks if the IntrospectJWTPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IntrospectJWTPayload{} + +/* + types and functions for token +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTPayloadGetTokenAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIntrospectJWTPayloadGetTokenAttributeTypeOk(arg IntrospectJWTPayloadGetTokenAttributeType) (ret IntrospectJWTPayloadGetTokenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIntrospectJWTPayloadGetTokenAttributeType(arg *IntrospectJWTPayloadGetTokenAttributeType, val IntrospectJWTPayloadGetTokenRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTPayloadGetTokenArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTPayloadGetTokenRetType = string + +/* + types and functions for token_type_hint +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTPayloadGetTokenTypeHintAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIntrospectJWTPayloadGetTokenTypeHintAttributeTypeOk(arg IntrospectJWTPayloadGetTokenTypeHintAttributeType) (ret IntrospectJWTPayloadGetTokenTypeHintRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIntrospectJWTPayloadGetTokenTypeHintAttributeType(arg *IntrospectJWTPayloadGetTokenTypeHintAttributeType, val IntrospectJWTPayloadGetTokenTypeHintRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTPayloadGetTokenTypeHintArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTPayloadGetTokenTypeHintRetType = string + +// IntrospectJWTPayload struct for IntrospectJWTPayload +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTPayload struct { + // REQUIRED + Token IntrospectJWTPayloadGetTokenAttributeType `json:"token" required:"true"` + TokenTypeHint IntrospectJWTPayloadGetTokenTypeHintAttributeType `json:"token_type_hint,omitempty"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _IntrospectJWTPayload IntrospectJWTPayload + +// NewIntrospectJWTPayload instantiates a new IntrospectJWTPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewIntrospectJWTPayload(token IntrospectJWTPayloadGetTokenArgType) *IntrospectJWTPayload { + this := IntrospectJWTPayload{} + setIntrospectJWTPayloadGetTokenAttributeType(&this.Token, token) + return &this +} + +// NewIntrospectJWTPayloadWithDefaults instantiates a new IntrospectJWTPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewIntrospectJWTPayloadWithDefaults() *IntrospectJWTPayload { + this := IntrospectJWTPayload{} + return &this +} + +// GetToken returns the Token field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTPayload) GetToken() (ret IntrospectJWTPayloadGetTokenRetType) { + ret, _ = o.GetTokenOk() + return ret +} + +// GetTokenOk returns a tuple with the Token field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTPayload) GetTokenOk() (ret IntrospectJWTPayloadGetTokenRetType, ok bool) { + return getIntrospectJWTPayloadGetTokenAttributeTypeOk(o.Token) +} + +// SetToken sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTPayload) SetToken(v IntrospectJWTPayloadGetTokenRetType) { + setIntrospectJWTPayloadGetTokenAttributeType(&o.Token, v) +} + +// GetTokenTypeHint returns the TokenTypeHint field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTPayload) GetTokenTypeHint() (res IntrospectJWTPayloadGetTokenTypeHintRetType) { + res, _ = o.GetTokenTypeHintOk() + return +} + +// GetTokenTypeHintOk returns a tuple with the TokenTypeHint field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTPayload) GetTokenTypeHintOk() (ret IntrospectJWTPayloadGetTokenTypeHintRetType, ok bool) { + return getIntrospectJWTPayloadGetTokenTypeHintAttributeTypeOk(o.TokenTypeHint) +} + +// HasTokenTypeHint returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTPayload) HasTokenTypeHint() bool { + _, ok := o.GetTokenTypeHintOk() + return ok +} + +// SetTokenTypeHint gets a reference to the given string and assigns it to the TokenTypeHint field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTPayload) SetTokenTypeHint(v IntrospectJWTPayloadGetTokenTypeHintRetType) { + setIntrospectJWTPayloadGetTokenTypeHintAttributeType(&o.TokenTypeHint, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o IntrospectJWTPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getIntrospectJWTPayloadGetTokenAttributeTypeOk(o.Token); ok { + toSerialize["Token"] = val + } + if val, ok := getIntrospectJWTPayloadGetTokenTypeHintAttributeTypeOk(o.TokenTypeHint); ok { + toSerialize["TokenTypeHint"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableIntrospectJWTPayload struct { + value *IntrospectJWTPayload + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableIntrospectJWTPayload) Get() *IntrospectJWTPayload { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableIntrospectJWTPayload) Set(val *IntrospectJWTPayload) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableIntrospectJWTPayload) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableIntrospectJWTPayload) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableIntrospectJWTPayload(val *IntrospectJWTPayload) *NullableIntrospectJWTPayload { + return &NullableIntrospectJWTPayload{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableIntrospectJWTPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableIntrospectJWTPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/serviceaccount/model_introspect_jwt_payload_test.go b/services/serviceaccount/model_introspect_jwt_payload_test.go new file mode 100644 index 000000000..df6e96236 --- /dev/null +++ b/services/serviceaccount/model_introspect_jwt_payload_test.go @@ -0,0 +1,11 @@ +/* +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| + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package serviceaccount diff --git a/services/serviceaccount/model_introspect_jwt_response.go b/services/serviceaccount/model_introspect_jwt_response.go new file mode 100644 index 000000000..0fb7d4bc2 --- /dev/null +++ b/services/serviceaccount/model_introspect_jwt_response.go @@ -0,0 +1,729 @@ +/* +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| + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package serviceaccount + +import ( + "encoding/json" +) + +// checks if the IntrospectJWTResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IntrospectJWTResponse{} + +/* + types and functions for active +*/ + +// isBoolean +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponsegetActiveAttributeType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponsegetActiveArgType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponsegetActiveRetType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIntrospectJWTResponsegetActiveAttributeTypeOk(arg IntrospectJWTResponsegetActiveAttributeType) (ret IntrospectJWTResponsegetActiveRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIntrospectJWTResponsegetActiveAttributeType(arg *IntrospectJWTResponsegetActiveAttributeType, val IntrospectJWTResponsegetActiveRetType) { + *arg = &val +} + +/* + types and functions for aud +*/ + +// isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetAudAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetAudArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetAudRetType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIntrospectJWTResponseGetAudAttributeTypeOk(arg IntrospectJWTResponseGetAudAttributeType) (ret IntrospectJWTResponseGetAudRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIntrospectJWTResponseGetAudAttributeType(arg *IntrospectJWTResponseGetAudAttributeType, val IntrospectJWTResponseGetAudRetType) { + *arg = &val +} + +/* + types and functions for client_id +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetClientIdAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIntrospectJWTResponseGetClientIdAttributeTypeOk(arg IntrospectJWTResponseGetClientIdAttributeType) (ret IntrospectJWTResponseGetClientIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIntrospectJWTResponseGetClientIdAttributeType(arg *IntrospectJWTResponseGetClientIdAttributeType, val IntrospectJWTResponseGetClientIdRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetClientIdArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetClientIdRetType = string + +/* + types and functions for exp +*/ + +// isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetExpAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetExpArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetExpRetType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIntrospectJWTResponseGetExpAttributeTypeOk(arg IntrospectJWTResponseGetExpAttributeType) (ret IntrospectJWTResponseGetExpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIntrospectJWTResponseGetExpAttributeType(arg *IntrospectJWTResponseGetExpAttributeType, val IntrospectJWTResponseGetExpRetType) { + *arg = &val +} + +/* + types and functions for iat +*/ + +// isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetIatAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetIatArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetIatRetType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIntrospectJWTResponseGetIatAttributeTypeOk(arg IntrospectJWTResponseGetIatAttributeType) (ret IntrospectJWTResponseGetIatRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIntrospectJWTResponseGetIatAttributeType(arg *IntrospectJWTResponseGetIatAttributeType, val IntrospectJWTResponseGetIatRetType) { + *arg = &val +} + +/* + types and functions for iss +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetIssAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIntrospectJWTResponseGetIssAttributeTypeOk(arg IntrospectJWTResponseGetIssAttributeType) (ret IntrospectJWTResponseGetIssRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIntrospectJWTResponseGetIssAttributeType(arg *IntrospectJWTResponseGetIssAttributeType, val IntrospectJWTResponseGetIssRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetIssArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetIssRetType = string + +/* + types and functions for jti +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetJtiAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIntrospectJWTResponseGetJtiAttributeTypeOk(arg IntrospectJWTResponseGetJtiAttributeType) (ret IntrospectJWTResponseGetJtiRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIntrospectJWTResponseGetJtiAttributeType(arg *IntrospectJWTResponseGetJtiAttributeType, val IntrospectJWTResponseGetJtiRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetJtiArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetJtiRetType = string + +/* + types and functions for scope +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetScopeAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIntrospectJWTResponseGetScopeAttributeTypeOk(arg IntrospectJWTResponseGetScopeAttributeType) (ret IntrospectJWTResponseGetScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIntrospectJWTResponseGetScopeAttributeType(arg *IntrospectJWTResponseGetScopeAttributeType, val IntrospectJWTResponseGetScopeRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetScopeArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetScopeRetType = string + +/* + types and functions for sub +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetSubAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIntrospectJWTResponseGetSubAttributeTypeOk(arg IntrospectJWTResponseGetSubAttributeType) (ret IntrospectJWTResponseGetSubRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIntrospectJWTResponseGetSubAttributeType(arg *IntrospectJWTResponseGetSubAttributeType, val IntrospectJWTResponseGetSubRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetSubArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetSubRetType = string + +/* + types and functions for token_type +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetTokenTypeAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIntrospectJWTResponseGetTokenTypeAttributeTypeOk(arg IntrospectJWTResponseGetTokenTypeAttributeType) (ret IntrospectJWTResponseGetTokenTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIntrospectJWTResponseGetTokenTypeAttributeType(arg *IntrospectJWTResponseGetTokenTypeAttributeType, val IntrospectJWTResponseGetTokenTypeRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetTokenTypeArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetTokenTypeRetType = string + +/* + types and functions for username +*/ + +// isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetUsernameAttributeType = *string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func getIntrospectJWTResponseGetUsernameAttributeTypeOk(arg IntrospectJWTResponseGetUsernameAttributeType) (ret IntrospectJWTResponseGetUsernameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func setIntrospectJWTResponseGetUsernameAttributeType(arg *IntrospectJWTResponseGetUsernameAttributeType, val IntrospectJWTResponseGetUsernameRetType) { + *arg = &val +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetUsernameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponseGetUsernameRetType = string + +// IntrospectJWTResponse struct for IntrospectJWTResponse +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type IntrospectJWTResponse struct { + // REQUIRED + Active IntrospectJWTResponsegetActiveAttributeType `json:"active" required:"true"` + Aud IntrospectJWTResponseGetAudAttributeType `json:"aud,omitempty"` + ClientId IntrospectJWTResponseGetClientIdAttributeType `json:"client_id,omitempty"` + Exp IntrospectJWTResponseGetExpAttributeType `json:"exp,omitempty"` + Iat IntrospectJWTResponseGetIatAttributeType `json:"iat,omitempty"` + Iss IntrospectJWTResponseGetIssAttributeType `json:"iss,omitempty"` + Jti IntrospectJWTResponseGetJtiAttributeType `json:"jti,omitempty"` + Scope IntrospectJWTResponseGetScopeAttributeType `json:"scope,omitempty"` + Sub IntrospectJWTResponseGetSubAttributeType `json:"sub,omitempty"` + TokenType IntrospectJWTResponseGetTokenTypeAttributeType `json:"token_type,omitempty"` + Username IntrospectJWTResponseGetUsernameAttributeType `json:"username,omitempty"` +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type _IntrospectJWTResponse IntrospectJWTResponse + +// NewIntrospectJWTResponse instantiates a new IntrospectJWTResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewIntrospectJWTResponse(active IntrospectJWTResponsegetActiveArgType) *IntrospectJWTResponse { + this := IntrospectJWTResponse{} + setIntrospectJWTResponsegetActiveAttributeType(&this.Active, active) + return &this +} + +// NewIntrospectJWTResponseWithDefaults instantiates a new IntrospectJWTResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewIntrospectJWTResponseWithDefaults() *IntrospectJWTResponse { + this := IntrospectJWTResponse{} + return &this +} + +// GetActive returns the Active field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetActive() (ret IntrospectJWTResponsegetActiveRetType) { + ret, _ = o.GetActiveOk() + return ret +} + +// GetActiveOk returns a tuple with the Active field value +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetActiveOk() (ret IntrospectJWTResponsegetActiveRetType, ok bool) { + return getIntrospectJWTResponsegetActiveAttributeTypeOk(o.Active) +} + +// SetActive sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) SetActive(v IntrospectJWTResponsegetActiveRetType) { + setIntrospectJWTResponsegetActiveAttributeType(&o.Active, v) +} + +// GetAud returns the Aud field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetAud() (res IntrospectJWTResponseGetAudRetType) { + res, _ = o.GetAudOk() + return +} + +// GetAudOk returns a tuple with the Aud field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetAudOk() (ret IntrospectJWTResponseGetAudRetType, ok bool) { + return getIntrospectJWTResponseGetAudAttributeTypeOk(o.Aud) +} + +// HasAud returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) HasAud() bool { + _, ok := o.GetAudOk() + return ok +} + +// SetAud gets a reference to the given []string and assigns it to the Aud field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) SetAud(v IntrospectJWTResponseGetAudRetType) { + setIntrospectJWTResponseGetAudAttributeType(&o.Aud, v) +} + +// GetClientId returns the ClientId field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetClientId() (res IntrospectJWTResponseGetClientIdRetType) { + res, _ = o.GetClientIdOk() + return +} + +// GetClientIdOk returns a tuple with the ClientId field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetClientIdOk() (ret IntrospectJWTResponseGetClientIdRetType, ok bool) { + return getIntrospectJWTResponseGetClientIdAttributeTypeOk(o.ClientId) +} + +// HasClientId returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) HasClientId() bool { + _, ok := o.GetClientIdOk() + return ok +} + +// SetClientId gets a reference to the given string and assigns it to the ClientId field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) SetClientId(v IntrospectJWTResponseGetClientIdRetType) { + setIntrospectJWTResponseGetClientIdAttributeType(&o.ClientId, v) +} + +// GetExp returns the Exp field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetExp() (res IntrospectJWTResponseGetExpRetType) { + res, _ = o.GetExpOk() + return +} + +// GetExpOk returns a tuple with the Exp field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetExpOk() (ret IntrospectJWTResponseGetExpRetType, ok bool) { + return getIntrospectJWTResponseGetExpAttributeTypeOk(o.Exp) +} + +// HasExp returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) HasExp() bool { + _, ok := o.GetExpOk() + return ok +} + +// SetExp gets a reference to the given int64 and assigns it to the Exp field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) SetExp(v IntrospectJWTResponseGetExpRetType) { + setIntrospectJWTResponseGetExpAttributeType(&o.Exp, v) +} + +// GetIat returns the Iat field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetIat() (res IntrospectJWTResponseGetIatRetType) { + res, _ = o.GetIatOk() + return +} + +// GetIatOk returns a tuple with the Iat field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetIatOk() (ret IntrospectJWTResponseGetIatRetType, ok bool) { + return getIntrospectJWTResponseGetIatAttributeTypeOk(o.Iat) +} + +// HasIat returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) HasIat() bool { + _, ok := o.GetIatOk() + return ok +} + +// SetIat gets a reference to the given int64 and assigns it to the Iat field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) SetIat(v IntrospectJWTResponseGetIatRetType) { + setIntrospectJWTResponseGetIatAttributeType(&o.Iat, v) +} + +// GetIss returns the Iss field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetIss() (res IntrospectJWTResponseGetIssRetType) { + res, _ = o.GetIssOk() + return +} + +// GetIssOk returns a tuple with the Iss field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetIssOk() (ret IntrospectJWTResponseGetIssRetType, ok bool) { + return getIntrospectJWTResponseGetIssAttributeTypeOk(o.Iss) +} + +// HasIss returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) HasIss() bool { + _, ok := o.GetIssOk() + return ok +} + +// SetIss gets a reference to the given string and assigns it to the Iss field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) SetIss(v IntrospectJWTResponseGetIssRetType) { + setIntrospectJWTResponseGetIssAttributeType(&o.Iss, v) +} + +// GetJti returns the Jti field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetJti() (res IntrospectJWTResponseGetJtiRetType) { + res, _ = o.GetJtiOk() + return +} + +// GetJtiOk returns a tuple with the Jti field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetJtiOk() (ret IntrospectJWTResponseGetJtiRetType, ok bool) { + return getIntrospectJWTResponseGetJtiAttributeTypeOk(o.Jti) +} + +// HasJti returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) HasJti() bool { + _, ok := o.GetJtiOk() + return ok +} + +// SetJti gets a reference to the given string and assigns it to the Jti field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) SetJti(v IntrospectJWTResponseGetJtiRetType) { + setIntrospectJWTResponseGetJtiAttributeType(&o.Jti, v) +} + +// GetScope returns the Scope field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetScope() (res IntrospectJWTResponseGetScopeRetType) { + res, _ = o.GetScopeOk() + return +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetScopeOk() (ret IntrospectJWTResponseGetScopeRetType, ok bool) { + return getIntrospectJWTResponseGetScopeAttributeTypeOk(o.Scope) +} + +// HasScope returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) HasScope() bool { + _, ok := o.GetScopeOk() + return ok +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) SetScope(v IntrospectJWTResponseGetScopeRetType) { + setIntrospectJWTResponseGetScopeAttributeType(&o.Scope, v) +} + +// GetSub returns the Sub field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetSub() (res IntrospectJWTResponseGetSubRetType) { + res, _ = o.GetSubOk() + return +} + +// GetSubOk returns a tuple with the Sub field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetSubOk() (ret IntrospectJWTResponseGetSubRetType, ok bool) { + return getIntrospectJWTResponseGetSubAttributeTypeOk(o.Sub) +} + +// HasSub returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) HasSub() bool { + _, ok := o.GetSubOk() + return ok +} + +// SetSub gets a reference to the given string and assigns it to the Sub field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) SetSub(v IntrospectJWTResponseGetSubRetType) { + setIntrospectJWTResponseGetSubAttributeType(&o.Sub, v) +} + +// GetTokenType returns the TokenType field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetTokenType() (res IntrospectJWTResponseGetTokenTypeRetType) { + res, _ = o.GetTokenTypeOk() + return +} + +// GetTokenTypeOk returns a tuple with the TokenType field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetTokenTypeOk() (ret IntrospectJWTResponseGetTokenTypeRetType, ok bool) { + return getIntrospectJWTResponseGetTokenTypeAttributeTypeOk(o.TokenType) +} + +// HasTokenType returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) HasTokenType() bool { + _, ok := o.GetTokenTypeOk() + return ok +} + +// SetTokenType gets a reference to the given string and assigns it to the TokenType field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) SetTokenType(v IntrospectJWTResponseGetTokenTypeRetType) { + setIntrospectJWTResponseGetTokenTypeAttributeType(&o.TokenType, v) +} + +// GetUsername returns the Username field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetUsername() (res IntrospectJWTResponseGetUsernameRetType) { + res, _ = o.GetUsernameOk() + return +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) GetUsernameOk() (ret IntrospectJWTResponseGetUsernameRetType, ok bool) { + return getIntrospectJWTResponseGetUsernameAttributeTypeOk(o.Username) +} + +// HasUsername returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) HasUsername() bool { + _, ok := o.GetUsernameOk() + return ok +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o *IntrospectJWTResponse) SetUsername(v IntrospectJWTResponseGetUsernameRetType) { + setIntrospectJWTResponseGetUsernameAttributeType(&o.Username, v) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (o IntrospectJWTResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getIntrospectJWTResponsegetActiveAttributeTypeOk(o.Active); ok { + toSerialize["Active"] = val + } + if val, ok := getIntrospectJWTResponseGetAudAttributeTypeOk(o.Aud); ok { + toSerialize["Aud"] = val + } + if val, ok := getIntrospectJWTResponseGetClientIdAttributeTypeOk(o.ClientId); ok { + toSerialize["ClientId"] = val + } + if val, ok := getIntrospectJWTResponseGetExpAttributeTypeOk(o.Exp); ok { + toSerialize["Exp"] = val + } + if val, ok := getIntrospectJWTResponseGetIatAttributeTypeOk(o.Iat); ok { + toSerialize["Iat"] = val + } + if val, ok := getIntrospectJWTResponseGetIssAttributeTypeOk(o.Iss); ok { + toSerialize["Iss"] = val + } + if val, ok := getIntrospectJWTResponseGetJtiAttributeTypeOk(o.Jti); ok { + toSerialize["Jti"] = val + } + if val, ok := getIntrospectJWTResponseGetScopeAttributeTypeOk(o.Scope); ok { + toSerialize["Scope"] = val + } + if val, ok := getIntrospectJWTResponseGetSubAttributeTypeOk(o.Sub); ok { + toSerialize["Sub"] = val + } + if val, ok := getIntrospectJWTResponseGetTokenTypeAttributeTypeOk(o.TokenType); ok { + toSerialize["TokenType"] = val + } + if val, ok := getIntrospectJWTResponseGetUsernameAttributeTypeOk(o.Username); ok { + toSerialize["Username"] = val + } + return toSerialize, nil +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +type NullableIntrospectJWTResponse struct { + value *IntrospectJWTResponse + isSet bool +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableIntrospectJWTResponse) Get() *IntrospectJWTResponse { + return v.value +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableIntrospectJWTResponse) Set(val *IntrospectJWTResponse) { + v.value = val + v.isSet = true +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableIntrospectJWTResponse) IsSet() bool { + return v.isSet +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableIntrospectJWTResponse) Unset() { + v.value = nil + v.isSet = false +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func NewNullableIntrospectJWTResponse(val *IntrospectJWTResponse) *NullableIntrospectJWTResponse { + return &NullableIntrospectJWTResponse{value: val, isSet: true} +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v NullableIntrospectJWTResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +func (v *NullableIntrospectJWTResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/serviceaccount/model_introspect_jwt_response_test.go b/services/serviceaccount/model_introspect_jwt_response_test.go new file mode 100644 index 000000000..df6e96236 --- /dev/null +++ b/services/serviceaccount/model_introspect_jwt_response_test.go @@ -0,0 +1,11 @@ +/* +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| + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package serviceaccount diff --git a/services/serviceaccount/oas_commit b/services/serviceaccount/oas_commit index 8ae9a8db5..fc3f2e0cd 100644 --- a/services/serviceaccount/oas_commit +++ b/services/serviceaccount/oas_commit @@ -1 +1 @@ -e9fe931e91e0b8f067d5c12518398a52062ca794 +3495dec9dec80e7ef859725d8161fdb7940238a6 diff --git a/services/serviceaccount/v2api/api_default.go b/services/serviceaccount/v2api/api_default.go index 8198c600f..95b4555b5 100644 --- a/services/serviceaccount/v2api/api_default.go +++ b/services/serviceaccount/v2api/api_default.go @@ -23,22 +23,6 @@ import ( type DefaultAPI interface { - /* - CreateAccessToken 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 ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The email of the Service Account. - @return ApiCreateAccessTokenRequest - */ - CreateAccessToken(ctx context.Context, projectId string, serviceAccountEmail string) ApiCreateAccessTokenRequest - - // CreateAccessTokenExecute executes the request - // @return AccessToken - CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*AccessToken, error) - /* CreateFederatedIdentityProvider Create a new Federated Identity Provider @@ -101,22 +85,6 @@ type DefaultAPI interface { // @return CreateShortLivedAccessTokenResponse CreateShortLivedAccessTokenExecute(r ApiCreateShortLivedAccessTokenRequest) (*CreateShortLivedAccessTokenResponse, error) - /* - DeleteAccessToken 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 ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The ID of the Service Account. - @param accessTokenId The ID of the Access Token. - @return ApiDeleteAccessTokenRequest - */ - DeleteAccessToken(ctx context.Context, projectId string, serviceAccountEmail string, accessTokenId string) ApiDeleteAccessTokenRequest - - // DeleteAccessTokenExecute executes the request - DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) error - /* DeleteServiceAccount Delete Service Account @@ -213,22 +181,6 @@ type DefaultAPI interface { // @return GetServiceAccountKeyResponse GetServiceAccountKeyExecute(r ApiGetServiceAccountKeyRequest) (*GetServiceAccountKeyResponse, error) - /* - ListAccessTokens 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 ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The email of the Service Account. - @return ApiListAccessTokensRequest - */ - ListAccessTokens(ctx context.Context, projectId string, serviceAccountEmail string) ApiListAccessTokensRequest - - // ListAccessTokensExecute executes the request - // @return ListAccessTokensResponse - ListAccessTokensExecute(r ApiListAccessTokensRequest) (*ListAccessTokensResponse, error) - /* ListFederatedIdentityProviders List all federated identity providers @@ -314,177 +266,6 @@ type DefaultAPI interface { // DefaultAPIService DefaultAPI service type DefaultAPIService service -type ApiCreateAccessTokenRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - serviceAccountEmail string - createAccessTokenPayload *CreateAccessTokenPayload -} - -// Token request. Optional. If not specified the access token will be valid for 90days. -func (r ApiCreateAccessTokenRequest) CreateAccessTokenPayload(createAccessTokenPayload CreateAccessTokenPayload) ApiCreateAccessTokenRequest { - r.createAccessTokenPayload = &createAccessTokenPayload - return r -} - -func (r ApiCreateAccessTokenRequest) Execute() (*AccessToken, error) { - return r.ApiService.CreateAccessTokenExecute(r) -} - -/* -CreateAccessToken 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 ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The email of the Service Account. - @return ApiCreateAccessTokenRequest -*/ -func (a *DefaultAPIService) CreateAccessToken(ctx context.Context, projectId string, serviceAccountEmail string) ApiCreateAccessTokenRequest { - return ApiCreateAccessTokenRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - serviceAccountEmail: serviceAccountEmail, - } -} - -// Execute executes the request -// -// @return AccessToken -func (a *DefaultAPIService) CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*AccessToken, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *AccessToken - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateAccessToken") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v2/projects/{projectId}/service-accounts/{serviceAccountEmail}/access-tokens" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountEmail"+"}", url.PathEscape(parameterValueToString(r.serviceAccountEmail, "serviceAccountEmail")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.createAccessTokenPayload - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, err - } - - contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) - if ok { - *contextHTTPRequest = req - } - - localVarHTTPResponse, err := a.client.callAPI(req) - contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) - if ok { - *contextHTTPResponse = localVarHTTPResponse - } - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &oapierror.GenericOpenAPIError{ - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - StatusCode: localVarHTTPResponse.StatusCode, - } - if localVarHTTPResponse.StatusCode == 400 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v AuthError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, newErr - } - - return localVarReturnValue, nil -} - type ApiCreateFederatedIdentityProviderRequest struct { ctx context.Context ApiService DefaultAPI @@ -1168,170 +949,6 @@ func (a *DefaultAPIService) CreateShortLivedAccessTokenExecute(r ApiCreateShortL return localVarReturnValue, nil } -type ApiDeleteAccessTokenRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - serviceAccountEmail string - accessTokenId string -} - -func (r ApiDeleteAccessTokenRequest) Execute() error { - return r.ApiService.DeleteAccessTokenExecute(r) -} - -/* -DeleteAccessToken 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 ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The ID of the Service Account. - @param accessTokenId The ID of the Access Token. - @return ApiDeleteAccessTokenRequest -*/ -func (a *DefaultAPIService) DeleteAccessToken(ctx context.Context, projectId string, serviceAccountEmail string, accessTokenId string) ApiDeleteAccessTokenRequest { - return ApiDeleteAccessTokenRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - serviceAccountEmail: serviceAccountEmail, - accessTokenId: accessTokenId, - } -} - -// Execute executes the request -func (a *DefaultAPIService) DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) error { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteAccessToken") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v2/projects/{projectId}/service-accounts/{serviceAccountEmail}/access-tokens/{accessTokenId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountEmail"+"}", url.PathEscape(parameterValueToString(r.serviceAccountEmail, "serviceAccountEmail")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"accessTokenId"+"}", url.PathEscape(parameterValueToString(r.accessTokenId, "accessTokenId")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return err - } - - contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) - if ok { - *contextHTTPRequest = req - } - - localVarHTTPResponse, err := a.client.callAPI(req) - contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) - if ok { - *contextHTTPResponse = localVarHTTPResponse - } - if err != nil || localVarHTTPResponse == nil { - return err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &oapierror.GenericOpenAPIError{ - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - StatusCode: localVarHTTPResponse.StatusCode, - } - if localVarHTTPResponse.StatusCode == 400 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v AuthError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return newErr - } - if localVarHTTPResponse.StatusCode == 409 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - } - return newErr - } - - return nil -} - type ApiDeleteServiceAccountRequest struct { ctx context.Context ApiService DefaultAPI @@ -2237,168 +1854,6 @@ func (a *DefaultAPIService) GetServiceAccountKeyExecute(r ApiGetServiceAccountKe return localVarReturnValue, nil } -type ApiListAccessTokensRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - serviceAccountEmail string -} - -func (r ApiListAccessTokensRequest) Execute() (*ListAccessTokensResponse, error) { - return r.ApiService.ListAccessTokensExecute(r) -} - -/* -ListAccessTokens 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 ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The ID of the project. - @param serviceAccountEmail The email of the Service Account. - @return ApiListAccessTokensRequest -*/ -func (a *DefaultAPIService) ListAccessTokens(ctx context.Context, projectId string, serviceAccountEmail string) ApiListAccessTokensRequest { - return ApiListAccessTokensRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - serviceAccountEmail: serviceAccountEmail, - } -} - -// Execute executes the request -// -// @return ListAccessTokensResponse -func (a *DefaultAPIService) ListAccessTokensExecute(r ApiListAccessTokensRequest) (*ListAccessTokensResponse, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ListAccessTokensResponse - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListAccessTokens") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v2/projects/{projectId}/service-accounts/{serviceAccountEmail}/access-tokens" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountEmail"+"}", url.PathEscape(parameterValueToString(r.serviceAccountEmail, "serviceAccountEmail")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{"application/json"} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, err - } - - contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) - if ok { - *contextHTTPRequest = req - } - - localVarHTTPResponse, err := a.client.callAPI(req) - contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) - if ok { - *contextHTTPResponse = localVarHTTPResponse - } - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, err - } - - localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &oapierror.GenericOpenAPIError{ - Body: localVarBody, - ErrorMessage: localVarHTTPResponse.Status, - StatusCode: localVarHTTPResponse.StatusCode, - } - if localVarHTTPResponse.StatusCode == 400 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 401 { - var v AuthError - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 403 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v Error - err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr.ErrorMessage = err.Error() - return localVarReturnValue, newErr - } - newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) - newErr.Model = v - } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) - if err != nil { - newErr := &oapierror.GenericOpenAPIError{ - StatusCode: localVarHTTPResponse.StatusCode, - Body: localVarBody, - ErrorMessage: err.Error(), - } - return localVarReturnValue, newErr - } - - return localVarReturnValue, nil -} - type ApiListFederatedIdentityProvidersRequest struct { ctx context.Context ApiService DefaultAPI diff --git a/services/serviceaccount/v2api/api_default_mock.go b/services/serviceaccount/v2api/api_default_mock.go index b021e0715..dfea2357f 100644 --- a/services/serviceaccount/v2api/api_default_mock.go +++ b/services/serviceaccount/v2api/api_default_mock.go @@ -20,8 +20,6 @@ var _ DefaultAPI = &DefaultAPIServiceMock{} // DefaultAPIServiceMock is meant to be used for testing only as a replacement for DefaultAPIService. // By default all FooExecute() implementations are a no-op. Behavior of the mock can be customized by populating the callbacks in this struct. type DefaultAPIServiceMock struct { - // CreateAccessTokenExecuteMock can be populated to implement the behavior of the CreateAccessTokenExecute function of this mock - CreateAccessTokenExecuteMock *func(r ApiCreateAccessTokenRequest) (*AccessToken, error) // CreateFederatedIdentityProviderExecuteMock can be populated to implement the behavior of the CreateFederatedIdentityProviderExecute function of this mock CreateFederatedIdentityProviderExecuteMock *func(r ApiCreateFederatedIdentityProviderRequest) (*FederatedIdentityProvider, error) // CreateServiceAccountExecuteMock can be populated to implement the behavior of the CreateServiceAccountExecute function of this mock @@ -30,8 +28,6 @@ type DefaultAPIServiceMock struct { CreateServiceAccountKeyExecuteMock *func(r ApiCreateServiceAccountKeyRequest) (*CreateServiceAccountKeyResponse, error) // CreateShortLivedAccessTokenExecuteMock can be populated to implement the behavior of the CreateShortLivedAccessTokenExecute function of this mock CreateShortLivedAccessTokenExecuteMock *func(r ApiCreateShortLivedAccessTokenRequest) (*CreateShortLivedAccessTokenResponse, error) - // DeleteAccessTokenExecuteMock can be populated to implement the behavior of the DeleteAccessTokenExecute function of this mock - DeleteAccessTokenExecuteMock *func(r ApiDeleteAccessTokenRequest) error // DeleteServiceAccountExecuteMock can be populated to implement the behavior of the DeleteServiceAccountExecute function of this mock DeleteServiceAccountExecuteMock *func(r ApiDeleteServiceAccountRequest) error // DeleteServiceAccountKeyExecuteMock can be populated to implement the behavior of the DeleteServiceAccountKeyExecute function of this mock @@ -44,8 +40,6 @@ type DefaultAPIServiceMock struct { GetJWKSExecuteMock *func(r ApiGetJWKSRequest) (*JWKS, error) // GetServiceAccountKeyExecuteMock can be populated to implement the behavior of the GetServiceAccountKeyExecute function of this mock GetServiceAccountKeyExecuteMock *func(r ApiGetServiceAccountKeyRequest) (*GetServiceAccountKeyResponse, error) - // ListAccessTokensExecuteMock can be populated to implement the behavior of the ListAccessTokensExecute function of this mock - ListAccessTokensExecuteMock *func(r ApiListAccessTokensRequest) (*ListAccessTokensResponse, error) // ListFederatedIdentityProvidersExecuteMock can be populated to implement the behavior of the ListFederatedIdentityProvidersExecute function of this mock ListFederatedIdentityProvidersExecuteMock *func(r ApiListFederatedIdentityProvidersRequest) (*FederatedListFederatedIdentityProvidersResponse, error) // ListServiceAccountKeysExecuteMock can be populated to implement the behavior of the ListServiceAccountKeysExecute function of this mock @@ -58,25 +52,6 @@ type DefaultAPIServiceMock struct { PartialUpdateServiceAccountKeyExecuteMock *func(r ApiPartialUpdateServiceAccountKeyRequest) (*PartialUpdateServiceAccountKeyResponse, error) } -func (a DefaultAPIServiceMock) CreateAccessToken(ctx context.Context, projectId string, serviceAccountEmail string) ApiCreateAccessTokenRequest { - return ApiCreateAccessTokenRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - serviceAccountEmail: serviceAccountEmail, - } -} - -// CreateAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*AccessToken, error) { - if a.CreateAccessTokenExecuteMock == nil { - var localVarReturnValue *AccessToken - return localVarReturnValue, nil - } - - return (*a.CreateAccessTokenExecuteMock)(r) -} - func (a DefaultAPIServiceMock) CreateFederatedIdentityProvider(ctx context.Context, projectId string, serviceAccountEmail string) ApiCreateFederatedIdentityProviderRequest { return ApiCreateFederatedIdentityProviderRequest{ ApiService: a, @@ -150,25 +125,6 @@ func (a DefaultAPIServiceMock) CreateShortLivedAccessTokenExecute(r ApiCreateSho return (*a.CreateShortLivedAccessTokenExecuteMock)(r) } -func (a DefaultAPIServiceMock) DeleteAccessToken(ctx context.Context, projectId string, serviceAccountEmail string, accessTokenId string) ApiDeleteAccessTokenRequest { - return ApiDeleteAccessTokenRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - serviceAccountEmail: serviceAccountEmail, - accessTokenId: accessTokenId, - } -} - -// DeleteAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) error { - if a.DeleteAccessTokenExecuteMock == nil { - return nil - } - - return (*a.DeleteAccessTokenExecuteMock)(r) -} - func (a DefaultAPIServiceMock) DeleteServiceAccount(ctx context.Context, projectId string, serviceAccountEmail string) ApiDeleteServiceAccountRequest { return ApiDeleteServiceAccountRequest{ ApiService: a, @@ -283,25 +239,6 @@ func (a DefaultAPIServiceMock) GetServiceAccountKeyExecute(r ApiGetServiceAccoun return (*a.GetServiceAccountKeyExecuteMock)(r) } -func (a DefaultAPIServiceMock) ListAccessTokens(ctx context.Context, projectId string, serviceAccountEmail string) ApiListAccessTokensRequest { - return ApiListAccessTokensRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - serviceAccountEmail: serviceAccountEmail, - } -} - -// ListAccessTokensExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListAccessTokensExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) ListAccessTokensExecute(r ApiListAccessTokensRequest) (*ListAccessTokensResponse, error) { - if a.ListAccessTokensExecuteMock == nil { - var localVarReturnValue *ListAccessTokensResponse - return localVarReturnValue, nil - } - - return (*a.ListAccessTokensExecuteMock)(r) -} - func (a DefaultAPIServiceMock) ListFederatedIdentityProviders(ctx context.Context, projectId string, serviceAccountEmail string) ApiListFederatedIdentityProvidersRequest { return ApiListFederatedIdentityProvidersRequest{ ApiService: a, diff --git a/services/serviceaccount/v2api/model_introspect_jwt_payload.go b/services/serviceaccount/v2api/model_introspect_jwt_payload.go new file mode 100644 index 000000000..b9b61ae13 --- /dev/null +++ b/services/serviceaccount/v2api/model_introspect_jwt_payload.go @@ -0,0 +1,203 @@ +/* +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| + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "encoding/json" + "fmt" +) + +// checks if the IntrospectJWTPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IntrospectJWTPayload{} + +// IntrospectJWTPayload struct for IntrospectJWTPayload +type IntrospectJWTPayload struct { + Token string `json:"token"` + TokenTypeHint *string `json:"token_type_hint,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _IntrospectJWTPayload IntrospectJWTPayload + +// NewIntrospectJWTPayload instantiates a new IntrospectJWTPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIntrospectJWTPayload(token string) *IntrospectJWTPayload { + this := IntrospectJWTPayload{} + this.Token = token + return &this +} + +// NewIntrospectJWTPayloadWithDefaults instantiates a new IntrospectJWTPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIntrospectJWTPayloadWithDefaults() *IntrospectJWTPayload { + this := IntrospectJWTPayload{} + return &this +} + +// GetToken returns the Token field value +func (o *IntrospectJWTPayload) GetToken() string { + if o == nil { + var ret string + return ret + } + + return o.Token +} + +// GetTokenOk returns a tuple with the Token field value +// and a boolean to check if the value has been set. +func (o *IntrospectJWTPayload) GetTokenOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Token, true +} + +// SetToken sets field value +func (o *IntrospectJWTPayload) SetToken(v string) { + o.Token = v +} + +// GetTokenTypeHint returns the TokenTypeHint field value if set, zero value otherwise. +func (o *IntrospectJWTPayload) GetTokenTypeHint() string { + if o == nil || IsNil(o.TokenTypeHint) { + var ret string + return ret + } + return *o.TokenTypeHint +} + +// GetTokenTypeHintOk returns a tuple with the TokenTypeHint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntrospectJWTPayload) GetTokenTypeHintOk() (*string, bool) { + if o == nil || IsNil(o.TokenTypeHint) { + return nil, false + } + return o.TokenTypeHint, true +} + +// HasTokenTypeHint returns a boolean if a field has been set. +func (o *IntrospectJWTPayload) HasTokenTypeHint() bool { + if o != nil && !IsNil(o.TokenTypeHint) { + return true + } + + return false +} + +// SetTokenTypeHint gets a reference to the given string and assigns it to the TokenTypeHint field. +func (o *IntrospectJWTPayload) SetTokenTypeHint(v string) { + o.TokenTypeHint = &v +} + +func (o IntrospectJWTPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IntrospectJWTPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["token"] = o.Token + if !IsNil(o.TokenTypeHint) { + toSerialize["token_type_hint"] = o.TokenTypeHint + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *IntrospectJWTPayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "token", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIntrospectJWTPayload := _IntrospectJWTPayload{} + + err = json.Unmarshal(data, &varIntrospectJWTPayload) + + if err != nil { + return err + } + + *o = IntrospectJWTPayload(varIntrospectJWTPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "token") + delete(additionalProperties, "token_type_hint") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIntrospectJWTPayload struct { + value *IntrospectJWTPayload + isSet bool +} + +func (v NullableIntrospectJWTPayload) Get() *IntrospectJWTPayload { + return v.value +} + +func (v *NullableIntrospectJWTPayload) Set(val *IntrospectJWTPayload) { + v.value = val + v.isSet = true +} + +func (v NullableIntrospectJWTPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableIntrospectJWTPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIntrospectJWTPayload(val *IntrospectJWTPayload) *NullableIntrospectJWTPayload { + return &NullableIntrospectJWTPayload{value: val, isSet: true} +} + +func (v NullableIntrospectJWTPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIntrospectJWTPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/serviceaccount/v2api/model_introspect_jwt_response.go b/services/serviceaccount/v2api/model_introspect_jwt_response.go new file mode 100644 index 000000000..ca0886f35 --- /dev/null +++ b/services/serviceaccount/v2api/model_introspect_jwt_response.go @@ -0,0 +1,536 @@ +/* +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| + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v2api + +import ( + "encoding/json" + "fmt" +) + +// checks if the IntrospectJWTResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IntrospectJWTResponse{} + +// IntrospectJWTResponse struct for IntrospectJWTResponse +type IntrospectJWTResponse struct { + Active bool `json:"active"` + Aud []string `json:"aud,omitempty"` + ClientId *string `json:"client_id,omitempty"` + Exp *int32 `json:"exp,omitempty"` + Iat *int32 `json:"iat,omitempty"` + Iss *string `json:"iss,omitempty"` + Jti *string `json:"jti,omitempty"` + Scope *string `json:"scope,omitempty"` + Sub *string `json:"sub,omitempty"` + TokenType *string `json:"token_type,omitempty"` + Username *string `json:"username,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _IntrospectJWTResponse IntrospectJWTResponse + +// NewIntrospectJWTResponse instantiates a new IntrospectJWTResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewIntrospectJWTResponse(active bool) *IntrospectJWTResponse { + this := IntrospectJWTResponse{} + this.Active = active + return &this +} + +// NewIntrospectJWTResponseWithDefaults instantiates a new IntrospectJWTResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewIntrospectJWTResponseWithDefaults() *IntrospectJWTResponse { + this := IntrospectJWTResponse{} + return &this +} + +// GetActive returns the Active field value +func (o *IntrospectJWTResponse) GetActive() bool { + if o == nil { + var ret bool + return ret + } + + return o.Active +} + +// GetActiveOk returns a tuple with the Active field value +// and a boolean to check if the value has been set. +func (o *IntrospectJWTResponse) GetActiveOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Active, true +} + +// SetActive sets field value +func (o *IntrospectJWTResponse) SetActive(v bool) { + o.Active = v +} + +// GetAud returns the Aud field value if set, zero value otherwise. +func (o *IntrospectJWTResponse) GetAud() []string { + if o == nil || IsNil(o.Aud) { + var ret []string + return ret + } + return o.Aud +} + +// GetAudOk returns a tuple with the Aud field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntrospectJWTResponse) GetAudOk() ([]string, bool) { + if o == nil || IsNil(o.Aud) { + return nil, false + } + return o.Aud, true +} + +// HasAud returns a boolean if a field has been set. +func (o *IntrospectJWTResponse) HasAud() bool { + if o != nil && !IsNil(o.Aud) { + return true + } + + return false +} + +// SetAud gets a reference to the given []string and assigns it to the Aud field. +func (o *IntrospectJWTResponse) SetAud(v []string) { + o.Aud = v +} + +// GetClientId returns the ClientId field value if set, zero value otherwise. +func (o *IntrospectJWTResponse) GetClientId() string { + if o == nil || IsNil(o.ClientId) { + var ret string + return ret + } + return *o.ClientId +} + +// GetClientIdOk returns a tuple with the ClientId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntrospectJWTResponse) GetClientIdOk() (*string, bool) { + if o == nil || IsNil(o.ClientId) { + return nil, false + } + return o.ClientId, true +} + +// HasClientId returns a boolean if a field has been set. +func (o *IntrospectJWTResponse) HasClientId() bool { + if o != nil && !IsNil(o.ClientId) { + return true + } + + return false +} + +// SetClientId gets a reference to the given string and assigns it to the ClientId field. +func (o *IntrospectJWTResponse) SetClientId(v string) { + o.ClientId = &v +} + +// GetExp returns the Exp field value if set, zero value otherwise. +func (o *IntrospectJWTResponse) GetExp() int32 { + if o == nil || IsNil(o.Exp) { + var ret int32 + return ret + } + return *o.Exp +} + +// GetExpOk returns a tuple with the Exp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntrospectJWTResponse) GetExpOk() (*int32, bool) { + if o == nil || IsNil(o.Exp) { + return nil, false + } + return o.Exp, true +} + +// HasExp returns a boolean if a field has been set. +func (o *IntrospectJWTResponse) HasExp() bool { + if o != nil && !IsNil(o.Exp) { + return true + } + + return false +} + +// SetExp gets a reference to the given int32 and assigns it to the Exp field. +func (o *IntrospectJWTResponse) SetExp(v int32) { + o.Exp = &v +} + +// GetIat returns the Iat field value if set, zero value otherwise. +func (o *IntrospectJWTResponse) GetIat() int32 { + if o == nil || IsNil(o.Iat) { + var ret int32 + return ret + } + return *o.Iat +} + +// GetIatOk returns a tuple with the Iat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntrospectJWTResponse) GetIatOk() (*int32, bool) { + if o == nil || IsNil(o.Iat) { + return nil, false + } + return o.Iat, true +} + +// HasIat returns a boolean if a field has been set. +func (o *IntrospectJWTResponse) HasIat() bool { + if o != nil && !IsNil(o.Iat) { + return true + } + + return false +} + +// SetIat gets a reference to the given int32 and assigns it to the Iat field. +func (o *IntrospectJWTResponse) SetIat(v int32) { + o.Iat = &v +} + +// GetIss returns the Iss field value if set, zero value otherwise. +func (o *IntrospectJWTResponse) GetIss() string { + if o == nil || IsNil(o.Iss) { + var ret string + return ret + } + return *o.Iss +} + +// GetIssOk returns a tuple with the Iss field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntrospectJWTResponse) GetIssOk() (*string, bool) { + if o == nil || IsNil(o.Iss) { + return nil, false + } + return o.Iss, true +} + +// HasIss returns a boolean if a field has been set. +func (o *IntrospectJWTResponse) HasIss() bool { + if o != nil && !IsNil(o.Iss) { + return true + } + + return false +} + +// SetIss gets a reference to the given string and assigns it to the Iss field. +func (o *IntrospectJWTResponse) SetIss(v string) { + o.Iss = &v +} + +// GetJti returns the Jti field value if set, zero value otherwise. +func (o *IntrospectJWTResponse) GetJti() string { + if o == nil || IsNil(o.Jti) { + var ret string + return ret + } + return *o.Jti +} + +// GetJtiOk returns a tuple with the Jti field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntrospectJWTResponse) GetJtiOk() (*string, bool) { + if o == nil || IsNil(o.Jti) { + return nil, false + } + return o.Jti, true +} + +// HasJti returns a boolean if a field has been set. +func (o *IntrospectJWTResponse) HasJti() bool { + if o != nil && !IsNil(o.Jti) { + return true + } + + return false +} + +// SetJti gets a reference to the given string and assigns it to the Jti field. +func (o *IntrospectJWTResponse) SetJti(v string) { + o.Jti = &v +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *IntrospectJWTResponse) GetScope() string { + if o == nil || IsNil(o.Scope) { + var ret string + return ret + } + return *o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntrospectJWTResponse) GetScopeOk() (*string, bool) { + if o == nil || IsNil(o.Scope) { + return nil, false + } + return o.Scope, true +} + +// HasScope returns a boolean if a field has been set. +func (o *IntrospectJWTResponse) HasScope() bool { + if o != nil && !IsNil(o.Scope) { + return true + } + + return false +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *IntrospectJWTResponse) SetScope(v string) { + o.Scope = &v +} + +// GetSub returns the Sub field value if set, zero value otherwise. +func (o *IntrospectJWTResponse) GetSub() string { + if o == nil || IsNil(o.Sub) { + var ret string + return ret + } + return *o.Sub +} + +// GetSubOk returns a tuple with the Sub field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntrospectJWTResponse) GetSubOk() (*string, bool) { + if o == nil || IsNil(o.Sub) { + return nil, false + } + return o.Sub, true +} + +// HasSub returns a boolean if a field has been set. +func (o *IntrospectJWTResponse) HasSub() bool { + if o != nil && !IsNil(o.Sub) { + return true + } + + return false +} + +// SetSub gets a reference to the given string and assigns it to the Sub field. +func (o *IntrospectJWTResponse) SetSub(v string) { + o.Sub = &v +} + +// GetTokenType returns the TokenType field value if set, zero value otherwise. +func (o *IntrospectJWTResponse) GetTokenType() string { + if o == nil || IsNil(o.TokenType) { + var ret string + return ret + } + return *o.TokenType +} + +// GetTokenTypeOk returns a tuple with the TokenType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntrospectJWTResponse) GetTokenTypeOk() (*string, bool) { + if o == nil || IsNil(o.TokenType) { + return nil, false + } + return o.TokenType, true +} + +// HasTokenType returns a boolean if a field has been set. +func (o *IntrospectJWTResponse) HasTokenType() bool { + if o != nil && !IsNil(o.TokenType) { + return true + } + + return false +} + +// SetTokenType gets a reference to the given string and assigns it to the TokenType field. +func (o *IntrospectJWTResponse) SetTokenType(v string) { + o.TokenType = &v +} + +// GetUsername returns the Username field value if set, zero value otherwise. +func (o *IntrospectJWTResponse) GetUsername() string { + if o == nil || IsNil(o.Username) { + var ret string + return ret + } + return *o.Username +} + +// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *IntrospectJWTResponse) GetUsernameOk() (*string, bool) { + if o == nil || IsNil(o.Username) { + return nil, false + } + return o.Username, true +} + +// HasUsername returns a boolean if a field has been set. +func (o *IntrospectJWTResponse) HasUsername() bool { + if o != nil && !IsNil(o.Username) { + return true + } + + return false +} + +// SetUsername gets a reference to the given string and assigns it to the Username field. +func (o *IntrospectJWTResponse) SetUsername(v string) { + o.Username = &v +} + +func (o IntrospectJWTResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IntrospectJWTResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["active"] = o.Active + if !IsNil(o.Aud) { + toSerialize["aud"] = o.Aud + } + if !IsNil(o.ClientId) { + toSerialize["client_id"] = o.ClientId + } + if !IsNil(o.Exp) { + toSerialize["exp"] = o.Exp + } + if !IsNil(o.Iat) { + toSerialize["iat"] = o.Iat + } + if !IsNil(o.Iss) { + toSerialize["iss"] = o.Iss + } + if !IsNil(o.Jti) { + toSerialize["jti"] = o.Jti + } + if !IsNil(o.Scope) { + toSerialize["scope"] = o.Scope + } + if !IsNil(o.Sub) { + toSerialize["sub"] = o.Sub + } + if !IsNil(o.TokenType) { + toSerialize["token_type"] = o.TokenType + } + if !IsNil(o.Username) { + toSerialize["username"] = o.Username + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *IntrospectJWTResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "active", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varIntrospectJWTResponse := _IntrospectJWTResponse{} + + err = json.Unmarshal(data, &varIntrospectJWTResponse) + + if err != nil { + return err + } + + *o = IntrospectJWTResponse(varIntrospectJWTResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "active") + delete(additionalProperties, "aud") + delete(additionalProperties, "client_id") + delete(additionalProperties, "exp") + delete(additionalProperties, "iat") + delete(additionalProperties, "iss") + delete(additionalProperties, "jti") + delete(additionalProperties, "scope") + delete(additionalProperties, "sub") + delete(additionalProperties, "token_type") + delete(additionalProperties, "username") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableIntrospectJWTResponse struct { + value *IntrospectJWTResponse + isSet bool +} + +func (v NullableIntrospectJWTResponse) Get() *IntrospectJWTResponse { + return v.value +} + +func (v *NullableIntrospectJWTResponse) Set(val *IntrospectJWTResponse) { + v.value = val + v.isSet = true +} + +func (v NullableIntrospectJWTResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableIntrospectJWTResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIntrospectJWTResponse(val *IntrospectJWTResponse) *NullableIntrospectJWTResponse { + return &NullableIntrospectJWTResponse{value: val, isSet: true} +} + +func (v NullableIntrospectJWTResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIntrospectJWTResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +}