From 1867153a64fb2d4a9b5d96118a41f6ec3efaa711 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Wed, 15 Apr 2026 17:26:31 +0000 Subject: [PATCH 1/3] Generate secretsmanager --- services/secretsmanager/go.mod | 2 +- services/secretsmanager/go.sum | 4 +- services/secretsmanager/oas_commit | 2 +- .../secretsmanager/v1alphaapi/api_default.go | 1788 +++++++++++++++++ .../v1alphaapi/api_default_mock.go | 231 +++ services/secretsmanager/v1alphaapi/client.go | 658 ++++++ .../v1alphaapi/configuration.go | 40 + ...odel_add_instance_role_bindings_payload.go | 195 ++ ..._add_secret_group_role_bindings_payload.go | 195 ++ .../v1alphaapi/model_bad_request.go | 167 ++ .../model_create_secretgroup_payload.go | 197 ++ ...del_edit_instance_role_bindings_payload.go | 195 ++ ...edit_secret_group_role_bindings_payload.go | 195 ++ .../v1alphaapi/model_error_response.go | 283 +++ ...odel_get_instance_role_bindings_payload.go | 195 ++ ..._get_secret_group_role_bindings_payload.go | 195 ++ .../model_list_role_bindings_response.go | 153 ++ .../model_list_secretgroups_response.go | 153 ++ .../v1alphaapi/model_not_found.go | 167 ++ ...l_remove_instance_role_bindings_payload.go | 195 ++ ...move_secret_group_role_bindings_payload.go | 195 ++ .../v1alphaapi/model_role_binding.go | 195 ++ .../v1alphaapi/model_secretgroup.go | 227 +++ .../model_update_secretgroup_payload.go | 192 ++ .../secretsmanager/v1alphaapi/response.go | 47 + services/secretsmanager/v1alphaapi/utils.go | 361 ++++ 26 files changed, 6423 insertions(+), 4 deletions(-) create mode 100644 services/secretsmanager/v1alphaapi/api_default.go create mode 100644 services/secretsmanager/v1alphaapi/api_default_mock.go create mode 100644 services/secretsmanager/v1alphaapi/client.go create mode 100644 services/secretsmanager/v1alphaapi/configuration.go create mode 100644 services/secretsmanager/v1alphaapi/model_add_instance_role_bindings_payload.go create mode 100644 services/secretsmanager/v1alphaapi/model_add_secret_group_role_bindings_payload.go create mode 100644 services/secretsmanager/v1alphaapi/model_bad_request.go create mode 100644 services/secretsmanager/v1alphaapi/model_create_secretgroup_payload.go create mode 100644 services/secretsmanager/v1alphaapi/model_edit_instance_role_bindings_payload.go create mode 100644 services/secretsmanager/v1alphaapi/model_edit_secret_group_role_bindings_payload.go create mode 100644 services/secretsmanager/v1alphaapi/model_error_response.go create mode 100644 services/secretsmanager/v1alphaapi/model_get_instance_role_bindings_payload.go create mode 100644 services/secretsmanager/v1alphaapi/model_get_secret_group_role_bindings_payload.go create mode 100644 services/secretsmanager/v1alphaapi/model_list_role_bindings_response.go create mode 100644 services/secretsmanager/v1alphaapi/model_list_secretgroups_response.go create mode 100644 services/secretsmanager/v1alphaapi/model_not_found.go create mode 100644 services/secretsmanager/v1alphaapi/model_remove_instance_role_bindings_payload.go create mode 100644 services/secretsmanager/v1alphaapi/model_remove_secret_group_role_bindings_payload.go create mode 100644 services/secretsmanager/v1alphaapi/model_role_binding.go create mode 100644 services/secretsmanager/v1alphaapi/model_secretgroup.go create mode 100644 services/secretsmanager/v1alphaapi/model_update_secretgroup_payload.go create mode 100644 services/secretsmanager/v1alphaapi/response.go create mode 100644 services/secretsmanager/v1alphaapi/utils.go diff --git a/services/secretsmanager/go.mod b/services/secretsmanager/go.mod index 712b5de82..6f16bb40b 100644 --- a/services/secretsmanager/go.mod +++ b/services/secretsmanager/go.mod @@ -2,7 +2,7 @@ module github.com/stackitcloud/stackit-sdk-go/services/secretsmanager go 1.25 -require github.com/stackitcloud/stackit-sdk-go/core v0.24.1 +require github.com/stackitcloud/stackit-sdk-go/core v0.25.0 require ( github.com/golang-jwt/jwt/v5 v5.3.1 // indirect diff --git a/services/secretsmanager/go.sum b/services/secretsmanager/go.sum index 516c6a66d..f66cfd445 100644 --- a/services/secretsmanager/go.sum +++ b/services/secretsmanager/go.sum @@ -4,5 +4,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/stackitcloud/stackit-sdk-go/core v0.24.1 h1:IrG0XBlJivUpXC4Y6TE+6FeSxNPs1JQXsero0ivwh0o= -github.com/stackitcloud/stackit-sdk-go/core v0.24.1/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= +github.com/stackitcloud/stackit-sdk-go/core v0.25.0 h1:ra3VEk684MNoq741g+xbZrKjZzhyztq5liUAwwew4DY= +github.com/stackitcloud/stackit-sdk-go/core v0.25.0/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA= diff --git a/services/secretsmanager/oas_commit b/services/secretsmanager/oas_commit index e3713dde3..b95d3c889 100644 --- a/services/secretsmanager/oas_commit +++ b/services/secretsmanager/oas_commit @@ -1 +1 @@ -0e64886dd0847341800d7191ed193b75413be998 +2f884c6bfba1c6294aa8ed17cda9b1704f935231 diff --git a/services/secretsmanager/v1alphaapi/api_default.go b/services/secretsmanager/v1alphaapi/api_default.go new file mode 100644 index 000000000..7bc083480 --- /dev/null +++ b/services/secretsmanager/v1alphaapi/api_default.go @@ -0,0 +1,1788 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alphaapi + +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 { + + /* + AddInstanceRoleBindings Add a new role binding + + Add role binding to the given resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiAddInstanceRoleBindingsRequest + */ + AddInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiAddInstanceRoleBindingsRequest + + // AddInstanceRoleBindingsExecute executes the request + // @return RoleBinding + AddInstanceRoleBindingsExecute(r ApiAddInstanceRoleBindingsRequest) (*RoleBinding, error) + + /* + AddSecretGroupRoleBindings Add a new role binding + + Add role binding to the given resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiAddSecretGroupRoleBindingsRequest + */ + AddSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiAddSecretGroupRoleBindingsRequest + + // AddSecretGroupRoleBindingsExecute executes the request + // @return RoleBinding + AddSecretGroupRoleBindingsExecute(r ApiAddSecretGroupRoleBindingsRequest) (*RoleBinding, error) + + /* + EditInstanceRoleBindings Update an existing role binding + + Update a role binding. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiEditInstanceRoleBindingsRequest + */ + EditInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiEditInstanceRoleBindingsRequest + + // EditInstanceRoleBindingsExecute executes the request + // @return RoleBinding + EditInstanceRoleBindingsExecute(r ApiEditInstanceRoleBindingsRequest) (*RoleBinding, error) + + /* + EditSecretGroupRoleBindings Update an existing role binding + + Update a role binding. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiEditSecretGroupRoleBindingsRequest + */ + EditSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiEditSecretGroupRoleBindingsRequest + + // EditSecretGroupRoleBindingsExecute executes the request + // @return RoleBinding + EditSecretGroupRoleBindingsExecute(r ApiEditSecretGroupRoleBindingsRequest) (*RoleBinding, error) + + /* + GetInstanceRoleBindings Get role binding of a resource + + Get a specific role binding of the given resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiGetInstanceRoleBindingsRequest + */ + GetInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiGetInstanceRoleBindingsRequest + + // GetInstanceRoleBindingsExecute executes the request + // @return RoleBinding + GetInstanceRoleBindingsExecute(r ApiGetInstanceRoleBindingsRequest) (*RoleBinding, error) + + /* + GetSecretGroupRoleBindings Get role binding of a resource + + Get a specific role binding of the given resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiGetSecretGroupRoleBindingsRequest + */ + GetSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiGetSecretGroupRoleBindingsRequest + + // GetSecretGroupRoleBindingsExecute executes the request + // @return RoleBinding + GetSecretGroupRoleBindingsExecute(r ApiGetSecretGroupRoleBindingsRequest) (*RoleBinding, error) + + /* + ListInstanceRoleBindings List role bindings of a resource + + List role bindings of the given resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiListInstanceRoleBindingsRequest + */ + ListInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiListInstanceRoleBindingsRequest + + // ListInstanceRoleBindingsExecute executes the request + // @return ListRoleBindingsResponse + ListInstanceRoleBindingsExecute(r ApiListInstanceRoleBindingsRequest) (*ListRoleBindingsResponse, error) + + /* + ListSecretGroupRoleBindings List role bindings of a resource + + List role bindings of the given resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiListSecretGroupRoleBindingsRequest + */ + ListSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiListSecretGroupRoleBindingsRequest + + // ListSecretGroupRoleBindingsExecute executes the request + // @return ListRoleBindingsResponse + ListSecretGroupRoleBindingsExecute(r ApiListSecretGroupRoleBindingsRequest) (*ListRoleBindingsResponse, error) + + /* + RemoveInstanceRoleBindings Delete an existing role binding + + Delete a role binding. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiRemoveInstanceRoleBindingsRequest + */ + RemoveInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiRemoveInstanceRoleBindingsRequest + + // RemoveInstanceRoleBindingsExecute executes the request + RemoveInstanceRoleBindingsExecute(r ApiRemoveInstanceRoleBindingsRequest) error + + /* + RemoveSecretGroupRoleBindings Delete an existing role binding + + Delete a role binding. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiRemoveSecretGroupRoleBindingsRequest + */ + RemoveSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiRemoveSecretGroupRoleBindingsRequest + + // RemoveSecretGroupRoleBindingsExecute executes the request + RemoveSecretGroupRoleBindingsExecute(r ApiRemoveSecretGroupRoleBindingsRequest) error +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiAddInstanceRoleBindingsRequest struct { + ctx context.Context + ApiService DefaultAPI + region string + resourceId string + addInstanceRoleBindingsPayload *AddInstanceRoleBindingsPayload +} + +func (r ApiAddInstanceRoleBindingsRequest) AddInstanceRoleBindingsPayload(addInstanceRoleBindingsPayload AddInstanceRoleBindingsPayload) ApiAddInstanceRoleBindingsRequest { + r.addInstanceRoleBindingsPayload = &addInstanceRoleBindingsPayload + return r +} + +func (r ApiAddInstanceRoleBindingsRequest) Execute() (*RoleBinding, error) { + return r.ApiService.AddInstanceRoleBindingsExecute(r) +} + +/* +AddInstanceRoleBindings Add a new role binding + +Add role binding to the given resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiAddInstanceRoleBindingsRequest +*/ +func (a *DefaultAPIService) AddInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiAddInstanceRoleBindingsRequest { + return ApiAddInstanceRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// Execute executes the request +// +// @return RoleBinding +func (a *DefaultAPIService) AddInstanceRoleBindingsExecute(r ApiAddInstanceRoleBindingsRequest) (*RoleBinding, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoleBinding + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.AddInstanceRoleBindings") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/region/{region}/instance/{resourceId}:addRoleBinding" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", url.PathEscape(parameterValueToString(r.resourceId, "resourceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.addInstanceRoleBindingsPayload == nil { + return localVarReturnValue, reportError("addInstanceRoleBindingsPayload 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.addInstanceRoleBindingsPayload + 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 ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 + } + 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 ApiAddSecretGroupRoleBindingsRequest struct { + ctx context.Context + ApiService DefaultAPI + region string + resourceId string + addSecretGroupRoleBindingsPayload *AddSecretGroupRoleBindingsPayload +} + +func (r ApiAddSecretGroupRoleBindingsRequest) AddSecretGroupRoleBindingsPayload(addSecretGroupRoleBindingsPayload AddSecretGroupRoleBindingsPayload) ApiAddSecretGroupRoleBindingsRequest { + r.addSecretGroupRoleBindingsPayload = &addSecretGroupRoleBindingsPayload + return r +} + +func (r ApiAddSecretGroupRoleBindingsRequest) Execute() (*RoleBinding, error) { + return r.ApiService.AddSecretGroupRoleBindingsExecute(r) +} + +/* +AddSecretGroupRoleBindings Add a new role binding + +Add role binding to the given resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiAddSecretGroupRoleBindingsRequest +*/ +func (a *DefaultAPIService) AddSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiAddSecretGroupRoleBindingsRequest { + return ApiAddSecretGroupRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// Execute executes the request +// +// @return RoleBinding +func (a *DefaultAPIService) AddSecretGroupRoleBindingsExecute(r ApiAddSecretGroupRoleBindingsRequest) (*RoleBinding, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoleBinding + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.AddSecretGroupRoleBindings") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/region/{region}/secret-group/{resourceId}:addRoleBinding" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", url.PathEscape(parameterValueToString(r.resourceId, "resourceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.addSecretGroupRoleBindingsPayload == nil { + return localVarReturnValue, reportError("addSecretGroupRoleBindingsPayload 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.addSecretGroupRoleBindingsPayload + 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 ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 + } + 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 ApiEditInstanceRoleBindingsRequest struct { + ctx context.Context + ApiService DefaultAPI + region string + resourceId string + editInstanceRoleBindingsPayload *EditInstanceRoleBindingsPayload +} + +func (r ApiEditInstanceRoleBindingsRequest) EditInstanceRoleBindingsPayload(editInstanceRoleBindingsPayload EditInstanceRoleBindingsPayload) ApiEditInstanceRoleBindingsRequest { + r.editInstanceRoleBindingsPayload = &editInstanceRoleBindingsPayload + return r +} + +func (r ApiEditInstanceRoleBindingsRequest) Execute() (*RoleBinding, error) { + return r.ApiService.EditInstanceRoleBindingsExecute(r) +} + +/* +EditInstanceRoleBindings Update an existing role binding + +Update a role binding. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiEditInstanceRoleBindingsRequest +*/ +func (a *DefaultAPIService) EditInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiEditInstanceRoleBindingsRequest { + return ApiEditInstanceRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// Execute executes the request +// +// @return RoleBinding +func (a *DefaultAPIService) EditInstanceRoleBindingsExecute(r ApiEditInstanceRoleBindingsRequest) (*RoleBinding, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoleBinding + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.EditInstanceRoleBindings") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/region/{region}/instance/{resourceId}:updateRoleBinding" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", url.PathEscape(parameterValueToString(r.resourceId, "resourceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.editInstanceRoleBindingsPayload == nil { + return localVarReturnValue, reportError("editInstanceRoleBindingsPayload 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.editInstanceRoleBindingsPayload + 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 ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 + } + 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 ApiEditSecretGroupRoleBindingsRequest struct { + ctx context.Context + ApiService DefaultAPI + region string + resourceId string + editSecretGroupRoleBindingsPayload *EditSecretGroupRoleBindingsPayload +} + +func (r ApiEditSecretGroupRoleBindingsRequest) EditSecretGroupRoleBindingsPayload(editSecretGroupRoleBindingsPayload EditSecretGroupRoleBindingsPayload) ApiEditSecretGroupRoleBindingsRequest { + r.editSecretGroupRoleBindingsPayload = &editSecretGroupRoleBindingsPayload + return r +} + +func (r ApiEditSecretGroupRoleBindingsRequest) Execute() (*RoleBinding, error) { + return r.ApiService.EditSecretGroupRoleBindingsExecute(r) +} + +/* +EditSecretGroupRoleBindings Update an existing role binding + +Update a role binding. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiEditSecretGroupRoleBindingsRequest +*/ +func (a *DefaultAPIService) EditSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiEditSecretGroupRoleBindingsRequest { + return ApiEditSecretGroupRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// Execute executes the request +// +// @return RoleBinding +func (a *DefaultAPIService) EditSecretGroupRoleBindingsExecute(r ApiEditSecretGroupRoleBindingsRequest) (*RoleBinding, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoleBinding + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.EditSecretGroupRoleBindings") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/region/{region}/secret-group/{resourceId}:updateRoleBinding" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", url.PathEscape(parameterValueToString(r.resourceId, "resourceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.editSecretGroupRoleBindingsPayload == nil { + return localVarReturnValue, reportError("editSecretGroupRoleBindingsPayload 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.editSecretGroupRoleBindingsPayload + 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 ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 + } + 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 ApiGetInstanceRoleBindingsRequest struct { + ctx context.Context + ApiService DefaultAPI + region string + resourceId string + getInstanceRoleBindingsPayload *GetInstanceRoleBindingsPayload +} + +func (r ApiGetInstanceRoleBindingsRequest) GetInstanceRoleBindingsPayload(getInstanceRoleBindingsPayload GetInstanceRoleBindingsPayload) ApiGetInstanceRoleBindingsRequest { + r.getInstanceRoleBindingsPayload = &getInstanceRoleBindingsPayload + return r +} + +func (r ApiGetInstanceRoleBindingsRequest) Execute() (*RoleBinding, error) { + return r.ApiService.GetInstanceRoleBindingsExecute(r) +} + +/* +GetInstanceRoleBindings Get role binding of a resource + +Get a specific role binding of the given resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiGetInstanceRoleBindingsRequest +*/ +func (a *DefaultAPIService) GetInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiGetInstanceRoleBindingsRequest { + return ApiGetInstanceRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// Execute executes the request +// +// @return RoleBinding +func (a *DefaultAPIService) GetInstanceRoleBindingsExecute(r ApiGetInstanceRoleBindingsRequest) (*RoleBinding, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoleBinding + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetInstanceRoleBindings") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/region/{region}/instance/{resourceId}:getRoleBinding" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", url.PathEscape(parameterValueToString(r.resourceId, "resourceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.getInstanceRoleBindingsPayload == nil { + return localVarReturnValue, reportError("getInstanceRoleBindingsPayload 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.getInstanceRoleBindingsPayload + 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 ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 + } + 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 ApiGetSecretGroupRoleBindingsRequest struct { + ctx context.Context + ApiService DefaultAPI + region string + resourceId string + getSecretGroupRoleBindingsPayload *GetSecretGroupRoleBindingsPayload +} + +func (r ApiGetSecretGroupRoleBindingsRequest) GetSecretGroupRoleBindingsPayload(getSecretGroupRoleBindingsPayload GetSecretGroupRoleBindingsPayload) ApiGetSecretGroupRoleBindingsRequest { + r.getSecretGroupRoleBindingsPayload = &getSecretGroupRoleBindingsPayload + return r +} + +func (r ApiGetSecretGroupRoleBindingsRequest) Execute() (*RoleBinding, error) { + return r.ApiService.GetSecretGroupRoleBindingsExecute(r) +} + +/* +GetSecretGroupRoleBindings Get role binding of a resource + +Get a specific role binding of the given resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiGetSecretGroupRoleBindingsRequest +*/ +func (a *DefaultAPIService) GetSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiGetSecretGroupRoleBindingsRequest { + return ApiGetSecretGroupRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// Execute executes the request +// +// @return RoleBinding +func (a *DefaultAPIService) GetSecretGroupRoleBindingsExecute(r ApiGetSecretGroupRoleBindingsRequest) (*RoleBinding, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoleBinding + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetSecretGroupRoleBindings") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/region/{region}/secret-group/{resourceId}:getRoleBinding" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", url.PathEscape(parameterValueToString(r.resourceId, "resourceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.getSecretGroupRoleBindingsPayload == nil { + return localVarReturnValue, reportError("getSecretGroupRoleBindingsPayload 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.getSecretGroupRoleBindingsPayload + 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 ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 + } + 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 ApiListInstanceRoleBindingsRequest struct { + ctx context.Context + ApiService DefaultAPI + region string + resourceId string +} + +func (r ApiListInstanceRoleBindingsRequest) Execute() (*ListRoleBindingsResponse, error) { + return r.ApiService.ListInstanceRoleBindingsExecute(r) +} + +/* +ListInstanceRoleBindings List role bindings of a resource + +List role bindings of the given resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiListInstanceRoleBindingsRequest +*/ +func (a *DefaultAPIService) ListInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiListInstanceRoleBindingsRequest { + return ApiListInstanceRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// Execute executes the request +// +// @return ListRoleBindingsResponse +func (a *DefaultAPIService) ListInstanceRoleBindingsExecute(r ApiListInstanceRoleBindingsRequest) (*ListRoleBindingsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListRoleBindingsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListInstanceRoleBindings") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/region/{region}/instance/{resourceId}:listRoleBindings" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", url.PathEscape(parameterValueToString(r.resourceId, "resourceId")), -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 ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 + } + 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 ApiListSecretGroupRoleBindingsRequest struct { + ctx context.Context + ApiService DefaultAPI + region string + resourceId string +} + +func (r ApiListSecretGroupRoleBindingsRequest) Execute() (*ListRoleBindingsResponse, error) { + return r.ApiService.ListSecretGroupRoleBindingsExecute(r) +} + +/* +ListSecretGroupRoleBindings List role bindings of a resource + +List role bindings of the given resource. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiListSecretGroupRoleBindingsRequest +*/ +func (a *DefaultAPIService) ListSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiListSecretGroupRoleBindingsRequest { + return ApiListSecretGroupRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// Execute executes the request +// +// @return ListRoleBindingsResponse +func (a *DefaultAPIService) ListSecretGroupRoleBindingsExecute(r ApiListSecretGroupRoleBindingsRequest) (*ListRoleBindingsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListRoleBindingsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListSecretGroupRoleBindings") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/region/{region}/secret-group/{resourceId}:listRoleBindings" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", url.PathEscape(parameterValueToString(r.resourceId, "resourceId")), -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 ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + 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 + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 + } + 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 ApiRemoveInstanceRoleBindingsRequest struct { + ctx context.Context + ApiService DefaultAPI + region string + resourceId string + removeInstanceRoleBindingsPayload *RemoveInstanceRoleBindingsPayload +} + +func (r ApiRemoveInstanceRoleBindingsRequest) RemoveInstanceRoleBindingsPayload(removeInstanceRoleBindingsPayload RemoveInstanceRoleBindingsPayload) ApiRemoveInstanceRoleBindingsRequest { + r.removeInstanceRoleBindingsPayload = &removeInstanceRoleBindingsPayload + return r +} + +func (r ApiRemoveInstanceRoleBindingsRequest) Execute() error { + return r.ApiService.RemoveInstanceRoleBindingsExecute(r) +} + +/* +RemoveInstanceRoleBindings Delete an existing role binding + +Delete a role binding. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiRemoveInstanceRoleBindingsRequest +*/ +func (a *DefaultAPIService) RemoveInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiRemoveInstanceRoleBindingsRequest { + return ApiRemoveInstanceRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) RemoveInstanceRoleBindingsExecute(r ApiRemoveInstanceRoleBindingsRequest) error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.RemoveInstanceRoleBindings") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/region/{region}/instance/{resourceId}:deleteRoleBinding" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", url.PathEscape(parameterValueToString(r.resourceId, "resourceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.removeInstanceRoleBindingsPayload == nil { + return reportError("removeInstanceRoleBindingsPayload 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.removeInstanceRoleBindingsPayload + 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 ErrorResponse + 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 newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + 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 newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 newErr + } + + return nil +} + +type ApiRemoveSecretGroupRoleBindingsRequest struct { + ctx context.Context + ApiService DefaultAPI + region string + resourceId string + removeSecretGroupRoleBindingsPayload *RemoveSecretGroupRoleBindingsPayload +} + +func (r ApiRemoveSecretGroupRoleBindingsRequest) RemoveSecretGroupRoleBindingsPayload(removeSecretGroupRoleBindingsPayload RemoveSecretGroupRoleBindingsPayload) ApiRemoveSecretGroupRoleBindingsRequest { + r.removeSecretGroupRoleBindingsPayload = &removeSecretGroupRoleBindingsPayload + return r +} + +func (r ApiRemoveSecretGroupRoleBindingsRequest) Execute() error { + return r.ApiService.RemoveSecretGroupRoleBindingsExecute(r) +} + +/* +RemoveSecretGroupRoleBindings Delete an existing role binding + +Delete a role binding. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region + @param resourceId + @return ApiRemoveSecretGroupRoleBindingsRequest +*/ +func (a *DefaultAPIService) RemoveSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiRemoveSecretGroupRoleBindingsRequest { + return ApiRemoveSecretGroupRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) RemoveSecretGroupRoleBindingsExecute(r ApiRemoveSecretGroupRoleBindingsRequest) error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.RemoveSecretGroupRoleBindings") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/region/{region}/secret-group/{resourceId}:deleteRoleBinding" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", url.PathEscape(parameterValueToString(r.resourceId, "resourceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.removeSecretGroupRoleBindingsPayload == nil { + return reportError("removeSecretGroupRoleBindingsPayload 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.removeSecretGroupRoleBindingsPayload + 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 ErrorResponse + 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 newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + 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 newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v ErrorResponse + 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 newErr + } + + return nil +} diff --git a/services/secretsmanager/v1alphaapi/api_default_mock.go b/services/secretsmanager/v1alphaapi/api_default_mock.go new file mode 100644 index 000000000..357a2cf47 --- /dev/null +++ b/services/secretsmanager/v1alphaapi/api_default_mock.go @@ -0,0 +1,231 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +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 { + // AddInstanceRoleBindingsExecuteMock can be populated to implement the behavior of the AddInstanceRoleBindingsExecute function of this mock + AddInstanceRoleBindingsExecuteMock *func(r ApiAddInstanceRoleBindingsRequest) (*RoleBinding, error) + // AddSecretGroupRoleBindingsExecuteMock can be populated to implement the behavior of the AddSecretGroupRoleBindingsExecute function of this mock + AddSecretGroupRoleBindingsExecuteMock *func(r ApiAddSecretGroupRoleBindingsRequest) (*RoleBinding, error) + // EditInstanceRoleBindingsExecuteMock can be populated to implement the behavior of the EditInstanceRoleBindingsExecute function of this mock + EditInstanceRoleBindingsExecuteMock *func(r ApiEditInstanceRoleBindingsRequest) (*RoleBinding, error) + // EditSecretGroupRoleBindingsExecuteMock can be populated to implement the behavior of the EditSecretGroupRoleBindingsExecute function of this mock + EditSecretGroupRoleBindingsExecuteMock *func(r ApiEditSecretGroupRoleBindingsRequest) (*RoleBinding, error) + // GetInstanceRoleBindingsExecuteMock can be populated to implement the behavior of the GetInstanceRoleBindingsExecute function of this mock + GetInstanceRoleBindingsExecuteMock *func(r ApiGetInstanceRoleBindingsRequest) (*RoleBinding, error) + // GetSecretGroupRoleBindingsExecuteMock can be populated to implement the behavior of the GetSecretGroupRoleBindingsExecute function of this mock + GetSecretGroupRoleBindingsExecuteMock *func(r ApiGetSecretGroupRoleBindingsRequest) (*RoleBinding, error) + // ListInstanceRoleBindingsExecuteMock can be populated to implement the behavior of the ListInstanceRoleBindingsExecute function of this mock + ListInstanceRoleBindingsExecuteMock *func(r ApiListInstanceRoleBindingsRequest) (*ListRoleBindingsResponse, error) + // ListSecretGroupRoleBindingsExecuteMock can be populated to implement the behavior of the ListSecretGroupRoleBindingsExecute function of this mock + ListSecretGroupRoleBindingsExecuteMock *func(r ApiListSecretGroupRoleBindingsRequest) (*ListRoleBindingsResponse, error) + // RemoveInstanceRoleBindingsExecuteMock can be populated to implement the behavior of the RemoveInstanceRoleBindingsExecute function of this mock + RemoveInstanceRoleBindingsExecuteMock *func(r ApiRemoveInstanceRoleBindingsRequest) error + // RemoveSecretGroupRoleBindingsExecuteMock can be populated to implement the behavior of the RemoveSecretGroupRoleBindingsExecute function of this mock + RemoveSecretGroupRoleBindingsExecuteMock *func(r ApiRemoveSecretGroupRoleBindingsRequest) error +} + +func (a DefaultAPIServiceMock) AddInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiAddInstanceRoleBindingsRequest { + return ApiAddInstanceRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// AddInstanceRoleBindingsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the AddInstanceRoleBindingsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) AddInstanceRoleBindingsExecute(r ApiAddInstanceRoleBindingsRequest) (*RoleBinding, error) { + if a.AddInstanceRoleBindingsExecuteMock == nil { + var localVarReturnValue *RoleBinding + return localVarReturnValue, nil + } + + return (*a.AddInstanceRoleBindingsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) AddSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiAddSecretGroupRoleBindingsRequest { + return ApiAddSecretGroupRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// AddSecretGroupRoleBindingsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the AddSecretGroupRoleBindingsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) AddSecretGroupRoleBindingsExecute(r ApiAddSecretGroupRoleBindingsRequest) (*RoleBinding, error) { + if a.AddSecretGroupRoleBindingsExecuteMock == nil { + var localVarReturnValue *RoleBinding + return localVarReturnValue, nil + } + + return (*a.AddSecretGroupRoleBindingsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) EditInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiEditInstanceRoleBindingsRequest { + return ApiEditInstanceRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// EditInstanceRoleBindingsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the EditInstanceRoleBindingsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) EditInstanceRoleBindingsExecute(r ApiEditInstanceRoleBindingsRequest) (*RoleBinding, error) { + if a.EditInstanceRoleBindingsExecuteMock == nil { + var localVarReturnValue *RoleBinding + return localVarReturnValue, nil + } + + return (*a.EditInstanceRoleBindingsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) EditSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiEditSecretGroupRoleBindingsRequest { + return ApiEditSecretGroupRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// EditSecretGroupRoleBindingsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the EditSecretGroupRoleBindingsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) EditSecretGroupRoleBindingsExecute(r ApiEditSecretGroupRoleBindingsRequest) (*RoleBinding, error) { + if a.EditSecretGroupRoleBindingsExecuteMock == nil { + var localVarReturnValue *RoleBinding + return localVarReturnValue, nil + } + + return (*a.EditSecretGroupRoleBindingsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiGetInstanceRoleBindingsRequest { + return ApiGetInstanceRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// GetInstanceRoleBindingsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetInstanceRoleBindingsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetInstanceRoleBindingsExecute(r ApiGetInstanceRoleBindingsRequest) (*RoleBinding, error) { + if a.GetInstanceRoleBindingsExecuteMock == nil { + var localVarReturnValue *RoleBinding + return localVarReturnValue, nil + } + + return (*a.GetInstanceRoleBindingsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiGetSecretGroupRoleBindingsRequest { + return ApiGetSecretGroupRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// GetSecretGroupRoleBindingsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetSecretGroupRoleBindingsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetSecretGroupRoleBindingsExecute(r ApiGetSecretGroupRoleBindingsRequest) (*RoleBinding, error) { + if a.GetSecretGroupRoleBindingsExecuteMock == nil { + var localVarReturnValue *RoleBinding + return localVarReturnValue, nil + } + + return (*a.GetSecretGroupRoleBindingsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiListInstanceRoleBindingsRequest { + return ApiListInstanceRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// ListInstanceRoleBindingsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListInstanceRoleBindingsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListInstanceRoleBindingsExecute(r ApiListInstanceRoleBindingsRequest) (*ListRoleBindingsResponse, error) { + if a.ListInstanceRoleBindingsExecuteMock == nil { + var localVarReturnValue *ListRoleBindingsResponse + return localVarReturnValue, nil + } + + return (*a.ListInstanceRoleBindingsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiListSecretGroupRoleBindingsRequest { + return ApiListSecretGroupRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// ListSecretGroupRoleBindingsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListSecretGroupRoleBindingsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListSecretGroupRoleBindingsExecute(r ApiListSecretGroupRoleBindingsRequest) (*ListRoleBindingsResponse, error) { + if a.ListSecretGroupRoleBindingsExecuteMock == nil { + var localVarReturnValue *ListRoleBindingsResponse + return localVarReturnValue, nil + } + + return (*a.ListSecretGroupRoleBindingsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) RemoveInstanceRoleBindings(ctx context.Context, region string, resourceId string) ApiRemoveInstanceRoleBindingsRequest { + return ApiRemoveInstanceRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// RemoveInstanceRoleBindingsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the RemoveInstanceRoleBindingsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) RemoveInstanceRoleBindingsExecute(r ApiRemoveInstanceRoleBindingsRequest) error { + if a.RemoveInstanceRoleBindingsExecuteMock == nil { + return nil + } + + return (*a.RemoveInstanceRoleBindingsExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) RemoveSecretGroupRoleBindings(ctx context.Context, region string, resourceId string) ApiRemoveSecretGroupRoleBindingsRequest { + return ApiRemoveSecretGroupRoleBindingsRequest{ + ApiService: a, + ctx: ctx, + region: region, + resourceId: resourceId, + } +} + +// RemoveSecretGroupRoleBindingsExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the RemoveSecretGroupRoleBindingsExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) RemoveSecretGroupRoleBindingsExecute(r ApiRemoveSecretGroupRoleBindingsRequest) error { + if a.RemoveSecretGroupRoleBindingsExecuteMock == nil { + return nil + } + + return (*a.RemoveSecretGroupRoleBindingsExecuteMock)(r) +} diff --git a/services/secretsmanager/v1alphaapi/client.go b/services/secretsmanager/v1alphaapi/client.go new file mode 100644 index 000000000..d19f6e19e --- /dev/null +++ b/services/secretsmanager/v1alphaapi/client.go @@ -0,0 +1,658 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alphaapi + +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 Secrets Manager API API v1alpha +// 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/secretsmanager/v1alphaapi/configuration.go b/services/secretsmanager/v1alphaapi/configuration.go new file mode 100644 index 000000000..cb38c2537 --- /dev/null +++ b/services/secretsmanager/v1alphaapi/configuration.go @@ -0,0 +1,40 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alphaapi + +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/secretsmanager", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://secrets-manager.api.{region}stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "eu01.", + EnumValues: []string{ + "eu01.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/services/secretsmanager/v1alphaapi/model_add_instance_role_bindings_payload.go b/services/secretsmanager/v1alphaapi/model_add_instance_role_bindings_payload.go new file mode 100644 index 000000000..dd63a8627 --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_add_instance_role_bindings_payload.go @@ -0,0 +1,195 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the AddInstanceRoleBindingsPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddInstanceRoleBindingsPayload{} + +// AddInstanceRoleBindingsPayload struct for AddInstanceRoleBindingsPayload +type AddInstanceRoleBindingsPayload struct { + Role string `json:"role" validate:"regexp=^[a-z](?:[-.]?[a-z]){1,63}$"` + Subject string `json:"subject"` + AdditionalProperties map[string]interface{} +} + +type _AddInstanceRoleBindingsPayload AddInstanceRoleBindingsPayload + +// NewAddInstanceRoleBindingsPayload instantiates a new AddInstanceRoleBindingsPayload 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 NewAddInstanceRoleBindingsPayload(role string, subject string) *AddInstanceRoleBindingsPayload { + this := AddInstanceRoleBindingsPayload{} + this.Role = role + this.Subject = subject + return &this +} + +// NewAddInstanceRoleBindingsPayloadWithDefaults instantiates a new AddInstanceRoleBindingsPayload 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 NewAddInstanceRoleBindingsPayloadWithDefaults() *AddInstanceRoleBindingsPayload { + this := AddInstanceRoleBindingsPayload{} + return &this +} + +// GetRole returns the Role field value +func (o *AddInstanceRoleBindingsPayload) GetRole() string { + if o == nil { + var ret string + return ret + } + + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value +// and a boolean to check if the value has been set. +func (o *AddInstanceRoleBindingsPayload) GetRoleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Role, true +} + +// SetRole sets field value +func (o *AddInstanceRoleBindingsPayload) SetRole(v string) { + o.Role = v +} + +// GetSubject returns the Subject field value +func (o *AddInstanceRoleBindingsPayload) GetSubject() string { + if o == nil { + var ret string + return ret + } + + return o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value +// and a boolean to check if the value has been set. +func (o *AddInstanceRoleBindingsPayload) GetSubjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Subject, true +} + +// SetSubject sets field value +func (o *AddInstanceRoleBindingsPayload) SetSubject(v string) { + o.Subject = v +} + +func (o AddInstanceRoleBindingsPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AddInstanceRoleBindingsPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["role"] = o.Role + toSerialize["subject"] = o.Subject + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AddInstanceRoleBindingsPayload) 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{ + "role", + "subject", + } + + 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) + } + } + + varAddInstanceRoleBindingsPayload := _AddInstanceRoleBindingsPayload{} + + err = json.Unmarshal(data, &varAddInstanceRoleBindingsPayload) + + if err != nil { + return err + } + + *o = AddInstanceRoleBindingsPayload(varAddInstanceRoleBindingsPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "role") + delete(additionalProperties, "subject") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAddInstanceRoleBindingsPayload struct { + value *AddInstanceRoleBindingsPayload + isSet bool +} + +func (v NullableAddInstanceRoleBindingsPayload) Get() *AddInstanceRoleBindingsPayload { + return v.value +} + +func (v *NullableAddInstanceRoleBindingsPayload) Set(val *AddInstanceRoleBindingsPayload) { + v.value = val + v.isSet = true +} + +func (v NullableAddInstanceRoleBindingsPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableAddInstanceRoleBindingsPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddInstanceRoleBindingsPayload(val *AddInstanceRoleBindingsPayload) *NullableAddInstanceRoleBindingsPayload { + return &NullableAddInstanceRoleBindingsPayload{value: val, isSet: true} +} + +func (v NullableAddInstanceRoleBindingsPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddInstanceRoleBindingsPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_add_secret_group_role_bindings_payload.go b/services/secretsmanager/v1alphaapi/model_add_secret_group_role_bindings_payload.go new file mode 100644 index 000000000..affc39456 --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_add_secret_group_role_bindings_payload.go @@ -0,0 +1,195 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the AddSecretGroupRoleBindingsPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddSecretGroupRoleBindingsPayload{} + +// AddSecretGroupRoleBindingsPayload struct for AddSecretGroupRoleBindingsPayload +type AddSecretGroupRoleBindingsPayload struct { + Role string `json:"role" validate:"regexp=^[a-z](?:[-.]?[a-z]){1,63}$"` + Subject string `json:"subject"` + AdditionalProperties map[string]interface{} +} + +type _AddSecretGroupRoleBindingsPayload AddSecretGroupRoleBindingsPayload + +// NewAddSecretGroupRoleBindingsPayload instantiates a new AddSecretGroupRoleBindingsPayload 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 NewAddSecretGroupRoleBindingsPayload(role string, subject string) *AddSecretGroupRoleBindingsPayload { + this := AddSecretGroupRoleBindingsPayload{} + this.Role = role + this.Subject = subject + return &this +} + +// NewAddSecretGroupRoleBindingsPayloadWithDefaults instantiates a new AddSecretGroupRoleBindingsPayload 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 NewAddSecretGroupRoleBindingsPayloadWithDefaults() *AddSecretGroupRoleBindingsPayload { + this := AddSecretGroupRoleBindingsPayload{} + return &this +} + +// GetRole returns the Role field value +func (o *AddSecretGroupRoleBindingsPayload) GetRole() string { + if o == nil { + var ret string + return ret + } + + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value +// and a boolean to check if the value has been set. +func (o *AddSecretGroupRoleBindingsPayload) GetRoleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Role, true +} + +// SetRole sets field value +func (o *AddSecretGroupRoleBindingsPayload) SetRole(v string) { + o.Role = v +} + +// GetSubject returns the Subject field value +func (o *AddSecretGroupRoleBindingsPayload) GetSubject() string { + if o == nil { + var ret string + return ret + } + + return o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value +// and a boolean to check if the value has been set. +func (o *AddSecretGroupRoleBindingsPayload) GetSubjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Subject, true +} + +// SetSubject sets field value +func (o *AddSecretGroupRoleBindingsPayload) SetSubject(v string) { + o.Subject = v +} + +func (o AddSecretGroupRoleBindingsPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AddSecretGroupRoleBindingsPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["role"] = o.Role + toSerialize["subject"] = o.Subject + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AddSecretGroupRoleBindingsPayload) 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{ + "role", + "subject", + } + + 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) + } + } + + varAddSecretGroupRoleBindingsPayload := _AddSecretGroupRoleBindingsPayload{} + + err = json.Unmarshal(data, &varAddSecretGroupRoleBindingsPayload) + + if err != nil { + return err + } + + *o = AddSecretGroupRoleBindingsPayload(varAddSecretGroupRoleBindingsPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "role") + delete(additionalProperties, "subject") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAddSecretGroupRoleBindingsPayload struct { + value *AddSecretGroupRoleBindingsPayload + isSet bool +} + +func (v NullableAddSecretGroupRoleBindingsPayload) Get() *AddSecretGroupRoleBindingsPayload { + return v.value +} + +func (v *NullableAddSecretGroupRoleBindingsPayload) Set(val *AddSecretGroupRoleBindingsPayload) { + v.value = val + v.isSet = true +} + +func (v NullableAddSecretGroupRoleBindingsPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableAddSecretGroupRoleBindingsPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddSecretGroupRoleBindingsPayload(val *AddSecretGroupRoleBindingsPayload) *NullableAddSecretGroupRoleBindingsPayload { + return &NullableAddSecretGroupRoleBindingsPayload{value: val, isSet: true} +} + +func (v NullableAddSecretGroupRoleBindingsPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddSecretGroupRoleBindingsPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_bad_request.go b/services/secretsmanager/v1alphaapi/model_bad_request.go new file mode 100644 index 000000000..f37594c1d --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_bad_request.go @@ -0,0 +1,167 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the BadRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BadRequest{} + +// BadRequest struct for BadRequest +type BadRequest struct { + // The error message for bad requests + Message string `json:"message"` + AdditionalProperties map[string]interface{} +} + +type _BadRequest BadRequest + +// NewBadRequest instantiates a new BadRequest 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 NewBadRequest(message string) *BadRequest { + this := BadRequest{} + this.Message = message + return &this +} + +// NewBadRequestWithDefaults instantiates a new BadRequest 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 NewBadRequestWithDefaults() *BadRequest { + this := BadRequest{} + return &this +} + +// GetMessage returns the Message field value +func (o *BadRequest) 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 *BadRequest) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *BadRequest) SetMessage(v string) { + o.Message = v +} + +func (o BadRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BadRequest) 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 *BadRequest) 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) + } + } + + varBadRequest := _BadRequest{} + + err = json.Unmarshal(data, &varBadRequest) + + if err != nil { + return err + } + + *o = BadRequest(varBadRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBadRequest struct { + value *BadRequest + isSet bool +} + +func (v NullableBadRequest) Get() *BadRequest { + return v.value +} + +func (v *NullableBadRequest) Set(val *BadRequest) { + v.value = val + v.isSet = true +} + +func (v NullableBadRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableBadRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBadRequest(val *BadRequest) *NullableBadRequest { + return &NullableBadRequest{value: val, isSet: true} +} + +func (v NullableBadRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBadRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_create_secretgroup_payload.go b/services/secretsmanager/v1alphaapi/model_create_secretgroup_payload.go new file mode 100644 index 000000000..81149e9bd --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_create_secretgroup_payload.go @@ -0,0 +1,197 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateSecretgroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSecretgroupPayload{} + +// CreateSecretgroupPayload struct for CreateSecretgroupPayload +type CreateSecretgroupPayload struct { + // A user chosen description to differentiate between multiple secret groups. + Description string `json:"description"` + // A list of secrets this secret group contains. + Secrets []string `json:"secrets"` + AdditionalProperties map[string]interface{} +} + +type _CreateSecretgroupPayload CreateSecretgroupPayload + +// NewCreateSecretgroupPayload instantiates a new CreateSecretgroupPayload 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 NewCreateSecretgroupPayload(description string, secrets []string) *CreateSecretgroupPayload { + this := CreateSecretgroupPayload{} + this.Description = description + this.Secrets = secrets + return &this +} + +// NewCreateSecretgroupPayloadWithDefaults instantiates a new CreateSecretgroupPayload 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 NewCreateSecretgroupPayloadWithDefaults() *CreateSecretgroupPayload { + this := CreateSecretgroupPayload{} + return &this +} + +// GetDescription returns the Description field value +func (o *CreateSecretgroupPayload) GetDescription() string { + if o == nil { + var ret string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *CreateSecretgroupPayload) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value +func (o *CreateSecretgroupPayload) SetDescription(v string) { + o.Description = v +} + +// GetSecrets returns the Secrets field value +func (o *CreateSecretgroupPayload) GetSecrets() []string { + if o == nil { + var ret []string + return ret + } + + return o.Secrets +} + +// GetSecretsOk returns a tuple with the Secrets field value +// and a boolean to check if the value has been set. +func (o *CreateSecretgroupPayload) GetSecretsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Secrets, true +} + +// SetSecrets sets field value +func (o *CreateSecretgroupPayload) SetSecrets(v []string) { + o.Secrets = v +} + +func (o CreateSecretgroupPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateSecretgroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["description"] = o.Description + toSerialize["secrets"] = o.Secrets + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateSecretgroupPayload) 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{ + "description", + "secrets", + } + + 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) + } + } + + varCreateSecretgroupPayload := _CreateSecretgroupPayload{} + + err = json.Unmarshal(data, &varCreateSecretgroupPayload) + + if err != nil { + return err + } + + *o = CreateSecretgroupPayload(varCreateSecretgroupPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "secrets") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateSecretgroupPayload struct { + value *CreateSecretgroupPayload + isSet bool +} + +func (v NullableCreateSecretgroupPayload) Get() *CreateSecretgroupPayload { + return v.value +} + +func (v *NullableCreateSecretgroupPayload) Set(val *CreateSecretgroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSecretgroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSecretgroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSecretgroupPayload(val *CreateSecretgroupPayload) *NullableCreateSecretgroupPayload { + return &NullableCreateSecretgroupPayload{value: val, isSet: true} +} + +func (v NullableCreateSecretgroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSecretgroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_edit_instance_role_bindings_payload.go b/services/secretsmanager/v1alphaapi/model_edit_instance_role_bindings_payload.go new file mode 100644 index 000000000..386f33cdc --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_edit_instance_role_bindings_payload.go @@ -0,0 +1,195 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the EditInstanceRoleBindingsPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EditInstanceRoleBindingsPayload{} + +// EditInstanceRoleBindingsPayload struct for EditInstanceRoleBindingsPayload +type EditInstanceRoleBindingsPayload struct { + Role string `json:"role" validate:"regexp=^[a-z](?:[-.]?[a-z]){1,63}$"` + Subject string `json:"subject"` + AdditionalProperties map[string]interface{} +} + +type _EditInstanceRoleBindingsPayload EditInstanceRoleBindingsPayload + +// NewEditInstanceRoleBindingsPayload instantiates a new EditInstanceRoleBindingsPayload 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 NewEditInstanceRoleBindingsPayload(role string, subject string) *EditInstanceRoleBindingsPayload { + this := EditInstanceRoleBindingsPayload{} + this.Role = role + this.Subject = subject + return &this +} + +// NewEditInstanceRoleBindingsPayloadWithDefaults instantiates a new EditInstanceRoleBindingsPayload 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 NewEditInstanceRoleBindingsPayloadWithDefaults() *EditInstanceRoleBindingsPayload { + this := EditInstanceRoleBindingsPayload{} + return &this +} + +// GetRole returns the Role field value +func (o *EditInstanceRoleBindingsPayload) GetRole() string { + if o == nil { + var ret string + return ret + } + + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value +// and a boolean to check if the value has been set. +func (o *EditInstanceRoleBindingsPayload) GetRoleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Role, true +} + +// SetRole sets field value +func (o *EditInstanceRoleBindingsPayload) SetRole(v string) { + o.Role = v +} + +// GetSubject returns the Subject field value +func (o *EditInstanceRoleBindingsPayload) GetSubject() string { + if o == nil { + var ret string + return ret + } + + return o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value +// and a boolean to check if the value has been set. +func (o *EditInstanceRoleBindingsPayload) GetSubjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Subject, true +} + +// SetSubject sets field value +func (o *EditInstanceRoleBindingsPayload) SetSubject(v string) { + o.Subject = v +} + +func (o EditInstanceRoleBindingsPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EditInstanceRoleBindingsPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["role"] = o.Role + toSerialize["subject"] = o.Subject + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *EditInstanceRoleBindingsPayload) 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{ + "role", + "subject", + } + + 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) + } + } + + varEditInstanceRoleBindingsPayload := _EditInstanceRoleBindingsPayload{} + + err = json.Unmarshal(data, &varEditInstanceRoleBindingsPayload) + + if err != nil { + return err + } + + *o = EditInstanceRoleBindingsPayload(varEditInstanceRoleBindingsPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "role") + delete(additionalProperties, "subject") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEditInstanceRoleBindingsPayload struct { + value *EditInstanceRoleBindingsPayload + isSet bool +} + +func (v NullableEditInstanceRoleBindingsPayload) Get() *EditInstanceRoleBindingsPayload { + return v.value +} + +func (v *NullableEditInstanceRoleBindingsPayload) Set(val *EditInstanceRoleBindingsPayload) { + v.value = val + v.isSet = true +} + +func (v NullableEditInstanceRoleBindingsPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableEditInstanceRoleBindingsPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEditInstanceRoleBindingsPayload(val *EditInstanceRoleBindingsPayload) *NullableEditInstanceRoleBindingsPayload { + return &NullableEditInstanceRoleBindingsPayload{value: val, isSet: true} +} + +func (v NullableEditInstanceRoleBindingsPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEditInstanceRoleBindingsPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_edit_secret_group_role_bindings_payload.go b/services/secretsmanager/v1alphaapi/model_edit_secret_group_role_bindings_payload.go new file mode 100644 index 000000000..611a2324e --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_edit_secret_group_role_bindings_payload.go @@ -0,0 +1,195 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the EditSecretGroupRoleBindingsPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EditSecretGroupRoleBindingsPayload{} + +// EditSecretGroupRoleBindingsPayload struct for EditSecretGroupRoleBindingsPayload +type EditSecretGroupRoleBindingsPayload struct { + Role string `json:"role" validate:"regexp=^[a-z](?:[-.]?[a-z]){1,63}$"` + Subject string `json:"subject"` + AdditionalProperties map[string]interface{} +} + +type _EditSecretGroupRoleBindingsPayload EditSecretGroupRoleBindingsPayload + +// NewEditSecretGroupRoleBindingsPayload instantiates a new EditSecretGroupRoleBindingsPayload 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 NewEditSecretGroupRoleBindingsPayload(role string, subject string) *EditSecretGroupRoleBindingsPayload { + this := EditSecretGroupRoleBindingsPayload{} + this.Role = role + this.Subject = subject + return &this +} + +// NewEditSecretGroupRoleBindingsPayloadWithDefaults instantiates a new EditSecretGroupRoleBindingsPayload 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 NewEditSecretGroupRoleBindingsPayloadWithDefaults() *EditSecretGroupRoleBindingsPayload { + this := EditSecretGroupRoleBindingsPayload{} + return &this +} + +// GetRole returns the Role field value +func (o *EditSecretGroupRoleBindingsPayload) GetRole() string { + if o == nil { + var ret string + return ret + } + + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value +// and a boolean to check if the value has been set. +func (o *EditSecretGroupRoleBindingsPayload) GetRoleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Role, true +} + +// SetRole sets field value +func (o *EditSecretGroupRoleBindingsPayload) SetRole(v string) { + o.Role = v +} + +// GetSubject returns the Subject field value +func (o *EditSecretGroupRoleBindingsPayload) GetSubject() string { + if o == nil { + var ret string + return ret + } + + return o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value +// and a boolean to check if the value has been set. +func (o *EditSecretGroupRoleBindingsPayload) GetSubjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Subject, true +} + +// SetSubject sets field value +func (o *EditSecretGroupRoleBindingsPayload) SetSubject(v string) { + o.Subject = v +} + +func (o EditSecretGroupRoleBindingsPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EditSecretGroupRoleBindingsPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["role"] = o.Role + toSerialize["subject"] = o.Subject + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *EditSecretGroupRoleBindingsPayload) 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{ + "role", + "subject", + } + + 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) + } + } + + varEditSecretGroupRoleBindingsPayload := _EditSecretGroupRoleBindingsPayload{} + + err = json.Unmarshal(data, &varEditSecretGroupRoleBindingsPayload) + + if err != nil { + return err + } + + *o = EditSecretGroupRoleBindingsPayload(varEditSecretGroupRoleBindingsPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "role") + delete(additionalProperties, "subject") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableEditSecretGroupRoleBindingsPayload struct { + value *EditSecretGroupRoleBindingsPayload + isSet bool +} + +func (v NullableEditSecretGroupRoleBindingsPayload) Get() *EditSecretGroupRoleBindingsPayload { + return v.value +} + +func (v *NullableEditSecretGroupRoleBindingsPayload) Set(val *EditSecretGroupRoleBindingsPayload) { + v.value = val + v.isSet = true +} + +func (v NullableEditSecretGroupRoleBindingsPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableEditSecretGroupRoleBindingsPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEditSecretGroupRoleBindingsPayload(val *EditSecretGroupRoleBindingsPayload) *NullableEditSecretGroupRoleBindingsPayload { + return &NullableEditSecretGroupRoleBindingsPayload{value: val, isSet: true} +} + +func (v NullableEditSecretGroupRoleBindingsPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEditSecretGroupRoleBindingsPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_error_response.go b/services/secretsmanager/v1alphaapi/model_error_response.go new file mode 100644 index 000000000..a47fea6f5 --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_error_response.go @@ -0,0 +1,283 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the ErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorResponse{} + +// ErrorResponse struct for ErrorResponse +type ErrorResponse struct { + Error string `json:"error"` + Message string `json:"message"` + Path string `json:"path"` + Status int32 `json:"status"` + TimeStamp time.Time `json:"timeStamp"` + AdditionalProperties map[string]interface{} +} + +type _ErrorResponse ErrorResponse + +// NewErrorResponse instantiates a new ErrorResponse 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 NewErrorResponse(error_ string, message string, path string, status int32, timeStamp time.Time) *ErrorResponse { + this := ErrorResponse{} + this.Error = error_ + this.Message = message + this.Path = path + this.Status = status + this.TimeStamp = timeStamp + return &this +} + +// NewErrorResponseWithDefaults instantiates a new ErrorResponse 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 NewErrorResponseWithDefaults() *ErrorResponse { + this := ErrorResponse{} + return &this +} + +// GetError returns the Error field value +func (o *ErrorResponse) GetError() string { + if o == nil { + var ret string + return ret + } + + return o.Error +} + +// GetErrorOk returns a tuple with the Error field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetErrorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Error, true +} + +// SetError sets field value +func (o *ErrorResponse) SetError(v string) { + o.Error = v +} + +// GetMessage returns the Message field value +func (o *ErrorResponse) 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 *ErrorResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *ErrorResponse) SetMessage(v string) { + o.Message = v +} + +// GetPath returns the Path field value +func (o *ErrorResponse) GetPath() string { + if o == nil { + var ret string + return ret + } + + return o.Path +} + +// GetPathOk returns a tuple with the Path field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetPathOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Path, true +} + +// SetPath sets field value +func (o *ErrorResponse) SetPath(v string) { + o.Path = v +} + +// GetStatus returns the Status field value +func (o *ErrorResponse) GetStatus() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetStatusOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *ErrorResponse) SetStatus(v int32) { + o.Status = v +} + +// GetTimeStamp returns the TimeStamp field value +func (o *ErrorResponse) GetTimeStamp() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.TimeStamp +} + +// GetTimeStampOk returns a tuple with the TimeStamp field value +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetTimeStampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.TimeStamp, true +} + +// SetTimeStamp sets field value +func (o *ErrorResponse) SetTimeStamp(v time.Time) { + o.TimeStamp = v +} + +func (o ErrorResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["error"] = o.Error + toSerialize["message"] = o.Message + toSerialize["path"] = o.Path + toSerialize["status"] = o.Status + toSerialize["timeStamp"] = o.TimeStamp + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ErrorResponse) 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{ + "error", + "message", + "path", + "status", + "timeStamp", + } + + 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) + } + } + + varErrorResponse := _ErrorResponse{} + + err = json.Unmarshal(data, &varErrorResponse) + + if err != nil { + return err + } + + *o = ErrorResponse(varErrorResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "error") + delete(additionalProperties, "message") + delete(additionalProperties, "path") + delete(additionalProperties, "status") + delete(additionalProperties, "timeStamp") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableErrorResponse struct { + value *ErrorResponse + isSet bool +} + +func (v NullableErrorResponse) Get() *ErrorResponse { + return v.value +} + +func (v *NullableErrorResponse) Set(val *ErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorResponse(val *ErrorResponse) *NullableErrorResponse { + return &NullableErrorResponse{value: val, isSet: true} +} + +func (v NullableErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_get_instance_role_bindings_payload.go b/services/secretsmanager/v1alphaapi/model_get_instance_role_bindings_payload.go new file mode 100644 index 000000000..8397d2a48 --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_get_instance_role_bindings_payload.go @@ -0,0 +1,195 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetInstanceRoleBindingsPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetInstanceRoleBindingsPayload{} + +// GetInstanceRoleBindingsPayload struct for GetInstanceRoleBindingsPayload +type GetInstanceRoleBindingsPayload struct { + Role string `json:"role" validate:"regexp=^[a-z](?:[-.]?[a-z]){1,63}$"` + Subject string `json:"subject"` + AdditionalProperties map[string]interface{} +} + +type _GetInstanceRoleBindingsPayload GetInstanceRoleBindingsPayload + +// NewGetInstanceRoleBindingsPayload instantiates a new GetInstanceRoleBindingsPayload 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 NewGetInstanceRoleBindingsPayload(role string, subject string) *GetInstanceRoleBindingsPayload { + this := GetInstanceRoleBindingsPayload{} + this.Role = role + this.Subject = subject + return &this +} + +// NewGetInstanceRoleBindingsPayloadWithDefaults instantiates a new GetInstanceRoleBindingsPayload 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 NewGetInstanceRoleBindingsPayloadWithDefaults() *GetInstanceRoleBindingsPayload { + this := GetInstanceRoleBindingsPayload{} + return &this +} + +// GetRole returns the Role field value +func (o *GetInstanceRoleBindingsPayload) GetRole() string { + if o == nil { + var ret string + return ret + } + + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value +// and a boolean to check if the value has been set. +func (o *GetInstanceRoleBindingsPayload) GetRoleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Role, true +} + +// SetRole sets field value +func (o *GetInstanceRoleBindingsPayload) SetRole(v string) { + o.Role = v +} + +// GetSubject returns the Subject field value +func (o *GetInstanceRoleBindingsPayload) GetSubject() string { + if o == nil { + var ret string + return ret + } + + return o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value +// and a boolean to check if the value has been set. +func (o *GetInstanceRoleBindingsPayload) GetSubjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Subject, true +} + +// SetSubject sets field value +func (o *GetInstanceRoleBindingsPayload) SetSubject(v string) { + o.Subject = v +} + +func (o GetInstanceRoleBindingsPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetInstanceRoleBindingsPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["role"] = o.Role + toSerialize["subject"] = o.Subject + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetInstanceRoleBindingsPayload) 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{ + "role", + "subject", + } + + 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) + } + } + + varGetInstanceRoleBindingsPayload := _GetInstanceRoleBindingsPayload{} + + err = json.Unmarshal(data, &varGetInstanceRoleBindingsPayload) + + if err != nil { + return err + } + + *o = GetInstanceRoleBindingsPayload(varGetInstanceRoleBindingsPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "role") + delete(additionalProperties, "subject") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetInstanceRoleBindingsPayload struct { + value *GetInstanceRoleBindingsPayload + isSet bool +} + +func (v NullableGetInstanceRoleBindingsPayload) Get() *GetInstanceRoleBindingsPayload { + return v.value +} + +func (v *NullableGetInstanceRoleBindingsPayload) Set(val *GetInstanceRoleBindingsPayload) { + v.value = val + v.isSet = true +} + +func (v NullableGetInstanceRoleBindingsPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableGetInstanceRoleBindingsPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetInstanceRoleBindingsPayload(val *GetInstanceRoleBindingsPayload) *NullableGetInstanceRoleBindingsPayload { + return &NullableGetInstanceRoleBindingsPayload{value: val, isSet: true} +} + +func (v NullableGetInstanceRoleBindingsPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetInstanceRoleBindingsPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_get_secret_group_role_bindings_payload.go b/services/secretsmanager/v1alphaapi/model_get_secret_group_role_bindings_payload.go new file mode 100644 index 000000000..f974b17cc --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_get_secret_group_role_bindings_payload.go @@ -0,0 +1,195 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetSecretGroupRoleBindingsPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetSecretGroupRoleBindingsPayload{} + +// GetSecretGroupRoleBindingsPayload struct for GetSecretGroupRoleBindingsPayload +type GetSecretGroupRoleBindingsPayload struct { + Role string `json:"role" validate:"regexp=^[a-z](?:[-.]?[a-z]){1,63}$"` + Subject string `json:"subject"` + AdditionalProperties map[string]interface{} +} + +type _GetSecretGroupRoleBindingsPayload GetSecretGroupRoleBindingsPayload + +// NewGetSecretGroupRoleBindingsPayload instantiates a new GetSecretGroupRoleBindingsPayload 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 NewGetSecretGroupRoleBindingsPayload(role string, subject string) *GetSecretGroupRoleBindingsPayload { + this := GetSecretGroupRoleBindingsPayload{} + this.Role = role + this.Subject = subject + return &this +} + +// NewGetSecretGroupRoleBindingsPayloadWithDefaults instantiates a new GetSecretGroupRoleBindingsPayload 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 NewGetSecretGroupRoleBindingsPayloadWithDefaults() *GetSecretGroupRoleBindingsPayload { + this := GetSecretGroupRoleBindingsPayload{} + return &this +} + +// GetRole returns the Role field value +func (o *GetSecretGroupRoleBindingsPayload) GetRole() string { + if o == nil { + var ret string + return ret + } + + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value +// and a boolean to check if the value has been set. +func (o *GetSecretGroupRoleBindingsPayload) GetRoleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Role, true +} + +// SetRole sets field value +func (o *GetSecretGroupRoleBindingsPayload) SetRole(v string) { + o.Role = v +} + +// GetSubject returns the Subject field value +func (o *GetSecretGroupRoleBindingsPayload) GetSubject() string { + if o == nil { + var ret string + return ret + } + + return o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value +// and a boolean to check if the value has been set. +func (o *GetSecretGroupRoleBindingsPayload) GetSubjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Subject, true +} + +// SetSubject sets field value +func (o *GetSecretGroupRoleBindingsPayload) SetSubject(v string) { + o.Subject = v +} + +func (o GetSecretGroupRoleBindingsPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetSecretGroupRoleBindingsPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["role"] = o.Role + toSerialize["subject"] = o.Subject + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetSecretGroupRoleBindingsPayload) 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{ + "role", + "subject", + } + + 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) + } + } + + varGetSecretGroupRoleBindingsPayload := _GetSecretGroupRoleBindingsPayload{} + + err = json.Unmarshal(data, &varGetSecretGroupRoleBindingsPayload) + + if err != nil { + return err + } + + *o = GetSecretGroupRoleBindingsPayload(varGetSecretGroupRoleBindingsPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "role") + delete(additionalProperties, "subject") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetSecretGroupRoleBindingsPayload struct { + value *GetSecretGroupRoleBindingsPayload + isSet bool +} + +func (v NullableGetSecretGroupRoleBindingsPayload) Get() *GetSecretGroupRoleBindingsPayload { + return v.value +} + +func (v *NullableGetSecretGroupRoleBindingsPayload) Set(val *GetSecretGroupRoleBindingsPayload) { + v.value = val + v.isSet = true +} + +func (v NullableGetSecretGroupRoleBindingsPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableGetSecretGroupRoleBindingsPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetSecretGroupRoleBindingsPayload(val *GetSecretGroupRoleBindingsPayload) *NullableGetSecretGroupRoleBindingsPayload { + return &NullableGetSecretGroupRoleBindingsPayload{value: val, isSet: true} +} + +func (v NullableGetSecretGroupRoleBindingsPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetSecretGroupRoleBindingsPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_list_role_bindings_response.go b/services/secretsmanager/v1alphaapi/model_list_role_bindings_response.go new file mode 100644 index 000000000..b04daca09 --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_list_role_bindings_response.go @@ -0,0 +1,153 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the ListRoleBindingsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListRoleBindingsResponse{} + +// ListRoleBindingsResponse struct for ListRoleBindingsResponse +type ListRoleBindingsResponse struct { + RoleBindings []RoleBinding `json:"roleBindings,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListRoleBindingsResponse ListRoleBindingsResponse + +// NewListRoleBindingsResponse instantiates a new ListRoleBindingsResponse 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 NewListRoleBindingsResponse() *ListRoleBindingsResponse { + this := ListRoleBindingsResponse{} + return &this +} + +// NewListRoleBindingsResponseWithDefaults instantiates a new ListRoleBindingsResponse 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 NewListRoleBindingsResponseWithDefaults() *ListRoleBindingsResponse { + this := ListRoleBindingsResponse{} + return &this +} + +// GetRoleBindings returns the RoleBindings field value if set, zero value otherwise. +func (o *ListRoleBindingsResponse) GetRoleBindings() []RoleBinding { + if o == nil || IsNil(o.RoleBindings) { + var ret []RoleBinding + return ret + } + return o.RoleBindings +} + +// GetRoleBindingsOk returns a tuple with the RoleBindings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListRoleBindingsResponse) GetRoleBindingsOk() ([]RoleBinding, bool) { + if o == nil || IsNil(o.RoleBindings) { + return nil, false + } + return o.RoleBindings, true +} + +// HasRoleBindings returns a boolean if a field has been set. +func (o *ListRoleBindingsResponse) HasRoleBindings() bool { + if o != nil && !IsNil(o.RoleBindings) { + return true + } + + return false +} + +// SetRoleBindings gets a reference to the given []RoleBinding and assigns it to the RoleBindings field. +func (o *ListRoleBindingsResponse) SetRoleBindings(v []RoleBinding) { + o.RoleBindings = v +} + +func (o ListRoleBindingsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListRoleBindingsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.RoleBindings) { + toSerialize["roleBindings"] = o.RoleBindings + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListRoleBindingsResponse) UnmarshalJSON(data []byte) (err error) { + varListRoleBindingsResponse := _ListRoleBindingsResponse{} + + err = json.Unmarshal(data, &varListRoleBindingsResponse) + + if err != nil { + return err + } + + *o = ListRoleBindingsResponse(varListRoleBindingsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "roleBindings") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListRoleBindingsResponse struct { + value *ListRoleBindingsResponse + isSet bool +} + +func (v NullableListRoleBindingsResponse) Get() *ListRoleBindingsResponse { + return v.value +} + +func (v *NullableListRoleBindingsResponse) Set(val *ListRoleBindingsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListRoleBindingsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListRoleBindingsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListRoleBindingsResponse(val *ListRoleBindingsResponse) *NullableListRoleBindingsResponse { + return &NullableListRoleBindingsResponse{value: val, isSet: true} +} + +func (v NullableListRoleBindingsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListRoleBindingsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_list_secretgroups_response.go b/services/secretsmanager/v1alphaapi/model_list_secretgroups_response.go new file mode 100644 index 000000000..474481506 --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_list_secretgroups_response.go @@ -0,0 +1,153 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the ListSecretgroupsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListSecretgroupsResponse{} + +// ListSecretgroupsResponse struct for ListSecretgroupsResponse +type ListSecretgroupsResponse struct { + Secretgroups []Secretgroup `json:"secretgroups,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ListSecretgroupsResponse ListSecretgroupsResponse + +// NewListSecretgroupsResponse instantiates a new ListSecretgroupsResponse 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 NewListSecretgroupsResponse() *ListSecretgroupsResponse { + this := ListSecretgroupsResponse{} + return &this +} + +// NewListSecretgroupsResponseWithDefaults instantiates a new ListSecretgroupsResponse 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 NewListSecretgroupsResponseWithDefaults() *ListSecretgroupsResponse { + this := ListSecretgroupsResponse{} + return &this +} + +// GetSecretgroups returns the Secretgroups field value if set, zero value otherwise. +func (o *ListSecretgroupsResponse) GetSecretgroups() []Secretgroup { + if o == nil || IsNil(o.Secretgroups) { + var ret []Secretgroup + return ret + } + return o.Secretgroups +} + +// GetSecretgroupsOk returns a tuple with the Secretgroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListSecretgroupsResponse) GetSecretgroupsOk() ([]Secretgroup, bool) { + if o == nil || IsNil(o.Secretgroups) { + return nil, false + } + return o.Secretgroups, true +} + +// HasSecretgroups returns a boolean if a field has been set. +func (o *ListSecretgroupsResponse) HasSecretgroups() bool { + if o != nil && !IsNil(o.Secretgroups) { + return true + } + + return false +} + +// SetSecretgroups gets a reference to the given []Secretgroup and assigns it to the Secretgroups field. +func (o *ListSecretgroupsResponse) SetSecretgroups(v []Secretgroup) { + o.Secretgroups = v +} + +func (o ListSecretgroupsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListSecretgroupsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Secretgroups) { + toSerialize["secretgroups"] = o.Secretgroups + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListSecretgroupsResponse) UnmarshalJSON(data []byte) (err error) { + varListSecretgroupsResponse := _ListSecretgroupsResponse{} + + err = json.Unmarshal(data, &varListSecretgroupsResponse) + + if err != nil { + return err + } + + *o = ListSecretgroupsResponse(varListSecretgroupsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "secretgroups") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListSecretgroupsResponse struct { + value *ListSecretgroupsResponse + isSet bool +} + +func (v NullableListSecretgroupsResponse) Get() *ListSecretgroupsResponse { + return v.value +} + +func (v *NullableListSecretgroupsResponse) Set(val *ListSecretgroupsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListSecretgroupsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListSecretgroupsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListSecretgroupsResponse(val *ListSecretgroupsResponse) *NullableListSecretgroupsResponse { + return &NullableListSecretgroupsResponse{value: val, isSet: true} +} + +func (v NullableListSecretgroupsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListSecretgroupsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_not_found.go b/services/secretsmanager/v1alphaapi/model_not_found.go new file mode 100644 index 000000000..d1919493f --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_not_found.go @@ -0,0 +1,167 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the NotFound type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NotFound{} + +// NotFound struct for NotFound +type NotFound struct { + // The error message for not found resources + Message string `json:"message"` + AdditionalProperties map[string]interface{} +} + +type _NotFound NotFound + +// NewNotFound instantiates a new NotFound 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 NewNotFound(message string) *NotFound { + this := NotFound{} + this.Message = message + return &this +} + +// NewNotFoundWithDefaults instantiates a new NotFound 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 NewNotFoundWithDefaults() *NotFound { + this := NotFound{} + return &this +} + +// GetMessage returns the Message field value +func (o *NotFound) 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 *NotFound) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *NotFound) SetMessage(v string) { + o.Message = v +} + +func (o NotFound) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NotFound) 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 *NotFound) 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) + } + } + + varNotFound := _NotFound{} + + err = json.Unmarshal(data, &varNotFound) + + if err != nil { + return err + } + + *o = NotFound(varNotFound) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableNotFound struct { + value *NotFound + isSet bool +} + +func (v NullableNotFound) Get() *NotFound { + return v.value +} + +func (v *NullableNotFound) Set(val *NotFound) { + v.value = val + v.isSet = true +} + +func (v NullableNotFound) IsSet() bool { + return v.isSet +} + +func (v *NullableNotFound) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNotFound(val *NotFound) *NullableNotFound { + return &NullableNotFound{value: val, isSet: true} +} + +func (v NullableNotFound) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNotFound) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_remove_instance_role_bindings_payload.go b/services/secretsmanager/v1alphaapi/model_remove_instance_role_bindings_payload.go new file mode 100644 index 000000000..4b9474ed3 --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_remove_instance_role_bindings_payload.go @@ -0,0 +1,195 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the RemoveInstanceRoleBindingsPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RemoveInstanceRoleBindingsPayload{} + +// RemoveInstanceRoleBindingsPayload struct for RemoveInstanceRoleBindingsPayload +type RemoveInstanceRoleBindingsPayload struct { + Role string `json:"role" validate:"regexp=^[a-z](?:[-.]?[a-z]){1,63}$"` + Subject string `json:"subject"` + AdditionalProperties map[string]interface{} +} + +type _RemoveInstanceRoleBindingsPayload RemoveInstanceRoleBindingsPayload + +// NewRemoveInstanceRoleBindingsPayload instantiates a new RemoveInstanceRoleBindingsPayload 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 NewRemoveInstanceRoleBindingsPayload(role string, subject string) *RemoveInstanceRoleBindingsPayload { + this := RemoveInstanceRoleBindingsPayload{} + this.Role = role + this.Subject = subject + return &this +} + +// NewRemoveInstanceRoleBindingsPayloadWithDefaults instantiates a new RemoveInstanceRoleBindingsPayload 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 NewRemoveInstanceRoleBindingsPayloadWithDefaults() *RemoveInstanceRoleBindingsPayload { + this := RemoveInstanceRoleBindingsPayload{} + return &this +} + +// GetRole returns the Role field value +func (o *RemoveInstanceRoleBindingsPayload) GetRole() string { + if o == nil { + var ret string + return ret + } + + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value +// and a boolean to check if the value has been set. +func (o *RemoveInstanceRoleBindingsPayload) GetRoleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Role, true +} + +// SetRole sets field value +func (o *RemoveInstanceRoleBindingsPayload) SetRole(v string) { + o.Role = v +} + +// GetSubject returns the Subject field value +func (o *RemoveInstanceRoleBindingsPayload) GetSubject() string { + if o == nil { + var ret string + return ret + } + + return o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value +// and a boolean to check if the value has been set. +func (o *RemoveInstanceRoleBindingsPayload) GetSubjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Subject, true +} + +// SetSubject sets field value +func (o *RemoveInstanceRoleBindingsPayload) SetSubject(v string) { + o.Subject = v +} + +func (o RemoveInstanceRoleBindingsPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RemoveInstanceRoleBindingsPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["role"] = o.Role + toSerialize["subject"] = o.Subject + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *RemoveInstanceRoleBindingsPayload) 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{ + "role", + "subject", + } + + 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) + } + } + + varRemoveInstanceRoleBindingsPayload := _RemoveInstanceRoleBindingsPayload{} + + err = json.Unmarshal(data, &varRemoveInstanceRoleBindingsPayload) + + if err != nil { + return err + } + + *o = RemoveInstanceRoleBindingsPayload(varRemoveInstanceRoleBindingsPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "role") + delete(additionalProperties, "subject") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRemoveInstanceRoleBindingsPayload struct { + value *RemoveInstanceRoleBindingsPayload + isSet bool +} + +func (v NullableRemoveInstanceRoleBindingsPayload) Get() *RemoveInstanceRoleBindingsPayload { + return v.value +} + +func (v *NullableRemoveInstanceRoleBindingsPayload) Set(val *RemoveInstanceRoleBindingsPayload) { + v.value = val + v.isSet = true +} + +func (v NullableRemoveInstanceRoleBindingsPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableRemoveInstanceRoleBindingsPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRemoveInstanceRoleBindingsPayload(val *RemoveInstanceRoleBindingsPayload) *NullableRemoveInstanceRoleBindingsPayload { + return &NullableRemoveInstanceRoleBindingsPayload{value: val, isSet: true} +} + +func (v NullableRemoveInstanceRoleBindingsPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRemoveInstanceRoleBindingsPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_remove_secret_group_role_bindings_payload.go b/services/secretsmanager/v1alphaapi/model_remove_secret_group_role_bindings_payload.go new file mode 100644 index 000000000..0dc4b82ca --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_remove_secret_group_role_bindings_payload.go @@ -0,0 +1,195 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the RemoveSecretGroupRoleBindingsPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RemoveSecretGroupRoleBindingsPayload{} + +// RemoveSecretGroupRoleBindingsPayload struct for RemoveSecretGroupRoleBindingsPayload +type RemoveSecretGroupRoleBindingsPayload struct { + Role string `json:"role" validate:"regexp=^[a-z](?:[-.]?[a-z]){1,63}$"` + Subject string `json:"subject"` + AdditionalProperties map[string]interface{} +} + +type _RemoveSecretGroupRoleBindingsPayload RemoveSecretGroupRoleBindingsPayload + +// NewRemoveSecretGroupRoleBindingsPayload instantiates a new RemoveSecretGroupRoleBindingsPayload 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 NewRemoveSecretGroupRoleBindingsPayload(role string, subject string) *RemoveSecretGroupRoleBindingsPayload { + this := RemoveSecretGroupRoleBindingsPayload{} + this.Role = role + this.Subject = subject + return &this +} + +// NewRemoveSecretGroupRoleBindingsPayloadWithDefaults instantiates a new RemoveSecretGroupRoleBindingsPayload 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 NewRemoveSecretGroupRoleBindingsPayloadWithDefaults() *RemoveSecretGroupRoleBindingsPayload { + this := RemoveSecretGroupRoleBindingsPayload{} + return &this +} + +// GetRole returns the Role field value +func (o *RemoveSecretGroupRoleBindingsPayload) GetRole() string { + if o == nil { + var ret string + return ret + } + + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value +// and a boolean to check if the value has been set. +func (o *RemoveSecretGroupRoleBindingsPayload) GetRoleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Role, true +} + +// SetRole sets field value +func (o *RemoveSecretGroupRoleBindingsPayload) SetRole(v string) { + o.Role = v +} + +// GetSubject returns the Subject field value +func (o *RemoveSecretGroupRoleBindingsPayload) GetSubject() string { + if o == nil { + var ret string + return ret + } + + return o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value +// and a boolean to check if the value has been set. +func (o *RemoveSecretGroupRoleBindingsPayload) GetSubjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Subject, true +} + +// SetSubject sets field value +func (o *RemoveSecretGroupRoleBindingsPayload) SetSubject(v string) { + o.Subject = v +} + +func (o RemoveSecretGroupRoleBindingsPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RemoveSecretGroupRoleBindingsPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["role"] = o.Role + toSerialize["subject"] = o.Subject + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *RemoveSecretGroupRoleBindingsPayload) 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{ + "role", + "subject", + } + + 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) + } + } + + varRemoveSecretGroupRoleBindingsPayload := _RemoveSecretGroupRoleBindingsPayload{} + + err = json.Unmarshal(data, &varRemoveSecretGroupRoleBindingsPayload) + + if err != nil { + return err + } + + *o = RemoveSecretGroupRoleBindingsPayload(varRemoveSecretGroupRoleBindingsPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "role") + delete(additionalProperties, "subject") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRemoveSecretGroupRoleBindingsPayload struct { + value *RemoveSecretGroupRoleBindingsPayload + isSet bool +} + +func (v NullableRemoveSecretGroupRoleBindingsPayload) Get() *RemoveSecretGroupRoleBindingsPayload { + return v.value +} + +func (v *NullableRemoveSecretGroupRoleBindingsPayload) Set(val *RemoveSecretGroupRoleBindingsPayload) { + v.value = val + v.isSet = true +} + +func (v NullableRemoveSecretGroupRoleBindingsPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableRemoveSecretGroupRoleBindingsPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRemoveSecretGroupRoleBindingsPayload(val *RemoveSecretGroupRoleBindingsPayload) *NullableRemoveSecretGroupRoleBindingsPayload { + return &NullableRemoveSecretGroupRoleBindingsPayload{value: val, isSet: true} +} + +func (v NullableRemoveSecretGroupRoleBindingsPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRemoveSecretGroupRoleBindingsPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_role_binding.go b/services/secretsmanager/v1alphaapi/model_role_binding.go new file mode 100644 index 000000000..a897d05ca --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_role_binding.go @@ -0,0 +1,195 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the RoleBinding type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RoleBinding{} + +// RoleBinding struct for RoleBinding +type RoleBinding struct { + Role string `json:"role" validate:"regexp=^[a-z](?:[-.]?[a-z]){1,63}$"` + Subject string `json:"subject"` + AdditionalProperties map[string]interface{} +} + +type _RoleBinding RoleBinding + +// NewRoleBinding instantiates a new RoleBinding 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 NewRoleBinding(role string, subject string) *RoleBinding { + this := RoleBinding{} + this.Role = role + this.Subject = subject + return &this +} + +// NewRoleBindingWithDefaults instantiates a new RoleBinding 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 NewRoleBindingWithDefaults() *RoleBinding { + this := RoleBinding{} + return &this +} + +// GetRole returns the Role field value +func (o *RoleBinding) GetRole() string { + if o == nil { + var ret string + return ret + } + + return o.Role +} + +// GetRoleOk returns a tuple with the Role field value +// and a boolean to check if the value has been set. +func (o *RoleBinding) GetRoleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Role, true +} + +// SetRole sets field value +func (o *RoleBinding) SetRole(v string) { + o.Role = v +} + +// GetSubject returns the Subject field value +func (o *RoleBinding) GetSubject() string { + if o == nil { + var ret string + return ret + } + + return o.Subject +} + +// GetSubjectOk returns a tuple with the Subject field value +// and a boolean to check if the value has been set. +func (o *RoleBinding) GetSubjectOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Subject, true +} + +// SetSubject sets field value +func (o *RoleBinding) SetSubject(v string) { + o.Subject = v +} + +func (o RoleBinding) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RoleBinding) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["role"] = o.Role + toSerialize["subject"] = o.Subject + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *RoleBinding) 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{ + "role", + "subject", + } + + 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) + } + } + + varRoleBinding := _RoleBinding{} + + err = json.Unmarshal(data, &varRoleBinding) + + if err != nil { + return err + } + + *o = RoleBinding(varRoleBinding) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "role") + delete(additionalProperties, "subject") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableRoleBinding struct { + value *RoleBinding + isSet bool +} + +func (v NullableRoleBinding) Get() *RoleBinding { + return v.value +} + +func (v *NullableRoleBinding) Set(val *RoleBinding) { + v.value = val + v.isSet = true +} + +func (v NullableRoleBinding) IsSet() bool { + return v.isSet +} + +func (v *NullableRoleBinding) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRoleBinding(val *RoleBinding) *NullableRoleBinding { + return &NullableRoleBinding{value: val, isSet: true} +} + +func (v NullableRoleBinding) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRoleBinding) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_secretgroup.go b/services/secretsmanager/v1alphaapi/model_secretgroup.go new file mode 100644 index 000000000..48aeeb7aa --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_secretgroup.go @@ -0,0 +1,227 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" + "fmt" +) + +// checks if the Secretgroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Secretgroup{} + +// Secretgroup struct for Secretgroup +type Secretgroup struct { + // A user chosen description to differentiate between multiple secret groups. + Description string `json:"description"` + // A auto generated unique id which identifies the secret group. + Id string `json:"id"` + // A list of secrets this secret group contains. + Secrets []string `json:"secrets"` + AdditionalProperties map[string]interface{} +} + +type _Secretgroup Secretgroup + +// NewSecretgroup instantiates a new Secretgroup 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 NewSecretgroup(description string, id string, secrets []string) *Secretgroup { + this := Secretgroup{} + this.Description = description + this.Id = id + this.Secrets = secrets + return &this +} + +// NewSecretgroupWithDefaults instantiates a new Secretgroup 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 NewSecretgroupWithDefaults() *Secretgroup { + this := Secretgroup{} + return &this +} + +// GetDescription returns the Description field value +func (o *Secretgroup) GetDescription() string { + if o == nil { + var ret string + return ret + } + + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value +// and a boolean to check if the value has been set. +func (o *Secretgroup) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value +func (o *Secretgroup) SetDescription(v string) { + o.Description = v +} + +// GetId returns the Id field value +func (o *Secretgroup) 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 *Secretgroup) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *Secretgroup) SetId(v string) { + o.Id = v +} + +// GetSecrets returns the Secrets field value +func (o *Secretgroup) GetSecrets() []string { + if o == nil { + var ret []string + return ret + } + + return o.Secrets +} + +// GetSecretsOk returns a tuple with the Secrets field value +// and a boolean to check if the value has been set. +func (o *Secretgroup) GetSecretsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Secrets, true +} + +// SetSecrets sets field value +func (o *Secretgroup) SetSecrets(v []string) { + o.Secrets = v +} + +func (o Secretgroup) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Secretgroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["description"] = o.Description + toSerialize["id"] = o.Id + toSerialize["secrets"] = o.Secrets + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Secretgroup) 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{ + "description", + "id", + "secrets", + } + + 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) + } + } + + varSecretgroup := _Secretgroup{} + + err = json.Unmarshal(data, &varSecretgroup) + + if err != nil { + return err + } + + *o = Secretgroup(varSecretgroup) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "id") + delete(additionalProperties, "secrets") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableSecretgroup struct { + value *Secretgroup + isSet bool +} + +func (v NullableSecretgroup) Get() *Secretgroup { + return v.value +} + +func (v *NullableSecretgroup) Set(val *Secretgroup) { + v.value = val + v.isSet = true +} + +func (v NullableSecretgroup) IsSet() bool { + return v.isSet +} + +func (v *NullableSecretgroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecretgroup(val *Secretgroup) *NullableSecretgroup { + return &NullableSecretgroup{value: val, isSet: true} +} + +func (v NullableSecretgroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecretgroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/model_update_secretgroup_payload.go b/services/secretsmanager/v1alphaapi/model_update_secretgroup_payload.go new file mode 100644 index 000000000..64f83f69c --- /dev/null +++ b/services/secretsmanager/v1alphaapi/model_update_secretgroup_payload.go @@ -0,0 +1,192 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the UpdateSecretgroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSecretgroupPayload{} + +// UpdateSecretgroupPayload struct for UpdateSecretgroupPayload +type UpdateSecretgroupPayload struct { + // A user chosen description to differentiate between multiple secret groups. + Description *string `json:"description,omitempty"` + // A list of secrets this secret group contains. + Secrets []string `json:"secrets,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateSecretgroupPayload UpdateSecretgroupPayload + +// NewUpdateSecretgroupPayload instantiates a new UpdateSecretgroupPayload 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 NewUpdateSecretgroupPayload() *UpdateSecretgroupPayload { + this := UpdateSecretgroupPayload{} + return &this +} + +// NewUpdateSecretgroupPayloadWithDefaults instantiates a new UpdateSecretgroupPayload 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 NewUpdateSecretgroupPayloadWithDefaults() *UpdateSecretgroupPayload { + this := UpdateSecretgroupPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateSecretgroupPayload) 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 *UpdateSecretgroupPayload) 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 *UpdateSecretgroupPayload) 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 *UpdateSecretgroupPayload) SetDescription(v string) { + o.Description = &v +} + +// GetSecrets returns the Secrets field value if set, zero value otherwise. +func (o *UpdateSecretgroupPayload) GetSecrets() []string { + if o == nil || IsNil(o.Secrets) { + var ret []string + return ret + } + return o.Secrets +} + +// GetSecretsOk returns a tuple with the Secrets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateSecretgroupPayload) GetSecretsOk() ([]string, bool) { + if o == nil || IsNil(o.Secrets) { + return nil, false + } + return o.Secrets, true +} + +// HasSecrets returns a boolean if a field has been set. +func (o *UpdateSecretgroupPayload) HasSecrets() bool { + if o != nil && !IsNil(o.Secrets) { + return true + } + + return false +} + +// SetSecrets gets a reference to the given []string and assigns it to the Secrets field. +func (o *UpdateSecretgroupPayload) SetSecrets(v []string) { + o.Secrets = v +} + +func (o UpdateSecretgroupPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateSecretgroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Secrets) { + toSerialize["secrets"] = o.Secrets + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateSecretgroupPayload) UnmarshalJSON(data []byte) (err error) { + varUpdateSecretgroupPayload := _UpdateSecretgroupPayload{} + + err = json.Unmarshal(data, &varUpdateSecretgroupPayload) + + if err != nil { + return err + } + + *o = UpdateSecretgroupPayload(varUpdateSecretgroupPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "description") + delete(additionalProperties, "secrets") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateSecretgroupPayload struct { + value *UpdateSecretgroupPayload + isSet bool +} + +func (v NullableUpdateSecretgroupPayload) Get() *UpdateSecretgroupPayload { + return v.value +} + +func (v *NullableUpdateSecretgroupPayload) Set(val *UpdateSecretgroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateSecretgroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateSecretgroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateSecretgroupPayload(val *UpdateSecretgroupPayload) *NullableUpdateSecretgroupPayload { + return &NullableUpdateSecretgroupPayload{value: val, isSet: true} +} + +func (v NullableUpdateSecretgroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateSecretgroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/secretsmanager/v1alphaapi/response.go b/services/secretsmanager/v1alphaapi/response.go new file mode 100644 index 000000000..8bcafdb45 --- /dev/null +++ b/services/secretsmanager/v1alphaapi/response.go @@ -0,0 +1,47 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +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/secretsmanager/v1alphaapi/utils.go b/services/secretsmanager/v1alphaapi/utils.go new file mode 100644 index 000000000..6f2324482 --- /dev/null +++ b/services/secretsmanager/v1alphaapi/utils.go @@ -0,0 +1,361 @@ +/* +STACKIT Secrets Manager API + +This API provides endpoints for managing the Secrets-Manager. + +API version: 1alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +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...) +} From 5ce83d5123993a30690856da755d1c5150aafa04 Mon Sep 17 00:00:00 2001 From: Ruben Hoenle Date: Thu, 16 Apr 2026 09:17:07 +0200 Subject: [PATCH 2/3] changelogs --- CHANGELOG.md | 7 +++++-- examples/secretsmanager/go.mod | 2 +- examples/secretsmanager/go.sum | 4 ++-- services/secretsmanager/CHANGELOG.md | 4 ++++ services/secretsmanager/VERSION | 2 +- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8504c63b6..b1841587b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -168,10 +168,13 @@ - [v0.7.0](services/scf/CHANGELOG.md#v070) - Minimal go version is now Go 1.25 - `secretsmanager`: - - [v0.16.3](services/secretsmanager/CHANGELOG.md#v0163) + - [v0.16.3](services/secretsmanager/CHANGELOG.md#v0163) - **Dependencies:** Bump STACKIT SDK core module from `v0.24.0` to `v0.24.1` - - [v0.17.0](services/secretsmanager/CHANGELOG.md#v0170) + - [v0.17.0](services/secretsmanager/CHANGELOG.md#v0170) - Minimal go version is now Go 1.25 + - [v0.18.0](services/secretsmanager/CHANGELOG.md#v0180) + - `v1alphaapi`: New package which can be used for communication with the STACKIT secretsmanager v1 alpha API +- **Dependencies:** Bump STACKIT SDK core module from `v0.24.1` to `v0.25.0` - `serverbackup`: - [v1.5.3](services/serverbackup/CHANGELOG.md#v153) - **Dependencies:** Bump STACKIT SDK core module from `v0.24.0` to `v0.24.1` diff --git a/examples/secretsmanager/go.mod b/examples/secretsmanager/go.mod index 4584118da..da3dec473 100644 --- a/examples/secretsmanager/go.mod +++ b/examples/secretsmanager/go.mod @@ -6,7 +6,7 @@ go 1.25 replace github.com/stackitcloud/stackit-sdk-go/services/secretsmanager => ../../services/secretsmanager require ( - github.com/stackitcloud/stackit-sdk-go/core v0.24.1 + github.com/stackitcloud/stackit-sdk-go/core v0.25.0 github.com/stackitcloud/stackit-sdk-go/services/secretsmanager v0.16.3 ) diff --git a/examples/secretsmanager/go.sum b/examples/secretsmanager/go.sum index 516c6a66d..f66cfd445 100644 --- a/examples/secretsmanager/go.sum +++ b/examples/secretsmanager/go.sum @@ -4,5 +4,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/stackitcloud/stackit-sdk-go/core v0.24.1 h1:IrG0XBlJivUpXC4Y6TE+6FeSxNPs1JQXsero0ivwh0o= -github.com/stackitcloud/stackit-sdk-go/core v0.24.1/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= +github.com/stackitcloud/stackit-sdk-go/core v0.25.0 h1:ra3VEk684MNoq741g+xbZrKjZzhyztq5liUAwwew4DY= +github.com/stackitcloud/stackit-sdk-go/core v0.25.0/go.mod h1:WU1hhxnjXw2EV7CYa1nlEvNpMiRY6CvmIOaHuL3pOaA= diff --git a/services/secretsmanager/CHANGELOG.md b/services/secretsmanager/CHANGELOG.md index d34613b3b..edffb2ece 100644 --- a/services/secretsmanager/CHANGELOG.md +++ b/services/secretsmanager/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.18.0 +- `v1alphaapi`: New package which can be used for communication with the STACKIT secretsmanager v1 alpha API +- **Dependencies:** Bump STACKIT SDK core module from `v0.24.1` to `v0.25.0` + ## v0.17.0 - Minimal go version is now Go 1.25 diff --git a/services/secretsmanager/VERSION b/services/secretsmanager/VERSION index 2bb97efb7..a86d3df72 100644 --- a/services/secretsmanager/VERSION +++ b/services/secretsmanager/VERSION @@ -1 +1 @@ -v0.17.0 \ No newline at end of file +v0.18.0 From 510246428f14910145d545ea1ced4297831938e9 Mon Sep 17 00:00:00 2001 From: Ruben Hoenle Date: Thu, 16 Apr 2026 09:19:13 +0200 Subject: [PATCH 3/3] formatting --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1841587b..c9324989c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -174,7 +174,7 @@ - Minimal go version is now Go 1.25 - [v0.18.0](services/secretsmanager/CHANGELOG.md#v0180) - `v1alphaapi`: New package which can be used for communication with the STACKIT secretsmanager v1 alpha API -- **Dependencies:** Bump STACKIT SDK core module from `v0.24.1` to `v0.25.0` + - **Dependencies:** Bump STACKIT SDK core module from `v0.24.1` to `v0.25.0` - `serverbackup`: - [v1.5.3](services/serverbackup/CHANGELOG.md#v153) - **Dependencies:** Bump STACKIT SDK core module from `v0.24.0` to `v0.24.1`