diff --git a/services/kms/oas_commit b/services/kms/oas_commit index c08a6770d..9b743b1ca 100644 --- a/services/kms/oas_commit +++ b/services/kms/oas_commit @@ -1 +1 @@ -4407196dbbef4e53e6798809e856725cbc84ae05 +e1f55f7939b240f74912eedb8020d2f0a0ffb046 diff --git a/services/kms/v1betaapi/api_default.go b/services/kms/v1betaapi/api_default.go deleted file mode 100644 index a72a1e6aa..000000000 --- a/services/kms/v1betaapi/api_default.go +++ /dev/null @@ -1,5009 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package v1betaapi - -import ( - "bytes" - "context" - "io" - "net/http" - "net/url" - "strings" - - "github.com/stackitcloud/stackit-sdk-go/core/config" - "github.com/stackitcloud/stackit-sdk-go/core/oapierror" -) - -type DefaultAPI interface { - - /* - CreateKey Create key - - Creates a new key for the given key ring. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @return ApiCreateKeyRequest - - Deprecated - */ - CreateKey(ctx context.Context, projectId string, regionId string, keyRingId string) ApiCreateKeyRequest - - // CreateKeyExecute executes the request - // @return Key - // Deprecated - CreateKeyExecute(r ApiCreateKeyRequest) (*Key, error) - - /* - CreateKeyRing Create key ring - - Creates a new key ring within the project. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @return ApiCreateKeyRingRequest - - Deprecated - */ - CreateKeyRing(ctx context.Context, projectId string, regionId string) ApiCreateKeyRingRequest - - // CreateKeyRingExecute executes the request - // @return KeyRing - // Deprecated - CreateKeyRingExecute(r ApiCreateKeyRingRequest) (*KeyRing, error) - - /* - CreateWrappingKey Create wrapping key - - Creates a new wrapping key for the given key ring. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @return ApiCreateWrappingKeyRequest - - Deprecated - */ - CreateWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string) ApiCreateWrappingKeyRequest - - // CreateWrappingKeyExecute executes the request - // @return WrappingKey - // Deprecated - CreateWrappingKeyExecute(r ApiCreateWrappingKeyRequest) (*WrappingKey, error) - - /* - Decrypt Decrypt - - Decrypts data using the given key version. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiDecryptRequest - - Deprecated - */ - Decrypt(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDecryptRequest - - // DecryptExecute executes the request - // @return DecryptedData - // Deprecated - DecryptExecute(r ApiDecryptRequest) (*DecryptedData, error) - - /* - DeleteKey Delete key - - Schedules the deletion of the given key - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @return ApiDeleteKeyRequest - - Deprecated - */ - DeleteKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiDeleteKeyRequest - - // DeleteKeyExecute executes the request - // Deprecated - DeleteKeyExecute(r ApiDeleteKeyRequest) error - - /* - DeleteKeyRing Delete keyring - - Deletes the given key ring if it is empty - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @return ApiDeleteKeyRingRequest - - Deprecated - */ - DeleteKeyRing(ctx context.Context, projectId string, regionId string, keyRingId string) ApiDeleteKeyRingRequest - - // DeleteKeyRingExecute executes the request - // Deprecated - DeleteKeyRingExecute(r ApiDeleteKeyRingRequest) error - - /* - DeleteWrappingKey Delete wrapping key - - Deletes the given wrapping key - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param wrappingKeyId The wrapping key UUID. - @return ApiDeleteWrappingKeyRequest - - Deprecated - */ - DeleteWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) ApiDeleteWrappingKeyRequest - - // DeleteWrappingKeyExecute executes the request - // Deprecated - DeleteWrappingKeyExecute(r ApiDeleteWrappingKeyRequest) error - - /* - DestroyVersion Destroy version - - Removes the key material of a version permanently. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiDestroyVersionRequest - - Deprecated - */ - DestroyVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDestroyVersionRequest - - // DestroyVersionExecute executes the request - // Deprecated - DestroyVersionExecute(r ApiDestroyVersionRequest) error - - /* - DisableVersion Disable version - - Disables the given version. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiDisableVersionRequest - - Deprecated - */ - DisableVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDisableVersionRequest - - // DisableVersionExecute executes the request - // Deprecated - DisableVersionExecute(r ApiDisableVersionRequest) error - - /* - EnableVersion Enable version - - Enables the given version. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiEnableVersionRequest - - Deprecated - */ - EnableVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiEnableVersionRequest - - // EnableVersionExecute executes the request - // Deprecated - EnableVersionExecute(r ApiEnableVersionRequest) error - - /* - Encrypt Encrypt - - Encrypts data using the given key version. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiEncryptRequest - - Deprecated - */ - Encrypt(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiEncryptRequest - - // EncryptExecute executes the request - // @return EncryptedData - // Deprecated - EncryptExecute(r ApiEncryptRequest) (*EncryptedData, error) - - /* - GetKey Get key - - Returns the details for the given key. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @return ApiGetKeyRequest - - Deprecated - */ - GetKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiGetKeyRequest - - // GetKeyExecute executes the request - // @return Key - // Deprecated - GetKeyExecute(r ApiGetKeyRequest) (*Key, error) - - /* - GetKeyRing Get key ring - - Returns the details for the given key ring. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @return ApiGetKeyRingRequest - - Deprecated - */ - GetKeyRing(ctx context.Context, projectId string, regionId string, keyRingId string) ApiGetKeyRingRequest - - // GetKeyRingExecute executes the request - // @return KeyRing - // Deprecated - GetKeyRingExecute(r ApiGetKeyRingRequest) (*KeyRing, error) - - /* - GetVersion Get version - - Returns the details for the given version. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiGetVersionRequest - - Deprecated - */ - GetVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiGetVersionRequest - - // GetVersionExecute executes the request - // @return Version - // Deprecated - GetVersionExecute(r ApiGetVersionRequest) (*Version, error) - - /* - GetWrappingKey Get wrapping key - - Returns the details for the given wrapping key. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param wrappingKeyId The wrapping key UUID. - @return ApiGetWrappingKeyRequest - - Deprecated - */ - GetWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) ApiGetWrappingKeyRequest - - // GetWrappingKeyExecute executes the request - // @return WrappingKey - // Deprecated - GetWrappingKeyExecute(r ApiGetWrappingKeyRequest) (*WrappingKey, error) - - /* - ImportKey Import key - - Imports a new version to the given key. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @return ApiImportKeyRequest - - Deprecated - */ - ImportKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiImportKeyRequest - - // ImportKeyExecute executes the request - // @return Version - // Deprecated - ImportKeyExecute(r ApiImportKeyRequest) (*Version, error) - - /* - ListKeyRings List key rings - - Returns a list of all key rings within the project. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @return ApiListKeyRingsRequest - - Deprecated - */ - ListKeyRings(ctx context.Context, projectId string, regionId string) ApiListKeyRingsRequest - - // ListKeyRingsExecute executes the request - // @return KeyRingList - // Deprecated - ListKeyRingsExecute(r ApiListKeyRingsRequest) (*KeyRingList, error) - - /* - ListKeys List keys - - Returns the keys for the given key ring. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @return ApiListKeysRequest - - Deprecated - */ - ListKeys(ctx context.Context, projectId string, regionId string, keyRingId string) ApiListKeysRequest - - // ListKeysExecute executes the request - // @return KeyList - // Deprecated - ListKeysExecute(r ApiListKeysRequest) (*KeyList, error) - - /* - ListVersions List versions - - Returns a list of all versions of a given key. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @return ApiListVersionsRequest - - Deprecated - */ - ListVersions(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiListVersionsRequest - - // ListVersionsExecute executes the request - // @return VersionList - // Deprecated - ListVersionsExecute(r ApiListVersionsRequest) (*VersionList, error) - - /* - ListWrappingKeys List wrapping keys - - Returns the wrapping keys for the given key ring. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @return ApiListWrappingKeysRequest - - Deprecated - */ - ListWrappingKeys(ctx context.Context, projectId string, regionId string, keyRingId string) ApiListWrappingKeysRequest - - // ListWrappingKeysExecute executes the request - // @return WrappingKeyList - // Deprecated - ListWrappingKeysExecute(r ApiListWrappingKeysRequest) (*WrappingKeyList, error) - - /* - RestoreKey Restore deleted key - - Restores the given key from being deleted. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @return ApiRestoreKeyRequest - - Deprecated - */ - RestoreKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiRestoreKeyRequest - - // RestoreKeyExecute executes the request - // Deprecated - RestoreKeyExecute(r ApiRestoreKeyRequest) error - - /* - RestoreVersion Restore version - - Restores the given version from being destroyed - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiRestoreVersionRequest - - Deprecated - */ - RestoreVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiRestoreVersionRequest - - // RestoreVersionExecute executes the request - // Deprecated - RestoreVersionExecute(r ApiRestoreVersionRequest) error - - /* - RotateKey Rotate key - - Rotates the given key. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @return ApiRotateKeyRequest - - Deprecated - */ - RotateKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiRotateKeyRequest - - // RotateKeyExecute executes the request - // @return Version - // Deprecated - RotateKeyExecute(r ApiRotateKeyRequest) (*Version, error) - - /* - Sign Sign - - Sign data using the given key version as secret. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiSignRequest - - Deprecated - */ - Sign(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiSignRequest - - // SignExecute executes the request - // @return SignedData - // Deprecated - SignExecute(r ApiSignRequest) (*SignedData, error) - - /* - Verify Verify - - Verify data using the given key version as secret. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiVerifyRequest - - Deprecated - */ - Verify(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiVerifyRequest - - // VerifyExecute executes the request - // @return VerifiedData - // Deprecated - VerifyExecute(r ApiVerifyRequest) (*VerifiedData, error) -} - -// DefaultAPIService DefaultAPI service -type DefaultAPIService service - -type ApiCreateKeyRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - createKeyPayload *CreateKeyPayload -} - -func (r ApiCreateKeyRequest) CreateKeyPayload(createKeyPayload CreateKeyPayload) ApiCreateKeyRequest { - r.createKeyPayload = &createKeyPayload - return r -} - -func (r ApiCreateKeyRequest) Execute() (*Key, error) { - return r.ApiService.CreateKeyExecute(r) -} - -/* -CreateKey Create key - -Creates a new key for the given key ring. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @return ApiCreateKeyRequest - -Deprecated -*/ -func (a *DefaultAPIService) CreateKey(ctx context.Context, projectId string, regionId string, keyRingId string) ApiCreateKeyRequest { - return ApiCreateKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - } -} - -// Execute executes the request -// -// @return Key -// -// Deprecated -func (a *DefaultAPIService) CreateKeyExecute(r ApiCreateKeyRequest) (*Key, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Key - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateKey") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.createKeyPayload == nil { - return localVarReturnValue, reportError("createKeyPayload is required and must be specified") - } - - // 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.createKeyPayload - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiCreateKeyRingRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - createKeyRingPayload *CreateKeyRingPayload -} - -func (r ApiCreateKeyRingRequest) CreateKeyRingPayload(createKeyRingPayload CreateKeyRingPayload) ApiCreateKeyRingRequest { - r.createKeyRingPayload = &createKeyRingPayload - return r -} - -func (r ApiCreateKeyRingRequest) Execute() (*KeyRing, error) { - return r.ApiService.CreateKeyRingExecute(r) -} - -/* -CreateKeyRing Create key ring - -Creates a new key ring within the project. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @return ApiCreateKeyRingRequest - -Deprecated -*/ -func (a *DefaultAPIService) CreateKeyRing(ctx context.Context, projectId string, regionId string) ApiCreateKeyRingRequest { - return ApiCreateKeyRingRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - } -} - -// Execute executes the request -// -// @return KeyRing -// -// Deprecated -func (a *DefaultAPIService) CreateKeyRingExecute(r ApiCreateKeyRingRequest) (*KeyRing, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *KeyRing - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateKeyRing") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.createKeyRingPayload == nil { - return localVarReturnValue, reportError("createKeyRingPayload is required and must be specified") - } - - // 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.createKeyRingPayload - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiCreateWrappingKeyRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - createWrappingKeyPayload *CreateWrappingKeyPayload -} - -func (r ApiCreateWrappingKeyRequest) CreateWrappingKeyPayload(createWrappingKeyPayload CreateWrappingKeyPayload) ApiCreateWrappingKeyRequest { - r.createWrappingKeyPayload = &createWrappingKeyPayload - return r -} - -func (r ApiCreateWrappingKeyRequest) Execute() (*WrappingKey, error) { - return r.ApiService.CreateWrappingKeyExecute(r) -} - -/* -CreateWrappingKey Create wrapping key - -Creates a new wrapping key for the given key ring. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @return ApiCreateWrappingKeyRequest - -Deprecated -*/ -func (a *DefaultAPIService) CreateWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string) ApiCreateWrappingKeyRequest { - return ApiCreateWrappingKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - } -} - -// Execute executes the request -// -// @return WrappingKey -// -// Deprecated -func (a *DefaultAPIService) CreateWrappingKeyExecute(r ApiCreateWrappingKeyRequest) (*WrappingKey, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *WrappingKey - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateWrappingKey") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/wrappingkeys" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.createWrappingKeyPayload == nil { - return localVarReturnValue, reportError("createWrappingKeyPayload is required and must be specified") - } - - // 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.createWrappingKeyPayload - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiDecryptRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string - versionNumber int64 - decryptPayload *DecryptPayload -} - -func (r ApiDecryptRequest) DecryptPayload(decryptPayload DecryptPayload) ApiDecryptRequest { - r.decryptPayload = &decryptPayload - return r -} - -func (r ApiDecryptRequest) Execute() (*DecryptedData, error) { - return r.ApiService.DecryptExecute(r) -} - -/* -Decrypt Decrypt - -Decrypts data using the given key version. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiDecryptRequest - -Deprecated -*/ -func (a *DefaultAPIService) Decrypt(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDecryptRequest { - return ApiDecryptRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Execute executes the request -// -// @return DecryptedData -// -// Deprecated -func (a *DefaultAPIService) DecryptExecute(r ApiDecryptRequest) (*DecryptedData, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *DecryptedData - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.Decrypt") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/decrypt" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(parameterValueToString(r.keyId, "keyId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(parameterValueToString(r.versionNumber, "versionNumber")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.decryptPayload == nil { - return localVarReturnValue, reportError("decryptPayload is required and must be specified") - } - - // 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.decryptPayload - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 409 { - var v HttpError - 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 == 500 { - var v HttpError - 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 ApiDeleteKeyRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string -} - -func (r ApiDeleteKeyRequest) Execute() error { - return r.ApiService.DeleteKeyExecute(r) -} - -/* -DeleteKey Delete key - -Schedules the deletion of the given key - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @return ApiDeleteKeyRequest - -Deprecated -*/ -func (a *DefaultAPIService) DeleteKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiDeleteKeyRequest { - return ApiDeleteKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - } -} - -// Execute executes the request -// Deprecated -func (a *DefaultAPIService) DeleteKeyExecute(r ApiDeleteKeyRequest) error { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteKey") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -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 := 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 HttpError - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiDeleteKeyRingRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string -} - -func (r ApiDeleteKeyRingRequest) Execute() error { - return r.ApiService.DeleteKeyRingExecute(r) -} - -/* -DeleteKeyRing Delete keyring - -Deletes the given key ring if it is empty - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @return ApiDeleteKeyRingRequest - -Deprecated -*/ -func (a *DefaultAPIService) DeleteKeyRing(ctx context.Context, projectId string, regionId string, keyRingId string) ApiDeleteKeyRingRequest { - return ApiDeleteKeyRingRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - } -} - -// Execute executes the request -// Deprecated -func (a *DefaultAPIService) DeleteKeyRingExecute(r ApiDeleteKeyRingRequest) error { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteKeyRing") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -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 HttpError - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiDeleteWrappingKeyRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - wrappingKeyId string -} - -func (r ApiDeleteWrappingKeyRequest) Execute() error { - return r.ApiService.DeleteWrappingKeyExecute(r) -} - -/* -DeleteWrappingKey Delete wrapping key - -Deletes the given wrapping key - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param wrappingKeyId The wrapping key UUID. - @return ApiDeleteWrappingKeyRequest - -Deprecated -*/ -func (a *DefaultAPIService) DeleteWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) ApiDeleteWrappingKeyRequest { - return ApiDeleteWrappingKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - wrappingKeyId: wrappingKeyId, - } -} - -// Execute executes the request -// Deprecated -func (a *DefaultAPIService) DeleteWrappingKeyExecute(r ApiDeleteWrappingKeyRequest) error { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteWrappingKey") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/wrappingkeys/{wrappingKeyId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"wrappingKeyId"+"}", url.PathEscape(parameterValueToString(r.wrappingKeyId, "wrappingKeyId")), -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 HttpError - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiDestroyVersionRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string - versionNumber int64 -} - -func (r ApiDestroyVersionRequest) Execute() error { - return r.ApiService.DestroyVersionExecute(r) -} - -/* -DestroyVersion Destroy version - -Removes the key material of a version permanently. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiDestroyVersionRequest - -Deprecated -*/ -func (a *DefaultAPIService) DestroyVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDestroyVersionRequest { - return ApiDestroyVersionRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Execute executes the request -// Deprecated -func (a *DefaultAPIService) DestroyVersionExecute(r ApiDestroyVersionRequest) error { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DestroyVersion") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/destroy" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(parameterValueToString(r.keyId, "keyId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(parameterValueToString(r.versionNumber, "versionNumber")), -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 HttpError - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiDisableVersionRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string - versionNumber int64 -} - -func (r ApiDisableVersionRequest) Execute() error { - return r.ApiService.DisableVersionExecute(r) -} - -/* -DisableVersion Disable version - -Disables the given version. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiDisableVersionRequest - -Deprecated -*/ -func (a *DefaultAPIService) DisableVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDisableVersionRequest { - return ApiDisableVersionRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Execute executes the request -// Deprecated -func (a *DefaultAPIService) DisableVersionExecute(r ApiDisableVersionRequest) error { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DisableVersion") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/disable" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(parameterValueToString(r.keyId, "keyId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(parameterValueToString(r.versionNumber, "versionNumber")), -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 HttpError - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiEnableVersionRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string - versionNumber int64 -} - -func (r ApiEnableVersionRequest) Execute() error { - return r.ApiService.EnableVersionExecute(r) -} - -/* -EnableVersion Enable version - -Enables the given version. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiEnableVersionRequest - -Deprecated -*/ -func (a *DefaultAPIService) EnableVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiEnableVersionRequest { - return ApiEnableVersionRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Execute executes the request -// Deprecated -func (a *DefaultAPIService) EnableVersionExecute(r ApiEnableVersionRequest) error { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.EnableVersion") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/enable" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(parameterValueToString(r.keyId, "keyId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(parameterValueToString(r.versionNumber, "versionNumber")), -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 HttpError - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiEncryptRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string - versionNumber int64 - encryptPayload *EncryptPayload -} - -func (r ApiEncryptRequest) EncryptPayload(encryptPayload EncryptPayload) ApiEncryptRequest { - r.encryptPayload = &encryptPayload - return r -} - -func (r ApiEncryptRequest) Execute() (*EncryptedData, error) { - return r.ApiService.EncryptExecute(r) -} - -/* -Encrypt Encrypt - -Encrypts data using the given key version. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiEncryptRequest - -Deprecated -*/ -func (a *DefaultAPIService) Encrypt(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiEncryptRequest { - return ApiEncryptRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Execute executes the request -// -// @return EncryptedData -// -// Deprecated -func (a *DefaultAPIService) EncryptExecute(r ApiEncryptRequest) (*EncryptedData, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *EncryptedData - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.Encrypt") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/encrypt" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(parameterValueToString(r.keyId, "keyId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(parameterValueToString(r.versionNumber, "versionNumber")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.encryptPayload == nil { - return localVarReturnValue, reportError("encryptPayload is required and must be specified") - } - - // 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.encryptPayload - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 409 { - var v HttpError - 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 == 500 { - var v HttpError - 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 ApiGetKeyRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string -} - -func (r ApiGetKeyRequest) Execute() (*Key, error) { - return r.ApiService.GetKeyExecute(r) -} - -/* -GetKey Get key - -Returns the details for the given key. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @return ApiGetKeyRequest - -Deprecated -*/ -func (a *DefaultAPIService) GetKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiGetKeyRequest { - return ApiGetKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - } -} - -// Execute executes the request -// -// @return Key -// -// Deprecated -func (a *DefaultAPIService) GetKeyExecute(r ApiGetKeyRequest) (*Key, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Key - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetKey") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -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 := 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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiGetKeyRingRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string -} - -func (r ApiGetKeyRingRequest) Execute() (*KeyRing, error) { - return r.ApiService.GetKeyRingExecute(r) -} - -/* -GetKeyRing Get key ring - -Returns the details for the given key ring. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @return ApiGetKeyRingRequest - -Deprecated -*/ -func (a *DefaultAPIService) GetKeyRing(ctx context.Context, projectId string, regionId string, keyRingId string) ApiGetKeyRingRequest { - return ApiGetKeyRingRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - } -} - -// Execute executes the request -// -// @return KeyRing -// -// Deprecated -func (a *DefaultAPIService) GetKeyRingExecute(r ApiGetKeyRingRequest) (*KeyRing, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *KeyRing - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetKeyRing") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiGetVersionRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string - versionNumber int64 -} - -func (r ApiGetVersionRequest) Execute() (*Version, error) { - return r.ApiService.GetVersionExecute(r) -} - -/* -GetVersion Get version - -Returns the details for the given version. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiGetVersionRequest - -Deprecated -*/ -func (a *DefaultAPIService) GetVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiGetVersionRequest { - return ApiGetVersionRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Execute executes the request -// -// @return Version -// -// Deprecated -func (a *DefaultAPIService) GetVersionExecute(r ApiGetVersionRequest) (*Version, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Version - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetVersion") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(parameterValueToString(r.keyId, "keyId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(parameterValueToString(r.versionNumber, "versionNumber")), -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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiGetWrappingKeyRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - wrappingKeyId string -} - -func (r ApiGetWrappingKeyRequest) Execute() (*WrappingKey, error) { - return r.ApiService.GetWrappingKeyExecute(r) -} - -/* -GetWrappingKey Get wrapping key - -Returns the details for the given wrapping key. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param wrappingKeyId The wrapping key UUID. - @return ApiGetWrappingKeyRequest - -Deprecated -*/ -func (a *DefaultAPIService) GetWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) ApiGetWrappingKeyRequest { - return ApiGetWrappingKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - wrappingKeyId: wrappingKeyId, - } -} - -// Execute executes the request -// -// @return WrappingKey -// -// Deprecated -func (a *DefaultAPIService) GetWrappingKeyExecute(r ApiGetWrappingKeyRequest) (*WrappingKey, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *WrappingKey - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetWrappingKey") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/wrappingkeys/{wrappingKeyId}" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"wrappingKeyId"+"}", url.PathEscape(parameterValueToString(r.wrappingKeyId, "wrappingKeyId")), -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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiImportKeyRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string - importKeyPayload *ImportKeyPayload -} - -func (r ApiImportKeyRequest) ImportKeyPayload(importKeyPayload ImportKeyPayload) ApiImportKeyRequest { - r.importKeyPayload = &importKeyPayload - return r -} - -func (r ApiImportKeyRequest) Execute() (*Version, error) { - return r.ApiService.ImportKeyExecute(r) -} - -/* -ImportKey Import key - -Imports a new version to the given key. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @return ApiImportKeyRequest - -Deprecated -*/ -func (a *DefaultAPIService) ImportKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiImportKeyRequest { - return ApiImportKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - } -} - -// Execute executes the request -// -// @return Version -// -// Deprecated -func (a *DefaultAPIService) ImportKeyExecute(r ApiImportKeyRequest) (*Version, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Version - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ImportKey") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/import" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(parameterValueToString(r.keyId, "keyId")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.importKeyPayload == nil { - return localVarReturnValue, reportError("importKeyPayload is required and must be specified") - } - - // 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.importKeyPayload - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 409 { - var v HttpError - 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 == 500 { - var v HttpError - 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 ApiListKeyRingsRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string -} - -func (r ApiListKeyRingsRequest) Execute() (*KeyRingList, error) { - return r.ApiService.ListKeyRingsExecute(r) -} - -/* -ListKeyRings List key rings - -Returns a list of all key rings within the project. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @return ApiListKeyRingsRequest - -Deprecated -*/ -func (a *DefaultAPIService) ListKeyRings(ctx context.Context, projectId string, regionId string) ApiListKeyRingsRequest { - return ApiListKeyRingsRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - } -} - -// Execute executes the request -// -// @return KeyRingList -// -// Deprecated -func (a *DefaultAPIService) ListKeyRingsExecute(r ApiListKeyRingsRequest) (*KeyRingList, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *KeyRingList - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListKeyRings") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiListKeysRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string -} - -func (r ApiListKeysRequest) Execute() (*KeyList, error) { - return r.ApiService.ListKeysExecute(r) -} - -/* -ListKeys List keys - -Returns the keys for the given key ring. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @return ApiListKeysRequest - -Deprecated -*/ -func (a *DefaultAPIService) ListKeys(ctx context.Context, projectId string, regionId string, keyRingId string) ApiListKeysRequest { - return ApiListKeysRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - } -} - -// Execute executes the request -// -// @return KeyList -// -// Deprecated -func (a *DefaultAPIService) ListKeysExecute(r ApiListKeysRequest) (*KeyList, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *KeyList - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListKeys") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiListVersionsRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string -} - -func (r ApiListVersionsRequest) Execute() (*VersionList, error) { - return r.ApiService.ListVersionsExecute(r) -} - -/* -ListVersions List versions - -Returns a list of all versions of a given key. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @return ApiListVersionsRequest - -Deprecated -*/ -func (a *DefaultAPIService) ListVersions(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiListVersionsRequest { - return ApiListVersionsRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - } -} - -// Execute executes the request -// -// @return VersionList -// -// Deprecated -func (a *DefaultAPIService) ListVersionsExecute(r ApiListVersionsRequest) (*VersionList, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *VersionList - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListVersions") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -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 := 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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiListWrappingKeysRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string -} - -func (r ApiListWrappingKeysRequest) Execute() (*WrappingKeyList, error) { - return r.ApiService.ListWrappingKeysExecute(r) -} - -/* -ListWrappingKeys List wrapping keys - -Returns the wrapping keys for the given key ring. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @return ApiListWrappingKeysRequest - -Deprecated -*/ -func (a *DefaultAPIService) ListWrappingKeys(ctx context.Context, projectId string, regionId string, keyRingId string) ApiListWrappingKeysRequest { - return ApiListWrappingKeysRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - } -} - -// Execute executes the request -// -// @return WrappingKeyList -// -// Deprecated -func (a *DefaultAPIService) ListWrappingKeysExecute(r ApiListWrappingKeysRequest) (*WrappingKeyList, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *WrappingKeyList - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListWrappingKeys") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/wrappingkeys" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiRestoreKeyRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string -} - -func (r ApiRestoreKeyRequest) Execute() error { - return r.ApiService.RestoreKeyExecute(r) -} - -/* -RestoreKey Restore deleted key - -Restores the given key from being deleted. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @return ApiRestoreKeyRequest - -Deprecated -*/ -func (a *DefaultAPIService) RestoreKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiRestoreKeyRequest { - return ApiRestoreKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - } -} - -// Execute executes the request -// Deprecated -func (a *DefaultAPIService) RestoreKeyExecute(r ApiRestoreKeyRequest) error { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.RestoreKey") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/restore" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -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 := 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 HttpError - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiRestoreVersionRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string - versionNumber int64 -} - -func (r ApiRestoreVersionRequest) Execute() error { - return r.ApiService.RestoreVersionExecute(r) -} - -/* -RestoreVersion Restore version - -Restores the given version from being destroyed - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiRestoreVersionRequest - -Deprecated -*/ -func (a *DefaultAPIService) RestoreVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiRestoreVersionRequest { - return ApiRestoreVersionRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Execute executes the request -// Deprecated -func (a *DefaultAPIService) RestoreVersionExecute(r ApiRestoreVersionRequest) error { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.RestoreVersion") - if err != nil { - return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/restore" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(parameterValueToString(r.keyId, "keyId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(parameterValueToString(r.versionNumber, "versionNumber")), -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 HttpError - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 500 { - var v HttpError - 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 ApiRotateKeyRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string -} - -func (r ApiRotateKeyRequest) Execute() (*Version, error) { - return r.ApiService.RotateKeyExecute(r) -} - -/* -RotateKey Rotate key - -Rotates the given key. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @return ApiRotateKeyRequest - -Deprecated -*/ -func (a *DefaultAPIService) RotateKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiRotateKeyRequest { - return ApiRotateKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - } -} - -// Execute executes the request -// -// @return Version -// -// Deprecated -func (a *DefaultAPIService) RotateKeyExecute(r ApiRotateKeyRequest) (*Version, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Version - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.RotateKey") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/rotate" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -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 := 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 HttpError - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 409 { - var v HttpError - 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 == 500 { - var v HttpError - 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 ApiSignRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string - versionNumber int64 - signPayload *SignPayload -} - -func (r ApiSignRequest) SignPayload(signPayload SignPayload) ApiSignRequest { - r.signPayload = &signPayload - return r -} - -func (r ApiSignRequest) Execute() (*SignedData, error) { - return r.ApiService.SignExecute(r) -} - -/* -Sign Sign - -Sign data using the given key version as secret. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiSignRequest - -Deprecated -*/ -func (a *DefaultAPIService) Sign(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiSignRequest { - return ApiSignRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Execute executes the request -// -// @return SignedData -// -// Deprecated -func (a *DefaultAPIService) SignExecute(r ApiSignRequest) (*SignedData, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *SignedData - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.Sign") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/sign" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(parameterValueToString(r.keyId, "keyId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(parameterValueToString(r.versionNumber, "versionNumber")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.signPayload == nil { - return localVarReturnValue, reportError("signPayload is required and must be specified") - } - - // 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.signPayload - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 409 { - var v HttpError - 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 == 500 { - var v HttpError - 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 ApiVerifyRequest struct { - ctx context.Context - ApiService DefaultAPI - projectId string - regionId string - keyRingId string - keyId string - versionNumber int64 - verifyPayload *VerifyPayload -} - -func (r ApiVerifyRequest) VerifyPayload(verifyPayload VerifyPayload) ApiVerifyRequest { - r.verifyPayload = &verifyPayload - return r -} - -func (r ApiVerifyRequest) Execute() (*VerifiedData, error) { - return r.ApiService.VerifyExecute(r) -} - -/* -Verify Verify - -Verify data using the given key version as secret. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param projectId The STACKIT portal project UUID the key ring is part of. - @param regionId The STACKIT region name the key ring is located in. - @param keyRingId The key ring UUID. - @param keyId The key UUID. - @param versionNumber The version number. - @return ApiVerifyRequest - -Deprecated -*/ -func (a *DefaultAPIService) Verify(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiVerifyRequest { - return ApiVerifyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Execute executes the request -// -// @return VerifiedData -// -// Deprecated -func (a *DefaultAPIService) VerifyExecute(r ApiVerifyRequest) (*VerifiedData, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *VerifiedData - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.Verify") - if err != nil { - return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} - } - - localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/keyrings/{keyRingId}/keys/{keyId}/versions/{versionNumber}/verify" - localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyRingId"+"}", url.PathEscape(parameterValueToString(r.keyRingId, "keyRingId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", url.PathEscape(parameterValueToString(r.keyId, "keyId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"versionNumber"+"}", url.PathEscape(parameterValueToString(r.versionNumber, "versionNumber")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.verifyPayload == nil { - return localVarReturnValue, reportError("verifyPayload is required and must be specified") - } - - // 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.verifyPayload - 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 HttpError - 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 HttpError - 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 HttpError - 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 == 409 { - var v HttpError - 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 == 500 { - var v HttpError - 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 -} diff --git a/services/kms/v1betaapi/api_default_mock.go b/services/kms/v1betaapi/api_default_mock.go deleted file mode 100644 index c4c1c5409..000000000 --- a/services/kms/v1betaapi/api_default_mock.go +++ /dev/null @@ -1,614 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "context" -) - -// assert the implementation matches the interface -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 { - // Deprecated: CreateKeyExecuteMock can be populated to implement the behavior of the CreateKeyExecute function of this mock - CreateKeyExecuteMock *func(r ApiCreateKeyRequest) (*Key, error) - // Deprecated: CreateKeyRingExecuteMock can be populated to implement the behavior of the CreateKeyRingExecute function of this mock - CreateKeyRingExecuteMock *func(r ApiCreateKeyRingRequest) (*KeyRing, error) - // Deprecated: CreateWrappingKeyExecuteMock can be populated to implement the behavior of the CreateWrappingKeyExecute function of this mock - CreateWrappingKeyExecuteMock *func(r ApiCreateWrappingKeyRequest) (*WrappingKey, error) - // Deprecated: DecryptExecuteMock can be populated to implement the behavior of the DecryptExecute function of this mock - DecryptExecuteMock *func(r ApiDecryptRequest) (*DecryptedData, error) - // Deprecated: DeleteKeyExecuteMock can be populated to implement the behavior of the DeleteKeyExecute function of this mock - DeleteKeyExecuteMock *func(r ApiDeleteKeyRequest) error - // Deprecated: DeleteKeyRingExecuteMock can be populated to implement the behavior of the DeleteKeyRingExecute function of this mock - DeleteKeyRingExecuteMock *func(r ApiDeleteKeyRingRequest) error - // Deprecated: DeleteWrappingKeyExecuteMock can be populated to implement the behavior of the DeleteWrappingKeyExecute function of this mock - DeleteWrappingKeyExecuteMock *func(r ApiDeleteWrappingKeyRequest) error - // Deprecated: DestroyVersionExecuteMock can be populated to implement the behavior of the DestroyVersionExecute function of this mock - DestroyVersionExecuteMock *func(r ApiDestroyVersionRequest) error - // Deprecated: DisableVersionExecuteMock can be populated to implement the behavior of the DisableVersionExecute function of this mock - DisableVersionExecuteMock *func(r ApiDisableVersionRequest) error - // Deprecated: EnableVersionExecuteMock can be populated to implement the behavior of the EnableVersionExecute function of this mock - EnableVersionExecuteMock *func(r ApiEnableVersionRequest) error - // Deprecated: EncryptExecuteMock can be populated to implement the behavior of the EncryptExecute function of this mock - EncryptExecuteMock *func(r ApiEncryptRequest) (*EncryptedData, error) - // Deprecated: GetKeyExecuteMock can be populated to implement the behavior of the GetKeyExecute function of this mock - GetKeyExecuteMock *func(r ApiGetKeyRequest) (*Key, error) - // Deprecated: GetKeyRingExecuteMock can be populated to implement the behavior of the GetKeyRingExecute function of this mock - GetKeyRingExecuteMock *func(r ApiGetKeyRingRequest) (*KeyRing, error) - // Deprecated: GetVersionExecuteMock can be populated to implement the behavior of the GetVersionExecute function of this mock - GetVersionExecuteMock *func(r ApiGetVersionRequest) (*Version, error) - // Deprecated: GetWrappingKeyExecuteMock can be populated to implement the behavior of the GetWrappingKeyExecute function of this mock - GetWrappingKeyExecuteMock *func(r ApiGetWrappingKeyRequest) (*WrappingKey, error) - // Deprecated: ImportKeyExecuteMock can be populated to implement the behavior of the ImportKeyExecute function of this mock - ImportKeyExecuteMock *func(r ApiImportKeyRequest) (*Version, error) - // Deprecated: ListKeyRingsExecuteMock can be populated to implement the behavior of the ListKeyRingsExecute function of this mock - ListKeyRingsExecuteMock *func(r ApiListKeyRingsRequest) (*KeyRingList, error) - // Deprecated: ListKeysExecuteMock can be populated to implement the behavior of the ListKeysExecute function of this mock - ListKeysExecuteMock *func(r ApiListKeysRequest) (*KeyList, error) - // Deprecated: ListVersionsExecuteMock can be populated to implement the behavior of the ListVersionsExecute function of this mock - ListVersionsExecuteMock *func(r ApiListVersionsRequest) (*VersionList, error) - // Deprecated: ListWrappingKeysExecuteMock can be populated to implement the behavior of the ListWrappingKeysExecute function of this mock - ListWrappingKeysExecuteMock *func(r ApiListWrappingKeysRequest) (*WrappingKeyList, error) - // Deprecated: RestoreKeyExecuteMock can be populated to implement the behavior of the RestoreKeyExecute function of this mock - RestoreKeyExecuteMock *func(r ApiRestoreKeyRequest) error - // Deprecated: RestoreVersionExecuteMock can be populated to implement the behavior of the RestoreVersionExecute function of this mock - RestoreVersionExecuteMock *func(r ApiRestoreVersionRequest) error - // Deprecated: RotateKeyExecuteMock can be populated to implement the behavior of the RotateKeyExecute function of this mock - RotateKeyExecuteMock *func(r ApiRotateKeyRequest) (*Version, error) - // Deprecated: SignExecuteMock can be populated to implement the behavior of the SignExecute function of this mock - SignExecuteMock *func(r ApiSignRequest) (*SignedData, error) - // Deprecated: VerifyExecuteMock can be populated to implement the behavior of the VerifyExecute function of this mock - VerifyExecuteMock *func(r ApiVerifyRequest) (*VerifiedData, error) -} - -// Deprecated -func (a DefaultAPIServiceMock) CreateKey(ctx context.Context, projectId string, regionId string, keyRingId string) ApiCreateKeyRequest { - return ApiCreateKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - } -} - -// Deprecated: CreateKeyExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateKeyExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) CreateKeyExecute(r ApiCreateKeyRequest) (*Key, error) { - if a.CreateKeyExecuteMock == nil { - var localVarReturnValue *Key - return localVarReturnValue, nil - } - - return (*a.CreateKeyExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) CreateKeyRing(ctx context.Context, projectId string, regionId string) ApiCreateKeyRingRequest { - return ApiCreateKeyRingRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - } -} - -// Deprecated: CreateKeyRingExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateKeyRingExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) CreateKeyRingExecute(r ApiCreateKeyRingRequest) (*KeyRing, error) { - if a.CreateKeyRingExecuteMock == nil { - var localVarReturnValue *KeyRing - return localVarReturnValue, nil - } - - return (*a.CreateKeyRingExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) CreateWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string) ApiCreateWrappingKeyRequest { - return ApiCreateWrappingKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - } -} - -// Deprecated: CreateWrappingKeyExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateWrappingKeyExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) CreateWrappingKeyExecute(r ApiCreateWrappingKeyRequest) (*WrappingKey, error) { - if a.CreateWrappingKeyExecuteMock == nil { - var localVarReturnValue *WrappingKey - return localVarReturnValue, nil - } - - return (*a.CreateWrappingKeyExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) Decrypt(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDecryptRequest { - return ApiDecryptRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Deprecated: DecryptExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DecryptExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) DecryptExecute(r ApiDecryptRequest) (*DecryptedData, error) { - if a.DecryptExecuteMock == nil { - var localVarReturnValue *DecryptedData - return localVarReturnValue, nil - } - - return (*a.DecryptExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) DeleteKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiDeleteKeyRequest { - return ApiDeleteKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - } -} - -// Deprecated: DeleteKeyExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteKeyExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) DeleteKeyExecute(r ApiDeleteKeyRequest) error { - if a.DeleteKeyExecuteMock == nil { - return nil - } - - return (*a.DeleteKeyExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) DeleteKeyRing(ctx context.Context, projectId string, regionId string, keyRingId string) ApiDeleteKeyRingRequest { - return ApiDeleteKeyRingRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - } -} - -// Deprecated: DeleteKeyRingExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteKeyRingExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) DeleteKeyRingExecute(r ApiDeleteKeyRingRequest) error { - if a.DeleteKeyRingExecuteMock == nil { - return nil - } - - return (*a.DeleteKeyRingExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) DeleteWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) ApiDeleteWrappingKeyRequest { - return ApiDeleteWrappingKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - wrappingKeyId: wrappingKeyId, - } -} - -// Deprecated: DeleteWrappingKeyExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteWrappingKeyExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) DeleteWrappingKeyExecute(r ApiDeleteWrappingKeyRequest) error { - if a.DeleteWrappingKeyExecuteMock == nil { - return nil - } - - return (*a.DeleteWrappingKeyExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) DestroyVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDestroyVersionRequest { - return ApiDestroyVersionRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Deprecated: DestroyVersionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DestroyVersionExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) DestroyVersionExecute(r ApiDestroyVersionRequest) error { - if a.DestroyVersionExecuteMock == nil { - return nil - } - - return (*a.DestroyVersionExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) DisableVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiDisableVersionRequest { - return ApiDisableVersionRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Deprecated: DisableVersionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DisableVersionExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) DisableVersionExecute(r ApiDisableVersionRequest) error { - if a.DisableVersionExecuteMock == nil { - return nil - } - - return (*a.DisableVersionExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) EnableVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiEnableVersionRequest { - return ApiEnableVersionRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Deprecated: EnableVersionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the EnableVersionExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) EnableVersionExecute(r ApiEnableVersionRequest) error { - if a.EnableVersionExecuteMock == nil { - return nil - } - - return (*a.EnableVersionExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) Encrypt(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiEncryptRequest { - return ApiEncryptRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Deprecated: EncryptExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the EncryptExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) EncryptExecute(r ApiEncryptRequest) (*EncryptedData, error) { - if a.EncryptExecuteMock == nil { - var localVarReturnValue *EncryptedData - return localVarReturnValue, nil - } - - return (*a.EncryptExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) GetKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiGetKeyRequest { - return ApiGetKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - } -} - -// Deprecated: GetKeyExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetKeyExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) GetKeyExecute(r ApiGetKeyRequest) (*Key, error) { - if a.GetKeyExecuteMock == nil { - var localVarReturnValue *Key - return localVarReturnValue, nil - } - - return (*a.GetKeyExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) GetKeyRing(ctx context.Context, projectId string, regionId string, keyRingId string) ApiGetKeyRingRequest { - return ApiGetKeyRingRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - } -} - -// Deprecated: GetKeyRingExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetKeyRingExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) GetKeyRingExecute(r ApiGetKeyRingRequest) (*KeyRing, error) { - if a.GetKeyRingExecuteMock == nil { - var localVarReturnValue *KeyRing - return localVarReturnValue, nil - } - - return (*a.GetKeyRingExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) GetVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiGetVersionRequest { - return ApiGetVersionRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Deprecated: GetVersionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetVersionExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) GetVersionExecute(r ApiGetVersionRequest) (*Version, error) { - if a.GetVersionExecuteMock == nil { - var localVarReturnValue *Version - return localVarReturnValue, nil - } - - return (*a.GetVersionExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) GetWrappingKey(ctx context.Context, projectId string, regionId string, keyRingId string, wrappingKeyId string) ApiGetWrappingKeyRequest { - return ApiGetWrappingKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - wrappingKeyId: wrappingKeyId, - } -} - -// Deprecated: GetWrappingKeyExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetWrappingKeyExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) GetWrappingKeyExecute(r ApiGetWrappingKeyRequest) (*WrappingKey, error) { - if a.GetWrappingKeyExecuteMock == nil { - var localVarReturnValue *WrappingKey - return localVarReturnValue, nil - } - - return (*a.GetWrappingKeyExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) ImportKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiImportKeyRequest { - return ApiImportKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - } -} - -// Deprecated: ImportKeyExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ImportKeyExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) ImportKeyExecute(r ApiImportKeyRequest) (*Version, error) { - if a.ImportKeyExecuteMock == nil { - var localVarReturnValue *Version - return localVarReturnValue, nil - } - - return (*a.ImportKeyExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) ListKeyRings(ctx context.Context, projectId string, regionId string) ApiListKeyRingsRequest { - return ApiListKeyRingsRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - } -} - -// Deprecated: ListKeyRingsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListKeyRingsExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) ListKeyRingsExecute(r ApiListKeyRingsRequest) (*KeyRingList, error) { - if a.ListKeyRingsExecuteMock == nil { - var localVarReturnValue *KeyRingList - return localVarReturnValue, nil - } - - return (*a.ListKeyRingsExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) ListKeys(ctx context.Context, projectId string, regionId string, keyRingId string) ApiListKeysRequest { - return ApiListKeysRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - } -} - -// Deprecated: ListKeysExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListKeysExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) ListKeysExecute(r ApiListKeysRequest) (*KeyList, error) { - if a.ListKeysExecuteMock == nil { - var localVarReturnValue *KeyList - return localVarReturnValue, nil - } - - return (*a.ListKeysExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) ListVersions(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiListVersionsRequest { - return ApiListVersionsRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - } -} - -// Deprecated: ListVersionsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListVersionsExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) ListVersionsExecute(r ApiListVersionsRequest) (*VersionList, error) { - if a.ListVersionsExecuteMock == nil { - var localVarReturnValue *VersionList - return localVarReturnValue, nil - } - - return (*a.ListVersionsExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) ListWrappingKeys(ctx context.Context, projectId string, regionId string, keyRingId string) ApiListWrappingKeysRequest { - return ApiListWrappingKeysRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - } -} - -// Deprecated: ListWrappingKeysExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListWrappingKeysExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) ListWrappingKeysExecute(r ApiListWrappingKeysRequest) (*WrappingKeyList, error) { - if a.ListWrappingKeysExecuteMock == nil { - var localVarReturnValue *WrappingKeyList - return localVarReturnValue, nil - } - - return (*a.ListWrappingKeysExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) RestoreKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiRestoreKeyRequest { - return ApiRestoreKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - } -} - -// Deprecated: RestoreKeyExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the RestoreKeyExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) RestoreKeyExecute(r ApiRestoreKeyRequest) error { - if a.RestoreKeyExecuteMock == nil { - return nil - } - - return (*a.RestoreKeyExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) RestoreVersion(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiRestoreVersionRequest { - return ApiRestoreVersionRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Deprecated: RestoreVersionExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the RestoreVersionExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) RestoreVersionExecute(r ApiRestoreVersionRequest) error { - if a.RestoreVersionExecuteMock == nil { - return nil - } - - return (*a.RestoreVersionExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) RotateKey(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string) ApiRotateKeyRequest { - return ApiRotateKeyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - } -} - -// Deprecated: RotateKeyExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the RotateKeyExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) RotateKeyExecute(r ApiRotateKeyRequest) (*Version, error) { - if a.RotateKeyExecuteMock == nil { - var localVarReturnValue *Version - return localVarReturnValue, nil - } - - return (*a.RotateKeyExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) Sign(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiSignRequest { - return ApiSignRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Deprecated: SignExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the SignExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) SignExecute(r ApiSignRequest) (*SignedData, error) { - if a.SignExecuteMock == nil { - var localVarReturnValue *SignedData - return localVarReturnValue, nil - } - - return (*a.SignExecuteMock)(r) -} - -// Deprecated -func (a DefaultAPIServiceMock) Verify(ctx context.Context, projectId string, regionId string, keyRingId string, keyId string, versionNumber int64) ApiVerifyRequest { - return ApiVerifyRequest{ - ApiService: a, - ctx: ctx, - projectId: projectId, - regionId: regionId, - keyRingId: keyRingId, - keyId: keyId, - versionNumber: versionNumber, - } -} - -// Deprecated: VerifyExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the VerifyExecuteMock field in the DefaultAPIServiceMock struct. -func (a DefaultAPIServiceMock) VerifyExecute(r ApiVerifyRequest) (*VerifiedData, error) { - if a.VerifyExecuteMock == nil { - var localVarReturnValue *VerifiedData - return localVarReturnValue, nil - } - - return (*a.VerifyExecuteMock)(r) -} diff --git a/services/kms/v1betaapi/client.go b/services/kms/v1betaapi/client.go deleted file mode 100644 index 254d26e6f..000000000 --- a/services/kms/v1betaapi/client.go +++ /dev/null @@ -1,658 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package v1betaapi - -import ( - "bytes" - "context" - "encoding/json" - "encoding/xml" - "errors" - "fmt" - "io" - "log" - "mime/multipart" - "net/http" - "net/http/httputil" - "net/url" - "os" - "path/filepath" - "reflect" - "regexp" - "strconv" - "strings" - "time" - "unicode/utf8" - - "github.com/stackitcloud/stackit-sdk-go/core/auth" - "github.com/stackitcloud/stackit-sdk-go/core/config" -) - -var ( - JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) - XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) - queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) - queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") -) - -// APIClient manages communication with the STACKIT Key Management Service API API v1beta.0.0 -// In most cases there should be only one, shared, APIClient. -type APIClient struct { - cfg *config.Configuration - common service // Reuse a single struct instead of allocating one for each service on the heap. - - // API Services - - DefaultAPI DefaultAPI -} - -type service struct { - client *APIClient -} - -// NewAPIClient creates a new API client. Requires a userAgent string describing your application. -// optionally a custom http.Client to allow for advanced features such as caching. -func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { - cfg := NewConfiguration() - - for _, option := range opts { - err := option(cfg) - if err != nil { - return nil, fmt.Errorf("configuring the client: %w", err) - } - } - - err := config.ConfigureRegion(cfg) - if err != nil { - return nil, fmt.Errorf("configuring region: %w", err) - } - - if cfg.HTTPClient == nil { - cfg.HTTPClient = &http.Client{} - } - - authRoundTripper, err := auth.SetupAuth(cfg) - if err != nil { - return nil, fmt.Errorf("setting up authentication: %w", err) - } - - roundTripper := authRoundTripper - if cfg.Middleware != nil { - roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) - } - - cfg.HTTPClient.Transport = roundTripper - - c := &APIClient{} - c.cfg = cfg - c.common.client = c - - // API Services - c.DefaultAPI = (*DefaultAPIService)(&c.common) - - return c, nil -} - -func atoi(in string) (int, error) { - return strconv.Atoi(in) -} - -// selectHeaderContentType select a content type from the available list. -func selectHeaderContentType(contentTypes []string) string { - if len(contentTypes) == 0 { - return "" - } - if contains(contentTypes, "application/json") { - return "application/json" - } - return contentTypes[0] // use the first content type specified in 'consumes' -} - -// selectHeaderAccept join all accept types and return -func selectHeaderAccept(accepts []string) string { - if len(accepts) == 0 { - return "" - } - - if contains(accepts, "application/json") { - return "application/json" - } - - return strings.Join(accepts, ",") -} - -// contains is a case insensitive match, finding needle in a haystack -func contains(haystack []string, needle string) bool { - for _, a := range haystack { - if strings.EqualFold(a, needle) { - return true - } - } - return false -} - -// Verify optional parameters are of the correct type. -func typeCheckParameter(obj interface{}, expected string, name string) error { - // Make sure there is an object. - if obj == nil { - return nil - } - - // Check the type is as expected. - if reflect.TypeOf(obj).String() != expected { - return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) - } - return nil -} - -func parameterValueToString(obj interface{}, key string) string { - if reflect.TypeOf(obj).Kind() != reflect.Ptr { - if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { - return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) - } - - return fmt.Sprintf("%v", obj) - } - var param, ok = obj.(MappedNullable) - if !ok { - return "" - } - dataMap, err := param.ToMap() - if err != nil { - return "" - } - return fmt.Sprintf("%v", dataMap[key]) -} - -// parameterAddToHeaderOrQuery adds the provided object to the request header or url query -// supporting deep object syntax -func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { - var v = reflect.ValueOf(obj) - var value = "" - if v == reflect.ValueOf(nil) { - value = "null" - } else { - switch v.Kind() { - case reflect.Invalid: - value = "invalid" - - case reflect.Struct: - if t, ok := obj.(MappedNullable); ok { - dataMap, err := t.ToMap() - if err != nil { - return - } - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) - return - } - if t, ok := obj.(time.Time); ok { - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) - return - } - value = v.Type().String() + " value" - case reflect.Slice: - var indValue = reflect.ValueOf(obj) - if indValue == reflect.ValueOf(nil) { - return - } - var lenIndValue = indValue.Len() - for i := 0; i < lenIndValue; i++ { - var arrayValue = indValue.Index(i) - var keyPrefixForCollectionType = keyPrefix - if style == "deepObject" { - keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" - } - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) - } - return - - case reflect.Map: - var indValue = reflect.ValueOf(obj) - if indValue == reflect.ValueOf(nil) { - return - } - iter := indValue.MapRange() - for iter.Next() { - k, v := iter.Key(), iter.Value() - parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) - } - return - - case reflect.Interface: - fallthrough - case reflect.Ptr: - parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) - return - - case reflect.Int, reflect.Int8, reflect.Int16, - reflect.Int32, reflect.Int64: - value = strconv.FormatInt(v.Int(), 10) - case reflect.Uint, reflect.Uint8, reflect.Uint16, - reflect.Uint32, reflect.Uint64, reflect.Uintptr: - value = strconv.FormatUint(v.Uint(), 10) - case reflect.Float32, reflect.Float64: - value = strconv.FormatFloat(v.Float(), 'g', -1, 32) - case reflect.Bool: - value = strconv.FormatBool(v.Bool()) - case reflect.String: - value = v.String() - default: - value = v.Type().String() + " value" - } - } - - switch valuesMap := headerOrQueryParams.(type) { - case url.Values: - if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { - valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) - } else { - valuesMap.Add(keyPrefix, value) - } - break - case map[string]string: - valuesMap[keyPrefix] = value - break - } -} - -// helper for converting interface{} parameters to json strings -func parameterToJson(obj interface{}) (string, error) { - jsonBuf, err := json.Marshal(obj) - if err != nil { - return "", err - } - return string(jsonBuf), err -} - -// callAPI do the request. -func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { - if c.cfg.Debug { - dump, err := httputil.DumpRequestOut(request, true) - if err != nil { - return nil, err - } - log.Printf("\n%s\n", string(dump)) - } - - resp, err := c.cfg.HTTPClient.Do(request) - if err != nil { - return resp, err - } - - if c.cfg.Debug { - dump, err := httputil.DumpResponse(resp, true) - if err != nil { - return resp, err - } - log.Printf("\n%s\n", string(dump)) - } - return resp, err -} - -// Allow modification of underlying config for alternate implementations and testing -// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior -func (c *APIClient) GetConfig() *config.Configuration { - return c.cfg -} - -type formFile struct { - fileBytes []byte - fileName string - formFileName string -} - -// prepareRequest build the request -func (c *APIClient) prepareRequest( - ctx context.Context, - path string, method string, - postBody interface{}, - headerParams map[string]string, - queryParams url.Values, - formParams url.Values, - formFiles []formFile) (localVarRequest *http.Request, err error) { - - var body *bytes.Buffer - - // Detect postBody type and post. - if postBody != nil { - contentType := headerParams["Content-Type"] - if contentType == "" { - contentType = detectContentType(postBody) - headerParams["Content-Type"] = contentType - } - - body, err = setBody(postBody, contentType) - if err != nil { - return nil, err - } - } - - // add form parameters and file if available. - if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { - if body != nil { - return nil, errors.New("Cannot specify postBody and multipart form at the same time.") - } - body = &bytes.Buffer{} - w := multipart.NewWriter(body) - - for k, v := range formParams { - for _, iv := range v { - if strings.HasPrefix(k, "@") { // file - err = addFile(w, k[1:], iv) - if err != nil { - return nil, err - } - } else { // form value - w.WriteField(k, iv) - } - } - } - for _, formFile := range formFiles { - if len(formFile.fileBytes) > 0 && formFile.fileName != "" { - w.Boundary() - part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) - if err != nil { - return nil, err - } - _, err = part.Write(formFile.fileBytes) - if err != nil { - return nil, err - } - } - } - - // Set the Boundary in the Content-Type - headerParams["Content-Type"] = w.FormDataContentType() - - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - w.Close() - } - - if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { - if body != nil { - return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") - } - body = &bytes.Buffer{} - body.WriteString(formParams.Encode()) - // Set Content-Length - headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) - } - - // Setup path and query parameters - url, err := url.Parse(path) - if err != nil { - return nil, err - } - - // Override request host, if applicable - if c.cfg.Host != "" { - url.Host = c.cfg.Host - } - - // Override request scheme, if applicable - if c.cfg.Scheme != "" { - url.Scheme = c.cfg.Scheme - } - - // Adding Query Param - query := url.Query() - for k, v := range queryParams { - for _, iv := range v { - query.Add(k, iv) - } - } - - // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { - pieces := strings.Split(s, "=") - pieces[0] = queryDescape.Replace(pieces[0]) - return strings.Join(pieces, "=") - }) - - // Generate a new request - if body != nil { - localVarRequest, err = http.NewRequest(method, url.String(), body) - } else { - localVarRequest, err = http.NewRequest(method, url.String(), nil) - } - if err != nil { - return nil, err - } - - // add header parameters, if any - if len(headerParams) > 0 { - headers := http.Header{} - for h, v := range headerParams { - headers[h] = []string{v} - } - localVarRequest.Header = headers - } - - // Add the user agent to the request. - localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) - - if ctx != nil { - // add context to the request - localVarRequest = localVarRequest.WithContext(ctx) - - // Walk through any authentication. - - } - - for header, value := range c.cfg.DefaultHeader { - localVarRequest.Header.Add(header, value) - } - return localVarRequest, nil -} - -func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { - if len(b) == 0 { - return nil - } - if s, ok := v.(*string); ok { - *s = string(b) - return nil - } - if f, ok := v.(*os.File); ok { - f, err = os.CreateTemp("", "HttpClientFile") - if err != nil { - return - } - _, err = f.Write(b) - if err != nil { - return - } - _, err = f.Seek(0, io.SeekStart) - return - } - if f, ok := v.(**os.File); ok { - *f, err = os.CreateTemp("", "HttpClientFile") - if err != nil { - return - } - _, err = (*f).Write(b) - if err != nil { - return - } - _, err = (*f).Seek(0, io.SeekStart) - return - } - if XmlCheck.MatchString(contentType) { - if err = xml.Unmarshal(b, v); err != nil { - return err - } - return nil - } - if JsonCheck.MatchString(contentType) { - if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas - if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined - if err = unmarshalObj.UnmarshalJSON(b); err != nil { - return err - } - } else { - return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") - } - } else if err = json.Unmarshal(b, v); err != nil { // simple model - return err - } - return nil - } - return errors.New("undefined response type") -} - -// Add a file to the multipart request -func addFile(w *multipart.Writer, fieldName, path string) error { - file, err := os.Open(filepath.Clean(path)) - if err != nil { - return err - } - defer file.Close() - - part, err := w.CreateFormFile(fieldName, filepath.Base(path)) - if err != nil { - return err - } - _, err = io.Copy(part, file) - - return err -} - -// Set request body from an interface{} -func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { - if bodyBuf == nil { - bodyBuf = &bytes.Buffer{} - } - - if reader, ok := body.(io.Reader); ok { - _, err = bodyBuf.ReadFrom(reader) - } else if fp, ok := body.(*os.File); ok { - _, err = bodyBuf.ReadFrom(fp) - } else if b, ok := body.([]byte); ok { - _, err = bodyBuf.Write(b) - } else if s, ok := body.(string); ok { - _, err = bodyBuf.WriteString(s) - } else if s, ok := body.(*string); ok { - _, err = bodyBuf.WriteString(*s) - } else if JsonCheck.MatchString(contentType) { - err = json.NewEncoder(bodyBuf).Encode(body) - } else if XmlCheck.MatchString(contentType) { - var bs []byte - bs, err = xml.Marshal(body) - if err == nil { - bodyBuf.Write(bs) - } - } - - if err != nil { - return nil, err - } - - if bodyBuf.Len() == 0 { - err = fmt.Errorf("invalid body type %s\n", contentType) - return nil, err - } - return bodyBuf, nil -} - -// detectContentType method is used to figure out `Request.Body` content type for request header -func detectContentType(body interface{}) string { - contentType := "text/plain; charset=utf-8" - kind := reflect.TypeOf(body).Kind() - - switch kind { - case reflect.Struct, reflect.Map, reflect.Ptr: - contentType = "application/json; charset=utf-8" - case reflect.String: - contentType = "text/plain; charset=utf-8" - default: - if b, ok := body.([]byte); ok { - contentType = http.DetectContentType(b) - } else if kind == reflect.Slice { - contentType = "application/json; charset=utf-8" - } - } - - return contentType -} - -// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go -type cacheControl map[string]string - -func parseCacheControl(headers http.Header) cacheControl { - cc := cacheControl{} - ccHeader := headers.Get("Cache-Control") - for _, part := range strings.Split(ccHeader, ",") { - part = strings.Trim(part, " ") - if part == "" { - continue - } - if strings.ContainsRune(part, '=') { - keyval := strings.Split(part, "=") - cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") - } else { - cc[part] = "" - } - } - return cc -} - -// CacheExpires helper function to determine remaining time before repeating a request. -func CacheExpires(r *http.Response) time.Time { - // Figure out when the cache expires. - var expires time.Time - now, err := time.Parse(time.RFC1123, r.Header.Get("date")) - if err != nil { - return time.Now() - } - respCacheControl := parseCacheControl(r.Header) - - if maxAge, ok := respCacheControl["max-age"]; ok { - lifetime, err := time.ParseDuration(maxAge + "s") - if err != nil { - expires = now - } else { - expires = now.Add(lifetime) - } - } else { - expiresHeader := r.Header.Get("Expires") - if expiresHeader != "" { - expires, err = time.Parse(time.RFC1123, expiresHeader) - if err != nil { - expires = now - } - } - } - return expires -} - -func strlen(s string) int { - return utf8.RuneCountInString(s) -} - -// format error message using title and detail when model implements rfc7807 -func formatErrorMessage(status string, v interface{}) string { - str := "" - metaValue := reflect.ValueOf(v).Elem() - - if metaValue.Kind() == reflect.Struct { - field := metaValue.FieldByName("Title") - if field != (reflect.Value{}) { - str = fmt.Sprintf("%s", field.Interface()) - } - - field = metaValue.FieldByName("Detail") - if field != (reflect.Value{}) { - str = fmt.Sprintf("%s (%s)", str, field.Interface()) - } - } - - return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) -} diff --git a/services/kms/v1betaapi/configuration.go b/services/kms/v1betaapi/configuration.go deleted file mode 100644 index 5d4ee8e50..000000000 --- a/services/kms/v1betaapi/configuration.go +++ /dev/null @@ -1,37 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. -package v1betaapi - -import ( - "github.com/stackitcloud/stackit-sdk-go/core/config" -) - -// NewConfiguration returns a new Configuration object -func NewConfiguration() *config.Configuration { - cfg := &config.Configuration{ - DefaultHeader: make(map[string]string), - UserAgent: "stackit-sdk-go/kms", - Debug: false, - Servers: config.ServerConfigurations{ - { - URL: "https://kms.api.stackit.cloud", - Description: "No description provided", - Variables: map[string]config.ServerVariable{ - "region": { - Description: "No description provided", - DefaultValue: "global", - }, - }, - }, - }, - OperationServers: map[string]config.ServerConfigurations{}, - } - return cfg -} diff --git a/services/kms/v1betaapi/model_access_scope.go b/services/kms/v1betaapi/model_access_scope.go deleted file mode 100644 index bdbe076c2..000000000 --- a/services/kms/v1betaapi/model_access_scope.go +++ /dev/null @@ -1,113 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// AccessScope The access scope of the key. -type AccessScope string - -// List of access_scope -const ( - ACCESSSCOPE_PUBLIC AccessScope = "PUBLIC" - ACCESSSCOPE_SNA AccessScope = "SNA" - ACCESSSCOPE_UNKNOWN_DEFAULT_OPEN_API AccessScope = "unknown_default_open_api" -) - -// All allowed values of AccessScope enum -var AllowedAccessScopeEnumValues = []AccessScope{ - "PUBLIC", - "SNA", - "unknown_default_open_api", -} - -func (v *AccessScope) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := AccessScope(value) - for _, existing := range AllowedAccessScopeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - *v = ACCESSSCOPE_UNKNOWN_DEFAULT_OPEN_API - return nil -} - -// NewAccessScopeFromValue returns a pointer to a valid AccessScope -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewAccessScopeFromValue(v string) (*AccessScope, error) { - ev := AccessScope(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for AccessScope: valid values are %v", v, AllowedAccessScopeEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v AccessScope) IsValid() bool { - for _, existing := range AllowedAccessScopeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to access_scope value -func (v AccessScope) Ptr() *AccessScope { - return &v -} - -type NullableAccessScope struct { - value *AccessScope - isSet bool -} - -func (v NullableAccessScope) Get() *AccessScope { - return v.value -} - -func (v *NullableAccessScope) Set(val *AccessScope) { - v.value = val - v.isSet = true -} - -func (v NullableAccessScope) IsSet() bool { - return v.isSet -} - -func (v *NullableAccessScope) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableAccessScope(val *AccessScope) *NullableAccessScope { - return &NullableAccessScope{value: val, isSet: true} -} - -func (v NullableAccessScope) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableAccessScope) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_algorithm.go b/services/kms/v1betaapi/model_algorithm.go deleted file mode 100644 index 35e988882..000000000 --- a/services/kms/v1betaapi/model_algorithm.go +++ /dev/null @@ -1,131 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// Algorithm The algorithm the key material uses. -type Algorithm string - -// List of algorithm -const ( - ALGORITHM_AES_256_GCM Algorithm = "aes_256_gcm" - ALGORITHM_RSA_2048_OAEP_SHA256 Algorithm = "rsa_2048_oaep_sha256" - ALGORITHM_RSA_3072_OAEP_SHA256 Algorithm = "rsa_3072_oaep_sha256" - ALGORITHM_RSA_4096_OAEP_SHA256 Algorithm = "rsa_4096_oaep_sha256" - ALGORITHM_RSA_4096_OAEP_SHA512 Algorithm = "rsa_4096_oaep_sha512" - ALGORITHM_HMAC_SHA256 Algorithm = "hmac_sha256" - ALGORITHM_HMAC_SHA384 Algorithm = "hmac_sha384" - ALGORITHM_HMAC_SHA512 Algorithm = "hmac_sha512" - ALGORITHM_ECDSA_P256_SHA256 Algorithm = "ecdsa_p256_sha256" - ALGORITHM_ECDSA_P384_SHA384 Algorithm = "ecdsa_p384_sha384" - ALGORITHM_ECDSA_P521_SHA512 Algorithm = "ecdsa_p521_sha512" - ALGORITHM_UNKNOWN_DEFAULT_OPEN_API Algorithm = "unknown_default_open_api" -) - -// All allowed values of Algorithm enum -var AllowedAlgorithmEnumValues = []Algorithm{ - "aes_256_gcm", - "rsa_2048_oaep_sha256", - "rsa_3072_oaep_sha256", - "rsa_4096_oaep_sha256", - "rsa_4096_oaep_sha512", - "hmac_sha256", - "hmac_sha384", - "hmac_sha512", - "ecdsa_p256_sha256", - "ecdsa_p384_sha384", - "ecdsa_p521_sha512", - "unknown_default_open_api", -} - -func (v *Algorithm) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := Algorithm(value) - for _, existing := range AllowedAlgorithmEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - *v = ALGORITHM_UNKNOWN_DEFAULT_OPEN_API - return nil -} - -// NewAlgorithmFromValue returns a pointer to a valid Algorithm -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewAlgorithmFromValue(v string) (*Algorithm, error) { - ev := Algorithm(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for Algorithm: valid values are %v", v, AllowedAlgorithmEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v Algorithm) IsValid() bool { - for _, existing := range AllowedAlgorithmEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to algorithm value -func (v Algorithm) Ptr() *Algorithm { - return &v -} - -type NullableAlgorithm struct { - value *Algorithm - isSet bool -} - -func (v NullableAlgorithm) Get() *Algorithm { - return v.value -} - -func (v *NullableAlgorithm) Set(val *Algorithm) { - v.value = val - v.isSet = true -} - -func (v NullableAlgorithm) IsSet() bool { - return v.isSet -} - -func (v *NullableAlgorithm) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableAlgorithm(val *Algorithm) *NullableAlgorithm { - return &NullableAlgorithm{value: val, isSet: true} -} - -func (v NullableAlgorithm) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableAlgorithm) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_backend.go b/services/kms/v1betaapi/model_backend.go deleted file mode 100644 index 53734f4d3..000000000 --- a/services/kms/v1betaapi/model_backend.go +++ /dev/null @@ -1,111 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// Backend The backend that is responsible for maintaining this key. Deprecated - use `protection`. -type Backend string - -// List of backend -const ( - BACKEND_SOFTWARE Backend = "software" - BACKEND_UNKNOWN_DEFAULT_OPEN_API Backend = "unknown_default_open_api" -) - -// All allowed values of Backend enum -var AllowedBackendEnumValues = []Backend{ - "software", - "unknown_default_open_api", -} - -func (v *Backend) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := Backend(value) - for _, existing := range AllowedBackendEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - *v = BACKEND_UNKNOWN_DEFAULT_OPEN_API - return nil -} - -// NewBackendFromValue returns a pointer to a valid Backend -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewBackendFromValue(v string) (*Backend, error) { - ev := Backend(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for Backend: valid values are %v", v, AllowedBackendEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v Backend) IsValid() bool { - for _, existing := range AllowedBackendEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to backend value -func (v Backend) Ptr() *Backend { - return &v -} - -type NullableBackend struct { - value *Backend - isSet bool -} - -func (v NullableBackend) Get() *Backend { - return v.value -} - -func (v *NullableBackend) Set(val *Backend) { - v.value = val - v.isSet = true -} - -func (v NullableBackend) IsSet() bool { - return v.isSet -} - -func (v *NullableBackend) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableBackend(val *Backend) *NullableBackend { - return &NullableBackend{value: val, isSet: true} -} - -func (v NullableBackend) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableBackend) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_create_key_payload.go b/services/kms/v1betaapi/model_create_key_payload.go deleted file mode 100644 index 04ef7c395..000000000 --- a/services/kms/v1betaapi/model_create_key_payload.go +++ /dev/null @@ -1,416 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the CreateKeyPayload type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &CreateKeyPayload{} - -// CreateKeyPayload struct for CreateKeyPayload -type CreateKeyPayload struct { - AccessScope *AccessScope `json:"access_scope,omitempty"` - Algorithm Algorithm `json:"algorithm"` - // Deprecated - Backend Backend `json:"backend"` - // A user chosen description to distinguish multiple keys. - Description *string `json:"description,omitempty"` - // The display name to distinguish multiple keys. Valid characters: letters, digits, underscores and hyphens. - DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9_-]+$"` - // States whether versions can be created or only imported. - ImportOnly *bool `json:"importOnly,omitempty"` - Protection *Protection `json:"protection,omitempty"` - Purpose Purpose `json:"purpose"` - AdditionalProperties map[string]interface{} -} - -type _CreateKeyPayload CreateKeyPayload - -// NewCreateKeyPayload instantiates a new CreateKeyPayload 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 NewCreateKeyPayload(algorithm Algorithm, backend Backend, displayName string, purpose Purpose) *CreateKeyPayload { - this := CreateKeyPayload{} - var accessScope AccessScope = ACCESSSCOPE_PUBLIC - this.AccessScope = &accessScope - this.Algorithm = algorithm - this.Backend = backend - this.DisplayName = displayName - var importOnly bool = false - this.ImportOnly = &importOnly - this.Purpose = purpose - return &this -} - -// NewCreateKeyPayloadWithDefaults instantiates a new CreateKeyPayload 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 NewCreateKeyPayloadWithDefaults() *CreateKeyPayload { - this := CreateKeyPayload{} - var accessScope AccessScope = ACCESSSCOPE_PUBLIC - this.AccessScope = &accessScope - var importOnly bool = false - this.ImportOnly = &importOnly - return &this -} - -// GetAccessScope returns the AccessScope field value if set, zero value otherwise. -func (o *CreateKeyPayload) GetAccessScope() AccessScope { - if o == nil || IsNil(o.AccessScope) { - var ret AccessScope - return ret - } - return *o.AccessScope -} - -// GetAccessScopeOk returns a tuple with the AccessScope field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateKeyPayload) GetAccessScopeOk() (*AccessScope, bool) { - if o == nil || IsNil(o.AccessScope) { - return nil, false - } - return o.AccessScope, true -} - -// HasAccessScope returns a boolean if a field has been set. -func (o *CreateKeyPayload) HasAccessScope() bool { - if o != nil && !IsNil(o.AccessScope) { - return true - } - - return false -} - -// SetAccessScope gets a reference to the given AccessScope and assigns it to the AccessScope field. -func (o *CreateKeyPayload) SetAccessScope(v AccessScope) { - o.AccessScope = &v -} - -// GetAlgorithm returns the Algorithm field value -func (o *CreateKeyPayload) GetAlgorithm() Algorithm { - if o == nil { - var ret Algorithm - return ret - } - - return o.Algorithm -} - -// GetAlgorithmOk returns a tuple with the Algorithm field value -// and a boolean to check if the value has been set. -func (o *CreateKeyPayload) GetAlgorithmOk() (*Algorithm, bool) { - if o == nil { - return nil, false - } - return &o.Algorithm, true -} - -// SetAlgorithm sets field value -func (o *CreateKeyPayload) SetAlgorithm(v Algorithm) { - o.Algorithm = v -} - -// GetBackend returns the Backend field value -// Deprecated -func (o *CreateKeyPayload) GetBackend() Backend { - if o == nil { - var ret Backend - return ret - } - - return o.Backend -} - -// GetBackendOk returns a tuple with the Backend field value -// and a boolean to check if the value has been set. -// Deprecated -func (o *CreateKeyPayload) GetBackendOk() (*Backend, bool) { - if o == nil { - return nil, false - } - return &o.Backend, true -} - -// SetBackend sets field value -// Deprecated -func (o *CreateKeyPayload) SetBackend(v Backend) { - o.Backend = v -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *CreateKeyPayload) GetDescription() string { - if o == nil || IsNil(o.Description) { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateKeyPayload) GetDescriptionOk() (*string, bool) { - if o == nil || IsNil(o.Description) { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *CreateKeyPayload) HasDescription() bool { - if o != nil && !IsNil(o.Description) { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *CreateKeyPayload) SetDescription(v string) { - o.Description = &v -} - -// GetDisplayName returns the DisplayName field value -func (o *CreateKeyPayload) GetDisplayName() string { - if o == nil { - var ret string - return ret - } - - return o.DisplayName -} - -// GetDisplayNameOk returns a tuple with the DisplayName field value -// and a boolean to check if the value has been set. -func (o *CreateKeyPayload) GetDisplayNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.DisplayName, true -} - -// SetDisplayName sets field value -func (o *CreateKeyPayload) SetDisplayName(v string) { - o.DisplayName = v -} - -// GetImportOnly returns the ImportOnly field value if set, zero value otherwise. -func (o *CreateKeyPayload) GetImportOnly() bool { - if o == nil || IsNil(o.ImportOnly) { - var ret bool - return ret - } - return *o.ImportOnly -} - -// GetImportOnlyOk returns a tuple with the ImportOnly field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateKeyPayload) GetImportOnlyOk() (*bool, bool) { - if o == nil || IsNil(o.ImportOnly) { - return nil, false - } - return o.ImportOnly, true -} - -// HasImportOnly returns a boolean if a field has been set. -func (o *CreateKeyPayload) HasImportOnly() bool { - if o != nil && !IsNil(o.ImportOnly) { - return true - } - - return false -} - -// SetImportOnly gets a reference to the given bool and assigns it to the ImportOnly field. -func (o *CreateKeyPayload) SetImportOnly(v bool) { - o.ImportOnly = &v -} - -// GetProtection returns the Protection field value if set, zero value otherwise. -func (o *CreateKeyPayload) GetProtection() Protection { - if o == nil || IsNil(o.Protection) { - var ret Protection - return ret - } - return *o.Protection -} - -// GetProtectionOk returns a tuple with the Protection field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateKeyPayload) GetProtectionOk() (*Protection, bool) { - if o == nil || IsNil(o.Protection) { - return nil, false - } - return o.Protection, true -} - -// HasProtection returns a boolean if a field has been set. -func (o *CreateKeyPayload) HasProtection() bool { - if o != nil && !IsNil(o.Protection) { - return true - } - - return false -} - -// SetProtection gets a reference to the given Protection and assigns it to the Protection field. -func (o *CreateKeyPayload) SetProtection(v Protection) { - o.Protection = &v -} - -// GetPurpose returns the Purpose field value -func (o *CreateKeyPayload) GetPurpose() Purpose { - if o == nil { - var ret Purpose - return ret - } - - return o.Purpose -} - -// GetPurposeOk returns a tuple with the Purpose field value -// and a boolean to check if the value has been set. -func (o *CreateKeyPayload) GetPurposeOk() (*Purpose, bool) { - if o == nil { - return nil, false - } - return &o.Purpose, true -} - -// SetPurpose sets field value -func (o *CreateKeyPayload) SetPurpose(v Purpose) { - o.Purpose = v -} - -func (o CreateKeyPayload) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o CreateKeyPayload) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.AccessScope) { - toSerialize["access_scope"] = o.AccessScope - } - toSerialize["algorithm"] = o.Algorithm - toSerialize["backend"] = o.Backend - if !IsNil(o.Description) { - toSerialize["description"] = o.Description - } - toSerialize["displayName"] = o.DisplayName - if !IsNil(o.ImportOnly) { - toSerialize["importOnly"] = o.ImportOnly - } - if !IsNil(o.Protection) { - toSerialize["protection"] = o.Protection - } - toSerialize["purpose"] = o.Purpose - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *CreateKeyPayload) 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{ - "algorithm", - "backend", - "displayName", - "purpose", - } - - 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) - } - } - - varCreateKeyPayload := _CreateKeyPayload{} - - err = json.Unmarshal(data, &varCreateKeyPayload) - - if err != nil { - return err - } - - *o = CreateKeyPayload(varCreateKeyPayload) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "access_scope") - delete(additionalProperties, "algorithm") - delete(additionalProperties, "backend") - delete(additionalProperties, "description") - delete(additionalProperties, "displayName") - delete(additionalProperties, "importOnly") - delete(additionalProperties, "protection") - delete(additionalProperties, "purpose") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableCreateKeyPayload struct { - value *CreateKeyPayload - isSet bool -} - -func (v NullableCreateKeyPayload) Get() *CreateKeyPayload { - return v.value -} - -func (v *NullableCreateKeyPayload) Set(val *CreateKeyPayload) { - v.value = val - v.isSet = true -} - -func (v NullableCreateKeyPayload) IsSet() bool { - return v.isSet -} - -func (v *NullableCreateKeyPayload) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableCreateKeyPayload(val *CreateKeyPayload) *NullableCreateKeyPayload { - return &NullableCreateKeyPayload{value: val, isSet: true} -} - -func (v NullableCreateKeyPayload) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableCreateKeyPayload) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_create_key_ring_payload.go b/services/kms/v1betaapi/model_create_key_ring_payload.go deleted file mode 100644 index be4562441..000000000 --- a/services/kms/v1betaapi/model_create_key_ring_payload.go +++ /dev/null @@ -1,205 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the CreateKeyRingPayload type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &CreateKeyRingPayload{} - -// CreateKeyRingPayload struct for CreateKeyRingPayload -type CreateKeyRingPayload struct { - // A user chosen description to distinguish multiple key rings. - Description *string `json:"description,omitempty"` - // The display name to distinguish multiple key rings. Valid characters: letters, digits, underscores and hyphens. - DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9_-]+$"` - AdditionalProperties map[string]interface{} -} - -type _CreateKeyRingPayload CreateKeyRingPayload - -// NewCreateKeyRingPayload instantiates a new CreateKeyRingPayload 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 NewCreateKeyRingPayload(displayName string) *CreateKeyRingPayload { - this := CreateKeyRingPayload{} - this.DisplayName = displayName - return &this -} - -// NewCreateKeyRingPayloadWithDefaults instantiates a new CreateKeyRingPayload 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 NewCreateKeyRingPayloadWithDefaults() *CreateKeyRingPayload { - this := CreateKeyRingPayload{} - return &this -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *CreateKeyRingPayload) GetDescription() string { - if o == nil || IsNil(o.Description) { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateKeyRingPayload) GetDescriptionOk() (*string, bool) { - if o == nil || IsNil(o.Description) { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *CreateKeyRingPayload) HasDescription() bool { - if o != nil && !IsNil(o.Description) { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *CreateKeyRingPayload) SetDescription(v string) { - o.Description = &v -} - -// GetDisplayName returns the DisplayName field value -func (o *CreateKeyRingPayload) GetDisplayName() string { - if o == nil { - var ret string - return ret - } - - return o.DisplayName -} - -// GetDisplayNameOk returns a tuple with the DisplayName field value -// and a boolean to check if the value has been set. -func (o *CreateKeyRingPayload) GetDisplayNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.DisplayName, true -} - -// SetDisplayName sets field value -func (o *CreateKeyRingPayload) SetDisplayName(v string) { - o.DisplayName = v -} - -func (o CreateKeyRingPayload) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o CreateKeyRingPayload) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.Description) { - toSerialize["description"] = o.Description - } - toSerialize["displayName"] = o.DisplayName - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *CreateKeyRingPayload) 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{ - "displayName", - } - - 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) - } - } - - varCreateKeyRingPayload := _CreateKeyRingPayload{} - - err = json.Unmarshal(data, &varCreateKeyRingPayload) - - if err != nil { - return err - } - - *o = CreateKeyRingPayload(varCreateKeyRingPayload) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "description") - delete(additionalProperties, "displayName") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableCreateKeyRingPayload struct { - value *CreateKeyRingPayload - isSet bool -} - -func (v NullableCreateKeyRingPayload) Get() *CreateKeyRingPayload { - return v.value -} - -func (v *NullableCreateKeyRingPayload) Set(val *CreateKeyRingPayload) { - v.value = val - v.isSet = true -} - -func (v NullableCreateKeyRingPayload) IsSet() bool { - return v.isSet -} - -func (v *NullableCreateKeyRingPayload) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableCreateKeyRingPayload(val *CreateKeyRingPayload) *NullableCreateKeyRingPayload { - return &NullableCreateKeyRingPayload{value: val, isSet: true} -} - -func (v NullableCreateKeyRingPayload) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableCreateKeyRingPayload) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_create_wrapping_key_payload.go b/services/kms/v1betaapi/model_create_wrapping_key_payload.go deleted file mode 100644 index a6c0094b6..000000000 --- a/services/kms/v1betaapi/model_create_wrapping_key_payload.go +++ /dev/null @@ -1,374 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the CreateWrappingKeyPayload type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &CreateWrappingKeyPayload{} - -// CreateWrappingKeyPayload struct for CreateWrappingKeyPayload -type CreateWrappingKeyPayload struct { - AccessScope *AccessScope `json:"access_scope,omitempty"` - Algorithm WrappingAlgorithm `json:"algorithm"` - // Deprecated - Backend Backend `json:"backend"` - // A user chosen description to distinguish multiple wrapping keys. - Description *string `json:"description,omitempty"` - // The display name to distinguish multiple wrapping keys. Valid characters: letters, digits, underscores and hyphens. - DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z0-9_-]+$"` - Protection *Protection `json:"protection,omitempty"` - Purpose WrappingPurpose `json:"purpose"` - AdditionalProperties map[string]interface{} -} - -type _CreateWrappingKeyPayload CreateWrappingKeyPayload - -// NewCreateWrappingKeyPayload instantiates a new CreateWrappingKeyPayload 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 NewCreateWrappingKeyPayload(algorithm WrappingAlgorithm, backend Backend, displayName string, purpose WrappingPurpose) *CreateWrappingKeyPayload { - this := CreateWrappingKeyPayload{} - var accessScope AccessScope = ACCESSSCOPE_PUBLIC - this.AccessScope = &accessScope - this.Algorithm = algorithm - this.Backend = backend - this.DisplayName = displayName - this.Purpose = purpose - return &this -} - -// NewCreateWrappingKeyPayloadWithDefaults instantiates a new CreateWrappingKeyPayload 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 NewCreateWrappingKeyPayloadWithDefaults() *CreateWrappingKeyPayload { - this := CreateWrappingKeyPayload{} - var accessScope AccessScope = ACCESSSCOPE_PUBLIC - this.AccessScope = &accessScope - return &this -} - -// GetAccessScope returns the AccessScope field value if set, zero value otherwise. -func (o *CreateWrappingKeyPayload) GetAccessScope() AccessScope { - if o == nil || IsNil(o.AccessScope) { - var ret AccessScope - return ret - } - return *o.AccessScope -} - -// GetAccessScopeOk returns a tuple with the AccessScope field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateWrappingKeyPayload) GetAccessScopeOk() (*AccessScope, bool) { - if o == nil || IsNil(o.AccessScope) { - return nil, false - } - return o.AccessScope, true -} - -// HasAccessScope returns a boolean if a field has been set. -func (o *CreateWrappingKeyPayload) HasAccessScope() bool { - if o != nil && !IsNil(o.AccessScope) { - return true - } - - return false -} - -// SetAccessScope gets a reference to the given AccessScope and assigns it to the AccessScope field. -func (o *CreateWrappingKeyPayload) SetAccessScope(v AccessScope) { - o.AccessScope = &v -} - -// GetAlgorithm returns the Algorithm field value -func (o *CreateWrappingKeyPayload) GetAlgorithm() WrappingAlgorithm { - if o == nil { - var ret WrappingAlgorithm - return ret - } - - return o.Algorithm -} - -// GetAlgorithmOk returns a tuple with the Algorithm field value -// and a boolean to check if the value has been set. -func (o *CreateWrappingKeyPayload) GetAlgorithmOk() (*WrappingAlgorithm, bool) { - if o == nil { - return nil, false - } - return &o.Algorithm, true -} - -// SetAlgorithm sets field value -func (o *CreateWrappingKeyPayload) SetAlgorithm(v WrappingAlgorithm) { - o.Algorithm = v -} - -// GetBackend returns the Backend field value -// Deprecated -func (o *CreateWrappingKeyPayload) GetBackend() Backend { - if o == nil { - var ret Backend - return ret - } - - return o.Backend -} - -// GetBackendOk returns a tuple with the Backend field value -// and a boolean to check if the value has been set. -// Deprecated -func (o *CreateWrappingKeyPayload) GetBackendOk() (*Backend, bool) { - if o == nil { - return nil, false - } - return &o.Backend, true -} - -// SetBackend sets field value -// Deprecated -func (o *CreateWrappingKeyPayload) SetBackend(v Backend) { - o.Backend = v -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *CreateWrappingKeyPayload) GetDescription() string { - if o == nil || IsNil(o.Description) { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateWrappingKeyPayload) GetDescriptionOk() (*string, bool) { - if o == nil || IsNil(o.Description) { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *CreateWrappingKeyPayload) HasDescription() bool { - if o != nil && !IsNil(o.Description) { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *CreateWrappingKeyPayload) SetDescription(v string) { - o.Description = &v -} - -// GetDisplayName returns the DisplayName field value -func (o *CreateWrappingKeyPayload) GetDisplayName() string { - if o == nil { - var ret string - return ret - } - - return o.DisplayName -} - -// GetDisplayNameOk returns a tuple with the DisplayName field value -// and a boolean to check if the value has been set. -func (o *CreateWrappingKeyPayload) GetDisplayNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.DisplayName, true -} - -// SetDisplayName sets field value -func (o *CreateWrappingKeyPayload) SetDisplayName(v string) { - o.DisplayName = v -} - -// GetProtection returns the Protection field value if set, zero value otherwise. -func (o *CreateWrappingKeyPayload) GetProtection() Protection { - if o == nil || IsNil(o.Protection) { - var ret Protection - return ret - } - return *o.Protection -} - -// GetProtectionOk returns a tuple with the Protection field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *CreateWrappingKeyPayload) GetProtectionOk() (*Protection, bool) { - if o == nil || IsNil(o.Protection) { - return nil, false - } - return o.Protection, true -} - -// HasProtection returns a boolean if a field has been set. -func (o *CreateWrappingKeyPayload) HasProtection() bool { - if o != nil && !IsNil(o.Protection) { - return true - } - - return false -} - -// SetProtection gets a reference to the given Protection and assigns it to the Protection field. -func (o *CreateWrappingKeyPayload) SetProtection(v Protection) { - o.Protection = &v -} - -// GetPurpose returns the Purpose field value -func (o *CreateWrappingKeyPayload) GetPurpose() WrappingPurpose { - if o == nil { - var ret WrappingPurpose - return ret - } - - return o.Purpose -} - -// GetPurposeOk returns a tuple with the Purpose field value -// and a boolean to check if the value has been set. -func (o *CreateWrappingKeyPayload) GetPurposeOk() (*WrappingPurpose, bool) { - if o == nil { - return nil, false - } - return &o.Purpose, true -} - -// SetPurpose sets field value -func (o *CreateWrappingKeyPayload) SetPurpose(v WrappingPurpose) { - o.Purpose = v -} - -func (o CreateWrappingKeyPayload) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o CreateWrappingKeyPayload) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - if !IsNil(o.AccessScope) { - toSerialize["access_scope"] = o.AccessScope - } - toSerialize["algorithm"] = o.Algorithm - toSerialize["backend"] = o.Backend - if !IsNil(o.Description) { - toSerialize["description"] = o.Description - } - toSerialize["displayName"] = o.DisplayName - if !IsNil(o.Protection) { - toSerialize["protection"] = o.Protection - } - toSerialize["purpose"] = o.Purpose - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *CreateWrappingKeyPayload) 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{ - "algorithm", - "backend", - "displayName", - "purpose", - } - - 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) - } - } - - varCreateWrappingKeyPayload := _CreateWrappingKeyPayload{} - - err = json.Unmarshal(data, &varCreateWrappingKeyPayload) - - if err != nil { - return err - } - - *o = CreateWrappingKeyPayload(varCreateWrappingKeyPayload) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "access_scope") - delete(additionalProperties, "algorithm") - delete(additionalProperties, "backend") - delete(additionalProperties, "description") - delete(additionalProperties, "displayName") - delete(additionalProperties, "protection") - delete(additionalProperties, "purpose") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableCreateWrappingKeyPayload struct { - value *CreateWrappingKeyPayload - isSet bool -} - -func (v NullableCreateWrappingKeyPayload) Get() *CreateWrappingKeyPayload { - return v.value -} - -func (v *NullableCreateWrappingKeyPayload) Set(val *CreateWrappingKeyPayload) { - v.value = val - v.isSet = true -} - -func (v NullableCreateWrappingKeyPayload) IsSet() bool { - return v.isSet -} - -func (v *NullableCreateWrappingKeyPayload) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableCreateWrappingKeyPayload(val *CreateWrappingKeyPayload) *NullableCreateWrappingKeyPayload { - return &NullableCreateWrappingKeyPayload{value: val, isSet: true} -} - -func (v NullableCreateWrappingKeyPayload) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableCreateWrappingKeyPayload) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_decrypt_payload.go b/services/kms/v1betaapi/model_decrypt_payload.go deleted file mode 100644 index 22ab4cf5d..000000000 --- a/services/kms/v1betaapi/model_decrypt_payload.go +++ /dev/null @@ -1,167 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the DecryptPayload type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &DecryptPayload{} - -// DecryptPayload struct for DecryptPayload -type DecryptPayload struct { - // The data that has to be decrypted. Encoded in base64. - Data string `json:"data"` - AdditionalProperties map[string]interface{} -} - -type _DecryptPayload DecryptPayload - -// NewDecryptPayload instantiates a new DecryptPayload 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 NewDecryptPayload(data string) *DecryptPayload { - this := DecryptPayload{} - this.Data = data - return &this -} - -// NewDecryptPayloadWithDefaults instantiates a new DecryptPayload 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 NewDecryptPayloadWithDefaults() *DecryptPayload { - this := DecryptPayload{} - return &this -} - -// GetData returns the Data field value -func (o *DecryptPayload) GetData() string { - if o == nil { - var ret string - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *DecryptPayload) GetDataOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value -func (o *DecryptPayload) SetData(v string) { - o.Data = v -} - -func (o DecryptPayload) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o DecryptPayload) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *DecryptPayload) 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{ - "data", - } - - 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) - } - } - - varDecryptPayload := _DecryptPayload{} - - err = json.Unmarshal(data, &varDecryptPayload) - - if err != nil { - return err - } - - *o = DecryptPayload(varDecryptPayload) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "data") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableDecryptPayload struct { - value *DecryptPayload - isSet bool -} - -func (v NullableDecryptPayload) Get() *DecryptPayload { - return v.value -} - -func (v *NullableDecryptPayload) Set(val *DecryptPayload) { - v.value = val - v.isSet = true -} - -func (v NullableDecryptPayload) IsSet() bool { - return v.isSet -} - -func (v *NullableDecryptPayload) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableDecryptPayload(val *DecryptPayload) *NullableDecryptPayload { - return &NullableDecryptPayload{value: val, isSet: true} -} - -func (v NullableDecryptPayload) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableDecryptPayload) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_decrypted_data.go b/services/kms/v1betaapi/model_decrypted_data.go deleted file mode 100644 index 9e5f81bd7..000000000 --- a/services/kms/v1betaapi/model_decrypted_data.go +++ /dev/null @@ -1,167 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the DecryptedData type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &DecryptedData{} - -// DecryptedData struct for DecryptedData -type DecryptedData struct { - // The decrypted data. Encoded in base64. - Data string `json:"data"` - AdditionalProperties map[string]interface{} -} - -type _DecryptedData DecryptedData - -// NewDecryptedData instantiates a new DecryptedData 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 NewDecryptedData(data string) *DecryptedData { - this := DecryptedData{} - this.Data = data - return &this -} - -// NewDecryptedDataWithDefaults instantiates a new DecryptedData 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 NewDecryptedDataWithDefaults() *DecryptedData { - this := DecryptedData{} - return &this -} - -// GetData returns the Data field value -func (o *DecryptedData) GetData() string { - if o == nil { - var ret string - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *DecryptedData) GetDataOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value -func (o *DecryptedData) SetData(v string) { - o.Data = v -} - -func (o DecryptedData) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o DecryptedData) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *DecryptedData) 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{ - "data", - } - - 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) - } - } - - varDecryptedData := _DecryptedData{} - - err = json.Unmarshal(data, &varDecryptedData) - - if err != nil { - return err - } - - *o = DecryptedData(varDecryptedData) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "data") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableDecryptedData struct { - value *DecryptedData - isSet bool -} - -func (v NullableDecryptedData) Get() *DecryptedData { - return v.value -} - -func (v *NullableDecryptedData) Set(val *DecryptedData) { - v.value = val - v.isSet = true -} - -func (v NullableDecryptedData) IsSet() bool { - return v.isSet -} - -func (v *NullableDecryptedData) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableDecryptedData(val *DecryptedData) *NullableDecryptedData { - return &NullableDecryptedData{value: val, isSet: true} -} - -func (v NullableDecryptedData) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableDecryptedData) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_encrypt_payload.go b/services/kms/v1betaapi/model_encrypt_payload.go deleted file mode 100644 index 08466a11a..000000000 --- a/services/kms/v1betaapi/model_encrypt_payload.go +++ /dev/null @@ -1,167 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the EncryptPayload type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &EncryptPayload{} - -// EncryptPayload struct for EncryptPayload -type EncryptPayload struct { - // The data that has to be encrypted. Encoded in base64. - Data string `json:"data"` - AdditionalProperties map[string]interface{} -} - -type _EncryptPayload EncryptPayload - -// NewEncryptPayload instantiates a new EncryptPayload 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 NewEncryptPayload(data string) *EncryptPayload { - this := EncryptPayload{} - this.Data = data - return &this -} - -// NewEncryptPayloadWithDefaults instantiates a new EncryptPayload 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 NewEncryptPayloadWithDefaults() *EncryptPayload { - this := EncryptPayload{} - return &this -} - -// GetData returns the Data field value -func (o *EncryptPayload) GetData() string { - if o == nil { - var ret string - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *EncryptPayload) GetDataOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value -func (o *EncryptPayload) SetData(v string) { - o.Data = v -} - -func (o EncryptPayload) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o EncryptPayload) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *EncryptPayload) 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{ - "data", - } - - 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) - } - } - - varEncryptPayload := _EncryptPayload{} - - err = json.Unmarshal(data, &varEncryptPayload) - - if err != nil { - return err - } - - *o = EncryptPayload(varEncryptPayload) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "data") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableEncryptPayload struct { - value *EncryptPayload - isSet bool -} - -func (v NullableEncryptPayload) Get() *EncryptPayload { - return v.value -} - -func (v *NullableEncryptPayload) Set(val *EncryptPayload) { - v.value = val - v.isSet = true -} - -func (v NullableEncryptPayload) IsSet() bool { - return v.isSet -} - -func (v *NullableEncryptPayload) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableEncryptPayload(val *EncryptPayload) *NullableEncryptPayload { - return &NullableEncryptPayload{value: val, isSet: true} -} - -func (v NullableEncryptPayload) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableEncryptPayload) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_encrypted_data.go b/services/kms/v1betaapi/model_encrypted_data.go deleted file mode 100644 index 07227e4f7..000000000 --- a/services/kms/v1betaapi/model_encrypted_data.go +++ /dev/null @@ -1,167 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the EncryptedData type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &EncryptedData{} - -// EncryptedData struct for EncryptedData -type EncryptedData struct { - // The encrypted data. Encoded in base64. - Data string `json:"data"` - AdditionalProperties map[string]interface{} -} - -type _EncryptedData EncryptedData - -// NewEncryptedData instantiates a new EncryptedData 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 NewEncryptedData(data string) *EncryptedData { - this := EncryptedData{} - this.Data = data - return &this -} - -// NewEncryptedDataWithDefaults instantiates a new EncryptedData 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 NewEncryptedDataWithDefaults() *EncryptedData { - this := EncryptedData{} - return &this -} - -// GetData returns the Data field value -func (o *EncryptedData) GetData() string { - if o == nil { - var ret string - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *EncryptedData) GetDataOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value -func (o *EncryptedData) SetData(v string) { - o.Data = v -} - -func (o EncryptedData) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o EncryptedData) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *EncryptedData) 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{ - "data", - } - - 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) - } - } - - varEncryptedData := _EncryptedData{} - - err = json.Unmarshal(data, &varEncryptedData) - - if err != nil { - return err - } - - *o = EncryptedData(varEncryptedData) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "data") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableEncryptedData struct { - value *EncryptedData - isSet bool -} - -func (v NullableEncryptedData) Get() *EncryptedData { - return v.value -} - -func (v *NullableEncryptedData) Set(val *EncryptedData) { - v.value = val - v.isSet = true -} - -func (v NullableEncryptedData) IsSet() bool { - return v.isSet -} - -func (v *NullableEncryptedData) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableEncryptedData(val *EncryptedData) *NullableEncryptedData { - return &NullableEncryptedData{value: val, isSet: true} -} - -func (v NullableEncryptedData) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableEncryptedData) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_http_error.go b/services/kms/v1betaapi/model_http_error.go deleted file mode 100644 index 5e048f227..000000000 --- a/services/kms/v1betaapi/model_http_error.go +++ /dev/null @@ -1,167 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the HttpError type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &HttpError{} - -// HttpError struct for HttpError -type HttpError struct { - // A string that gives a short information about what went wrong. - Message string `json:"message"` - AdditionalProperties map[string]interface{} -} - -type _HttpError HttpError - -// NewHttpError instantiates a new HttpError 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 NewHttpError(message string) *HttpError { - this := HttpError{} - this.Message = message - return &this -} - -// NewHttpErrorWithDefaults instantiates a new HttpError 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 NewHttpErrorWithDefaults() *HttpError { - this := HttpError{} - return &this -} - -// GetMessage returns the Message field value -func (o *HttpError) GetMessage() string { - if o == nil { - var ret string - return ret - } - - return o.Message -} - -// GetMessageOk returns a tuple with the Message field value -// and a boolean to check if the value has been set. -func (o *HttpError) GetMessageOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Message, true -} - -// SetMessage sets field value -func (o *HttpError) SetMessage(v string) { - o.Message = v -} - -func (o HttpError) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o HttpError) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["message"] = o.Message - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *HttpError) 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{ - "message", - } - - 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) - } - } - - varHttpError := _HttpError{} - - err = json.Unmarshal(data, &varHttpError) - - if err != nil { - return err - } - - *o = HttpError(varHttpError) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "message") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableHttpError struct { - value *HttpError - isSet bool -} - -func (v NullableHttpError) Get() *HttpError { - return v.value -} - -func (v *NullableHttpError) Set(val *HttpError) { - v.value = val - v.isSet = true -} - -func (v NullableHttpError) IsSet() bool { - return v.isSet -} - -func (v *NullableHttpError) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableHttpError(val *HttpError) *NullableHttpError { - return &NullableHttpError{value: val, isSet: true} -} - -func (v NullableHttpError) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableHttpError) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_import_key_payload.go b/services/kms/v1betaapi/model_import_key_payload.go deleted file mode 100644 index ec52e8008..000000000 --- a/services/kms/v1betaapi/model_import_key_payload.go +++ /dev/null @@ -1,197 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the ImportKeyPayload type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ImportKeyPayload{} - -// ImportKeyPayload struct for ImportKeyPayload -type ImportKeyPayload struct { - // The wrapped key material that has to be imported. Encoded in base64. - WrappedKey string `json:"wrappedKey"` - // The unique id of the wrapping key the key material has been wrapped with. - WrappingKeyId string `json:"wrappingKeyId"` - AdditionalProperties map[string]interface{} -} - -type _ImportKeyPayload ImportKeyPayload - -// NewImportKeyPayload instantiates a new ImportKeyPayload 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 NewImportKeyPayload(wrappedKey string, wrappingKeyId string) *ImportKeyPayload { - this := ImportKeyPayload{} - this.WrappedKey = wrappedKey - this.WrappingKeyId = wrappingKeyId - return &this -} - -// NewImportKeyPayloadWithDefaults instantiates a new ImportKeyPayload 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 NewImportKeyPayloadWithDefaults() *ImportKeyPayload { - this := ImportKeyPayload{} - return &this -} - -// GetWrappedKey returns the WrappedKey field value -func (o *ImportKeyPayload) GetWrappedKey() string { - if o == nil { - var ret string - return ret - } - - return o.WrappedKey -} - -// GetWrappedKeyOk returns a tuple with the WrappedKey field value -// and a boolean to check if the value has been set. -func (o *ImportKeyPayload) GetWrappedKeyOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.WrappedKey, true -} - -// SetWrappedKey sets field value -func (o *ImportKeyPayload) SetWrappedKey(v string) { - o.WrappedKey = v -} - -// GetWrappingKeyId returns the WrappingKeyId field value -func (o *ImportKeyPayload) GetWrappingKeyId() string { - if o == nil { - var ret string - return ret - } - - return o.WrappingKeyId -} - -// GetWrappingKeyIdOk returns a tuple with the WrappingKeyId field value -// and a boolean to check if the value has been set. -func (o *ImportKeyPayload) GetWrappingKeyIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.WrappingKeyId, true -} - -// SetWrappingKeyId sets field value -func (o *ImportKeyPayload) SetWrappingKeyId(v string) { - o.WrappingKeyId = v -} - -func (o ImportKeyPayload) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o ImportKeyPayload) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["wrappedKey"] = o.WrappedKey - toSerialize["wrappingKeyId"] = o.WrappingKeyId - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *ImportKeyPayload) 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{ - "wrappedKey", - "wrappingKeyId", - } - - 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) - } - } - - varImportKeyPayload := _ImportKeyPayload{} - - err = json.Unmarshal(data, &varImportKeyPayload) - - if err != nil { - return err - } - - *o = ImportKeyPayload(varImportKeyPayload) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "wrappedKey") - delete(additionalProperties, "wrappingKeyId") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableImportKeyPayload struct { - value *ImportKeyPayload - isSet bool -} - -func (v NullableImportKeyPayload) Get() *ImportKeyPayload { - return v.value -} - -func (v *NullableImportKeyPayload) Set(val *ImportKeyPayload) { - v.value = val - v.isSet = true -} - -func (v NullableImportKeyPayload) IsSet() bool { - return v.isSet -} - -func (v *NullableImportKeyPayload) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableImportKeyPayload(val *ImportKeyPayload) *NullableImportKeyPayload { - return &NullableImportKeyPayload{value: val, isSet: true} -} - -func (v NullableImportKeyPayload) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableImportKeyPayload) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_key.go b/services/kms/v1betaapi/model_key.go deleted file mode 100644 index d1900f6b9..000000000 --- a/services/kms/v1betaapi/model_key.go +++ /dev/null @@ -1,547 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" - "time" -) - -// checks if the Key type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &Key{} - -// Key struct for Key -type Key struct { - AccessScope AccessScope `json:"access_scope"` - Algorithm Algorithm `json:"algorithm"` - // Deprecated - Backend Backend `json:"backend"` - // The date and time the creation of the key was triggered. - CreatedAt time.Time `json:"createdAt"` - // This date is set when a key is pending deletion and refers to the scheduled date of deletion - DeletionDate *time.Time `json:"deletionDate,omitempty"` - // A user chosen description to distinguish multiple keys. - Description *string `json:"description,omitempty"` - // The display name to distinguish multiple keys. - DisplayName string `json:"displayName"` - // A auto generated unique id which identifies the keys. - Id string `json:"id"` - // States whether versions can be created or only imported. - ImportOnly bool `json:"importOnly"` - // The unique id of the key ring this key is assigned to. - KeyRingId string `json:"keyRingId"` - Protection Protection `json:"protection"` - Purpose Purpose `json:"purpose"` - // The current state of the key. - State string `json:"state"` - AdditionalProperties map[string]interface{} -} - -type _Key Key - -// NewKey instantiates a new Key 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 NewKey(accessScope AccessScope, algorithm Algorithm, backend Backend, createdAt time.Time, displayName string, id string, importOnly bool, keyRingId string, protection Protection, purpose Purpose, state string) *Key { - this := Key{} - this.AccessScope = accessScope - this.Algorithm = algorithm - this.Backend = backend - this.CreatedAt = createdAt - this.DisplayName = displayName - this.Id = id - this.ImportOnly = importOnly - this.KeyRingId = keyRingId - this.Protection = protection - this.Purpose = purpose - this.State = state - return &this -} - -// NewKeyWithDefaults instantiates a new Key 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 NewKeyWithDefaults() *Key { - this := Key{} - var accessScope AccessScope = ACCESSSCOPE_PUBLIC - this.AccessScope = accessScope - var importOnly bool = false - this.ImportOnly = importOnly - return &this -} - -// GetAccessScope returns the AccessScope field value -func (o *Key) GetAccessScope() AccessScope { - if o == nil { - var ret AccessScope - return ret - } - - return o.AccessScope -} - -// GetAccessScopeOk returns a tuple with the AccessScope field value -// and a boolean to check if the value has been set. -func (o *Key) GetAccessScopeOk() (*AccessScope, bool) { - if o == nil { - return nil, false - } - return &o.AccessScope, true -} - -// SetAccessScope sets field value -func (o *Key) SetAccessScope(v AccessScope) { - o.AccessScope = v -} - -// GetAlgorithm returns the Algorithm field value -func (o *Key) GetAlgorithm() Algorithm { - if o == nil { - var ret Algorithm - return ret - } - - return o.Algorithm -} - -// GetAlgorithmOk returns a tuple with the Algorithm field value -// and a boolean to check if the value has been set. -func (o *Key) GetAlgorithmOk() (*Algorithm, bool) { - if o == nil { - return nil, false - } - return &o.Algorithm, true -} - -// SetAlgorithm sets field value -func (o *Key) SetAlgorithm(v Algorithm) { - o.Algorithm = v -} - -// GetBackend returns the Backend field value -// Deprecated -func (o *Key) GetBackend() Backend { - if o == nil { - var ret Backend - return ret - } - - return o.Backend -} - -// GetBackendOk returns a tuple with the Backend field value -// and a boolean to check if the value has been set. -// Deprecated -func (o *Key) GetBackendOk() (*Backend, bool) { - if o == nil { - return nil, false - } - return &o.Backend, true -} - -// SetBackend sets field value -// Deprecated -func (o *Key) SetBackend(v Backend) { - o.Backend = v -} - -// GetCreatedAt returns the CreatedAt field value -func (o *Key) GetCreatedAt() time.Time { - if o == nil { - var ret time.Time - return ret - } - - return o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value -// and a boolean to check if the value has been set. -func (o *Key) GetCreatedAtOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return &o.CreatedAt, true -} - -// SetCreatedAt sets field value -func (o *Key) SetCreatedAt(v time.Time) { - o.CreatedAt = v -} - -// GetDeletionDate returns the DeletionDate field value if set, zero value otherwise. -func (o *Key) GetDeletionDate() time.Time { - if o == nil || IsNil(o.DeletionDate) { - var ret time.Time - return ret - } - return *o.DeletionDate -} - -// GetDeletionDateOk returns a tuple with the DeletionDate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Key) GetDeletionDateOk() (*time.Time, bool) { - if o == nil || IsNil(o.DeletionDate) { - return nil, false - } - return o.DeletionDate, true -} - -// HasDeletionDate returns a boolean if a field has been set. -func (o *Key) HasDeletionDate() bool { - if o != nil && !IsNil(o.DeletionDate) { - return true - } - - return false -} - -// SetDeletionDate gets a reference to the given time.Time and assigns it to the DeletionDate field. -func (o *Key) SetDeletionDate(v time.Time) { - o.DeletionDate = &v -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *Key) GetDescription() string { - if o == nil || IsNil(o.Description) { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Key) GetDescriptionOk() (*string, bool) { - if o == nil || IsNil(o.Description) { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *Key) HasDescription() bool { - if o != nil && !IsNil(o.Description) { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *Key) SetDescription(v string) { - o.Description = &v -} - -// GetDisplayName returns the DisplayName field value -func (o *Key) GetDisplayName() string { - if o == nil { - var ret string - return ret - } - - return o.DisplayName -} - -// GetDisplayNameOk returns a tuple with the DisplayName field value -// and a boolean to check if the value has been set. -func (o *Key) GetDisplayNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.DisplayName, true -} - -// SetDisplayName sets field value -func (o *Key) SetDisplayName(v string) { - o.DisplayName = v -} - -// GetId returns the Id field value -func (o *Key) GetId() string { - if o == nil { - var ret string - return ret - } - - return o.Id -} - -// GetIdOk returns a tuple with the Id field value -// and a boolean to check if the value has been set. -func (o *Key) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value -func (o *Key) SetId(v string) { - o.Id = v -} - -// GetImportOnly returns the ImportOnly field value -func (o *Key) GetImportOnly() bool { - if o == nil { - var ret bool - return ret - } - - return o.ImportOnly -} - -// GetImportOnlyOk returns a tuple with the ImportOnly field value -// and a boolean to check if the value has been set. -func (o *Key) GetImportOnlyOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.ImportOnly, true -} - -// SetImportOnly sets field value -func (o *Key) SetImportOnly(v bool) { - o.ImportOnly = v -} - -// GetKeyRingId returns the KeyRingId field value -func (o *Key) GetKeyRingId() string { - if o == nil { - var ret string - return ret - } - - return o.KeyRingId -} - -// GetKeyRingIdOk returns a tuple with the KeyRingId field value -// and a boolean to check if the value has been set. -func (o *Key) GetKeyRingIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.KeyRingId, true -} - -// SetKeyRingId sets field value -func (o *Key) SetKeyRingId(v string) { - o.KeyRingId = v -} - -// GetProtection returns the Protection field value -func (o *Key) GetProtection() Protection { - if o == nil { - var ret Protection - return ret - } - - return o.Protection -} - -// GetProtectionOk returns a tuple with the Protection field value -// and a boolean to check if the value has been set. -func (o *Key) GetProtectionOk() (*Protection, bool) { - if o == nil { - return nil, false - } - return &o.Protection, true -} - -// SetProtection sets field value -func (o *Key) SetProtection(v Protection) { - o.Protection = v -} - -// GetPurpose returns the Purpose field value -func (o *Key) GetPurpose() Purpose { - if o == nil { - var ret Purpose - return ret - } - - return o.Purpose -} - -// GetPurposeOk returns a tuple with the Purpose field value -// and a boolean to check if the value has been set. -func (o *Key) GetPurposeOk() (*Purpose, bool) { - if o == nil { - return nil, false - } - return &o.Purpose, true -} - -// SetPurpose sets field value -func (o *Key) SetPurpose(v Purpose) { - o.Purpose = v -} - -// GetState returns the State field value -func (o *Key) GetState() string { - if o == nil { - var ret string - return ret - } - - return o.State -} - -// GetStateOk returns a tuple with the State field value -// and a boolean to check if the value has been set. -func (o *Key) GetStateOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.State, true -} - -// SetState sets field value -func (o *Key) SetState(v string) { - o.State = v -} - -func (o Key) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o Key) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["access_scope"] = o.AccessScope - toSerialize["algorithm"] = o.Algorithm - toSerialize["backend"] = o.Backend - toSerialize["createdAt"] = o.CreatedAt - if !IsNil(o.DeletionDate) { - toSerialize["deletionDate"] = o.DeletionDate - } - if !IsNil(o.Description) { - toSerialize["description"] = o.Description - } - toSerialize["displayName"] = o.DisplayName - toSerialize["id"] = o.Id - toSerialize["importOnly"] = o.ImportOnly - toSerialize["keyRingId"] = o.KeyRingId - toSerialize["protection"] = o.Protection - toSerialize["purpose"] = o.Purpose - toSerialize["state"] = o.State - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *Key) 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{ - "access_scope", - "algorithm", - "backend", - "createdAt", - "displayName", - "id", - "importOnly", - "keyRingId", - "protection", - "purpose", - "state", - } - - 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) - } - } - - varKey := _Key{} - - err = json.Unmarshal(data, &varKey) - - if err != nil { - return err - } - - *o = Key(varKey) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "access_scope") - delete(additionalProperties, "algorithm") - delete(additionalProperties, "backend") - delete(additionalProperties, "createdAt") - delete(additionalProperties, "deletionDate") - delete(additionalProperties, "description") - delete(additionalProperties, "displayName") - delete(additionalProperties, "id") - delete(additionalProperties, "importOnly") - delete(additionalProperties, "keyRingId") - delete(additionalProperties, "protection") - delete(additionalProperties, "purpose") - delete(additionalProperties, "state") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableKey struct { - value *Key - isSet bool -} - -func (v NullableKey) Get() *Key { - return v.value -} - -func (v *NullableKey) Set(val *Key) { - v.value = val - v.isSet = true -} - -func (v NullableKey) IsSet() bool { - return v.isSet -} - -func (v *NullableKey) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableKey(val *Key) *NullableKey { - return &NullableKey{value: val, isSet: true} -} - -func (v NullableKey) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableKey) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_key_list.go b/services/kms/v1betaapi/model_key_list.go deleted file mode 100644 index 8a54a831b..000000000 --- a/services/kms/v1betaapi/model_key_list.go +++ /dev/null @@ -1,166 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the KeyList type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &KeyList{} - -// KeyList struct for KeyList -type KeyList struct { - Keys []Key `json:"keys"` - AdditionalProperties map[string]interface{} -} - -type _KeyList KeyList - -// NewKeyList instantiates a new KeyList 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 NewKeyList(keys []Key) *KeyList { - this := KeyList{} - this.Keys = keys - return &this -} - -// NewKeyListWithDefaults instantiates a new KeyList 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 NewKeyListWithDefaults() *KeyList { - this := KeyList{} - return &this -} - -// GetKeys returns the Keys field value -func (o *KeyList) GetKeys() []Key { - if o == nil { - var ret []Key - return ret - } - - return o.Keys -} - -// GetKeysOk returns a tuple with the Keys field value -// and a boolean to check if the value has been set. -func (o *KeyList) GetKeysOk() ([]Key, bool) { - if o == nil { - return nil, false - } - return o.Keys, true -} - -// SetKeys sets field value -func (o *KeyList) SetKeys(v []Key) { - o.Keys = v -} - -func (o KeyList) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o KeyList) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["keys"] = o.Keys - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *KeyList) 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{ - "keys", - } - - 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) - } - } - - varKeyList := _KeyList{} - - err = json.Unmarshal(data, &varKeyList) - - if err != nil { - return err - } - - *o = KeyList(varKeyList) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "keys") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableKeyList struct { - value *KeyList - isSet bool -} - -func (v NullableKeyList) Get() *KeyList { - return v.value -} - -func (v *NullableKeyList) Set(val *KeyList) { - v.value = val - v.isSet = true -} - -func (v NullableKeyList) IsSet() bool { - return v.isSet -} - -func (v *NullableKeyList) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableKeyList(val *KeyList) *NullableKeyList { - return &NullableKeyList{value: val, isSet: true} -} - -func (v NullableKeyList) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableKeyList) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_key_ring.go b/services/kms/v1betaapi/model_key_ring.go deleted file mode 100644 index 9dfefbf3c..000000000 --- a/services/kms/v1betaapi/model_key_ring.go +++ /dev/null @@ -1,296 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" - "time" -) - -// checks if the KeyRing type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &KeyRing{} - -// KeyRing struct for KeyRing -type KeyRing struct { - // The date and time the creation of the key ring was triggered. - CreatedAt time.Time `json:"createdAt"` - // A user chosen description to distinguish multiple key rings. - Description *string `json:"description,omitempty"` - // The display name to distinguish multiple key rings. - DisplayName string `json:"displayName"` - // A auto generated unique id which identifies the key ring. - Id string `json:"id"` - // The current state of the key ring. - State string `json:"state"` - AdditionalProperties map[string]interface{} -} - -type _KeyRing KeyRing - -// NewKeyRing instantiates a new KeyRing 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 NewKeyRing(createdAt time.Time, displayName string, id string, state string) *KeyRing { - this := KeyRing{} - this.CreatedAt = createdAt - this.DisplayName = displayName - this.Id = id - this.State = state - return &this -} - -// NewKeyRingWithDefaults instantiates a new KeyRing 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 NewKeyRingWithDefaults() *KeyRing { - this := KeyRing{} - return &this -} - -// GetCreatedAt returns the CreatedAt field value -func (o *KeyRing) GetCreatedAt() time.Time { - if o == nil { - var ret time.Time - return ret - } - - return o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value -// and a boolean to check if the value has been set. -func (o *KeyRing) GetCreatedAtOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return &o.CreatedAt, true -} - -// SetCreatedAt sets field value -func (o *KeyRing) SetCreatedAt(v time.Time) { - o.CreatedAt = v -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *KeyRing) GetDescription() string { - if o == nil || IsNil(o.Description) { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *KeyRing) GetDescriptionOk() (*string, bool) { - if o == nil || IsNil(o.Description) { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *KeyRing) HasDescription() bool { - if o != nil && !IsNil(o.Description) { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *KeyRing) SetDescription(v string) { - o.Description = &v -} - -// GetDisplayName returns the DisplayName field value -func (o *KeyRing) GetDisplayName() string { - if o == nil { - var ret string - return ret - } - - return o.DisplayName -} - -// GetDisplayNameOk returns a tuple with the DisplayName field value -// and a boolean to check if the value has been set. -func (o *KeyRing) GetDisplayNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.DisplayName, true -} - -// SetDisplayName sets field value -func (o *KeyRing) SetDisplayName(v string) { - o.DisplayName = v -} - -// GetId returns the Id field value -func (o *KeyRing) GetId() string { - if o == nil { - var ret string - return ret - } - - return o.Id -} - -// GetIdOk returns a tuple with the Id field value -// and a boolean to check if the value has been set. -func (o *KeyRing) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value -func (o *KeyRing) SetId(v string) { - o.Id = v -} - -// GetState returns the State field value -func (o *KeyRing) GetState() string { - if o == nil { - var ret string - return ret - } - - return o.State -} - -// GetStateOk returns a tuple with the State field value -// and a boolean to check if the value has been set. -func (o *KeyRing) GetStateOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.State, true -} - -// SetState sets field value -func (o *KeyRing) SetState(v string) { - o.State = v -} - -func (o KeyRing) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o KeyRing) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["createdAt"] = o.CreatedAt - if !IsNil(o.Description) { - toSerialize["description"] = o.Description - } - toSerialize["displayName"] = o.DisplayName - toSerialize["id"] = o.Id - toSerialize["state"] = o.State - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *KeyRing) 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{ - "createdAt", - "displayName", - "id", - "state", - } - - 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) - } - } - - varKeyRing := _KeyRing{} - - err = json.Unmarshal(data, &varKeyRing) - - if err != nil { - return err - } - - *o = KeyRing(varKeyRing) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "createdAt") - delete(additionalProperties, "description") - delete(additionalProperties, "displayName") - delete(additionalProperties, "id") - delete(additionalProperties, "state") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableKeyRing struct { - value *KeyRing - isSet bool -} - -func (v NullableKeyRing) Get() *KeyRing { - return v.value -} - -func (v *NullableKeyRing) Set(val *KeyRing) { - v.value = val - v.isSet = true -} - -func (v NullableKeyRing) IsSet() bool { - return v.isSet -} - -func (v *NullableKeyRing) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableKeyRing(val *KeyRing) *NullableKeyRing { - return &NullableKeyRing{value: val, isSet: true} -} - -func (v NullableKeyRing) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableKeyRing) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_key_ring_list.go b/services/kms/v1betaapi/model_key_ring_list.go deleted file mode 100644 index b8170a72a..000000000 --- a/services/kms/v1betaapi/model_key_ring_list.go +++ /dev/null @@ -1,166 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the KeyRingList type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &KeyRingList{} - -// KeyRingList struct for KeyRingList -type KeyRingList struct { - KeyRings []KeyRing `json:"keyRings"` - AdditionalProperties map[string]interface{} -} - -type _KeyRingList KeyRingList - -// NewKeyRingList instantiates a new KeyRingList 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 NewKeyRingList(keyRings []KeyRing) *KeyRingList { - this := KeyRingList{} - this.KeyRings = keyRings - return &this -} - -// NewKeyRingListWithDefaults instantiates a new KeyRingList 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 NewKeyRingListWithDefaults() *KeyRingList { - this := KeyRingList{} - return &this -} - -// GetKeyRings returns the KeyRings field value -func (o *KeyRingList) GetKeyRings() []KeyRing { - if o == nil { - var ret []KeyRing - return ret - } - - return o.KeyRings -} - -// GetKeyRingsOk returns a tuple with the KeyRings field value -// and a boolean to check if the value has been set. -func (o *KeyRingList) GetKeyRingsOk() ([]KeyRing, bool) { - if o == nil { - return nil, false - } - return o.KeyRings, true -} - -// SetKeyRings sets field value -func (o *KeyRingList) SetKeyRings(v []KeyRing) { - o.KeyRings = v -} - -func (o KeyRingList) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o KeyRingList) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["keyRings"] = o.KeyRings - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *KeyRingList) 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{ - "keyRings", - } - - 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) - } - } - - varKeyRingList := _KeyRingList{} - - err = json.Unmarshal(data, &varKeyRingList) - - if err != nil { - return err - } - - *o = KeyRingList(varKeyRingList) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "keyRings") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableKeyRingList struct { - value *KeyRingList - isSet bool -} - -func (v NullableKeyRingList) Get() *KeyRingList { - return v.value -} - -func (v *NullableKeyRingList) Set(val *KeyRingList) { - v.value = val - v.isSet = true -} - -func (v NullableKeyRingList) IsSet() bool { - return v.isSet -} - -func (v *NullableKeyRingList) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableKeyRingList(val *KeyRingList) *NullableKeyRingList { - return &NullableKeyRingList{value: val, isSet: true} -} - -func (v NullableKeyRingList) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableKeyRingList) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_protection.go b/services/kms/v1betaapi/model_protection.go deleted file mode 100644 index 716e59246..000000000 --- a/services/kms/v1betaapi/model_protection.go +++ /dev/null @@ -1,111 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// Protection The underlying system that is responsible for protecting the key material. Overrides the deprecated 'backend' field. -type Protection string - -// List of protection -const ( - PROTECTION_SOFTWARE Protection = "software" - PROTECTION_UNKNOWN_DEFAULT_OPEN_API Protection = "unknown_default_open_api" -) - -// All allowed values of Protection enum -var AllowedProtectionEnumValues = []Protection{ - "software", - "unknown_default_open_api", -} - -func (v *Protection) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := Protection(value) - for _, existing := range AllowedProtectionEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - *v = PROTECTION_UNKNOWN_DEFAULT_OPEN_API - return nil -} - -// NewProtectionFromValue returns a pointer to a valid Protection -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewProtectionFromValue(v string) (*Protection, error) { - ev := Protection(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for Protection: valid values are %v", v, AllowedProtectionEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v Protection) IsValid() bool { - for _, existing := range AllowedProtectionEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to protection value -func (v Protection) Ptr() *Protection { - return &v -} - -type NullableProtection struct { - value *Protection - isSet bool -} - -func (v NullableProtection) Get() *Protection { - return v.value -} - -func (v *NullableProtection) Set(val *Protection) { - v.value = val - v.isSet = true -} - -func (v NullableProtection) IsSet() bool { - return v.isSet -} - -func (v *NullableProtection) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableProtection(val *Protection) *NullableProtection { - return &NullableProtection{value: val, isSet: true} -} - -func (v NullableProtection) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableProtection) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_purpose.go b/services/kms/v1betaapi/model_purpose.go deleted file mode 100644 index 57dbed86f..000000000 --- a/services/kms/v1betaapi/model_purpose.go +++ /dev/null @@ -1,117 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// Purpose The purpose of the key. -type Purpose string - -// List of purpose -const ( - PURPOSE_SYMMETRIC_ENCRYPT_DECRYPT Purpose = "symmetric_encrypt_decrypt" - PURPOSE_ASYMMETRIC_ENCRYPT_DECRYPT Purpose = "asymmetric_encrypt_decrypt" - PURPOSE_MESSAGE_AUTHENTICATION_CODE Purpose = "message_authentication_code" - PURPOSE_ASYMMETRIC_SIGN_VERIFY Purpose = "asymmetric_sign_verify" - PURPOSE_UNKNOWN_DEFAULT_OPEN_API Purpose = "unknown_default_open_api" -) - -// All allowed values of Purpose enum -var AllowedPurposeEnumValues = []Purpose{ - "symmetric_encrypt_decrypt", - "asymmetric_encrypt_decrypt", - "message_authentication_code", - "asymmetric_sign_verify", - "unknown_default_open_api", -} - -func (v *Purpose) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := Purpose(value) - for _, existing := range AllowedPurposeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - *v = PURPOSE_UNKNOWN_DEFAULT_OPEN_API - return nil -} - -// NewPurposeFromValue returns a pointer to a valid Purpose -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewPurposeFromValue(v string) (*Purpose, error) { - ev := Purpose(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for Purpose: valid values are %v", v, AllowedPurposeEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v Purpose) IsValid() bool { - for _, existing := range AllowedPurposeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to purpose value -func (v Purpose) Ptr() *Purpose { - return &v -} - -type NullablePurpose struct { - value *Purpose - isSet bool -} - -func (v NullablePurpose) Get() *Purpose { - return v.value -} - -func (v *NullablePurpose) Set(val *Purpose) { - v.value = val - v.isSet = true -} - -func (v NullablePurpose) IsSet() bool { - return v.isSet -} - -func (v *NullablePurpose) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullablePurpose(val *Purpose) *NullablePurpose { - return &NullablePurpose{value: val, isSet: true} -} - -func (v NullablePurpose) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullablePurpose) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_sign_payload.go b/services/kms/v1betaapi/model_sign_payload.go deleted file mode 100644 index f59e35d61..000000000 --- a/services/kms/v1betaapi/model_sign_payload.go +++ /dev/null @@ -1,167 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the SignPayload type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &SignPayload{} - -// SignPayload struct for SignPayload -type SignPayload struct { - // The data that has to be signed. Encoded in base64. - Data string `json:"data"` - AdditionalProperties map[string]interface{} -} - -type _SignPayload SignPayload - -// NewSignPayload instantiates a new SignPayload 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 NewSignPayload(data string) *SignPayload { - this := SignPayload{} - this.Data = data - return &this -} - -// NewSignPayloadWithDefaults instantiates a new SignPayload 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 NewSignPayloadWithDefaults() *SignPayload { - this := SignPayload{} - return &this -} - -// GetData returns the Data field value -func (o *SignPayload) GetData() string { - if o == nil { - var ret string - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *SignPayload) GetDataOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value -func (o *SignPayload) SetData(v string) { - o.Data = v -} - -func (o SignPayload) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o SignPayload) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *SignPayload) 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{ - "data", - } - - 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) - } - } - - varSignPayload := _SignPayload{} - - err = json.Unmarshal(data, &varSignPayload) - - if err != nil { - return err - } - - *o = SignPayload(varSignPayload) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "data") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableSignPayload struct { - value *SignPayload - isSet bool -} - -func (v NullableSignPayload) Get() *SignPayload { - return v.value -} - -func (v *NullableSignPayload) Set(val *SignPayload) { - v.value = val - v.isSet = true -} - -func (v NullableSignPayload) IsSet() bool { - return v.isSet -} - -func (v *NullableSignPayload) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableSignPayload(val *SignPayload) *NullableSignPayload { - return &NullableSignPayload{value: val, isSet: true} -} - -func (v NullableSignPayload) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableSignPayload) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_signed_data.go b/services/kms/v1betaapi/model_signed_data.go deleted file mode 100644 index 68a4f8461..000000000 --- a/services/kms/v1betaapi/model_signed_data.go +++ /dev/null @@ -1,197 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the SignedData type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &SignedData{} - -// SignedData struct for SignedData -type SignedData struct { - // The data that was signed. Encoded in base64. - Data string `json:"data"` - // The signature of the data. Encoded in base64. - Signature string `json:"signature"` - AdditionalProperties map[string]interface{} -} - -type _SignedData SignedData - -// NewSignedData instantiates a new SignedData 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 NewSignedData(data string, signature string) *SignedData { - this := SignedData{} - this.Data = data - this.Signature = signature - return &this -} - -// NewSignedDataWithDefaults instantiates a new SignedData 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 NewSignedDataWithDefaults() *SignedData { - this := SignedData{} - return &this -} - -// GetData returns the Data field value -func (o *SignedData) GetData() string { - if o == nil { - var ret string - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *SignedData) GetDataOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value -func (o *SignedData) SetData(v string) { - o.Data = v -} - -// GetSignature returns the Signature field value -func (o *SignedData) GetSignature() string { - if o == nil { - var ret string - return ret - } - - return o.Signature -} - -// GetSignatureOk returns a tuple with the Signature field value -// and a boolean to check if the value has been set. -func (o *SignedData) GetSignatureOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Signature, true -} - -// SetSignature sets field value -func (o *SignedData) SetSignature(v string) { - o.Signature = v -} - -func (o SignedData) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o SignedData) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - toSerialize["signature"] = o.Signature - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *SignedData) 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{ - "data", - "signature", - } - - 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) - } - } - - varSignedData := _SignedData{} - - err = json.Unmarshal(data, &varSignedData) - - if err != nil { - return err - } - - *o = SignedData(varSignedData) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "data") - delete(additionalProperties, "signature") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableSignedData struct { - value *SignedData - isSet bool -} - -func (v NullableSignedData) Get() *SignedData { - return v.value -} - -func (v *NullableSignedData) Set(val *SignedData) { - v.value = val - v.isSet = true -} - -func (v NullableSignedData) IsSet() bool { - return v.isSet -} - -func (v *NullableSignedData) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableSignedData(val *SignedData) *NullableSignedData { - return &NullableSignedData{value: val, isSet: true} -} - -func (v NullableSignedData) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableSignedData) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_verified_data.go b/services/kms/v1betaapi/model_verified_data.go deleted file mode 100644 index 49517b3a9..000000000 --- a/services/kms/v1betaapi/model_verified_data.go +++ /dev/null @@ -1,167 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the VerifiedData type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &VerifiedData{} - -// VerifiedData struct for VerifiedData -type VerifiedData struct { - // Whether or not the data has a valid signature. - Valid bool `json:"valid"` - AdditionalProperties map[string]interface{} -} - -type _VerifiedData VerifiedData - -// NewVerifiedData instantiates a new VerifiedData 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 NewVerifiedData(valid bool) *VerifiedData { - this := VerifiedData{} - this.Valid = valid - return &this -} - -// NewVerifiedDataWithDefaults instantiates a new VerifiedData 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 NewVerifiedDataWithDefaults() *VerifiedData { - this := VerifiedData{} - return &this -} - -// GetValid returns the Valid field value -func (o *VerifiedData) GetValid() bool { - if o == nil { - var ret bool - return ret - } - - return o.Valid -} - -// GetValidOk returns a tuple with the Valid field value -// and a boolean to check if the value has been set. -func (o *VerifiedData) GetValidOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.Valid, true -} - -// SetValid sets field value -func (o *VerifiedData) SetValid(v bool) { - o.Valid = v -} - -func (o VerifiedData) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o VerifiedData) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["valid"] = o.Valid - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *VerifiedData) 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{ - "valid", - } - - 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) - } - } - - varVerifiedData := _VerifiedData{} - - err = json.Unmarshal(data, &varVerifiedData) - - if err != nil { - return err - } - - *o = VerifiedData(varVerifiedData) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "valid") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableVerifiedData struct { - value *VerifiedData - isSet bool -} - -func (v NullableVerifiedData) Get() *VerifiedData { - return v.value -} - -func (v *NullableVerifiedData) Set(val *VerifiedData) { - v.value = val - v.isSet = true -} - -func (v NullableVerifiedData) IsSet() bool { - return v.isSet -} - -func (v *NullableVerifiedData) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableVerifiedData(val *VerifiedData) *NullableVerifiedData { - return &NullableVerifiedData{value: val, isSet: true} -} - -func (v NullableVerifiedData) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableVerifiedData) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_verify_payload.go b/services/kms/v1betaapi/model_verify_payload.go deleted file mode 100644 index f711895c4..000000000 --- a/services/kms/v1betaapi/model_verify_payload.go +++ /dev/null @@ -1,197 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the VerifyPayload type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &VerifyPayload{} - -// VerifyPayload struct for VerifyPayload -type VerifyPayload struct { - // The data to be verified. Encoded in base64. - Data string `json:"data"` - // The signature of the data. Encoded in base64. - Signature string `json:"signature"` - AdditionalProperties map[string]interface{} -} - -type _VerifyPayload VerifyPayload - -// NewVerifyPayload instantiates a new VerifyPayload 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 NewVerifyPayload(data string, signature string) *VerifyPayload { - this := VerifyPayload{} - this.Data = data - this.Signature = signature - return &this -} - -// NewVerifyPayloadWithDefaults instantiates a new VerifyPayload 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 NewVerifyPayloadWithDefaults() *VerifyPayload { - this := VerifyPayload{} - return &this -} - -// GetData returns the Data field value -func (o *VerifyPayload) GetData() string { - if o == nil { - var ret string - return ret - } - - return o.Data -} - -// GetDataOk returns a tuple with the Data field value -// and a boolean to check if the value has been set. -func (o *VerifyPayload) GetDataOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Data, true -} - -// SetData sets field value -func (o *VerifyPayload) SetData(v string) { - o.Data = v -} - -// GetSignature returns the Signature field value -func (o *VerifyPayload) GetSignature() string { - if o == nil { - var ret string - return ret - } - - return o.Signature -} - -// GetSignatureOk returns a tuple with the Signature field value -// and a boolean to check if the value has been set. -func (o *VerifyPayload) GetSignatureOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Signature, true -} - -// SetSignature sets field value -func (o *VerifyPayload) SetSignature(v string) { - o.Signature = v -} - -func (o VerifyPayload) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o VerifyPayload) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - toSerialize["signature"] = o.Signature - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *VerifyPayload) 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{ - "data", - "signature", - } - - 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) - } - } - - varVerifyPayload := _VerifyPayload{} - - err = json.Unmarshal(data, &varVerifyPayload) - - if err != nil { - return err - } - - *o = VerifyPayload(varVerifyPayload) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "data") - delete(additionalProperties, "signature") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableVerifyPayload struct { - value *VerifyPayload - isSet bool -} - -func (v NullableVerifyPayload) Get() *VerifyPayload { - return v.value -} - -func (v *NullableVerifyPayload) Set(val *VerifyPayload) { - v.value = val - v.isSet = true -} - -func (v NullableVerifyPayload) IsSet() bool { - return v.isSet -} - -func (v *NullableVerifyPayload) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableVerifyPayload(val *VerifyPayload) *NullableVerifyPayload { - return &NullableVerifyPayload{value: val, isSet: true} -} - -func (v NullableVerifyPayload) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableVerifyPayload) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_version.go b/services/kms/v1betaapi/model_version.go deleted file mode 100644 index 0b5a591ac..000000000 --- a/services/kms/v1betaapi/model_version.go +++ /dev/null @@ -1,396 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" - "time" -) - -// checks if the Version type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &Version{} - -// Version struct for Version -type Version struct { - // The date and time the creation of the key was triggered. - CreatedAt time.Time `json:"createdAt"` - // The scheduled date when a version's key material will be erased completely from the backend - DestroyDate *time.Time `json:"destroyDate,omitempty"` - // States whether versions is enabled or disabled. - Disabled bool `json:"disabled"` - // The unique id of the key this version is assigned to. - KeyId string `json:"keyId"` - // The unique id of the key ring the key of this version is assigned to. - KeyRingId string `json:"keyRingId"` - // A sequential number which identifies the key versions. - Number int64 `json:"number"` - // The public key of the key version. Only present in asymmetric keys. - PublicKey *string `json:"publicKey,omitempty"` - // The current state of the key. - State string `json:"state"` - AdditionalProperties map[string]interface{} -} - -type _Version Version - -// NewVersion instantiates a new Version 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 NewVersion(createdAt time.Time, disabled bool, keyId string, keyRingId string, number int64, state string) *Version { - this := Version{} - this.CreatedAt = createdAt - this.Disabled = disabled - this.KeyId = keyId - this.KeyRingId = keyRingId - this.Number = number - this.State = state - return &this -} - -// NewVersionWithDefaults instantiates a new Version 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 NewVersionWithDefaults() *Version { - this := Version{} - var disabled bool = false - this.Disabled = disabled - return &this -} - -// GetCreatedAt returns the CreatedAt field value -func (o *Version) GetCreatedAt() time.Time { - if o == nil { - var ret time.Time - return ret - } - - return o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value -// and a boolean to check if the value has been set. -func (o *Version) GetCreatedAtOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return &o.CreatedAt, true -} - -// SetCreatedAt sets field value -func (o *Version) SetCreatedAt(v time.Time) { - o.CreatedAt = v -} - -// GetDestroyDate returns the DestroyDate field value if set, zero value otherwise. -func (o *Version) GetDestroyDate() time.Time { - if o == nil || IsNil(o.DestroyDate) { - var ret time.Time - return ret - } - return *o.DestroyDate -} - -// GetDestroyDateOk returns a tuple with the DestroyDate field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Version) GetDestroyDateOk() (*time.Time, bool) { - if o == nil || IsNil(o.DestroyDate) { - return nil, false - } - return o.DestroyDate, true -} - -// HasDestroyDate returns a boolean if a field has been set. -func (o *Version) HasDestroyDate() bool { - if o != nil && !IsNil(o.DestroyDate) { - return true - } - - return false -} - -// SetDestroyDate gets a reference to the given time.Time and assigns it to the DestroyDate field. -func (o *Version) SetDestroyDate(v time.Time) { - o.DestroyDate = &v -} - -// GetDisabled returns the Disabled field value -func (o *Version) GetDisabled() bool { - if o == nil { - var ret bool - return ret - } - - return o.Disabled -} - -// GetDisabledOk returns a tuple with the Disabled field value -// and a boolean to check if the value has been set. -func (o *Version) GetDisabledOk() (*bool, bool) { - if o == nil { - return nil, false - } - return &o.Disabled, true -} - -// SetDisabled sets field value -func (o *Version) SetDisabled(v bool) { - o.Disabled = v -} - -// GetKeyId returns the KeyId field value -func (o *Version) GetKeyId() string { - if o == nil { - var ret string - return ret - } - - return o.KeyId -} - -// GetKeyIdOk returns a tuple with the KeyId field value -// and a boolean to check if the value has been set. -func (o *Version) GetKeyIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.KeyId, true -} - -// SetKeyId sets field value -func (o *Version) SetKeyId(v string) { - o.KeyId = v -} - -// GetKeyRingId returns the KeyRingId field value -func (o *Version) GetKeyRingId() string { - if o == nil { - var ret string - return ret - } - - return o.KeyRingId -} - -// GetKeyRingIdOk returns a tuple with the KeyRingId field value -// and a boolean to check if the value has been set. -func (o *Version) GetKeyRingIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.KeyRingId, true -} - -// SetKeyRingId sets field value -func (o *Version) SetKeyRingId(v string) { - o.KeyRingId = v -} - -// GetNumber returns the Number field value -func (o *Version) GetNumber() int64 { - if o == nil { - var ret int64 - return ret - } - - return o.Number -} - -// GetNumberOk returns a tuple with the Number field value -// and a boolean to check if the value has been set. -func (o *Version) GetNumberOk() (*int64, bool) { - if o == nil { - return nil, false - } - return &o.Number, true -} - -// SetNumber sets field value -func (o *Version) SetNumber(v int64) { - o.Number = v -} - -// GetPublicKey returns the PublicKey field value if set, zero value otherwise. -func (o *Version) GetPublicKey() string { - if o == nil || IsNil(o.PublicKey) { - var ret string - return ret - } - return *o.PublicKey -} - -// GetPublicKeyOk returns a tuple with the PublicKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *Version) GetPublicKeyOk() (*string, bool) { - if o == nil || IsNil(o.PublicKey) { - return nil, false - } - return o.PublicKey, true -} - -// HasPublicKey returns a boolean if a field has been set. -func (o *Version) HasPublicKey() bool { - if o != nil && !IsNil(o.PublicKey) { - return true - } - - return false -} - -// SetPublicKey gets a reference to the given string and assigns it to the PublicKey field. -func (o *Version) SetPublicKey(v string) { - o.PublicKey = &v -} - -// GetState returns the State field value -func (o *Version) GetState() string { - if o == nil { - var ret string - return ret - } - - return o.State -} - -// GetStateOk returns a tuple with the State field value -// and a boolean to check if the value has been set. -func (o *Version) GetStateOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.State, true -} - -// SetState sets field value -func (o *Version) SetState(v string) { - o.State = v -} - -func (o Version) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o Version) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["createdAt"] = o.CreatedAt - if !IsNil(o.DestroyDate) { - toSerialize["destroyDate"] = o.DestroyDate - } - toSerialize["disabled"] = o.Disabled - toSerialize["keyId"] = o.KeyId - toSerialize["keyRingId"] = o.KeyRingId - toSerialize["number"] = o.Number - if !IsNil(o.PublicKey) { - toSerialize["publicKey"] = o.PublicKey - } - toSerialize["state"] = o.State - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *Version) 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{ - "createdAt", - "disabled", - "keyId", - "keyRingId", - "number", - "state", - } - - 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) - } - } - - varVersion := _Version{} - - err = json.Unmarshal(data, &varVersion) - - if err != nil { - return err - } - - *o = Version(varVersion) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "createdAt") - delete(additionalProperties, "destroyDate") - delete(additionalProperties, "disabled") - delete(additionalProperties, "keyId") - delete(additionalProperties, "keyRingId") - delete(additionalProperties, "number") - delete(additionalProperties, "publicKey") - delete(additionalProperties, "state") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableVersion struct { - value *Version - isSet bool -} - -func (v NullableVersion) Get() *Version { - return v.value -} - -func (v *NullableVersion) Set(val *Version) { - v.value = val - v.isSet = true -} - -func (v NullableVersion) IsSet() bool { - return v.isSet -} - -func (v *NullableVersion) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableVersion(val *Version) *NullableVersion { - return &NullableVersion{value: val, isSet: true} -} - -func (v NullableVersion) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableVersion) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_version_list.go b/services/kms/v1betaapi/model_version_list.go deleted file mode 100644 index c0dbf1640..000000000 --- a/services/kms/v1betaapi/model_version_list.go +++ /dev/null @@ -1,166 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the VersionList type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &VersionList{} - -// VersionList struct for VersionList -type VersionList struct { - Versions []Version `json:"versions"` - AdditionalProperties map[string]interface{} -} - -type _VersionList VersionList - -// NewVersionList instantiates a new VersionList 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 NewVersionList(versions []Version) *VersionList { - this := VersionList{} - this.Versions = versions - return &this -} - -// NewVersionListWithDefaults instantiates a new VersionList 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 NewVersionListWithDefaults() *VersionList { - this := VersionList{} - return &this -} - -// GetVersions returns the Versions field value -func (o *VersionList) GetVersions() []Version { - if o == nil { - var ret []Version - return ret - } - - return o.Versions -} - -// GetVersionsOk returns a tuple with the Versions field value -// and a boolean to check if the value has been set. -func (o *VersionList) GetVersionsOk() ([]Version, bool) { - if o == nil { - return nil, false - } - return o.Versions, true -} - -// SetVersions sets field value -func (o *VersionList) SetVersions(v []Version) { - o.Versions = v -} - -func (o VersionList) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o VersionList) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["versions"] = o.Versions - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *VersionList) 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{ - "versions", - } - - 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) - } - } - - varVersionList := _VersionList{} - - err = json.Unmarshal(data, &varVersionList) - - if err != nil { - return err - } - - *o = VersionList(varVersionList) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "versions") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableVersionList struct { - value *VersionList - isSet bool -} - -func (v NullableVersionList) Get() *VersionList { - return v.value -} - -func (v *NullableVersionList) Set(val *VersionList) { - v.value = val - v.isSet = true -} - -func (v NullableVersionList) IsSet() bool { - return v.isSet -} - -func (v *NullableVersionList) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableVersionList(val *VersionList) *NullableVersionList { - return &NullableVersionList{value: val, isSet: true} -} - -func (v NullableVersionList) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableVersionList) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_wrapping_algorithm.go b/services/kms/v1betaapi/model_wrapping_algorithm.go deleted file mode 100644 index c642f282c..000000000 --- a/services/kms/v1betaapi/model_wrapping_algorithm.go +++ /dev/null @@ -1,125 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// WrappingAlgorithm The wrapping algorithm used to wrap the key to import. -type WrappingAlgorithm string - -// List of wrappingAlgorithm -const ( - WRAPPINGALGORITHM_RSA_2048_OAEP_SHA256 WrappingAlgorithm = "rsa_2048_oaep_sha256" - WRAPPINGALGORITHM_RSA_3072_OAEP_SHA256 WrappingAlgorithm = "rsa_3072_oaep_sha256" - WRAPPINGALGORITHM_RSA_4096_OAEP_SHA256 WrappingAlgorithm = "rsa_4096_oaep_sha256" - WRAPPINGALGORITHM_RSA_4096_OAEP_SHA512 WrappingAlgorithm = "rsa_4096_oaep_sha512" - WRAPPINGALGORITHM_RSA_2048_OAEP_SHA256_AES_256_KEY_WRAP WrappingAlgorithm = "rsa_2048_oaep_sha256_aes_256_key_wrap" - WRAPPINGALGORITHM_RSA_3072_OAEP_SHA256_AES_256_KEY_WRAP WrappingAlgorithm = "rsa_3072_oaep_sha256_aes_256_key_wrap" - WRAPPINGALGORITHM_RSA_4096_OAEP_SHA256_AES_256_KEY_WRAP WrappingAlgorithm = "rsa_4096_oaep_sha256_aes_256_key_wrap" - WRAPPINGALGORITHM_RSA_4096_OAEP_SHA512_AES_256_KEY_WRAP WrappingAlgorithm = "rsa_4096_oaep_sha512_aes_256_key_wrap" - WRAPPINGALGORITHM_UNKNOWN_DEFAULT_OPEN_API WrappingAlgorithm = "unknown_default_open_api" -) - -// All allowed values of WrappingAlgorithm enum -var AllowedWrappingAlgorithmEnumValues = []WrappingAlgorithm{ - "rsa_2048_oaep_sha256", - "rsa_3072_oaep_sha256", - "rsa_4096_oaep_sha256", - "rsa_4096_oaep_sha512", - "rsa_2048_oaep_sha256_aes_256_key_wrap", - "rsa_3072_oaep_sha256_aes_256_key_wrap", - "rsa_4096_oaep_sha256_aes_256_key_wrap", - "rsa_4096_oaep_sha512_aes_256_key_wrap", - "unknown_default_open_api", -} - -func (v *WrappingAlgorithm) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := WrappingAlgorithm(value) - for _, existing := range AllowedWrappingAlgorithmEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - *v = WRAPPINGALGORITHM_UNKNOWN_DEFAULT_OPEN_API - return nil -} - -// NewWrappingAlgorithmFromValue returns a pointer to a valid WrappingAlgorithm -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewWrappingAlgorithmFromValue(v string) (*WrappingAlgorithm, error) { - ev := WrappingAlgorithm(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for WrappingAlgorithm: valid values are %v", v, AllowedWrappingAlgorithmEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v WrappingAlgorithm) IsValid() bool { - for _, existing := range AllowedWrappingAlgorithmEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to wrappingAlgorithm value -func (v WrappingAlgorithm) Ptr() *WrappingAlgorithm { - return &v -} - -type NullableWrappingAlgorithm struct { - value *WrappingAlgorithm - isSet bool -} - -func (v NullableWrappingAlgorithm) Get() *WrappingAlgorithm { - return v.value -} - -func (v *NullableWrappingAlgorithm) Set(val *WrappingAlgorithm) { - v.value = val - v.isSet = true -} - -func (v NullableWrappingAlgorithm) IsSet() bool { - return v.isSet -} - -func (v *NullableWrappingAlgorithm) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableWrappingAlgorithm(val *WrappingAlgorithm) *NullableWrappingAlgorithm { - return &NullableWrappingAlgorithm{value: val, isSet: true} -} - -func (v NullableWrappingAlgorithm) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableWrappingAlgorithm) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_wrapping_key.go b/services/kms/v1betaapi/model_wrapping_key.go deleted file mode 100644 index af016b890..000000000 --- a/services/kms/v1betaapi/model_wrapping_key.go +++ /dev/null @@ -1,545 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" - "time" -) - -// checks if the WrappingKey type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &WrappingKey{} - -// WrappingKey struct for WrappingKey -type WrappingKey struct { - AccessScope AccessScope `json:"access_scope"` - Algorithm WrappingAlgorithm `json:"algorithm"` - // Deprecated - Backend Backend `json:"backend"` - // The date and time the creation of the wrapping key was triggered. - CreatedAt time.Time `json:"createdAt"` - // A user chosen description to distinguish multiple wrapping keys. - Description *string `json:"description,omitempty"` - // The display name to distinguish multiple wrapping keys. - DisplayName string `json:"displayName"` - // The date and time the wrapping key will expire. - ExpiresAt time.Time `json:"expiresAt"` - // A auto generated unique id which identifies the wrapping keys. - Id string `json:"id"` - // The unique id of the key ring this wrapping key is assigned to. - KeyRingId string `json:"keyRingId"` - Protection Protection `json:"protection"` - // The public key of the wrapping key. - PublicKey *string `json:"publicKey,omitempty"` - Purpose WrappingPurpose `json:"purpose"` - // The current state of the wrapping key. - State string `json:"state"` - AdditionalProperties map[string]interface{} -} - -type _WrappingKey WrappingKey - -// NewWrappingKey instantiates a new WrappingKey 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 NewWrappingKey(accessScope AccessScope, algorithm WrappingAlgorithm, backend Backend, createdAt time.Time, displayName string, expiresAt time.Time, id string, keyRingId string, protection Protection, purpose WrappingPurpose, state string) *WrappingKey { - this := WrappingKey{} - this.AccessScope = accessScope - this.Algorithm = algorithm - this.Backend = backend - this.CreatedAt = createdAt - this.DisplayName = displayName - this.ExpiresAt = expiresAt - this.Id = id - this.KeyRingId = keyRingId - this.Protection = protection - this.Purpose = purpose - this.State = state - return &this -} - -// NewWrappingKeyWithDefaults instantiates a new WrappingKey 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 NewWrappingKeyWithDefaults() *WrappingKey { - this := WrappingKey{} - var accessScope AccessScope = ACCESSSCOPE_PUBLIC - this.AccessScope = accessScope - return &this -} - -// GetAccessScope returns the AccessScope field value -func (o *WrappingKey) GetAccessScope() AccessScope { - if o == nil { - var ret AccessScope - return ret - } - - return o.AccessScope -} - -// GetAccessScopeOk returns a tuple with the AccessScope field value -// and a boolean to check if the value has been set. -func (o *WrappingKey) GetAccessScopeOk() (*AccessScope, bool) { - if o == nil { - return nil, false - } - return &o.AccessScope, true -} - -// SetAccessScope sets field value -func (o *WrappingKey) SetAccessScope(v AccessScope) { - o.AccessScope = v -} - -// GetAlgorithm returns the Algorithm field value -func (o *WrappingKey) GetAlgorithm() WrappingAlgorithm { - if o == nil { - var ret WrappingAlgorithm - return ret - } - - return o.Algorithm -} - -// GetAlgorithmOk returns a tuple with the Algorithm field value -// and a boolean to check if the value has been set. -func (o *WrappingKey) GetAlgorithmOk() (*WrappingAlgorithm, bool) { - if o == nil { - return nil, false - } - return &o.Algorithm, true -} - -// SetAlgorithm sets field value -func (o *WrappingKey) SetAlgorithm(v WrappingAlgorithm) { - o.Algorithm = v -} - -// GetBackend returns the Backend field value -// Deprecated -func (o *WrappingKey) GetBackend() Backend { - if o == nil { - var ret Backend - return ret - } - - return o.Backend -} - -// GetBackendOk returns a tuple with the Backend field value -// and a boolean to check if the value has been set. -// Deprecated -func (o *WrappingKey) GetBackendOk() (*Backend, bool) { - if o == nil { - return nil, false - } - return &o.Backend, true -} - -// SetBackend sets field value -// Deprecated -func (o *WrappingKey) SetBackend(v Backend) { - o.Backend = v -} - -// GetCreatedAt returns the CreatedAt field value -func (o *WrappingKey) GetCreatedAt() time.Time { - if o == nil { - var ret time.Time - return ret - } - - return o.CreatedAt -} - -// GetCreatedAtOk returns a tuple with the CreatedAt field value -// and a boolean to check if the value has been set. -func (o *WrappingKey) GetCreatedAtOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return &o.CreatedAt, true -} - -// SetCreatedAt sets field value -func (o *WrappingKey) SetCreatedAt(v time.Time) { - o.CreatedAt = v -} - -// GetDescription returns the Description field value if set, zero value otherwise. -func (o *WrappingKey) GetDescription() string { - if o == nil || IsNil(o.Description) { - var ret string - return ret - } - return *o.Description -} - -// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WrappingKey) GetDescriptionOk() (*string, bool) { - if o == nil || IsNil(o.Description) { - return nil, false - } - return o.Description, true -} - -// HasDescription returns a boolean if a field has been set. -func (o *WrappingKey) HasDescription() bool { - if o != nil && !IsNil(o.Description) { - return true - } - - return false -} - -// SetDescription gets a reference to the given string and assigns it to the Description field. -func (o *WrappingKey) SetDescription(v string) { - o.Description = &v -} - -// GetDisplayName returns the DisplayName field value -func (o *WrappingKey) GetDisplayName() string { - if o == nil { - var ret string - return ret - } - - return o.DisplayName -} - -// GetDisplayNameOk returns a tuple with the DisplayName field value -// and a boolean to check if the value has been set. -func (o *WrappingKey) GetDisplayNameOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.DisplayName, true -} - -// SetDisplayName sets field value -func (o *WrappingKey) SetDisplayName(v string) { - o.DisplayName = v -} - -// GetExpiresAt returns the ExpiresAt field value -func (o *WrappingKey) GetExpiresAt() time.Time { - if o == nil { - var ret time.Time - return ret - } - - return o.ExpiresAt -} - -// GetExpiresAtOk returns a tuple with the ExpiresAt field value -// and a boolean to check if the value has been set. -func (o *WrappingKey) GetExpiresAtOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - return &o.ExpiresAt, true -} - -// SetExpiresAt sets field value -func (o *WrappingKey) SetExpiresAt(v time.Time) { - o.ExpiresAt = v -} - -// GetId returns the Id field value -func (o *WrappingKey) GetId() string { - if o == nil { - var ret string - return ret - } - - return o.Id -} - -// GetIdOk returns a tuple with the Id field value -// and a boolean to check if the value has been set. -func (o *WrappingKey) GetIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Id, true -} - -// SetId sets field value -func (o *WrappingKey) SetId(v string) { - o.Id = v -} - -// GetKeyRingId returns the KeyRingId field value -func (o *WrappingKey) GetKeyRingId() string { - if o == nil { - var ret string - return ret - } - - return o.KeyRingId -} - -// GetKeyRingIdOk returns a tuple with the KeyRingId field value -// and a boolean to check if the value has been set. -func (o *WrappingKey) GetKeyRingIdOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.KeyRingId, true -} - -// SetKeyRingId sets field value -func (o *WrappingKey) SetKeyRingId(v string) { - o.KeyRingId = v -} - -// GetProtection returns the Protection field value -func (o *WrappingKey) GetProtection() Protection { - if o == nil { - var ret Protection - return ret - } - - return o.Protection -} - -// GetProtectionOk returns a tuple with the Protection field value -// and a boolean to check if the value has been set. -func (o *WrappingKey) GetProtectionOk() (*Protection, bool) { - if o == nil { - return nil, false - } - return &o.Protection, true -} - -// SetProtection sets field value -func (o *WrappingKey) SetProtection(v Protection) { - o.Protection = v -} - -// GetPublicKey returns the PublicKey field value if set, zero value otherwise. -func (o *WrappingKey) GetPublicKey() string { - if o == nil || IsNil(o.PublicKey) { - var ret string - return ret - } - return *o.PublicKey -} - -// GetPublicKeyOk returns a tuple with the PublicKey field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *WrappingKey) GetPublicKeyOk() (*string, bool) { - if o == nil || IsNil(o.PublicKey) { - return nil, false - } - return o.PublicKey, true -} - -// HasPublicKey returns a boolean if a field has been set. -func (o *WrappingKey) HasPublicKey() bool { - if o != nil && !IsNil(o.PublicKey) { - return true - } - - return false -} - -// SetPublicKey gets a reference to the given string and assigns it to the PublicKey field. -func (o *WrappingKey) SetPublicKey(v string) { - o.PublicKey = &v -} - -// GetPurpose returns the Purpose field value -func (o *WrappingKey) GetPurpose() WrappingPurpose { - if o == nil { - var ret WrappingPurpose - return ret - } - - return o.Purpose -} - -// GetPurposeOk returns a tuple with the Purpose field value -// and a boolean to check if the value has been set. -func (o *WrappingKey) GetPurposeOk() (*WrappingPurpose, bool) { - if o == nil { - return nil, false - } - return &o.Purpose, true -} - -// SetPurpose sets field value -func (o *WrappingKey) SetPurpose(v WrappingPurpose) { - o.Purpose = v -} - -// GetState returns the State field value -func (o *WrappingKey) GetState() string { - if o == nil { - var ret string - return ret - } - - return o.State -} - -// GetStateOk returns a tuple with the State field value -// and a boolean to check if the value has been set. -func (o *WrappingKey) GetStateOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.State, true -} - -// SetState sets field value -func (o *WrappingKey) SetState(v string) { - o.State = v -} - -func (o WrappingKey) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o WrappingKey) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["access_scope"] = o.AccessScope - toSerialize["algorithm"] = o.Algorithm - toSerialize["backend"] = o.Backend - toSerialize["createdAt"] = o.CreatedAt - if !IsNil(o.Description) { - toSerialize["description"] = o.Description - } - toSerialize["displayName"] = o.DisplayName - toSerialize["expiresAt"] = o.ExpiresAt - toSerialize["id"] = o.Id - toSerialize["keyRingId"] = o.KeyRingId - toSerialize["protection"] = o.Protection - if !IsNil(o.PublicKey) { - toSerialize["publicKey"] = o.PublicKey - } - toSerialize["purpose"] = o.Purpose - toSerialize["state"] = o.State - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *WrappingKey) 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{ - "access_scope", - "algorithm", - "backend", - "createdAt", - "displayName", - "expiresAt", - "id", - "keyRingId", - "protection", - "purpose", - "state", - } - - 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) - } - } - - varWrappingKey := _WrappingKey{} - - err = json.Unmarshal(data, &varWrappingKey) - - if err != nil { - return err - } - - *o = WrappingKey(varWrappingKey) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "access_scope") - delete(additionalProperties, "algorithm") - delete(additionalProperties, "backend") - delete(additionalProperties, "createdAt") - delete(additionalProperties, "description") - delete(additionalProperties, "displayName") - delete(additionalProperties, "expiresAt") - delete(additionalProperties, "id") - delete(additionalProperties, "keyRingId") - delete(additionalProperties, "protection") - delete(additionalProperties, "publicKey") - delete(additionalProperties, "purpose") - delete(additionalProperties, "state") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableWrappingKey struct { - value *WrappingKey - isSet bool -} - -func (v NullableWrappingKey) Get() *WrappingKey { - return v.value -} - -func (v *NullableWrappingKey) Set(val *WrappingKey) { - v.value = val - v.isSet = true -} - -func (v NullableWrappingKey) IsSet() bool { - return v.isSet -} - -func (v *NullableWrappingKey) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableWrappingKey(val *WrappingKey) *NullableWrappingKey { - return &NullableWrappingKey{value: val, isSet: true} -} - -func (v NullableWrappingKey) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableWrappingKey) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_wrapping_key_list.go b/services/kms/v1betaapi/model_wrapping_key_list.go deleted file mode 100644 index e2d5935b4..000000000 --- a/services/kms/v1betaapi/model_wrapping_key_list.go +++ /dev/null @@ -1,166 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// checks if the WrappingKeyList type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &WrappingKeyList{} - -// WrappingKeyList struct for WrappingKeyList -type WrappingKeyList struct { - WrappingKeys []WrappingKey `json:"wrappingKeys"` - AdditionalProperties map[string]interface{} -} - -type _WrappingKeyList WrappingKeyList - -// NewWrappingKeyList instantiates a new WrappingKeyList 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 NewWrappingKeyList(wrappingKeys []WrappingKey) *WrappingKeyList { - this := WrappingKeyList{} - this.WrappingKeys = wrappingKeys - return &this -} - -// NewWrappingKeyListWithDefaults instantiates a new WrappingKeyList 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 NewWrappingKeyListWithDefaults() *WrappingKeyList { - this := WrappingKeyList{} - return &this -} - -// GetWrappingKeys returns the WrappingKeys field value -func (o *WrappingKeyList) GetWrappingKeys() []WrappingKey { - if o == nil { - var ret []WrappingKey - return ret - } - - return o.WrappingKeys -} - -// GetWrappingKeysOk returns a tuple with the WrappingKeys field value -// and a boolean to check if the value has been set. -func (o *WrappingKeyList) GetWrappingKeysOk() ([]WrappingKey, bool) { - if o == nil { - return nil, false - } - return o.WrappingKeys, true -} - -// SetWrappingKeys sets field value -func (o *WrappingKeyList) SetWrappingKeys(v []WrappingKey) { - o.WrappingKeys = v -} - -func (o WrappingKeyList) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o WrappingKeyList) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["wrappingKeys"] = o.WrappingKeys - - for key, value := range o.AdditionalProperties { - toSerialize[key] = value - } - - return toSerialize, nil -} - -func (o *WrappingKeyList) 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{ - "wrappingKeys", - } - - 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) - } - } - - varWrappingKeyList := _WrappingKeyList{} - - err = json.Unmarshal(data, &varWrappingKeyList) - - if err != nil { - return err - } - - *o = WrappingKeyList(varWrappingKeyList) - - additionalProperties := make(map[string]interface{}) - - if err = json.Unmarshal(data, &additionalProperties); err == nil { - delete(additionalProperties, "wrappingKeys") - o.AdditionalProperties = additionalProperties - } - - return err -} - -type NullableWrappingKeyList struct { - value *WrappingKeyList - isSet bool -} - -func (v NullableWrappingKeyList) Get() *WrappingKeyList { - return v.value -} - -func (v *NullableWrappingKeyList) Set(val *WrappingKeyList) { - v.value = val - v.isSet = true -} - -func (v NullableWrappingKeyList) IsSet() bool { - return v.isSet -} - -func (v *NullableWrappingKeyList) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableWrappingKeyList(val *WrappingKeyList) *NullableWrappingKeyList { - return &NullableWrappingKeyList{value: val, isSet: true} -} - -func (v NullableWrappingKeyList) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableWrappingKeyList) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/model_wrapping_purpose.go b/services/kms/v1betaapi/model_wrapping_purpose.go deleted file mode 100644 index a5f973b03..000000000 --- a/services/kms/v1betaapi/model_wrapping_purpose.go +++ /dev/null @@ -1,113 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "encoding/json" - "fmt" -) - -// WrappingPurpose The wrapping purpose for the wrapping key. -type WrappingPurpose string - -// List of wrappingPurpose -const ( - WRAPPINGPURPOSE_WRAP_SYMMETRIC_KEY WrappingPurpose = "wrap_symmetric_key" - WRAPPINGPURPOSE_WRAP_ASYMMETRIC_KEY WrappingPurpose = "wrap_asymmetric_key" - WRAPPINGPURPOSE_UNKNOWN_DEFAULT_OPEN_API WrappingPurpose = "unknown_default_open_api" -) - -// All allowed values of WrappingPurpose enum -var AllowedWrappingPurposeEnumValues = []WrappingPurpose{ - "wrap_symmetric_key", - "wrap_asymmetric_key", - "unknown_default_open_api", -} - -func (v *WrappingPurpose) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return err - } - enumTypeValue := WrappingPurpose(value) - for _, existing := range AllowedWrappingPurposeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - *v = WRAPPINGPURPOSE_UNKNOWN_DEFAULT_OPEN_API - return nil -} - -// NewWrappingPurposeFromValue returns a pointer to a valid WrappingPurpose -// for the value passed as argument, or an error if the value passed is not allowed by the enum -func NewWrappingPurposeFromValue(v string) (*WrappingPurpose, error) { - ev := WrappingPurpose(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for WrappingPurpose: valid values are %v", v, AllowedWrappingPurposeEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise -func (v WrappingPurpose) IsValid() bool { - for _, existing := range AllowedWrappingPurposeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to wrappingPurpose value -func (v WrappingPurpose) Ptr() *WrappingPurpose { - return &v -} - -type NullableWrappingPurpose struct { - value *WrappingPurpose - isSet bool -} - -func (v NullableWrappingPurpose) Get() *WrappingPurpose { - return v.value -} - -func (v *NullableWrappingPurpose) Set(val *WrappingPurpose) { - v.value = val - v.isSet = true -} - -func (v NullableWrappingPurpose) IsSet() bool { - return v.isSet -} - -func (v *NullableWrappingPurpose) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableWrappingPurpose(val *WrappingPurpose) *NullableWrappingPurpose { - return &NullableWrappingPurpose{value: val, isSet: true} -} - -func (v NullableWrappingPurpose) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableWrappingPurpose) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/services/kms/v1betaapi/response.go b/services/kms/v1betaapi/response.go deleted file mode 100644 index 348575062..000000000 --- a/services/kms/v1betaapi/response.go +++ /dev/null @@ -1,47 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "net/http" -) - -// APIResponse stores the API response returned by the server. -type APIResponse struct { - *http.Response `json:"-"` - Message string `json:"message,omitempty"` - // Operation is the name of the OpenAPI operation. - Operation string `json:"operation,omitempty"` - // RequestURL is the request URL. This value is always available, even if the - // embedded *http.Response is nil. - RequestURL string `json:"url,omitempty"` - // Method is the HTTP method used for the request. This value is always - // available, even if the embedded *http.Response is nil. - Method string `json:"method,omitempty"` - // Payload holds the contents of the response body (which may be nil or empty). - // This is provided here as the raw response.Body() reader will have already - // been drained. - Payload []byte `json:"-"` -} - -// NewAPIResponse returns a new APIResponse object. -func NewAPIResponse(r *http.Response) *APIResponse { - - response := &APIResponse{Response: r} - return response -} - -// NewAPIResponseWithError returns a new APIResponse object with the provided error message. -func NewAPIResponseWithError(errorMessage string) *APIResponse { - - response := &APIResponse{Message: errorMessage} - return response -} diff --git a/services/kms/v1betaapi/utils.go b/services/kms/v1betaapi/utils.go deleted file mode 100644 index d43d5be9c..000000000 --- a/services/kms/v1betaapi/utils.go +++ /dev/null @@ -1,361 +0,0 @@ -/* -STACKIT Key Management Service API - -### DEPRECATED! This service is no longer maintained. Please use the version v1 instead. This API provides endpoints for managing keys and key rings. - -API version: 1beta.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package v1betaapi - -import ( - "bytes" - "encoding/json" - "fmt" - "reflect" - "time" -) - -// PtrBool is a helper routine that returns a pointer to given boolean value. -func PtrBool(v bool) *bool { return &v } - -// PtrInt is a helper routine that returns a pointer to given integer value. -func PtrInt(v int) *int { return &v } - -// PtrInt32 is a helper routine that returns a pointer to given integer value. -func PtrInt32(v int32) *int32 { return &v } - -// PtrInt64 is a helper routine that returns a pointer to given integer value. -func PtrInt64(v int64) *int64 { return &v } - -// PtrFloat32 is a helper routine that returns a pointer to given float value. -func PtrFloat32(v float32) *float32 { return &v } - -// PtrFloat64 is a helper routine that returns a pointer to given float value. -func PtrFloat64(v float64) *float64 { return &v } - -// PtrString is a helper routine that returns a pointer to given string value. -func PtrString(v string) *string { return &v } - -// PtrTime is helper routine that returns a pointer to given Time value. -func PtrTime(v time.Time) *time.Time { return &v } - -type NullableBool struct { - value *bool - isSet bool -} - -func (v NullableBool) Get() *bool { - return v.value -} - -func (v *NullableBool) Set(val *bool) { - v.value = val - v.isSet = true -} - -func (v NullableBool) IsSet() bool { - return v.isSet -} - -func (v *NullableBool) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableBool(val *bool) *NullableBool { - return &NullableBool{value: val, isSet: true} -} - -func (v NullableBool) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableBool) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableInt struct { - value *int - isSet bool -} - -func (v NullableInt) Get() *int { - return v.value -} - -func (v *NullableInt) Set(val *int) { - v.value = val - v.isSet = true -} - -func (v NullableInt) IsSet() bool { - return v.isSet -} - -func (v *NullableInt) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInt(val *int) *NullableInt { - return &NullableInt{value: val, isSet: true} -} - -func (v NullableInt) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInt) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableInt32 struct { - value *int32 - isSet bool -} - -func (v NullableInt32) Get() *int32 { - return v.value -} - -func (v *NullableInt32) Set(val *int32) { - v.value = val - v.isSet = true -} - -func (v NullableInt32) IsSet() bool { - return v.isSet -} - -func (v *NullableInt32) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInt32(val *int32) *NullableInt32 { - return &NullableInt32{value: val, isSet: true} -} - -func (v NullableInt32) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInt32) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableInt64 struct { - value *int64 - isSet bool -} - -func (v NullableInt64) Get() *int64 { - return v.value -} - -func (v *NullableInt64) Set(val *int64) { - v.value = val - v.isSet = true -} - -func (v NullableInt64) IsSet() bool { - return v.isSet -} - -func (v *NullableInt64) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableInt64(val *int64) *NullableInt64 { - return &NullableInt64{value: val, isSet: true} -} - -func (v NullableInt64) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableInt64) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableFloat32 struct { - value *float32 - isSet bool -} - -func (v NullableFloat32) Get() *float32 { - return v.value -} - -func (v *NullableFloat32) Set(val *float32) { - v.value = val - v.isSet = true -} - -func (v NullableFloat32) IsSet() bool { - return v.isSet -} - -func (v *NullableFloat32) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableFloat32(val *float32) *NullableFloat32 { - return &NullableFloat32{value: val, isSet: true} -} - -func (v NullableFloat32) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableFloat32) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableFloat64 struct { - value *float64 - isSet bool -} - -func (v NullableFloat64) Get() *float64 { - return v.value -} - -func (v *NullableFloat64) Set(val *float64) { - v.value = val - v.isSet = true -} - -func (v NullableFloat64) IsSet() bool { - return v.isSet -} - -func (v *NullableFloat64) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableFloat64(val *float64) *NullableFloat64 { - return &NullableFloat64{value: val, isSet: true} -} - -func (v NullableFloat64) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableFloat64) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableString struct { - value *string - isSet bool -} - -func (v NullableString) Get() *string { - return v.value -} - -func (v *NullableString) Set(val *string) { - v.value = val - v.isSet = true -} - -func (v NullableString) IsSet() bool { - return v.isSet -} - -func (v *NullableString) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableString(val *string) *NullableString { - return &NullableString{value: val, isSet: true} -} - -func (v NullableString) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableString) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type NullableTime struct { - value *time.Time - isSet bool -} - -func (v NullableTime) Get() *time.Time { - return v.value -} - -func (v *NullableTime) Set(val *time.Time) { - v.value = val - v.isSet = true -} - -func (v NullableTime) IsSet() bool { - return v.isSet -} - -func (v *NullableTime) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTime(val *time.Time) *NullableTime { - return &NullableTime{value: val, isSet: true} -} - -func (v NullableTime) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableTime) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -// IsNil checks if an input is nil -func IsNil(i interface{}) bool { - if i == nil { - return true - } - switch reflect.TypeOf(i).Kind() { - case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: - return reflect.ValueOf(i).IsNil() - case reflect.Array: - return reflect.ValueOf(i).IsZero() - } - return false -} - -type MappedNullable interface { - ToMap() (map[string]interface{}, error) -} - -// A wrapper for strict JSON decoding -func newStrictDecoder(data []byte) *json.Decoder { - dec := json.NewDecoder(bytes.NewBuffer(data)) - dec.DisallowUnknownFields() - return dec -} - -// Prevent trying to import "fmt" -func reportError(format string, a ...interface{}) error { - return fmt.Errorf(format, a...) -}