From b543af9c21dd8e7ef09e4e271f3eeede9cb8910b Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Wed, 1 Jul 2026 09:02:55 +0000 Subject: [PATCH] Generate postgresflex --- services/postgresflex/oas_commit | 2 +- .../postgresflex/v3beta1api/api_default.go | 6180 +++++++++++++++++ .../v3beta1api/api_default_mock.go | 615 ++ services/postgresflex/v3beta1api/client.go | 659 ++ .../postgresflex/v3beta1api/configuration.go | 38 + .../v3beta1api/model_backup_data.go | 318 + .../v3beta1api/model_backup_sort.go | 134 + .../model_clone_instance_overrides.go | 244 + .../v3beta1api/model_clone_request_payload.go | 198 + .../v3beta1api/model_clone_response.go | 168 + .../model_create_database_request_payload.go | 206 + .../model_create_database_response.go | 168 + .../model_create_instance_request_payload.go | 423 ++ .../model_create_instance_response.go | 168 + .../model_create_user_request_payload.go | 206 + .../v3beta1api/model_create_user_response.go | 258 + .../v3beta1api/model_database_roles.go | 198 + .../v3beta1api/model_database_sort.go | 126 + .../postgresflex/v3beta1api/model_error.go | 258 + .../v3beta1api/model_flavor_sort.go | 142 + ...el_flavor_storage_classes_storage_class.go | 225 + .../model_get_collations_response.go | 168 + .../v3beta1api/model_get_database_response.go | 228 + .../v3beta1api/model_get_flavors_response.go | 197 + .../v3beta1api/model_get_instance_response.go | 579 ++ .../v3beta1api/model_get_user_response.go | 258 + .../v3beta1api/model_get_versions_response.go | 168 + .../model_instance_connection_info.go | 167 + .../model_instance_connection_info_write.go | 198 + .../v3beta1api/model_instance_encryption.go | 257 + .../v3beta1api/model_instance_network.go | 283 + .../model_instance_network_access_scope.go | 114 + .../model_instance_network_create.go | 209 + .../v3beta1api/model_instance_network_opt.go | 155 + .../model_instance_network_update.go | 168 + .../v3beta1api/model_instance_sort.go | 126 + .../model_instance_storage_range.go | 198 + .../v3beta1api/model_list_backup_response.go | 197 + .../v3beta1api/model_list_database.go | 228 + .../model_list_databases_response.go | 197 + .../v3beta1api/model_list_flavors.go | 378 + .../v3beta1api/model_list_instance.go | 257 + .../model_list_instances_response.go | 197 + .../v3beta1api/model_list_roles_response.go | 168 + .../v3beta1api/model_list_user.go | 228 + .../v3beta1api/model_list_user_response.go | 197 + .../v3beta1api/model_pagination.go | 283 + .../model_protect_instance_request_payload.go | 168 + .../model_protect_instance_response.go | 168 + .../v3beta1api/model_reset_user_response.go | 228 + .../postgresflex/v3beta1api/model_state.go | 122 + .../postgresflex/v3beta1api/model_storage.go | 193 + .../v3beta1api/model_storage_create.go | 206 + .../v3beta1api/model_storage_update.go | 155 + ...date_database_partially_request_payload.go | 193 + ...odel_update_database_partially_response.go | 167 + .../model_update_database_request_payload.go | 198 + .../model_update_database_response.go | 167 + ...date_instance_partially_request_payload.go | 419 ++ .../model_update_instance_request_payload.go | 386 + ...l_update_user_partially_request_payload.go | 193 + .../model_update_user_request_payload.go | 206 + .../v3beta1api/model_user_sort.go | 122 + .../v3beta1api/model_validation_error.go | 198 + ...model_validation_error_validation_inner.go | 196 + .../postgresflex/v3beta1api/model_version.go | 258 + services/postgresflex/v3beta1api/response.go | 48 + services/postgresflex/v3beta1api/utils.go | 362 + 68 files changed, 21089 insertions(+), 1 deletion(-) create mode 100644 services/postgresflex/v3beta1api/api_default.go create mode 100644 services/postgresflex/v3beta1api/api_default_mock.go create mode 100644 services/postgresflex/v3beta1api/client.go create mode 100644 services/postgresflex/v3beta1api/configuration.go create mode 100644 services/postgresflex/v3beta1api/model_backup_data.go create mode 100644 services/postgresflex/v3beta1api/model_backup_sort.go create mode 100644 services/postgresflex/v3beta1api/model_clone_instance_overrides.go create mode 100644 services/postgresflex/v3beta1api/model_clone_request_payload.go create mode 100644 services/postgresflex/v3beta1api/model_clone_response.go create mode 100644 services/postgresflex/v3beta1api/model_create_database_request_payload.go create mode 100644 services/postgresflex/v3beta1api/model_create_database_response.go create mode 100644 services/postgresflex/v3beta1api/model_create_instance_request_payload.go create mode 100644 services/postgresflex/v3beta1api/model_create_instance_response.go create mode 100644 services/postgresflex/v3beta1api/model_create_user_request_payload.go create mode 100644 services/postgresflex/v3beta1api/model_create_user_response.go create mode 100644 services/postgresflex/v3beta1api/model_database_roles.go create mode 100644 services/postgresflex/v3beta1api/model_database_sort.go create mode 100644 services/postgresflex/v3beta1api/model_error.go create mode 100644 services/postgresflex/v3beta1api/model_flavor_sort.go create mode 100644 services/postgresflex/v3beta1api/model_flavor_storage_classes_storage_class.go create mode 100644 services/postgresflex/v3beta1api/model_get_collations_response.go create mode 100644 services/postgresflex/v3beta1api/model_get_database_response.go create mode 100644 services/postgresflex/v3beta1api/model_get_flavors_response.go create mode 100644 services/postgresflex/v3beta1api/model_get_instance_response.go create mode 100644 services/postgresflex/v3beta1api/model_get_user_response.go create mode 100644 services/postgresflex/v3beta1api/model_get_versions_response.go create mode 100644 services/postgresflex/v3beta1api/model_instance_connection_info.go create mode 100644 services/postgresflex/v3beta1api/model_instance_connection_info_write.go create mode 100644 services/postgresflex/v3beta1api/model_instance_encryption.go create mode 100644 services/postgresflex/v3beta1api/model_instance_network.go create mode 100644 services/postgresflex/v3beta1api/model_instance_network_access_scope.go create mode 100644 services/postgresflex/v3beta1api/model_instance_network_create.go create mode 100644 services/postgresflex/v3beta1api/model_instance_network_opt.go create mode 100644 services/postgresflex/v3beta1api/model_instance_network_update.go create mode 100644 services/postgresflex/v3beta1api/model_instance_sort.go create mode 100644 services/postgresflex/v3beta1api/model_instance_storage_range.go create mode 100644 services/postgresflex/v3beta1api/model_list_backup_response.go create mode 100644 services/postgresflex/v3beta1api/model_list_database.go create mode 100644 services/postgresflex/v3beta1api/model_list_databases_response.go create mode 100644 services/postgresflex/v3beta1api/model_list_flavors.go create mode 100644 services/postgresflex/v3beta1api/model_list_instance.go create mode 100644 services/postgresflex/v3beta1api/model_list_instances_response.go create mode 100644 services/postgresflex/v3beta1api/model_list_roles_response.go create mode 100644 services/postgresflex/v3beta1api/model_list_user.go create mode 100644 services/postgresflex/v3beta1api/model_list_user_response.go create mode 100644 services/postgresflex/v3beta1api/model_pagination.go create mode 100644 services/postgresflex/v3beta1api/model_protect_instance_request_payload.go create mode 100644 services/postgresflex/v3beta1api/model_protect_instance_response.go create mode 100644 services/postgresflex/v3beta1api/model_reset_user_response.go create mode 100644 services/postgresflex/v3beta1api/model_state.go create mode 100644 services/postgresflex/v3beta1api/model_storage.go create mode 100644 services/postgresflex/v3beta1api/model_storage_create.go create mode 100644 services/postgresflex/v3beta1api/model_storage_update.go create mode 100644 services/postgresflex/v3beta1api/model_update_database_partially_request_payload.go create mode 100644 services/postgresflex/v3beta1api/model_update_database_partially_response.go create mode 100644 services/postgresflex/v3beta1api/model_update_database_request_payload.go create mode 100644 services/postgresflex/v3beta1api/model_update_database_response.go create mode 100644 services/postgresflex/v3beta1api/model_update_instance_partially_request_payload.go create mode 100644 services/postgresflex/v3beta1api/model_update_instance_request_payload.go create mode 100644 services/postgresflex/v3beta1api/model_update_user_partially_request_payload.go create mode 100644 services/postgresflex/v3beta1api/model_update_user_request_payload.go create mode 100644 services/postgresflex/v3beta1api/model_user_sort.go create mode 100644 services/postgresflex/v3beta1api/model_validation_error.go create mode 100644 services/postgresflex/v3beta1api/model_validation_error_validation_inner.go create mode 100644 services/postgresflex/v3beta1api/model_version.go create mode 100644 services/postgresflex/v3beta1api/response.go create mode 100644 services/postgresflex/v3beta1api/utils.go diff --git a/services/postgresflex/oas_commit b/services/postgresflex/oas_commit index 6e745cd65..5319daad3 100644 --- a/services/postgresflex/oas_commit +++ b/services/postgresflex/oas_commit @@ -1 +1 @@ -9873a8f7a4120017699e43baba2e8b2af7bca93e +3ce30e12ea17197c003ced5176b6084b8d09a69f diff --git a/services/postgresflex/v3beta1api/api_default.go b/services/postgresflex/v3beta1api/api_default.go new file mode 100644 index 000000000..05bdb8f6d --- /dev/null +++ b/services/postgresflex/v3beta1api/api_default.go @@ -0,0 +1,6180 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v3beta1api + +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 { + + /* + CloneRequest Clone Instance + + Clone Instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiCloneRequestRequest + */ + CloneRequest(ctx context.Context, projectId string, region string, instanceId string) ApiCloneRequestRequest + + // CloneRequestExecute executes the request + // @return CloneResponse + CloneRequestExecute(r ApiCloneRequestRequest) (*CloneResponse, error) + + /* + CreateDatabaseRequest Create Database + + Create database for a user. Note: The name of a valid user must be provided in the 'options' map field using the key 'owner' + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiCreateDatabaseRequestRequest + */ + CreateDatabaseRequest(ctx context.Context, projectId string, region string, instanceId string) ApiCreateDatabaseRequestRequest + + // CreateDatabaseRequestExecute executes the request + // @return CreateDatabaseResponse + CreateDatabaseRequestExecute(r ApiCreateDatabaseRequestRequest) (*CreateDatabaseResponse, error) + + /* + CreateInstanceRequest Create Instance + + Create a new instance of a postgres database instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @return ApiCreateInstanceRequestRequest + */ + CreateInstanceRequest(ctx context.Context, projectId string, region string) ApiCreateInstanceRequestRequest + + // CreateInstanceRequestExecute executes the request + // @return CreateInstanceResponse + CreateInstanceRequestExecute(r ApiCreateInstanceRequestRequest) (*CreateInstanceResponse, error) + + /* + CreateUserRequest Create User + + Create user for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiCreateUserRequestRequest + */ + CreateUserRequest(ctx context.Context, projectId string, region string, instanceId string) ApiCreateUserRequestRequest + + // CreateUserRequestExecute executes the request + // @return CreateUserResponse + CreateUserRequestExecute(r ApiCreateUserRequestRequest) (*CreateUserResponse, error) + + /* + DeleteDatabaseRequest Delete Database + + Delete database for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param databaseId The ID of the database. + @return ApiDeleteDatabaseRequestRequest + */ + DeleteDatabaseRequest(ctx context.Context, projectId string, region string, instanceId string, databaseId int32) ApiDeleteDatabaseRequestRequest + + // DeleteDatabaseRequestExecute executes the request + DeleteDatabaseRequestExecute(r ApiDeleteDatabaseRequestRequest) error + + /* + DeleteInstanceRequest Delete Instance + + Delete an available postgres instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiDeleteInstanceRequestRequest + */ + DeleteInstanceRequest(ctx context.Context, projectId string, region string, instanceId string) ApiDeleteInstanceRequestRequest + + // DeleteInstanceRequestExecute executes the request + DeleteInstanceRequestExecute(r ApiDeleteInstanceRequestRequest) error + + /* + DeleteUserRequest Delete User + + Delete an user from a specific instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param userId The ID of the user. + @return ApiDeleteUserRequestRequest + */ + DeleteUserRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiDeleteUserRequestRequest + + // DeleteUserRequestExecute executes the request + DeleteUserRequestExecute(r ApiDeleteUserRequestRequest) error + + /* + GetBackupRequest Get specific backup + + Get information about a specific backup for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param backupId The ID of the backup. + @return ApiGetBackupRequestRequest + */ + GetBackupRequest(ctx context.Context, projectId string, region string, instanceId string, backupId int32) ApiGetBackupRequestRequest + + // GetBackupRequestExecute executes the request + // @return BackupData + GetBackupRequestExecute(r ApiGetBackupRequestRequest) (*BackupData, error) + + /* + GetCollationsRequest Get Collations for an Instance + + Get available collations for an instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiGetCollationsRequestRequest + */ + GetCollationsRequest(ctx context.Context, projectId string, region string, instanceId string) ApiGetCollationsRequestRequest + + // GetCollationsRequestExecute executes the request + // @return GetCollationsResponse + GetCollationsRequestExecute(r ApiGetCollationsRequestRequest) (*GetCollationsResponse, error) + + /* + GetDatabaseRequest Get Specific Database + + Get information about a specific database in an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param databaseId The ID of the database. + @return ApiGetDatabaseRequestRequest + */ + GetDatabaseRequest(ctx context.Context, projectId string, region string, instanceId string, databaseId int32) ApiGetDatabaseRequestRequest + + // GetDatabaseRequestExecute executes the request + // @return GetDatabaseResponse + GetDatabaseRequestExecute(r ApiGetDatabaseRequestRequest) (*GetDatabaseResponse, error) + + /* + GetFlavorsRequest Get Flavors + + Get all available flavors for a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @return ApiGetFlavorsRequestRequest + */ + GetFlavorsRequest(ctx context.Context, projectId string, region string) ApiGetFlavorsRequestRequest + + // GetFlavorsRequestExecute executes the request + // @return GetFlavorsResponse + GetFlavorsRequestExecute(r ApiGetFlavorsRequestRequest) (*GetFlavorsResponse, error) + + /* + GetInstanceRequest Get Specific Instance + + Get information about a specific available instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiGetInstanceRequestRequest + */ + GetInstanceRequest(ctx context.Context, projectId string, region string, instanceId string) ApiGetInstanceRequestRequest + + // GetInstanceRequestExecute executes the request + // @return GetInstanceResponse + GetInstanceRequestExecute(r ApiGetInstanceRequestRequest) (*GetInstanceResponse, error) + + /* + GetUserRequest Get User + + Get a specific available user for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param userId The ID of the user. + @return ApiGetUserRequestRequest + */ + GetUserRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiGetUserRequestRequest + + // GetUserRequestExecute executes the request + // @return GetUserResponse + GetUserRequestExecute(r ApiGetUserRequestRequest) (*GetUserResponse, error) + + /* + GetVersionsRequest Get Versions + + Get available postgres versions for the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @return ApiGetVersionsRequestRequest + */ + GetVersionsRequest(ctx context.Context, projectId string, region string) ApiGetVersionsRequestRequest + + // GetVersionsRequestExecute executes the request + // @return GetVersionsResponse + GetVersionsRequestExecute(r ApiGetVersionsRequestRequest) (*GetVersionsResponse, error) + + /* + ListBackupsRequest List backups + + List all backups which are available for a specific instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiListBackupsRequestRequest + */ + ListBackupsRequest(ctx context.Context, projectId string, region string, instanceId string) ApiListBackupsRequestRequest + + // ListBackupsRequestExecute executes the request + // @return ListBackupResponse + ListBackupsRequestExecute(r ApiListBackupsRequestRequest) (*ListBackupResponse, error) + + /* + ListDatabasesRequest List Databases + + List available databases for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiListDatabasesRequestRequest + */ + ListDatabasesRequest(ctx context.Context, projectId string, region string, instanceId string) ApiListDatabasesRequestRequest + + // ListDatabasesRequestExecute executes the request + // @return ListDatabasesResponse + ListDatabasesRequestExecute(r ApiListDatabasesRequestRequest) (*ListDatabasesResponse, error) + + /* + ListInstancesRequest List Instances + + List all available instances for your project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @return ApiListInstancesRequestRequest + */ + ListInstancesRequest(ctx context.Context, projectId string, region string) ApiListInstancesRequestRequest + + // ListInstancesRequestExecute executes the request + // @return ListInstancesResponse + ListInstancesRequestExecute(r ApiListInstancesRequestRequest) (*ListInstancesResponse, error) + + /* + ListRolesRequest List Roles + + List available roles for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiListRolesRequestRequest + */ + ListRolesRequest(ctx context.Context, projectId string, region string, instanceId string) ApiListRolesRequestRequest + + // ListRolesRequestExecute executes the request + // @return ListRolesResponse + ListRolesRequestExecute(r ApiListRolesRequestRequest) (*ListRolesResponse, error) + + /* + ListUsersRequest List Users + + List available users for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiListUsersRequestRequest + */ + ListUsersRequest(ctx context.Context, projectId string, region string, instanceId string) ApiListUsersRequestRequest + + // ListUsersRequestExecute executes the request + // @return ListUserResponse + ListUsersRequestExecute(r ApiListUsersRequestRequest) (*ListUserResponse, error) + + /* + ProtectInstanceRequest Protect Instance + + Toggle the deletion protection for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiProtectInstanceRequestRequest + */ + ProtectInstanceRequest(ctx context.Context, projectId string, region string, instanceId string) ApiProtectInstanceRequestRequest + + // ProtectInstanceRequestExecute executes the request + // @return ProtectInstanceResponse + ProtectInstanceRequestExecute(r ApiProtectInstanceRequestRequest) (*ProtectInstanceResponse, error) + + /* + ResetUserRequest Reset User + + Reset an user from an specific instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param userId The ID of the user. + @return ApiResetUserRequestRequest + */ + ResetUserRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiResetUserRequestRequest + + // ResetUserRequestExecute executes the request + // @return ResetUserResponse + ResetUserRequestExecute(r ApiResetUserRequestRequest) (*ResetUserResponse, error) + + /* + UpdateDatabasePartiallyRequest Update Database partially + + Update a database partially in an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param databaseId The ID of the database. + @return ApiUpdateDatabasePartiallyRequestRequest + */ + UpdateDatabasePartiallyRequest(ctx context.Context, projectId string, region string, instanceId string, databaseId int32) ApiUpdateDatabasePartiallyRequestRequest + + // UpdateDatabasePartiallyRequestExecute executes the request + UpdateDatabasePartiallyRequestExecute(r ApiUpdateDatabasePartiallyRequestRequest) error + + /* + UpdateDatabaseRequest Update Database + + Update a database in an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param databaseId The ID of the database. + @return ApiUpdateDatabaseRequestRequest + */ + UpdateDatabaseRequest(ctx context.Context, projectId string, region string, instanceId string, databaseId int32) ApiUpdateDatabaseRequestRequest + + // UpdateDatabaseRequestExecute executes the request + UpdateDatabaseRequestExecute(r ApiUpdateDatabaseRequestRequest) error + + /* + UpdateInstancePartiallyRequest Update Instance Partially + + Update an available instance of a postgres database. No fields are required. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiUpdateInstancePartiallyRequestRequest + */ + UpdateInstancePartiallyRequest(ctx context.Context, projectId string, region string, instanceId string) ApiUpdateInstancePartiallyRequestRequest + + // UpdateInstancePartiallyRequestExecute executes the request + UpdateInstancePartiallyRequestExecute(r ApiUpdateInstancePartiallyRequestRequest) error + + /* + UpdateInstanceRequest Update Instance + + Updates an available instance of a postgres database + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiUpdateInstanceRequestRequest + */ + UpdateInstanceRequest(ctx context.Context, projectId string, region string, instanceId string) ApiUpdateInstanceRequestRequest + + // UpdateInstanceRequestExecute executes the request + UpdateInstanceRequestExecute(r ApiUpdateInstanceRequestRequest) error + + /* + UpdateUserPartiallyRequest Update User Partially + + Update an user partially for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param userId The ID of the user. + @return ApiUpdateUserPartiallyRequestRequest + */ + UpdateUserPartiallyRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiUpdateUserPartiallyRequestRequest + + // UpdateUserPartiallyRequestExecute executes the request + UpdateUserPartiallyRequestExecute(r ApiUpdateUserPartiallyRequestRequest) error + + /* + UpdateUserRequest Update User + + Update user for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param userId The ID of the user. + @return ApiUpdateUserRequestRequest + */ + UpdateUserRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiUpdateUserRequestRequest + + // UpdateUserRequestExecute executes the request + UpdateUserRequestExecute(r ApiUpdateUserRequestRequest) error +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCloneRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + cloneRequestPayload *CloneRequestPayload +} + +// The request body with the parameters for cloning an instance by a point in time into a new instance. +func (r ApiCloneRequestRequest) CloneRequestPayload(cloneRequestPayload CloneRequestPayload) ApiCloneRequestRequest { + r.cloneRequestPayload = &cloneRequestPayload + return r +} + +func (r ApiCloneRequestRequest) Execute() (*CloneResponse, error) { + return r.ApiService.CloneRequestExecute(r) +} + +/* +CloneRequest Clone Instance + +Clone Instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiCloneRequestRequest +*/ +func (a *DefaultAPIService) CloneRequest(ctx context.Context, projectId string, region string, instanceId string) ApiCloneRequestRequest { + return ApiCloneRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return CloneResponse +func (a *DefaultAPIService) CloneRequestExecute(r ApiCloneRequestRequest) (*CloneResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CloneResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CloneRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/clone" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.cloneRequestPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiCreateDatabaseRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + createDatabaseRequestPayload *CreateDatabaseRequestPayload +} + +// The request body containing the information for the new database. +func (r ApiCreateDatabaseRequestRequest) CreateDatabaseRequestPayload(createDatabaseRequestPayload CreateDatabaseRequestPayload) ApiCreateDatabaseRequestRequest { + r.createDatabaseRequestPayload = &createDatabaseRequestPayload + return r +} + +func (r ApiCreateDatabaseRequestRequest) Execute() (*CreateDatabaseResponse, error) { + return r.ApiService.CreateDatabaseRequestExecute(r) +} + +/* +CreateDatabaseRequest Create Database + +Create database for a user. Note: The name of a valid user must be provided in the 'options' map field using the key 'owner' + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiCreateDatabaseRequestRequest +*/ +func (a *DefaultAPIService) CreateDatabaseRequest(ctx context.Context, projectId string, region string, instanceId string) ApiCreateDatabaseRequestRequest { + return ApiCreateDatabaseRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return CreateDatabaseResponse +func (a *DefaultAPIService) CreateDatabaseRequestExecute(r ApiCreateDatabaseRequestRequest) (*CreateDatabaseResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateDatabaseResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateDatabaseRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createDatabaseRequestPayload == nil { + return localVarReturnValue, reportError("createDatabaseRequestPayload 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.createDatabaseRequestPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 423 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiCreateInstanceRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + createInstanceRequestPayload *CreateInstanceRequestPayload +} + +// The request body with the parameters for the instance creation. Every parameter is required. +func (r ApiCreateInstanceRequestRequest) CreateInstanceRequestPayload(createInstanceRequestPayload CreateInstanceRequestPayload) ApiCreateInstanceRequestRequest { + r.createInstanceRequestPayload = &createInstanceRequestPayload + return r +} + +func (r ApiCreateInstanceRequestRequest) Execute() (*CreateInstanceResponse, error) { + return r.ApiService.CreateInstanceRequestExecute(r) +} + +/* +CreateInstanceRequest Create Instance + +Create a new instance of a postgres database instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @return ApiCreateInstanceRequestRequest +*/ +func (a *DefaultAPIService) CreateInstanceRequest(ctx context.Context, projectId string, region string) ApiCreateInstanceRequestRequest { + return ApiCreateInstanceRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// Execute executes the request +// +// @return CreateInstanceResponse +func (a *DefaultAPIService) CreateInstanceRequestExecute(r ApiCreateInstanceRequestRequest) (*CreateInstanceResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateInstanceResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateInstanceRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createInstanceRequestPayload == nil { + return localVarReturnValue, reportError("createInstanceRequestPayload 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.createInstanceRequestPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiCreateUserRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + createUserRequestPayload *CreateUserRequestPayload +} + +// The request body containing the user details. +func (r ApiCreateUserRequestRequest) CreateUserRequestPayload(createUserRequestPayload CreateUserRequestPayload) ApiCreateUserRequestRequest { + r.createUserRequestPayload = &createUserRequestPayload + return r +} + +func (r ApiCreateUserRequestRequest) Execute() (*CreateUserResponse, error) { + return r.ApiService.CreateUserRequestExecute(r) +} + +/* +CreateUserRequest Create User + +Create user for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiCreateUserRequestRequest +*/ +func (a *DefaultAPIService) CreateUserRequest(ctx context.Context, projectId string, region string, instanceId string) ApiCreateUserRequestRequest { + return ApiCreateUserRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return CreateUserResponse +func (a *DefaultAPIService) CreateUserRequestExecute(r ApiCreateUserRequestRequest) (*CreateUserResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateUserResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateUserRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/users" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createUserRequestPayload == nil { + return localVarReturnValue, reportError("createUserRequestPayload 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.createUserRequestPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 423 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiDeleteDatabaseRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + databaseId int32 +} + +func (r ApiDeleteDatabaseRequestRequest) Execute() error { + return r.ApiService.DeleteDatabaseRequestExecute(r) +} + +/* +DeleteDatabaseRequest Delete Database + +Delete database for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param databaseId The ID of the database. + @return ApiDeleteDatabaseRequestRequest +*/ +func (a *DefaultAPIService) DeleteDatabaseRequest(ctx context.Context, projectId string, region string, instanceId string, databaseId int32) ApiDeleteDatabaseRequestRequest { + return ApiDeleteDatabaseRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + databaseId: databaseId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteDatabaseRequestExecute(r ApiDeleteDatabaseRequestRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteDatabaseRequest") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"databaseId"+"}", url.PathEscape(parameterValueToString(r.databaseId, "databaseId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 423 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiDeleteInstanceRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string +} + +func (r ApiDeleteInstanceRequestRequest) Execute() error { + return r.ApiService.DeleteInstanceRequestExecute(r) +} + +/* +DeleteInstanceRequest Delete Instance + +Delete an available postgres instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiDeleteInstanceRequestRequest +*/ +func (a *DefaultAPIService) DeleteInstanceRequest(ctx context.Context, projectId string, region string, instanceId string) ApiDeleteInstanceRequestRequest { + return ApiDeleteInstanceRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteInstanceRequestExecute(r ApiDeleteInstanceRequestRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteInstanceRequest") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiDeleteUserRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + userId int32 +} + +func (r ApiDeleteUserRequestRequest) Execute() error { + return r.ApiService.DeleteUserRequestExecute(r) +} + +/* +DeleteUserRequest Delete User + +Delete an user from a specific instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param userId The ID of the user. + @return ApiDeleteUserRequestRequest +*/ +func (a *DefaultAPIService) DeleteUserRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiDeleteUserRequestRequest { + return ApiDeleteUserRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + userId: userId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteUserRequestExecute(r ApiDeleteUserRequestRequest) error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteUserRequest") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 423 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiGetBackupRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + backupId int32 +} + +func (r ApiGetBackupRequestRequest) Execute() (*BackupData, error) { + return r.ApiService.GetBackupRequestExecute(r) +} + +/* +GetBackupRequest Get specific backup + +Get information about a specific backup for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param backupId The ID of the backup. + @return ApiGetBackupRequestRequest +*/ +func (a *DefaultAPIService) GetBackupRequest(ctx context.Context, projectId string, region string, instanceId string, backupId int32) ApiGetBackupRequestRequest { + return ApiGetBackupRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + backupId: backupId, + } +} + +// Execute executes the request +// +// @return BackupData +func (a *DefaultAPIService) GetBackupRequestExecute(r ApiGetBackupRequestRequest) (*BackupData, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BackupData + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetBackupRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups/{backupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(parameterValueToString(r.backupId, "backupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetCollationsRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string +} + +func (r ApiGetCollationsRequestRequest) Execute() (*GetCollationsResponse, error) { + return r.ApiService.GetCollationsRequestExecute(r) +} + +/* +GetCollationsRequest Get Collations for an Instance + +Get available collations for an instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiGetCollationsRequestRequest +*/ +func (a *DefaultAPIService) GetCollationsRequest(ctx context.Context, projectId string, region string, instanceId string) ApiGetCollationsRequestRequest { + return ApiGetCollationsRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return GetCollationsResponse +func (a *DefaultAPIService) GetCollationsRequestExecute(r ApiGetCollationsRequestRequest) (*GetCollationsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCollationsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetCollationsRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/collations" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetDatabaseRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + databaseId int32 +} + +func (r ApiGetDatabaseRequestRequest) Execute() (*GetDatabaseResponse, error) { + return r.ApiService.GetDatabaseRequestExecute(r) +} + +/* +GetDatabaseRequest Get Specific Database + +Get information about a specific database in an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param databaseId The ID of the database. + @return ApiGetDatabaseRequestRequest +*/ +func (a *DefaultAPIService) GetDatabaseRequest(ctx context.Context, projectId string, region string, instanceId string, databaseId int32) ApiGetDatabaseRequestRequest { + return ApiGetDatabaseRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + databaseId: databaseId, + } +} + +// Execute executes the request +// +// @return GetDatabaseResponse +func (a *DefaultAPIService) GetDatabaseRequestExecute(r ApiGetDatabaseRequestRequest) (*GetDatabaseResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetDatabaseResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetDatabaseRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"databaseId"+"}", url.PathEscape(parameterValueToString(r.databaseId, "databaseId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetFlavorsRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + page *int32 + size *int32 + sort *FlavorSort +} + +// Number of the page of items list to be returned. +func (r ApiGetFlavorsRequestRequest) Page(page int32) ApiGetFlavorsRequestRequest { + r.page = &page + return r +} + +// Number of items to be returned on each page. +func (r ApiGetFlavorsRequestRequest) Size(size int32) ApiGetFlavorsRequestRequest { + r.size = &size + return r +} + +// Sorting of the flavors to be returned on each page. +func (r ApiGetFlavorsRequestRequest) Sort(sort FlavorSort) ApiGetFlavorsRequestRequest { + r.sort = &sort + return r +} + +func (r ApiGetFlavorsRequestRequest) Execute() (*GetFlavorsResponse, error) { + return r.ApiService.GetFlavorsRequestExecute(r) +} + +/* +GetFlavorsRequest Get Flavors + +Get all available flavors for a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @return ApiGetFlavorsRequestRequest +*/ +func (a *DefaultAPIService) GetFlavorsRequest(ctx context.Context, projectId string, region string) ApiGetFlavorsRequestRequest { + return ApiGetFlavorsRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// Execute executes the request +// +// @return GetFlavorsResponse +func (a *DefaultAPIService) GetFlavorsRequestExecute(r ApiGetFlavorsRequestRequest) (*GetFlavorsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetFlavorsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetFlavorsRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/flavors" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } else { + var defaultValue int32 = 1 + parameterAddToHeaderOrQuery(localVarQueryParams, "page", defaultValue, "form", "") + r.page = &defaultValue + } + if r.size != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "size", r.size, "form", "") + } else { + var defaultValue int32 = 10 + parameterAddToHeaderOrQuery(localVarQueryParams, "size", defaultValue, "form", "") + r.size = &defaultValue + } + if r.sort != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sort", r.sort, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetInstanceRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string +} + +func (r ApiGetInstanceRequestRequest) Execute() (*GetInstanceResponse, error) { + return r.ApiService.GetInstanceRequestExecute(r) +} + +/* +GetInstanceRequest Get Specific Instance + +Get information about a specific available instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiGetInstanceRequestRequest +*/ +func (a *DefaultAPIService) GetInstanceRequest(ctx context.Context, projectId string, region string, instanceId string) ApiGetInstanceRequestRequest { + return ApiGetInstanceRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return GetInstanceResponse +func (a *DefaultAPIService) GetInstanceRequestExecute(r ApiGetInstanceRequestRequest) (*GetInstanceResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetInstanceResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetInstanceRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetUserRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + userId int32 +} + +func (r ApiGetUserRequestRequest) Execute() (*GetUserResponse, error) { + return r.ApiService.GetUserRequestExecute(r) +} + +/* +GetUserRequest Get User + +Get a specific available user for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param userId The ID of the user. + @return ApiGetUserRequestRequest +*/ +func (a *DefaultAPIService) GetUserRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiGetUserRequestRequest { + return ApiGetUserRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + userId: userId, + } +} + +// Execute executes the request +// +// @return GetUserResponse +func (a *DefaultAPIService) GetUserRequestExecute(r ApiGetUserRequestRequest) (*GetUserResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetUserResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetUserRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiGetVersionsRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string +} + +func (r ApiGetVersionsRequestRequest) Execute() (*GetVersionsResponse, error) { + return r.ApiService.GetVersionsRequestExecute(r) +} + +/* +GetVersionsRequest Get Versions + +Get available postgres versions for the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @return ApiGetVersionsRequestRequest +*/ +func (a *DefaultAPIService) GetVersionsRequest(ctx context.Context, projectId string, region string) ApiGetVersionsRequestRequest { + return ApiGetVersionsRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// Execute executes the request +// +// @return GetVersionsResponse +func (a *DefaultAPIService) GetVersionsRequestExecute(r ApiGetVersionsRequestRequest) (*GetVersionsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetVersionsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetVersionsRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/versions" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListBackupsRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + page *int32 + size *int32 + sort *BackupSort +} + +// Number of the page of items list to be returned. +func (r ApiListBackupsRequestRequest) Page(page int32) ApiListBackupsRequestRequest { + r.page = &page + return r +} + +// Number of items to be returned on each page. +func (r ApiListBackupsRequestRequest) Size(size int32) ApiListBackupsRequestRequest { + r.size = &size + return r +} + +// Sorting of the backups to be returned on each page. +func (r ApiListBackupsRequestRequest) Sort(sort BackupSort) ApiListBackupsRequestRequest { + r.sort = &sort + return r +} + +func (r ApiListBackupsRequestRequest) Execute() (*ListBackupResponse, error) { + return r.ApiService.ListBackupsRequestExecute(r) +} + +/* +ListBackupsRequest List backups + +List all backups which are available for a specific instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiListBackupsRequestRequest +*/ +func (a *DefaultAPIService) ListBackupsRequest(ctx context.Context, projectId string, region string, instanceId string) ApiListBackupsRequestRequest { + return ApiListBackupsRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return ListBackupResponse +func (a *DefaultAPIService) ListBackupsRequestExecute(r ApiListBackupsRequestRequest) (*ListBackupResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListBackupResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListBackupsRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/backups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } else { + var defaultValue int32 = 1 + parameterAddToHeaderOrQuery(localVarQueryParams, "page", defaultValue, "form", "") + r.page = &defaultValue + } + if r.size != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "size", r.size, "form", "") + } else { + var defaultValue int32 = 10 + parameterAddToHeaderOrQuery(localVarQueryParams, "size", defaultValue, "form", "") + r.size = &defaultValue + } + if r.sort != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sort", r.sort, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListDatabasesRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + page *int32 + size *int32 + sort *DatabaseSort +} + +// Number of the page of items list to be returned. +func (r ApiListDatabasesRequestRequest) Page(page int32) ApiListDatabasesRequestRequest { + r.page = &page + return r +} + +// Number of items to be returned on each page. +func (r ApiListDatabasesRequestRequest) Size(size int32) ApiListDatabasesRequestRequest { + r.size = &size + return r +} + +// Sorting of the databases to be returned on each page. +func (r ApiListDatabasesRequestRequest) Sort(sort DatabaseSort) ApiListDatabasesRequestRequest { + r.sort = &sort + return r +} + +func (r ApiListDatabasesRequestRequest) Execute() (*ListDatabasesResponse, error) { + return r.ApiService.ListDatabasesRequestExecute(r) +} + +/* +ListDatabasesRequest List Databases + +List available databases for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiListDatabasesRequestRequest +*/ +func (a *DefaultAPIService) ListDatabasesRequest(ctx context.Context, projectId string, region string, instanceId string) ApiListDatabasesRequestRequest { + return ApiListDatabasesRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return ListDatabasesResponse +func (a *DefaultAPIService) ListDatabasesRequestExecute(r ApiListDatabasesRequestRequest) (*ListDatabasesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListDatabasesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListDatabasesRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } else { + var defaultValue int32 = 1 + parameterAddToHeaderOrQuery(localVarQueryParams, "page", defaultValue, "form", "") + r.page = &defaultValue + } + if r.size != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "size", r.size, "form", "") + } else { + var defaultValue int32 = 10 + parameterAddToHeaderOrQuery(localVarQueryParams, "size", defaultValue, "form", "") + r.size = &defaultValue + } + if r.sort != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sort", r.sort, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListInstancesRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + page *int32 + size *int32 + sort *InstanceSort +} + +// Number of the page of items list to be returned. +func (r ApiListInstancesRequestRequest) Page(page int32) ApiListInstancesRequestRequest { + r.page = &page + return r +} + +// Number of items to be returned on each page. +func (r ApiListInstancesRequestRequest) Size(size int32) ApiListInstancesRequestRequest { + r.size = &size + return r +} + +// Sorting of the items to be returned on each page. +func (r ApiListInstancesRequestRequest) Sort(sort InstanceSort) ApiListInstancesRequestRequest { + r.sort = &sort + return r +} + +func (r ApiListInstancesRequestRequest) Execute() (*ListInstancesResponse, error) { + return r.ApiService.ListInstancesRequestExecute(r) +} + +/* +ListInstancesRequest List Instances + +List all available instances for your project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @return ApiListInstancesRequestRequest +*/ +func (a *DefaultAPIService) ListInstancesRequest(ctx context.Context, projectId string, region string) ApiListInstancesRequestRequest { + return ApiListInstancesRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// Execute executes the request +// +// @return ListInstancesResponse +func (a *DefaultAPIService) ListInstancesRequestExecute(r ApiListInstancesRequestRequest) (*ListInstancesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListInstancesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListInstancesRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } else { + var defaultValue int32 = 1 + parameterAddToHeaderOrQuery(localVarQueryParams, "page", defaultValue, "form", "") + r.page = &defaultValue + } + if r.size != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "size", r.size, "form", "") + } else { + var defaultValue int32 = 10 + parameterAddToHeaderOrQuery(localVarQueryParams, "size", defaultValue, "form", "") + r.size = &defaultValue + } + if r.sort != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sort", r.sort, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListRolesRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string +} + +func (r ApiListRolesRequestRequest) Execute() (*ListRolesResponse, error) { + return r.ApiService.ListRolesRequestExecute(r) +} + +/* +ListRolesRequest List Roles + +List available roles for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiListRolesRequestRequest +*/ +func (a *DefaultAPIService) ListRolesRequest(ctx context.Context, projectId string, region string, instanceId string) ApiListRolesRequestRequest { + return ApiListRolesRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return ListRolesResponse +func (a *DefaultAPIService) ListRolesRequestExecute(r ApiListRolesRequestRequest) (*ListRolesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListRolesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListRolesRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/roles" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiListUsersRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + page *int32 + size *int32 + sort *UserSort +} + +// Number of the page of items list to be returned. +func (r ApiListUsersRequestRequest) Page(page int32) ApiListUsersRequestRequest { + r.page = &page + return r +} + +// Number of items to be returned on each page. +func (r ApiListUsersRequestRequest) Size(size int32) ApiListUsersRequestRequest { + r.size = &size + return r +} + +// Sorting of the users to be returned on each page. +func (r ApiListUsersRequestRequest) Sort(sort UserSort) ApiListUsersRequestRequest { + r.sort = &sort + return r +} + +func (r ApiListUsersRequestRequest) Execute() (*ListUserResponse, error) { + return r.ApiService.ListUsersRequestExecute(r) +} + +/* +ListUsersRequest List Users + +List available users for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiListUsersRequestRequest +*/ +func (a *DefaultAPIService) ListUsersRequest(ctx context.Context, projectId string, region string, instanceId string) ApiListUsersRequestRequest { + return ApiListUsersRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return ListUserResponse +func (a *DefaultAPIService) ListUsersRequestExecute(r ApiListUsersRequestRequest) (*ListUserResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListUserResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListUsersRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/users" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } else { + var defaultValue int32 = 1 + parameterAddToHeaderOrQuery(localVarQueryParams, "page", defaultValue, "form", "") + r.page = &defaultValue + } + if r.size != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "size", r.size, "form", "") + } else { + var defaultValue int32 = 10 + parameterAddToHeaderOrQuery(localVarQueryParams, "size", defaultValue, "form", "") + r.size = &defaultValue + } + if r.sort != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sort", r.sort, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiProtectInstanceRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + protectInstanceRequestPayload *ProtectInstanceRequestPayload +} + +// The request body with flag isDeletable. Parameter is required. +func (r ApiProtectInstanceRequestRequest) ProtectInstanceRequestPayload(protectInstanceRequestPayload ProtectInstanceRequestPayload) ApiProtectInstanceRequestRequest { + r.protectInstanceRequestPayload = &protectInstanceRequestPayload + return r +} + +func (r ApiProtectInstanceRequestRequest) Execute() (*ProtectInstanceResponse, error) { + return r.ApiService.ProtectInstanceRequestExecute(r) +} + +/* +ProtectInstanceRequest Protect Instance + +Toggle the deletion protection for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiProtectInstanceRequestRequest +*/ +func (a *DefaultAPIService) ProtectInstanceRequest(ctx context.Context, projectId string, region string, instanceId string) ApiProtectInstanceRequestRequest { + return ApiProtectInstanceRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return ProtectInstanceResponse +func (a *DefaultAPIService) ProtectInstanceRequestExecute(r ApiProtectInstanceRequestRequest) (*ProtectInstanceResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ProtectInstanceResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ProtectInstanceRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/protections" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.protectInstanceRequestPayload == nil { + return localVarReturnValue, reportError("protectInstanceRequestPayload 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.protectInstanceRequestPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 501 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiResetUserRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + userId int32 +} + +func (r ApiResetUserRequestRequest) Execute() (*ResetUserResponse, error) { + return r.ApiService.ResetUserRequestExecute(r) +} + +/* +ResetUserRequest Reset User + +Reset an user from an specific instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param userId The ID of the user. + @return ApiResetUserRequestRequest +*/ +func (a *DefaultAPIService) ResetUserRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiResetUserRequestRequest { + return ApiResetUserRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + userId: userId, + } +} + +// Execute executes the request +// +// @return ResetUserResponse +func (a *DefaultAPIService) ResetUserRequestExecute(r ApiResetUserRequestRequest) (*ResetUserResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ResetUserResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ResetUserRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}/reset" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 423 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +type ApiUpdateDatabasePartiallyRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + databaseId int32 + updateDatabasePartiallyRequestPayload *UpdateDatabasePartiallyRequestPayload +} + +// The request body containing the information for the database update. +func (r ApiUpdateDatabasePartiallyRequestRequest) UpdateDatabasePartiallyRequestPayload(updateDatabasePartiallyRequestPayload UpdateDatabasePartiallyRequestPayload) ApiUpdateDatabasePartiallyRequestRequest { + r.updateDatabasePartiallyRequestPayload = &updateDatabasePartiallyRequestPayload + return r +} + +func (r ApiUpdateDatabasePartiallyRequestRequest) Execute() error { + return r.ApiService.UpdateDatabasePartiallyRequestExecute(r) +} + +/* +UpdateDatabasePartiallyRequest Update Database partially + +Update a database partially in an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param databaseId The ID of the database. + @return ApiUpdateDatabasePartiallyRequestRequest +*/ +func (a *DefaultAPIService) UpdateDatabasePartiallyRequest(ctx context.Context, projectId string, region string, instanceId string, databaseId int32) ApiUpdateDatabasePartiallyRequestRequest { + return ApiUpdateDatabasePartiallyRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + databaseId: databaseId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) UpdateDatabasePartiallyRequestExecute(r ApiUpdateDatabasePartiallyRequestRequest) error { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateDatabasePartiallyRequest") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"databaseId"+"}", url.PathEscape(parameterValueToString(r.databaseId, "databaseId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateDatabasePartiallyRequestPayload == nil { + return reportError("updateDatabasePartiallyRequestPayload 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.updateDatabasePartiallyRequestPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 423 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiUpdateDatabaseRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + databaseId int32 + updateDatabaseRequestPayload *UpdateDatabaseRequestPayload +} + +// The request body containing the information for the database update. +func (r ApiUpdateDatabaseRequestRequest) UpdateDatabaseRequestPayload(updateDatabaseRequestPayload UpdateDatabaseRequestPayload) ApiUpdateDatabaseRequestRequest { + r.updateDatabaseRequestPayload = &updateDatabaseRequestPayload + return r +} + +func (r ApiUpdateDatabaseRequestRequest) Execute() error { + return r.ApiService.UpdateDatabaseRequestExecute(r) +} + +/* +UpdateDatabaseRequest Update Database + +Update a database in an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param databaseId The ID of the database. + @return ApiUpdateDatabaseRequestRequest +*/ +func (a *DefaultAPIService) UpdateDatabaseRequest(ctx context.Context, projectId string, region string, instanceId string, databaseId int32) ApiUpdateDatabaseRequestRequest { + return ApiUpdateDatabaseRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + databaseId: databaseId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) UpdateDatabaseRequestExecute(r ApiUpdateDatabaseRequestRequest) error { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateDatabaseRequest") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/databases/{databaseId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"databaseId"+"}", url.PathEscape(parameterValueToString(r.databaseId, "databaseId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateDatabaseRequestPayload == nil { + return reportError("updateDatabaseRequestPayload 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.updateDatabaseRequestPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 423 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiUpdateInstancePartiallyRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + updateInstancePartiallyRequestPayload *UpdateInstancePartiallyRequestPayload +} + +// The request body with the parameters for updating the instance. +func (r ApiUpdateInstancePartiallyRequestRequest) UpdateInstancePartiallyRequestPayload(updateInstancePartiallyRequestPayload UpdateInstancePartiallyRequestPayload) ApiUpdateInstancePartiallyRequestRequest { + r.updateInstancePartiallyRequestPayload = &updateInstancePartiallyRequestPayload + return r +} + +func (r ApiUpdateInstancePartiallyRequestRequest) Execute() error { + return r.ApiService.UpdateInstancePartiallyRequestExecute(r) +} + +/* +UpdateInstancePartiallyRequest Update Instance Partially + +Update an available instance of a postgres database. No fields are required. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiUpdateInstancePartiallyRequestRequest +*/ +func (a *DefaultAPIService) UpdateInstancePartiallyRequest(ctx context.Context, projectId string, region string, instanceId string) ApiUpdateInstancePartiallyRequestRequest { + return ApiUpdateInstancePartiallyRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) UpdateInstancePartiallyRequestExecute(r ApiUpdateInstancePartiallyRequestRequest) error { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateInstancePartiallyRequest") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateInstancePartiallyRequestPayload == nil { + return reportError("updateInstancePartiallyRequestPayload 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.updateInstancePartiallyRequestPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 423 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiUpdateInstanceRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + updateInstanceRequestPayload *UpdateInstanceRequestPayload +} + +// The request body with the parameters for updating the instance +func (r ApiUpdateInstanceRequestRequest) UpdateInstanceRequestPayload(updateInstanceRequestPayload UpdateInstanceRequestPayload) ApiUpdateInstanceRequestRequest { + r.updateInstanceRequestPayload = &updateInstanceRequestPayload + return r +} + +func (r ApiUpdateInstanceRequestRequest) Execute() error { + return r.ApiService.UpdateInstanceRequestExecute(r) +} + +/* +UpdateInstanceRequest Update Instance + +Updates an available instance of a postgres database + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @return ApiUpdateInstanceRequestRequest +*/ +func (a *DefaultAPIService) UpdateInstanceRequest(ctx context.Context, projectId string, region string, instanceId string) ApiUpdateInstanceRequestRequest { + return ApiUpdateInstanceRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) UpdateInstanceRequestExecute(r ApiUpdateInstanceRequestRequest) error { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateInstanceRequest") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateInstanceRequestPayload == nil { + return reportError("updateInstanceRequestPayload 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.updateInstanceRequestPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 412 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 423 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiUpdateUserPartiallyRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + userId int32 + updateUserPartiallyRequestPayload *UpdateUserPartiallyRequestPayload +} + +// The Request body containing the new information for the user. If empty request body is send via patch, then login and createdb roles are removed from user. +func (r ApiUpdateUserPartiallyRequestRequest) UpdateUserPartiallyRequestPayload(updateUserPartiallyRequestPayload UpdateUserPartiallyRequestPayload) ApiUpdateUserPartiallyRequestRequest { + r.updateUserPartiallyRequestPayload = &updateUserPartiallyRequestPayload + return r +} + +func (r ApiUpdateUserPartiallyRequestRequest) Execute() error { + return r.ApiService.UpdateUserPartiallyRequestExecute(r) +} + +/* +UpdateUserPartiallyRequest Update User Partially + +Update an user partially for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param userId The ID of the user. + @return ApiUpdateUserPartiallyRequestRequest +*/ +func (a *DefaultAPIService) UpdateUserPartiallyRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiUpdateUserPartiallyRequestRequest { + return ApiUpdateUserPartiallyRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + userId: userId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) UpdateUserPartiallyRequestExecute(r ApiUpdateUserPartiallyRequestRequest) error { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateUserPartiallyRequest") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateUserPartiallyRequestPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 423 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +type ApiUpdateUserRequestRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + region string + instanceId string + userId int32 + updateUserRequestPayload *UpdateUserRequestPayload +} + +// The Request body containing the updated infos for the user. +func (r ApiUpdateUserRequestRequest) UpdateUserRequestPayload(updateUserRequestPayload UpdateUserRequestPayload) ApiUpdateUserRequestRequest { + r.updateUserRequestPayload = &updateUserRequestPayload + return r +} + +func (r ApiUpdateUserRequestRequest) Execute() error { + return r.ApiService.UpdateUserRequestExecute(r) +} + +/* +UpdateUserRequest Update User + +Update user for an instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT project ID. + @param region The region which should be addressed + @param instanceId The ID of the instance. + @param userId The ID of the user. + @return ApiUpdateUserRequestRequest +*/ +func (a *DefaultAPIService) UpdateUserRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiUpdateUserRequestRequest { + return ApiUpdateUserRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + userId: userId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) UpdateUserRequestExecute(r ApiUpdateUserRequestRequest) error { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateUserRequest") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v3beta1/projects/{projectId}/regions/{region}/instances/{instanceId}/users/{userId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(parameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", url.PathEscape(parameterValueToString(r.userId, "userId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateUserRequestPayload == nil { + return reportError("updateUserRequestPayload 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.updateUserRequestPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v ValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 423 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} diff --git a/services/postgresflex/v3beta1api/api_default_mock.go b/services/postgresflex/v3beta1api/api_default_mock.go new file mode 100644 index 000000000..857bc5910 --- /dev/null +++ b/services/postgresflex/v3beta1api/api_default_mock.go @@ -0,0 +1,615 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +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 { + // CloneRequestExecuteMock can be populated to implement the behavior of the CloneRequestExecute function of this mock + CloneRequestExecuteMock *func(r ApiCloneRequestRequest) (*CloneResponse, error) + // CreateDatabaseRequestExecuteMock can be populated to implement the behavior of the CreateDatabaseRequestExecute function of this mock + CreateDatabaseRequestExecuteMock *func(r ApiCreateDatabaseRequestRequest) (*CreateDatabaseResponse, error) + // CreateInstanceRequestExecuteMock can be populated to implement the behavior of the CreateInstanceRequestExecute function of this mock + CreateInstanceRequestExecuteMock *func(r ApiCreateInstanceRequestRequest) (*CreateInstanceResponse, error) + // CreateUserRequestExecuteMock can be populated to implement the behavior of the CreateUserRequestExecute function of this mock + CreateUserRequestExecuteMock *func(r ApiCreateUserRequestRequest) (*CreateUserResponse, error) + // DeleteDatabaseRequestExecuteMock can be populated to implement the behavior of the DeleteDatabaseRequestExecute function of this mock + DeleteDatabaseRequestExecuteMock *func(r ApiDeleteDatabaseRequestRequest) error + // DeleteInstanceRequestExecuteMock can be populated to implement the behavior of the DeleteInstanceRequestExecute function of this mock + DeleteInstanceRequestExecuteMock *func(r ApiDeleteInstanceRequestRequest) error + // DeleteUserRequestExecuteMock can be populated to implement the behavior of the DeleteUserRequestExecute function of this mock + DeleteUserRequestExecuteMock *func(r ApiDeleteUserRequestRequest) error + // GetBackupRequestExecuteMock can be populated to implement the behavior of the GetBackupRequestExecute function of this mock + GetBackupRequestExecuteMock *func(r ApiGetBackupRequestRequest) (*BackupData, error) + // GetCollationsRequestExecuteMock can be populated to implement the behavior of the GetCollationsRequestExecute function of this mock + GetCollationsRequestExecuteMock *func(r ApiGetCollationsRequestRequest) (*GetCollationsResponse, error) + // GetDatabaseRequestExecuteMock can be populated to implement the behavior of the GetDatabaseRequestExecute function of this mock + GetDatabaseRequestExecuteMock *func(r ApiGetDatabaseRequestRequest) (*GetDatabaseResponse, error) + // GetFlavorsRequestExecuteMock can be populated to implement the behavior of the GetFlavorsRequestExecute function of this mock + GetFlavorsRequestExecuteMock *func(r ApiGetFlavorsRequestRequest) (*GetFlavorsResponse, error) + // GetInstanceRequestExecuteMock can be populated to implement the behavior of the GetInstanceRequestExecute function of this mock + GetInstanceRequestExecuteMock *func(r ApiGetInstanceRequestRequest) (*GetInstanceResponse, error) + // GetUserRequestExecuteMock can be populated to implement the behavior of the GetUserRequestExecute function of this mock + GetUserRequestExecuteMock *func(r ApiGetUserRequestRequest) (*GetUserResponse, error) + // GetVersionsRequestExecuteMock can be populated to implement the behavior of the GetVersionsRequestExecute function of this mock + GetVersionsRequestExecuteMock *func(r ApiGetVersionsRequestRequest) (*GetVersionsResponse, error) + // ListBackupsRequestExecuteMock can be populated to implement the behavior of the ListBackupsRequestExecute function of this mock + ListBackupsRequestExecuteMock *func(r ApiListBackupsRequestRequest) (*ListBackupResponse, error) + // ListDatabasesRequestExecuteMock can be populated to implement the behavior of the ListDatabasesRequestExecute function of this mock + ListDatabasesRequestExecuteMock *func(r ApiListDatabasesRequestRequest) (*ListDatabasesResponse, error) + // ListInstancesRequestExecuteMock can be populated to implement the behavior of the ListInstancesRequestExecute function of this mock + ListInstancesRequestExecuteMock *func(r ApiListInstancesRequestRequest) (*ListInstancesResponse, error) + // ListRolesRequestExecuteMock can be populated to implement the behavior of the ListRolesRequestExecute function of this mock + ListRolesRequestExecuteMock *func(r ApiListRolesRequestRequest) (*ListRolesResponse, error) + // ListUsersRequestExecuteMock can be populated to implement the behavior of the ListUsersRequestExecute function of this mock + ListUsersRequestExecuteMock *func(r ApiListUsersRequestRequest) (*ListUserResponse, error) + // ProtectInstanceRequestExecuteMock can be populated to implement the behavior of the ProtectInstanceRequestExecute function of this mock + ProtectInstanceRequestExecuteMock *func(r ApiProtectInstanceRequestRequest) (*ProtectInstanceResponse, error) + // ResetUserRequestExecuteMock can be populated to implement the behavior of the ResetUserRequestExecute function of this mock + ResetUserRequestExecuteMock *func(r ApiResetUserRequestRequest) (*ResetUserResponse, error) + // UpdateDatabasePartiallyRequestExecuteMock can be populated to implement the behavior of the UpdateDatabasePartiallyRequestExecute function of this mock + UpdateDatabasePartiallyRequestExecuteMock *func(r ApiUpdateDatabasePartiallyRequestRequest) error + // UpdateDatabaseRequestExecuteMock can be populated to implement the behavior of the UpdateDatabaseRequestExecute function of this mock + UpdateDatabaseRequestExecuteMock *func(r ApiUpdateDatabaseRequestRequest) error + // UpdateInstancePartiallyRequestExecuteMock can be populated to implement the behavior of the UpdateInstancePartiallyRequestExecute function of this mock + UpdateInstancePartiallyRequestExecuteMock *func(r ApiUpdateInstancePartiallyRequestRequest) error + // UpdateInstanceRequestExecuteMock can be populated to implement the behavior of the UpdateInstanceRequestExecute function of this mock + UpdateInstanceRequestExecuteMock *func(r ApiUpdateInstanceRequestRequest) error + // UpdateUserPartiallyRequestExecuteMock can be populated to implement the behavior of the UpdateUserPartiallyRequestExecute function of this mock + UpdateUserPartiallyRequestExecuteMock *func(r ApiUpdateUserPartiallyRequestRequest) error + // UpdateUserRequestExecuteMock can be populated to implement the behavior of the UpdateUserRequestExecute function of this mock + UpdateUserRequestExecuteMock *func(r ApiUpdateUserRequestRequest) error +} + +func (a DefaultAPIServiceMock) CloneRequest(ctx context.Context, projectId string, region string, instanceId string) ApiCloneRequestRequest { + return ApiCloneRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// CloneRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CloneRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CloneRequestExecute(r ApiCloneRequestRequest) (*CloneResponse, error) { + if a.CloneRequestExecuteMock == nil { + var localVarReturnValue *CloneResponse + return localVarReturnValue, nil + } + + return (*a.CloneRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateDatabaseRequest(ctx context.Context, projectId string, region string, instanceId string) ApiCreateDatabaseRequestRequest { + return ApiCreateDatabaseRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// CreateDatabaseRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateDatabaseRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateDatabaseRequestExecute(r ApiCreateDatabaseRequestRequest) (*CreateDatabaseResponse, error) { + if a.CreateDatabaseRequestExecuteMock == nil { + var localVarReturnValue *CreateDatabaseResponse + return localVarReturnValue, nil + } + + return (*a.CreateDatabaseRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateInstanceRequest(ctx context.Context, projectId string, region string) ApiCreateInstanceRequestRequest { + return ApiCreateInstanceRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// CreateInstanceRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateInstanceRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateInstanceRequestExecute(r ApiCreateInstanceRequestRequest) (*CreateInstanceResponse, error) { + if a.CreateInstanceRequestExecuteMock == nil { + var localVarReturnValue *CreateInstanceResponse + return localVarReturnValue, nil + } + + return (*a.CreateInstanceRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateUserRequest(ctx context.Context, projectId string, region string, instanceId string) ApiCreateUserRequestRequest { + return ApiCreateUserRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// CreateUserRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateUserRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateUserRequestExecute(r ApiCreateUserRequestRequest) (*CreateUserResponse, error) { + if a.CreateUserRequestExecuteMock == nil { + var localVarReturnValue *CreateUserResponse + return localVarReturnValue, nil + } + + return (*a.CreateUserRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteDatabaseRequest(ctx context.Context, projectId string, region string, instanceId string, databaseId int32) ApiDeleteDatabaseRequestRequest { + return ApiDeleteDatabaseRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + databaseId: databaseId, + } +} + +// DeleteDatabaseRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteDatabaseRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteDatabaseRequestExecute(r ApiDeleteDatabaseRequestRequest) error { + if a.DeleteDatabaseRequestExecuteMock == nil { + return nil + } + + return (*a.DeleteDatabaseRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteInstanceRequest(ctx context.Context, projectId string, region string, instanceId string) ApiDeleteInstanceRequestRequest { + return ApiDeleteInstanceRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// DeleteInstanceRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteInstanceRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteInstanceRequestExecute(r ApiDeleteInstanceRequestRequest) error { + if a.DeleteInstanceRequestExecuteMock == nil { + return nil + } + + return (*a.DeleteInstanceRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteUserRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiDeleteUserRequestRequest { + return ApiDeleteUserRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + userId: userId, + } +} + +// DeleteUserRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteUserRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteUserRequestExecute(r ApiDeleteUserRequestRequest) error { + if a.DeleteUserRequestExecuteMock == nil { + return nil + } + + return (*a.DeleteUserRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetBackupRequest(ctx context.Context, projectId string, region string, instanceId string, backupId int32) ApiGetBackupRequestRequest { + return ApiGetBackupRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + backupId: backupId, + } +} + +// GetBackupRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetBackupRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetBackupRequestExecute(r ApiGetBackupRequestRequest) (*BackupData, error) { + if a.GetBackupRequestExecuteMock == nil { + var localVarReturnValue *BackupData + return localVarReturnValue, nil + } + + return (*a.GetBackupRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetCollationsRequest(ctx context.Context, projectId string, region string, instanceId string) ApiGetCollationsRequestRequest { + return ApiGetCollationsRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// GetCollationsRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetCollationsRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetCollationsRequestExecute(r ApiGetCollationsRequestRequest) (*GetCollationsResponse, error) { + if a.GetCollationsRequestExecuteMock == nil { + var localVarReturnValue *GetCollationsResponse + return localVarReturnValue, nil + } + + return (*a.GetCollationsRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetDatabaseRequest(ctx context.Context, projectId string, region string, instanceId string, databaseId int32) ApiGetDatabaseRequestRequest { + return ApiGetDatabaseRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + databaseId: databaseId, + } +} + +// GetDatabaseRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetDatabaseRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetDatabaseRequestExecute(r ApiGetDatabaseRequestRequest) (*GetDatabaseResponse, error) { + if a.GetDatabaseRequestExecuteMock == nil { + var localVarReturnValue *GetDatabaseResponse + return localVarReturnValue, nil + } + + return (*a.GetDatabaseRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetFlavorsRequest(ctx context.Context, projectId string, region string) ApiGetFlavorsRequestRequest { + return ApiGetFlavorsRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// GetFlavorsRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetFlavorsRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetFlavorsRequestExecute(r ApiGetFlavorsRequestRequest) (*GetFlavorsResponse, error) { + if a.GetFlavorsRequestExecuteMock == nil { + var localVarReturnValue *GetFlavorsResponse + return localVarReturnValue, nil + } + + return (*a.GetFlavorsRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetInstanceRequest(ctx context.Context, projectId string, region string, instanceId string) ApiGetInstanceRequestRequest { + return ApiGetInstanceRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// GetInstanceRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetInstanceRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetInstanceRequestExecute(r ApiGetInstanceRequestRequest) (*GetInstanceResponse, error) { + if a.GetInstanceRequestExecuteMock == nil { + var localVarReturnValue *GetInstanceResponse + return localVarReturnValue, nil + } + + return (*a.GetInstanceRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetUserRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiGetUserRequestRequest { + return ApiGetUserRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + userId: userId, + } +} + +// GetUserRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetUserRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetUserRequestExecute(r ApiGetUserRequestRequest) (*GetUserResponse, error) { + if a.GetUserRequestExecuteMock == nil { + var localVarReturnValue *GetUserResponse + return localVarReturnValue, nil + } + + return (*a.GetUserRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetVersionsRequest(ctx context.Context, projectId string, region string) ApiGetVersionsRequestRequest { + return ApiGetVersionsRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// GetVersionsRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetVersionsRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetVersionsRequestExecute(r ApiGetVersionsRequestRequest) (*GetVersionsResponse, error) { + if a.GetVersionsRequestExecuteMock == nil { + var localVarReturnValue *GetVersionsResponse + return localVarReturnValue, nil + } + + return (*a.GetVersionsRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListBackupsRequest(ctx context.Context, projectId string, region string, instanceId string) ApiListBackupsRequestRequest { + return ApiListBackupsRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// ListBackupsRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListBackupsRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListBackupsRequestExecute(r ApiListBackupsRequestRequest) (*ListBackupResponse, error) { + if a.ListBackupsRequestExecuteMock == nil { + var localVarReturnValue *ListBackupResponse + return localVarReturnValue, nil + } + + return (*a.ListBackupsRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListDatabasesRequest(ctx context.Context, projectId string, region string, instanceId string) ApiListDatabasesRequestRequest { + return ApiListDatabasesRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// ListDatabasesRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListDatabasesRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListDatabasesRequestExecute(r ApiListDatabasesRequestRequest) (*ListDatabasesResponse, error) { + if a.ListDatabasesRequestExecuteMock == nil { + var localVarReturnValue *ListDatabasesResponse + return localVarReturnValue, nil + } + + return (*a.ListDatabasesRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListInstancesRequest(ctx context.Context, projectId string, region string) ApiListInstancesRequestRequest { + return ApiListInstancesRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +// ListInstancesRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListInstancesRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListInstancesRequestExecute(r ApiListInstancesRequestRequest) (*ListInstancesResponse, error) { + if a.ListInstancesRequestExecuteMock == nil { + var localVarReturnValue *ListInstancesResponse + return localVarReturnValue, nil + } + + return (*a.ListInstancesRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListRolesRequest(ctx context.Context, projectId string, region string, instanceId string) ApiListRolesRequestRequest { + return ApiListRolesRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// ListRolesRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListRolesRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListRolesRequestExecute(r ApiListRolesRequestRequest) (*ListRolesResponse, error) { + if a.ListRolesRequestExecuteMock == nil { + var localVarReturnValue *ListRolesResponse + return localVarReturnValue, nil + } + + return (*a.ListRolesRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListUsersRequest(ctx context.Context, projectId string, region string, instanceId string) ApiListUsersRequestRequest { + return ApiListUsersRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// ListUsersRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListUsersRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListUsersRequestExecute(r ApiListUsersRequestRequest) (*ListUserResponse, error) { + if a.ListUsersRequestExecuteMock == nil { + var localVarReturnValue *ListUserResponse + return localVarReturnValue, nil + } + + return (*a.ListUsersRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ProtectInstanceRequest(ctx context.Context, projectId string, region string, instanceId string) ApiProtectInstanceRequestRequest { + return ApiProtectInstanceRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// ProtectInstanceRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ProtectInstanceRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ProtectInstanceRequestExecute(r ApiProtectInstanceRequestRequest) (*ProtectInstanceResponse, error) { + if a.ProtectInstanceRequestExecuteMock == nil { + var localVarReturnValue *ProtectInstanceResponse + return localVarReturnValue, nil + } + + return (*a.ProtectInstanceRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ResetUserRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiResetUserRequestRequest { + return ApiResetUserRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + userId: userId, + } +} + +// ResetUserRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ResetUserRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ResetUserRequestExecute(r ApiResetUserRequestRequest) (*ResetUserResponse, error) { + if a.ResetUserRequestExecuteMock == nil { + var localVarReturnValue *ResetUserResponse + return localVarReturnValue, nil + } + + return (*a.ResetUserRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateDatabasePartiallyRequest(ctx context.Context, projectId string, region string, instanceId string, databaseId int32) ApiUpdateDatabasePartiallyRequestRequest { + return ApiUpdateDatabasePartiallyRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + databaseId: databaseId, + } +} + +// UpdateDatabasePartiallyRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateDatabasePartiallyRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateDatabasePartiallyRequestExecute(r ApiUpdateDatabasePartiallyRequestRequest) error { + if a.UpdateDatabasePartiallyRequestExecuteMock == nil { + return nil + } + + return (*a.UpdateDatabasePartiallyRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateDatabaseRequest(ctx context.Context, projectId string, region string, instanceId string, databaseId int32) ApiUpdateDatabaseRequestRequest { + return ApiUpdateDatabaseRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + databaseId: databaseId, + } +} + +// UpdateDatabaseRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateDatabaseRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateDatabaseRequestExecute(r ApiUpdateDatabaseRequestRequest) error { + if a.UpdateDatabaseRequestExecuteMock == nil { + return nil + } + + return (*a.UpdateDatabaseRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateInstancePartiallyRequest(ctx context.Context, projectId string, region string, instanceId string) ApiUpdateInstancePartiallyRequestRequest { + return ApiUpdateInstancePartiallyRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// UpdateInstancePartiallyRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateInstancePartiallyRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateInstancePartiallyRequestExecute(r ApiUpdateInstancePartiallyRequestRequest) error { + if a.UpdateInstancePartiallyRequestExecuteMock == nil { + return nil + } + + return (*a.UpdateInstancePartiallyRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateInstanceRequest(ctx context.Context, projectId string, region string, instanceId string) ApiUpdateInstanceRequestRequest { + return ApiUpdateInstanceRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + } +} + +// UpdateInstanceRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateInstanceRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateInstanceRequestExecute(r ApiUpdateInstanceRequestRequest) error { + if a.UpdateInstanceRequestExecuteMock == nil { + return nil + } + + return (*a.UpdateInstanceRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateUserPartiallyRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiUpdateUserPartiallyRequestRequest { + return ApiUpdateUserPartiallyRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + userId: userId, + } +} + +// UpdateUserPartiallyRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateUserPartiallyRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateUserPartiallyRequestExecute(r ApiUpdateUserPartiallyRequestRequest) error { + if a.UpdateUserPartiallyRequestExecuteMock == nil { + return nil + } + + return (*a.UpdateUserPartiallyRequestExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateUserRequest(ctx context.Context, projectId string, region string, instanceId string, userId int32) ApiUpdateUserRequestRequest { + return ApiUpdateUserRequestRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + region: region, + instanceId: instanceId, + userId: userId, + } +} + +// UpdateUserRequestExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateUserRequestExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateUserRequestExecute(r ApiUpdateUserRequestRequest) error { + if a.UpdateUserRequestExecuteMock == nil { + return nil + } + + return (*a.UpdateUserRequestExecuteMock)(r) +} diff --git a/services/postgresflex/v3beta1api/client.go b/services/postgresflex/v3beta1api/client.go new file mode 100644 index 000000000..b4eef9751 --- /dev/null +++ b/services/postgresflex/v3beta1api/client.go @@ -0,0 +1,659 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v3beta1api + +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 PostgreSQL Flex API API v3beta1 +// 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/postgresflex/v3beta1api/configuration.go b/services/postgresflex/v3beta1api/configuration.go new file mode 100644 index 000000000..04b553792 --- /dev/null +++ b/services/postgresflex/v3beta1api/configuration.go @@ -0,0 +1,38 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v3beta1api + +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/postgresflex", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://postgres-flex-service.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/services/postgresflex/v3beta1api/model_backup_data.go b/services/postgresflex/v3beta1api/model_backup_data.go new file mode 100644 index 000000000..8cb5d580f --- /dev/null +++ b/services/postgresflex/v3beta1api/model_backup_data.go @@ -0,0 +1,318 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the BackupData type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackupData{} + +// BackupData struct for BackupData +type BackupData struct { + // The time when the backup was completed in RFC3339 format. + CompletionTime string `json:"completionTime"` + // The ID of the backup. + Id int32 `json:"id"` + // The name of the backup. + Name string `json:"name"` + // The time until the backup will be retained. + RetainedUntil string `json:"retainedUntil"` + // The size of the backup in bytes. + Size int32 `json:"size"` + // The type of the backup, which can be automated or manual triggered. + Type string `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _BackupData BackupData + +// NewBackupData instantiates a new BackupData 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 NewBackupData(completionTime string, id int32, name string, retainedUntil string, size int32, types string) *BackupData { + this := BackupData{} + this.CompletionTime = completionTime + this.Id = id + this.Name = name + this.RetainedUntil = retainedUntil + this.Size = size + this.Type = types + return &this +} + +// NewBackupDataWithDefaults instantiates a new BackupData 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 NewBackupDataWithDefaults() *BackupData { + this := BackupData{} + return &this +} + +// GetCompletionTime returns the CompletionTime field value +func (o *BackupData) GetCompletionTime() string { + if o == nil { + var ret string + return ret + } + + return o.CompletionTime +} + +// GetCompletionTimeOk returns a tuple with the CompletionTime field value +// and a boolean to check if the value has been set. +func (o *BackupData) GetCompletionTimeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CompletionTime, true +} + +// SetCompletionTime sets field value +func (o *BackupData) SetCompletionTime(v string) { + o.CompletionTime = v +} + +// GetId returns the Id field value +func (o *BackupData) GetId() int32 { + if o == nil { + var ret int32 + 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 *BackupData) GetIdOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *BackupData) SetId(v int32) { + o.Id = v +} + +// GetName returns the Name field value +func (o *BackupData) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *BackupData) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *BackupData) SetName(v string) { + o.Name = v +} + +// GetRetainedUntil returns the RetainedUntil field value +func (o *BackupData) GetRetainedUntil() string { + if o == nil { + var ret string + return ret + } + + return o.RetainedUntil +} + +// GetRetainedUntilOk returns a tuple with the RetainedUntil field value +// and a boolean to check if the value has been set. +func (o *BackupData) GetRetainedUntilOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RetainedUntil, true +} + +// SetRetainedUntil sets field value +func (o *BackupData) SetRetainedUntil(v string) { + o.RetainedUntil = v +} + +// GetSize returns the Size field value +func (o *BackupData) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *BackupData) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *BackupData) SetSize(v int32) { + o.Size = v +} + +// GetType returns the Type field value +func (o *BackupData) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *BackupData) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *BackupData) SetType(v string) { + o.Type = v +} + +func (o BackupData) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BackupData) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["completionTime"] = o.CompletionTime + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["retainedUntil"] = o.RetainedUntil + toSerialize["size"] = o.Size + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *BackupData) 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{ + "completionTime", + "id", + "name", + "retainedUntil", + "size", + "type", + } + + 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) + } + } + + varBackupData := _BackupData{} + + err = json.Unmarshal(data, &varBackupData) + + if err != nil { + return err + } + + *o = BackupData(varBackupData) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "completionTime") + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "retainedUntil") + delete(additionalProperties, "size") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableBackupData struct { + value *BackupData + isSet bool +} + +func (v NullableBackupData) Get() *BackupData { + return v.value +} + +func (v *NullableBackupData) Set(val *BackupData) { + v.value = val + v.isSet = true +} + +func (v NullableBackupData) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupData(val *BackupData) *NullableBackupData { + return &NullableBackupData{value: val, isSet: true} +} + +func (v NullableBackupData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_backup_sort.go b/services/postgresflex/v3beta1api/model_backup_sort.go new file mode 100644 index 000000000..c0f71bdd7 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_backup_sort.go @@ -0,0 +1,134 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// BackupSort the model 'BackupSort' +type BackupSort string + +// List of backup.sort +const ( + BACKUPSORT_COMPLETION_TIME_DESC BackupSort = "completion_time.desc" + BACKUPSORT_COMPLETION_TIME_ASC BackupSort = "completion_time.asc" + BACKUPSORT_END_TIME_DESC BackupSort = "end_time.desc" + BACKUPSORT_END_TIME_ASC BackupSort = "end_time.asc" + BACKUPSORT_NAME_DESC BackupSort = "name.desc" + BACKUPSORT_NAME_ASC BackupSort = "name.asc" + BACKUPSORT_RETAINED_UNTIL_DESC BackupSort = "retained_until.desc" + BACKUPSORT_RETAINED_UNTIL_ASC BackupSort = "retained_until.asc" + BACKUPSORT_SIZE_DESC BackupSort = "size.desc" + BACKUPSORT_SIZE_ASC BackupSort = "size.asc" + BACKUPSORT_TYPE_DESC BackupSort = "type.desc" + BACKUPSORT_TYPE_ASC BackupSort = "type.asc" + BACKUPSORT_UNKNOWN_DEFAULT_OPEN_API BackupSort = "unknown_default_open_api" +) + +// All allowed values of BackupSort enum +var AllowedBackupSortEnumValues = []BackupSort{ + "completion_time.desc", + "completion_time.asc", + "end_time.desc", + "end_time.asc", + "name.desc", + "name.asc", + "retained_until.desc", + "retained_until.asc", + "size.desc", + "size.asc", + "type.desc", + "type.asc", + "unknown_default_open_api", +} + +func (v *BackupSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := BackupSort(value) + for _, existing := range AllowedBackupSortEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = BACKUPSORT_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewBackupSortFromValue returns a pointer to a valid BackupSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewBackupSortFromValue(v string) (*BackupSort, error) { + ev := BackupSort(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for BackupSort: valid values are %v", v, AllowedBackupSortEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v BackupSort) IsValid() bool { + for _, existing := range AllowedBackupSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to backup.sort value +func (v BackupSort) Ptr() *BackupSort { + return &v +} + +type NullableBackupSort struct { + value *BackupSort + isSet bool +} + +func (v NullableBackupSort) Get() *BackupSort { + return v.value +} + +func (v *NullableBackupSort) Set(val *BackupSort) { + v.value = val + v.isSet = true +} + +func (v NullableBackupSort) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupSort) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupSort(val *BackupSort) *NullableBackupSort { + return &NullableBackupSort{value: val, isSet: true} +} + +func (v NullableBackupSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_clone_instance_overrides.go b/services/postgresflex/v3beta1api/model_clone_instance_overrides.go new file mode 100644 index 000000000..9d16d8010 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_clone_instance_overrides.go @@ -0,0 +1,244 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CloneInstanceOverrides type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CloneInstanceOverrides{} + +// CloneInstanceOverrides struct for CloneInstanceOverrides +type CloneInstanceOverrides struct { + // The storage class for the storage. + Class *string `json:"class,omitempty"` + // The name of the cloned instance. If not provided, the default naming behavior of appending '-clone' to the source instance name is used. + Name *string `json:"name,omitempty"` + // The storage size in Gigabytes. + Size int32 `json:"size"` + AdditionalProperties map[string]interface{} +} + +type _CloneInstanceOverrides CloneInstanceOverrides + +// NewCloneInstanceOverrides instantiates a new CloneInstanceOverrides 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 NewCloneInstanceOverrides(size int32) *CloneInstanceOverrides { + this := CloneInstanceOverrides{} + this.Size = size + return &this +} + +// NewCloneInstanceOverridesWithDefaults instantiates a new CloneInstanceOverrides 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 NewCloneInstanceOverridesWithDefaults() *CloneInstanceOverrides { + this := CloneInstanceOverrides{} + return &this +} + +// GetClass returns the Class field value if set, zero value otherwise. +func (o *CloneInstanceOverrides) GetClass() string { + if o == nil || IsNil(o.Class) { + var ret string + return ret + } + return *o.Class +} + +// GetClassOk returns a tuple with the Class field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloneInstanceOverrides) GetClassOk() (*string, bool) { + if o == nil || IsNil(o.Class) { + return nil, false + } + return o.Class, true +} + +// HasClass returns a boolean if a field has been set. +func (o *CloneInstanceOverrides) HasClass() bool { + if o != nil && !IsNil(o.Class) { + return true + } + + return false +} + +// SetClass gets a reference to the given string and assigns it to the Class field. +func (o *CloneInstanceOverrides) SetClass(v string) { + o.Class = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CloneInstanceOverrides) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CloneInstanceOverrides) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *CloneInstanceOverrides) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CloneInstanceOverrides) SetName(v string) { + o.Name = &v +} + +// GetSize returns the Size field value +func (o *CloneInstanceOverrides) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *CloneInstanceOverrides) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *CloneInstanceOverrides) SetSize(v int32) { + o.Size = v +} + +func (o CloneInstanceOverrides) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CloneInstanceOverrides) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Class) { + toSerialize["class"] = o.Class + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + toSerialize["size"] = o.Size + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CloneInstanceOverrides) 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{ + "size", + } + + 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) + } + } + + varCloneInstanceOverrides := _CloneInstanceOverrides{} + + err = json.Unmarshal(data, &varCloneInstanceOverrides) + + if err != nil { + return err + } + + *o = CloneInstanceOverrides(varCloneInstanceOverrides) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "class") + delete(additionalProperties, "name") + delete(additionalProperties, "size") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCloneInstanceOverrides struct { + value *CloneInstanceOverrides + isSet bool +} + +func (v NullableCloneInstanceOverrides) Get() *CloneInstanceOverrides { + return v.value +} + +func (v *NullableCloneInstanceOverrides) Set(val *CloneInstanceOverrides) { + v.value = val + v.isSet = true +} + +func (v NullableCloneInstanceOverrides) IsSet() bool { + return v.isSet +} + +func (v *NullableCloneInstanceOverrides) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCloneInstanceOverrides(val *CloneInstanceOverrides) *NullableCloneInstanceOverrides { + return &NullableCloneInstanceOverrides{value: val, isSet: true} +} + +func (v NullableCloneInstanceOverrides) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCloneInstanceOverrides) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_clone_request_payload.go b/services/postgresflex/v3beta1api/model_clone_request_payload.go new file mode 100644 index 000000000..8a52cfa84 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_clone_request_payload.go @@ -0,0 +1,198 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the CloneRequestPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CloneRequestPayload{} + +// CloneRequestPayload struct for CloneRequestPayload +type CloneRequestPayload struct { + InstanceOverrides CloneInstanceOverrides `json:"instanceOverrides"` + // the time for the point in time recovery it will be calculated between first backup and last backup + PointInTime time.Time `json:"pointInTime"` + AdditionalProperties map[string]interface{} +} + +type _CloneRequestPayload CloneRequestPayload + +// NewCloneRequestPayload instantiates a new CloneRequestPayload 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 NewCloneRequestPayload(instanceOverrides CloneInstanceOverrides, pointInTime time.Time) *CloneRequestPayload { + this := CloneRequestPayload{} + this.InstanceOverrides = instanceOverrides + this.PointInTime = pointInTime + return &this +} + +// NewCloneRequestPayloadWithDefaults instantiates a new CloneRequestPayload 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 NewCloneRequestPayloadWithDefaults() *CloneRequestPayload { + this := CloneRequestPayload{} + return &this +} + +// GetInstanceOverrides returns the InstanceOverrides field value +func (o *CloneRequestPayload) GetInstanceOverrides() CloneInstanceOverrides { + if o == nil { + var ret CloneInstanceOverrides + return ret + } + + return o.InstanceOverrides +} + +// GetInstanceOverridesOk returns a tuple with the InstanceOverrides field value +// and a boolean to check if the value has been set. +func (o *CloneRequestPayload) GetInstanceOverridesOk() (*CloneInstanceOverrides, bool) { + if o == nil { + return nil, false + } + return &o.InstanceOverrides, true +} + +// SetInstanceOverrides sets field value +func (o *CloneRequestPayload) SetInstanceOverrides(v CloneInstanceOverrides) { + o.InstanceOverrides = v +} + +// GetPointInTime returns the PointInTime field value +func (o *CloneRequestPayload) GetPointInTime() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.PointInTime +} + +// GetPointInTimeOk returns a tuple with the PointInTime field value +// and a boolean to check if the value has been set. +func (o *CloneRequestPayload) GetPointInTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.PointInTime, true +} + +// SetPointInTime sets field value +func (o *CloneRequestPayload) SetPointInTime(v time.Time) { + o.PointInTime = v +} + +func (o CloneRequestPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CloneRequestPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["instanceOverrides"] = o.InstanceOverrides + toSerialize["pointInTime"] = o.PointInTime + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CloneRequestPayload) 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{ + "instanceOverrides", + "pointInTime", + } + + 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) + } + } + + varCloneRequestPayload := _CloneRequestPayload{} + + err = json.Unmarshal(data, &varCloneRequestPayload) + + if err != nil { + return err + } + + *o = CloneRequestPayload(varCloneRequestPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "instanceOverrides") + delete(additionalProperties, "pointInTime") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCloneRequestPayload struct { + value *CloneRequestPayload + isSet bool +} + +func (v NullableCloneRequestPayload) Get() *CloneRequestPayload { + return v.value +} + +func (v *NullableCloneRequestPayload) Set(val *CloneRequestPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCloneRequestPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCloneRequestPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCloneRequestPayload(val *CloneRequestPayload) *NullableCloneRequestPayload { + return &NullableCloneRequestPayload{value: val, isSet: true} +} + +func (v NullableCloneRequestPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCloneRequestPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_clone_response.go b/services/postgresflex/v3beta1api/model_clone_response.go new file mode 100644 index 000000000..14969e843 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_clone_response.go @@ -0,0 +1,168 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CloneResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CloneResponse{} + +// CloneResponse struct for CloneResponse +type CloneResponse struct { + // The ID of the instance. + Id string `json:"id"` + AdditionalProperties map[string]interface{} +} + +type _CloneResponse CloneResponse + +// NewCloneResponse instantiates a new CloneResponse 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 NewCloneResponse(id string) *CloneResponse { + this := CloneResponse{} + this.Id = id + return &this +} + +// NewCloneResponseWithDefaults instantiates a new CloneResponse 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 NewCloneResponseWithDefaults() *CloneResponse { + this := CloneResponse{} + return &this +} + +// GetId returns the Id field value +func (o *CloneResponse) 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 *CloneResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *CloneResponse) SetId(v string) { + o.Id = v +} + +func (o CloneResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CloneResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CloneResponse) 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{ + "id", + } + + 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) + } + } + + varCloneResponse := _CloneResponse{} + + err = json.Unmarshal(data, &varCloneResponse) + + if err != nil { + return err + } + + *o = CloneResponse(varCloneResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCloneResponse struct { + value *CloneResponse + isSet bool +} + +func (v NullableCloneResponse) Get() *CloneResponse { + return v.value +} + +func (v *NullableCloneResponse) Set(val *CloneResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCloneResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCloneResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCloneResponse(val *CloneResponse) *NullableCloneResponse { + return &NullableCloneResponse{value: val, isSet: true} +} + +func (v NullableCloneResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCloneResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_create_database_request_payload.go b/services/postgresflex/v3beta1api/model_create_database_request_payload.go new file mode 100644 index 000000000..543ba42ba --- /dev/null +++ b/services/postgresflex/v3beta1api/model_create_database_request_payload.go @@ -0,0 +1,206 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateDatabaseRequestPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateDatabaseRequestPayload{} + +// CreateDatabaseRequestPayload struct for CreateDatabaseRequestPayload +type CreateDatabaseRequestPayload struct { + // The name of the database. + Name string `json:"name"` + // The owner of the database. + Owner *string `json:"owner,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateDatabaseRequestPayload CreateDatabaseRequestPayload + +// NewCreateDatabaseRequestPayload instantiates a new CreateDatabaseRequestPayload 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 NewCreateDatabaseRequestPayload(name string) *CreateDatabaseRequestPayload { + this := CreateDatabaseRequestPayload{} + this.Name = name + return &this +} + +// NewCreateDatabaseRequestPayloadWithDefaults instantiates a new CreateDatabaseRequestPayload 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 NewCreateDatabaseRequestPayloadWithDefaults() *CreateDatabaseRequestPayload { + this := CreateDatabaseRequestPayload{} + return &this +} + +// GetName returns the Name field value +func (o *CreateDatabaseRequestPayload) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateDatabaseRequestPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateDatabaseRequestPayload) SetName(v string) { + o.Name = v +} + +// GetOwner returns the Owner field value if set, zero value otherwise. +func (o *CreateDatabaseRequestPayload) GetOwner() string { + if o == nil || IsNil(o.Owner) { + var ret string + return ret + } + return *o.Owner +} + +// GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDatabaseRequestPayload) GetOwnerOk() (*string, bool) { + if o == nil || IsNil(o.Owner) { + return nil, false + } + return o.Owner, true +} + +// HasOwner returns a boolean if a field has been set. +func (o *CreateDatabaseRequestPayload) HasOwner() bool { + if o != nil && !IsNil(o.Owner) { + return true + } + + return false +} + +// SetOwner gets a reference to the given string and assigns it to the Owner field. +func (o *CreateDatabaseRequestPayload) SetOwner(v string) { + o.Owner = &v +} + +func (o CreateDatabaseRequestPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateDatabaseRequestPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.Owner) { + toSerialize["owner"] = o.Owner + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateDatabaseRequestPayload) 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{ + "name", + } + + 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) + } + } + + varCreateDatabaseRequestPayload := _CreateDatabaseRequestPayload{} + + err = json.Unmarshal(data, &varCreateDatabaseRequestPayload) + + if err != nil { + return err + } + + *o = CreateDatabaseRequestPayload(varCreateDatabaseRequestPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "owner") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateDatabaseRequestPayload struct { + value *CreateDatabaseRequestPayload + isSet bool +} + +func (v NullableCreateDatabaseRequestPayload) Get() *CreateDatabaseRequestPayload { + return v.value +} + +func (v *NullableCreateDatabaseRequestPayload) Set(val *CreateDatabaseRequestPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDatabaseRequestPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDatabaseRequestPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDatabaseRequestPayload(val *CreateDatabaseRequestPayload) *NullableCreateDatabaseRequestPayload { + return &NullableCreateDatabaseRequestPayload{value: val, isSet: true} +} + +func (v NullableCreateDatabaseRequestPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDatabaseRequestPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_create_database_response.go b/services/postgresflex/v3beta1api/model_create_database_response.go new file mode 100644 index 000000000..57f9103de --- /dev/null +++ b/services/postgresflex/v3beta1api/model_create_database_response.go @@ -0,0 +1,168 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateDatabaseResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateDatabaseResponse{} + +// CreateDatabaseResponse struct for CreateDatabaseResponse +type CreateDatabaseResponse struct { + // The id of the database. + Id int32 `json:"id"` + AdditionalProperties map[string]interface{} +} + +type _CreateDatabaseResponse CreateDatabaseResponse + +// NewCreateDatabaseResponse instantiates a new CreateDatabaseResponse 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 NewCreateDatabaseResponse(id int32) *CreateDatabaseResponse { + this := CreateDatabaseResponse{} + this.Id = id + return &this +} + +// NewCreateDatabaseResponseWithDefaults instantiates a new CreateDatabaseResponse 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 NewCreateDatabaseResponseWithDefaults() *CreateDatabaseResponse { + this := CreateDatabaseResponse{} + return &this +} + +// GetId returns the Id field value +func (o *CreateDatabaseResponse) GetId() int32 { + if o == nil { + var ret int32 + 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 *CreateDatabaseResponse) GetIdOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *CreateDatabaseResponse) SetId(v int32) { + o.Id = v +} + +func (o CreateDatabaseResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateDatabaseResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateDatabaseResponse) 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{ + "id", + } + + 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) + } + } + + varCreateDatabaseResponse := _CreateDatabaseResponse{} + + err = json.Unmarshal(data, &varCreateDatabaseResponse) + + if err != nil { + return err + } + + *o = CreateDatabaseResponse(varCreateDatabaseResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateDatabaseResponse struct { + value *CreateDatabaseResponse + isSet bool +} + +func (v NullableCreateDatabaseResponse) Get() *CreateDatabaseResponse { + return v.value +} + +func (v *NullableCreateDatabaseResponse) Set(val *CreateDatabaseResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDatabaseResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDatabaseResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDatabaseResponse(val *CreateDatabaseResponse) *NullableCreateDatabaseResponse { + return &NullableCreateDatabaseResponse{value: val, isSet: true} +} + +func (v NullableCreateDatabaseResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDatabaseResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_create_instance_request_payload.go b/services/postgresflex/v3beta1api/model_create_instance_request_payload.go new file mode 100644 index 000000000..9e3311c27 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_create_instance_request_payload.go @@ -0,0 +1,423 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateInstanceRequestPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateInstanceRequestPayload{} + +// CreateInstanceRequestPayload struct for CreateInstanceRequestPayload +type CreateInstanceRequestPayload struct { + // The schedule for when the database backup will be created. Currently, ONLY daily schedules are supported (every 24 hours). The schedule is written as a cron schedule. + BackupSchedule string `json:"backupSchedule"` + Encryption *InstanceEncryption `json:"encryption,omitempty"` + // The id of the instance flavor. + FlavorId string `json:"flavorId"` + // Key-value pairs, 63 characters max, begin and end with an alphanumerical character, may contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character. Max 64 labels Regex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$ Regex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$ The stackit- prefix is reserved and cannot be used for Keys. + Labels *map[string]string `json:"labels,omitempty"` + // The name of the instance. + Name string `json:"name"` + Network InstanceNetworkCreate `json:"network"` + // How long backups are retained. The value can only be between 32 and 90 days. + RetentionDays NullableInt32 `json:"retentionDays"` + Storage StorageCreate `json:"storage"` + // The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3beta1#tag/Version) for supported version parameters. + Version string `json:"version"` + AdditionalProperties map[string]interface{} +} + +type _CreateInstanceRequestPayload CreateInstanceRequestPayload + +// NewCreateInstanceRequestPayload instantiates a new CreateInstanceRequestPayload 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 NewCreateInstanceRequestPayload(backupSchedule string, flavorId string, name string, network InstanceNetworkCreate, retentionDays NullableInt32, storage StorageCreate, version string) *CreateInstanceRequestPayload { + this := CreateInstanceRequestPayload{} + this.BackupSchedule = backupSchedule + this.FlavorId = flavorId + this.Name = name + this.Network = network + this.RetentionDays = retentionDays + this.Storage = storage + this.Version = version + return &this +} + +// NewCreateInstanceRequestPayloadWithDefaults instantiates a new CreateInstanceRequestPayload 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 NewCreateInstanceRequestPayloadWithDefaults() *CreateInstanceRequestPayload { + this := CreateInstanceRequestPayload{} + return &this +} + +// GetBackupSchedule returns the BackupSchedule field value +func (o *CreateInstanceRequestPayload) GetBackupSchedule() string { + if o == nil { + var ret string + return ret + } + + return o.BackupSchedule +} + +// GetBackupScheduleOk returns a tuple with the BackupSchedule field value +// and a boolean to check if the value has been set. +func (o *CreateInstanceRequestPayload) GetBackupScheduleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BackupSchedule, true +} + +// SetBackupSchedule sets field value +func (o *CreateInstanceRequestPayload) SetBackupSchedule(v string) { + o.BackupSchedule = v +} + +// GetEncryption returns the Encryption field value if set, zero value otherwise. +func (o *CreateInstanceRequestPayload) GetEncryption() InstanceEncryption { + if o == nil || IsNil(o.Encryption) { + var ret InstanceEncryption + return ret + } + return *o.Encryption +} + +// GetEncryptionOk returns a tuple with the Encryption field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstanceRequestPayload) GetEncryptionOk() (*InstanceEncryption, bool) { + if o == nil || IsNil(o.Encryption) { + return nil, false + } + return o.Encryption, true +} + +// HasEncryption returns a boolean if a field has been set. +func (o *CreateInstanceRequestPayload) HasEncryption() bool { + if o != nil && !IsNil(o.Encryption) { + return true + } + + return false +} + +// SetEncryption gets a reference to the given InstanceEncryption and assigns it to the Encryption field. +func (o *CreateInstanceRequestPayload) SetEncryption(v InstanceEncryption) { + o.Encryption = &v +} + +// GetFlavorId returns the FlavorId field value +func (o *CreateInstanceRequestPayload) GetFlavorId() string { + if o == nil { + var ret string + return ret + } + + return o.FlavorId +} + +// GetFlavorIdOk returns a tuple with the FlavorId field value +// and a boolean to check if the value has been set. +func (o *CreateInstanceRequestPayload) GetFlavorIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FlavorId, true +} + +// SetFlavorId sets field value +func (o *CreateInstanceRequestPayload) SetFlavorId(v string) { + o.FlavorId = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateInstanceRequestPayload) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateInstanceRequestPayload) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateInstanceRequestPayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *CreateInstanceRequestPayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value +func (o *CreateInstanceRequestPayload) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateInstanceRequestPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateInstanceRequestPayload) SetName(v string) { + o.Name = v +} + +// GetNetwork returns the Network field value +func (o *CreateInstanceRequestPayload) GetNetwork() InstanceNetworkCreate { + if o == nil { + var ret InstanceNetworkCreate + return ret + } + + return o.Network +} + +// GetNetworkOk returns a tuple with the Network field value +// and a boolean to check if the value has been set. +func (o *CreateInstanceRequestPayload) GetNetworkOk() (*InstanceNetworkCreate, bool) { + if o == nil { + return nil, false + } + return &o.Network, true +} + +// SetNetwork sets field value +func (o *CreateInstanceRequestPayload) SetNetwork(v InstanceNetworkCreate) { + o.Network = v +} + +// GetRetentionDays returns the RetentionDays field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *CreateInstanceRequestPayload) GetRetentionDays() int32 { + if o == nil || o.RetentionDays.Get() == nil { + var ret int32 + return ret + } + + return *o.RetentionDays.Get() +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateInstanceRequestPayload) GetRetentionDaysOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.RetentionDays.Get(), o.RetentionDays.IsSet() +} + +// SetRetentionDays sets field value +func (o *CreateInstanceRequestPayload) SetRetentionDays(v int32) { + o.RetentionDays.Set(&v) +} + +// GetStorage returns the Storage field value +func (o *CreateInstanceRequestPayload) GetStorage() StorageCreate { + if o == nil { + var ret StorageCreate + return ret + } + + return o.Storage +} + +// GetStorageOk returns a tuple with the Storage field value +// and a boolean to check if the value has been set. +func (o *CreateInstanceRequestPayload) GetStorageOk() (*StorageCreate, bool) { + if o == nil { + return nil, false + } + return &o.Storage, true +} + +// SetStorage sets field value +func (o *CreateInstanceRequestPayload) SetStorage(v StorageCreate) { + o.Storage = v +} + +// GetVersion returns the Version field value +func (o *CreateInstanceRequestPayload) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *CreateInstanceRequestPayload) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *CreateInstanceRequestPayload) SetVersion(v string) { + o.Version = v +} + +func (o CreateInstanceRequestPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateInstanceRequestPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["backupSchedule"] = o.BackupSchedule + if !IsNil(o.Encryption) { + toSerialize["encryption"] = o.Encryption + } + toSerialize["flavorId"] = o.FlavorId + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + toSerialize["network"] = o.Network + toSerialize["retentionDays"] = o.RetentionDays.Get() + toSerialize["storage"] = o.Storage + toSerialize["version"] = o.Version + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateInstanceRequestPayload) 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{ + "backupSchedule", + "flavorId", + "name", + "network", + "retentionDays", + "storage", + "version", + } + + 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) + } + } + + varCreateInstanceRequestPayload := _CreateInstanceRequestPayload{} + + err = json.Unmarshal(data, &varCreateInstanceRequestPayload) + + if err != nil { + return err + } + + *o = CreateInstanceRequestPayload(varCreateInstanceRequestPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "backupSchedule") + delete(additionalProperties, "encryption") + delete(additionalProperties, "flavorId") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "network") + delete(additionalProperties, "retentionDays") + delete(additionalProperties, "storage") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateInstanceRequestPayload struct { + value *CreateInstanceRequestPayload + isSet bool +} + +func (v NullableCreateInstanceRequestPayload) Get() *CreateInstanceRequestPayload { + return v.value +} + +func (v *NullableCreateInstanceRequestPayload) Set(val *CreateInstanceRequestPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateInstanceRequestPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateInstanceRequestPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateInstanceRequestPayload(val *CreateInstanceRequestPayload) *NullableCreateInstanceRequestPayload { + return &NullableCreateInstanceRequestPayload{value: val, isSet: true} +} + +func (v NullableCreateInstanceRequestPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateInstanceRequestPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_create_instance_response.go b/services/postgresflex/v3beta1api/model_create_instance_response.go new file mode 100644 index 000000000..2a63d5a45 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_create_instance_response.go @@ -0,0 +1,168 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateInstanceResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateInstanceResponse{} + +// CreateInstanceResponse struct for CreateInstanceResponse +type CreateInstanceResponse struct { + // The ID of the instance. + Id string `json:"id"` + AdditionalProperties map[string]interface{} +} + +type _CreateInstanceResponse CreateInstanceResponse + +// NewCreateInstanceResponse instantiates a new CreateInstanceResponse 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 NewCreateInstanceResponse(id string) *CreateInstanceResponse { + this := CreateInstanceResponse{} + this.Id = id + return &this +} + +// NewCreateInstanceResponseWithDefaults instantiates a new CreateInstanceResponse 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 NewCreateInstanceResponseWithDefaults() *CreateInstanceResponse { + this := CreateInstanceResponse{} + return &this +} + +// GetId returns the Id field value +func (o *CreateInstanceResponse) 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 *CreateInstanceResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *CreateInstanceResponse) SetId(v string) { + o.Id = v +} + +func (o CreateInstanceResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateInstanceResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateInstanceResponse) 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{ + "id", + } + + 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) + } + } + + varCreateInstanceResponse := _CreateInstanceResponse{} + + err = json.Unmarshal(data, &varCreateInstanceResponse) + + if err != nil { + return err + } + + *o = CreateInstanceResponse(varCreateInstanceResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateInstanceResponse struct { + value *CreateInstanceResponse + isSet bool +} + +func (v NullableCreateInstanceResponse) Get() *CreateInstanceResponse { + return v.value +} + +func (v *NullableCreateInstanceResponse) Set(val *CreateInstanceResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateInstanceResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateInstanceResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateInstanceResponse(val *CreateInstanceResponse) *NullableCreateInstanceResponse { + return &NullableCreateInstanceResponse{value: val, isSet: true} +} + +func (v NullableCreateInstanceResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateInstanceResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_create_user_request_payload.go b/services/postgresflex/v3beta1api/model_create_user_request_payload.go new file mode 100644 index 000000000..24dfaf812 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_create_user_request_payload.go @@ -0,0 +1,206 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateUserRequestPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateUserRequestPayload{} + +// CreateUserRequestPayload struct for CreateUserRequestPayload +type CreateUserRequestPayload struct { + // The name of the user. + Name string `json:"name"` + // A list containing the user roles for the instance. Please refer to the List Roles endpoint for a list of all available Roles. + Roles []string `json:"roles,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _CreateUserRequestPayload CreateUserRequestPayload + +// NewCreateUserRequestPayload instantiates a new CreateUserRequestPayload 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 NewCreateUserRequestPayload(name string) *CreateUserRequestPayload { + this := CreateUserRequestPayload{} + this.Name = name + return &this +} + +// NewCreateUserRequestPayloadWithDefaults instantiates a new CreateUserRequestPayload 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 NewCreateUserRequestPayloadWithDefaults() *CreateUserRequestPayload { + this := CreateUserRequestPayload{} + return &this +} + +// GetName returns the Name field value +func (o *CreateUserRequestPayload) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateUserRequestPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateUserRequestPayload) SetName(v string) { + o.Name = v +} + +// GetRoles returns the Roles field value if set, zero value otherwise. +func (o *CreateUserRequestPayload) GetRoles() []string { + if o == nil || IsNil(o.Roles) { + var ret []string + return ret + } + return o.Roles +} + +// GetRolesOk returns a tuple with the Roles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateUserRequestPayload) GetRolesOk() ([]string, bool) { + if o == nil || IsNil(o.Roles) { + return nil, false + } + return o.Roles, true +} + +// HasRoles returns a boolean if a field has been set. +func (o *CreateUserRequestPayload) HasRoles() bool { + if o != nil && !IsNil(o.Roles) { + return true + } + + return false +} + +// SetRoles gets a reference to the given []string and assigns it to the Roles field. +func (o *CreateUserRequestPayload) SetRoles(v []string) { + o.Roles = v +} + +func (o CreateUserRequestPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateUserRequestPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.Roles) { + toSerialize["roles"] = o.Roles + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateUserRequestPayload) 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{ + "name", + } + + 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) + } + } + + varCreateUserRequestPayload := _CreateUserRequestPayload{} + + err = json.Unmarshal(data, &varCreateUserRequestPayload) + + if err != nil { + return err + } + + *o = CreateUserRequestPayload(varCreateUserRequestPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "roles") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateUserRequestPayload struct { + value *CreateUserRequestPayload + isSet bool +} + +func (v NullableCreateUserRequestPayload) Get() *CreateUserRequestPayload { + return v.value +} + +func (v *NullableCreateUserRequestPayload) Set(val *CreateUserRequestPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateUserRequestPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateUserRequestPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateUserRequestPayload(val *CreateUserRequestPayload) *NullableCreateUserRequestPayload { + return &NullableCreateUserRequestPayload{value: val, isSet: true} +} + +func (v NullableCreateUserRequestPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateUserRequestPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_create_user_response.go b/services/postgresflex/v3beta1api/model_create_user_response.go new file mode 100644 index 000000000..4f8761059 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_create_user_response.go @@ -0,0 +1,258 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the CreateUserResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateUserResponse{} + +// CreateUserResponse struct for CreateUserResponse +type CreateUserResponse struct { + // The ID of the user. + Id int32 `json:"id"` + // The name of the user. + Name string `json:"name"` + // The password for the user. + Password string `json:"password"` + // The current state of the user. + State string `json:"state"` + AdditionalProperties map[string]interface{} +} + +type _CreateUserResponse CreateUserResponse + +// NewCreateUserResponse instantiates a new CreateUserResponse 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 NewCreateUserResponse(id int32, name string, password string, state string) *CreateUserResponse { + this := CreateUserResponse{} + this.Id = id + this.Name = name + this.Password = password + this.State = state + return &this +} + +// NewCreateUserResponseWithDefaults instantiates a new CreateUserResponse 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 NewCreateUserResponseWithDefaults() *CreateUserResponse { + this := CreateUserResponse{} + return &this +} + +// GetId returns the Id field value +func (o *CreateUserResponse) GetId() int32 { + if o == nil { + var ret int32 + 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 *CreateUserResponse) GetIdOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *CreateUserResponse) SetId(v int32) { + o.Id = v +} + +// GetName returns the Name field value +func (o *CreateUserResponse) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateUserResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateUserResponse) SetName(v string) { + o.Name = v +} + +// GetPassword returns the Password field value +func (o *CreateUserResponse) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *CreateUserResponse) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *CreateUserResponse) SetPassword(v string) { + o.Password = v +} + +// GetState returns the State field value +func (o *CreateUserResponse) GetState() string { + if o == nil { + var ret string + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *CreateUserResponse) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *CreateUserResponse) SetState(v string) { + o.State = v +} + +func (o CreateUserResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateUserResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["password"] = o.Password + toSerialize["state"] = o.State + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *CreateUserResponse) 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{ + "id", + "name", + "password", + "state", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateUserResponse := _CreateUserResponse{} + + err = json.Unmarshal(data, &varCreateUserResponse) + + if err != nil { + return err + } + + *o = CreateUserResponse(varCreateUserResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "password") + delete(additionalProperties, "state") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCreateUserResponse struct { + value *CreateUserResponse + isSet bool +} + +func (v NullableCreateUserResponse) Get() *CreateUserResponse { + return v.value +} + +func (v *NullableCreateUserResponse) Set(val *CreateUserResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateUserResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateUserResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateUserResponse(val *CreateUserResponse) *NullableCreateUserResponse { + return &NullableCreateUserResponse{value: val, isSet: true} +} + +func (v NullableCreateUserResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateUserResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_database_roles.go b/services/postgresflex/v3beta1api/model_database_roles.go new file mode 100644 index 000000000..fecb61deb --- /dev/null +++ b/services/postgresflex/v3beta1api/model_database_roles.go @@ -0,0 +1,198 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the DatabaseRoles type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DatabaseRoles{} + +// DatabaseRoles The name and the roles for a database for a user. +type DatabaseRoles struct { + // The name of the database. + Name string `json:"name"` + // The name and the roles for a database + Roles []string `json:"roles"` + AdditionalProperties map[string]interface{} +} + +type _DatabaseRoles DatabaseRoles + +// NewDatabaseRoles instantiates a new DatabaseRoles 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 NewDatabaseRoles(name string, roles []string) *DatabaseRoles { + this := DatabaseRoles{} + this.Name = name + this.Roles = roles + return &this +} + +// NewDatabaseRolesWithDefaults instantiates a new DatabaseRoles 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 NewDatabaseRolesWithDefaults() *DatabaseRoles { + this := DatabaseRoles{} + return &this +} + +// GetName returns the Name field value +func (o *DatabaseRoles) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *DatabaseRoles) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *DatabaseRoles) SetName(v string) { + o.Name = v +} + +// GetRoles returns the Roles field value +func (o *DatabaseRoles) GetRoles() []string { + if o == nil { + var ret []string + return ret + } + + return o.Roles +} + +// GetRolesOk returns a tuple with the Roles field value +// and a boolean to check if the value has been set. +func (o *DatabaseRoles) GetRolesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Roles, true +} + +// SetRoles sets field value +func (o *DatabaseRoles) SetRoles(v []string) { + o.Roles = v +} + +func (o DatabaseRoles) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DatabaseRoles) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["roles"] = o.Roles + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DatabaseRoles) 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{ + "name", + "roles", + } + + 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) + } + } + + varDatabaseRoles := _DatabaseRoles{} + + err = json.Unmarshal(data, &varDatabaseRoles) + + if err != nil { + return err + } + + *o = DatabaseRoles(varDatabaseRoles) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "roles") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDatabaseRoles struct { + value *DatabaseRoles + isSet bool +} + +func (v NullableDatabaseRoles) Get() *DatabaseRoles { + return v.value +} + +func (v *NullableDatabaseRoles) Set(val *DatabaseRoles) { + v.value = val + v.isSet = true +} + +func (v NullableDatabaseRoles) IsSet() bool { + return v.isSet +} + +func (v *NullableDatabaseRoles) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDatabaseRoles(val *DatabaseRoles) *NullableDatabaseRoles { + return &NullableDatabaseRoles{value: val, isSet: true} +} + +func (v NullableDatabaseRoles) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDatabaseRoles) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_database_sort.go b/services/postgresflex/v3beta1api/model_database_sort.go new file mode 100644 index 000000000..880813984 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_database_sort.go @@ -0,0 +1,126 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// DatabaseSort the model 'DatabaseSort' +type DatabaseSort string + +// List of database.sort +const ( + DATABASESORT_CREATED_AT_DESC DatabaseSort = "created_at.desc" + DATABASESORT_CREATED_AT_ASC DatabaseSort = "created_at.asc" + DATABASESORT_DATABASE_ID_DESC DatabaseSort = "database_id.desc" + DATABASESORT_DATABASE_ID_ASC DatabaseSort = "database_id.asc" + DATABASESORT_DATABASE_NAME_DESC DatabaseSort = "database_name.desc" + DATABASESORT_DATABASE_NAME_ASC DatabaseSort = "database_name.asc" + DATABASESORT_DATABASE_OWNER_DESC DatabaseSort = "database_owner.desc" + DATABASESORT_DATABASE_OWNER_ASC DatabaseSort = "database_owner.asc" + DATABASESORT_UNKNOWN_DEFAULT_OPEN_API DatabaseSort = "unknown_default_open_api" +) + +// All allowed values of DatabaseSort enum +var AllowedDatabaseSortEnumValues = []DatabaseSort{ + "created_at.desc", + "created_at.asc", + "database_id.desc", + "database_id.asc", + "database_name.desc", + "database_name.asc", + "database_owner.desc", + "database_owner.asc", + "unknown_default_open_api", +} + +func (v *DatabaseSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := DatabaseSort(value) + for _, existing := range AllowedDatabaseSortEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = DATABASESORT_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewDatabaseSortFromValue returns a pointer to a valid DatabaseSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDatabaseSortFromValue(v string) (*DatabaseSort, error) { + ev := DatabaseSort(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DatabaseSort: valid values are %v", v, AllowedDatabaseSortEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DatabaseSort) IsValid() bool { + for _, existing := range AllowedDatabaseSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to database.sort value +func (v DatabaseSort) Ptr() *DatabaseSort { + return &v +} + +type NullableDatabaseSort struct { + value *DatabaseSort + isSet bool +} + +func (v NullableDatabaseSort) Get() *DatabaseSort { + return v.value +} + +func (v *NullableDatabaseSort) Set(val *DatabaseSort) { + v.value = val + v.isSet = true +} + +func (v NullableDatabaseSort) IsSet() bool { + return v.isSet +} + +func (v *NullableDatabaseSort) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDatabaseSort(val *DatabaseSort) *NullableDatabaseSort { + return &NullableDatabaseSort{value: val, isSet: true} +} + +func (v NullableDatabaseSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDatabaseSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_error.go b/services/postgresflex/v3beta1api/model_error.go new file mode 100644 index 000000000..c93c253cb --- /dev/null +++ b/services/postgresflex/v3beta1api/model_error.go @@ -0,0 +1,258 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the Error type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Error{} + +// Error struct for Error +type Error struct { + // The http error code of the error. + Code int32 `json:"code"` + // More detailed information about the error. + Message string `json:"message"` + // The trace id of the request. + TraceId string `json:"traceId"` + // Describes in which state the api was when the error happened. + Type string `json:"type"` + AdditionalProperties map[string]interface{} +} + +type _Error Error + +// NewError instantiates a new Error 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 NewError(code int32, message string, traceId string, types string) *Error { + this := Error{} + this.Code = code + this.Message = message + this.TraceId = traceId + this.Type = types + return &this +} + +// NewErrorWithDefaults instantiates a new Error 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 NewErrorWithDefaults() *Error { + this := Error{} + return &this +} + +// GetCode returns the Code field value +func (o *Error) GetCode() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Code +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *Error) GetCodeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Code, true +} + +// SetCode sets field value +func (o *Error) SetCode(v int32) { + o.Code = v +} + +// GetMessage returns the Message field value +func (o *Error) 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 *Error) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *Error) SetMessage(v string) { + o.Message = v +} + +// GetTraceId returns the TraceId field value +func (o *Error) GetTraceId() string { + if o == nil { + var ret string + return ret + } + + return o.TraceId +} + +// GetTraceIdOk returns a tuple with the TraceId field value +// and a boolean to check if the value has been set. +func (o *Error) GetTraceIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TraceId, true +} + +// SetTraceId sets field value +func (o *Error) SetTraceId(v string) { + o.TraceId = v +} + +// GetType returns the Type field value +func (o *Error) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *Error) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *Error) SetType(v string) { + o.Type = v +} + +func (o Error) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Error) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["code"] = o.Code + toSerialize["message"] = o.Message + toSerialize["traceId"] = o.TraceId + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Error) 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{ + "code", + "message", + "traceId", + "type", + } + + 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) + } + } + + varError := _Error{} + + err = json.Unmarshal(data, &varError) + + if err != nil { + return err + } + + *o = Error(varError) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "message") + delete(additionalProperties, "traceId") + delete(additionalProperties, "type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableError struct { + value *Error + isSet bool +} + +func (v NullableError) Get() *Error { + return v.value +} + +func (v *NullableError) Set(val *Error) { + v.value = val + v.isSet = true +} + +func (v NullableError) IsSet() bool { + return v.isSet +} + +func (v *NullableError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableError(val *Error) *NullableError { + return &NullableError{value: val, isSet: true} +} + +func (v NullableError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_flavor_sort.go b/services/postgresflex/v3beta1api/model_flavor_sort.go new file mode 100644 index 000000000..40e8be4c6 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_flavor_sort.go @@ -0,0 +1,142 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// FlavorSort the model 'FlavorSort' +type FlavorSort string + +// List of flavor.sort +const ( + FLAVORSORT_CPU_DESC FlavorSort = "cpu.desc" + FLAVORSORT_CPU_ASC FlavorSort = "cpu.asc" + FLAVORSORT_FLAVOR_DESCRIPTION_ASC FlavorSort = "flavor_description.asc" + FLAVORSORT_FLAVOR_DESCRIPTION_DESC FlavorSort = "flavor_description.desc" + FLAVORSORT_ID_DESC FlavorSort = "id.desc" + FLAVORSORT_ID_ASC FlavorSort = "id.asc" + FLAVORSORT_SIZE_MAX_DESC FlavorSort = "size_max.desc" + FLAVORSORT_SIZE_MAX_ASC FlavorSort = "size_max.asc" + FLAVORSORT_RAM_DESC FlavorSort = "ram.desc" + FLAVORSORT_RAM_ASC FlavorSort = "ram.asc" + FLAVORSORT_SIZE_MIN_DESC FlavorSort = "size_min.desc" + FLAVORSORT_SIZE_MIN_ASC FlavorSort = "size_min.asc" + FLAVORSORT_STORAGE_CLASS_ASC FlavorSort = "storage_class.asc" + FLAVORSORT_STORAGE_CLASS_DESC FlavorSort = "storage_class.desc" + FLAVORSORT_NODE_TYPE_ASC FlavorSort = "node_type.asc" + FLAVORSORT_NODE_TYPE_DESC FlavorSort = "node_type.desc" + FLAVORSORT_UNKNOWN_DEFAULT_OPEN_API FlavorSort = "unknown_default_open_api" +) + +// All allowed values of FlavorSort enum +var AllowedFlavorSortEnumValues = []FlavorSort{ + "cpu.desc", + "cpu.asc", + "flavor_description.asc", + "flavor_description.desc", + "id.desc", + "id.asc", + "size_max.desc", + "size_max.asc", + "ram.desc", + "ram.asc", + "size_min.desc", + "size_min.asc", + "storage_class.asc", + "storage_class.desc", + "node_type.asc", + "node_type.desc", + "unknown_default_open_api", +} + +func (v *FlavorSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := FlavorSort(value) + for _, existing := range AllowedFlavorSortEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = FLAVORSORT_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewFlavorSortFromValue returns a pointer to a valid FlavorSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewFlavorSortFromValue(v string) (*FlavorSort, error) { + ev := FlavorSort(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for FlavorSort: valid values are %v", v, AllowedFlavorSortEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v FlavorSort) IsValid() bool { + for _, existing := range AllowedFlavorSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to flavor.sort value +func (v FlavorSort) Ptr() *FlavorSort { + return &v +} + +type NullableFlavorSort struct { + value *FlavorSort + isSet bool +} + +func (v NullableFlavorSort) Get() *FlavorSort { + return v.value +} + +func (v *NullableFlavorSort) Set(val *FlavorSort) { + v.value = val + v.isSet = true +} + +func (v NullableFlavorSort) IsSet() bool { + return v.isSet +} + +func (v *NullableFlavorSort) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFlavorSort(val *FlavorSort) *NullableFlavorSort { + return &NullableFlavorSort{value: val, isSet: true} +} + +func (v NullableFlavorSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFlavorSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_flavor_storage_classes_storage_class.go b/services/postgresflex/v3beta1api/model_flavor_storage_classes_storage_class.go new file mode 100644 index 000000000..5aeadb669 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_flavor_storage_classes_storage_class.go @@ -0,0 +1,225 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the FlavorStorageClassesStorageClass type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FlavorStorageClassesStorageClass{} + +// FlavorStorageClassesStorageClass a storageClass defines how efficient the storage can work +type FlavorStorageClassesStorageClass struct { + Class string `json:"class"` + MaxIoPerSec int32 `json:"maxIoPerSec"` + MaxThroughInMb int32 `json:"maxThroughInMb"` + AdditionalProperties map[string]interface{} +} + +type _FlavorStorageClassesStorageClass FlavorStorageClassesStorageClass + +// NewFlavorStorageClassesStorageClass instantiates a new FlavorStorageClassesStorageClass 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 NewFlavorStorageClassesStorageClass(class string, maxIoPerSec int32, maxThroughInMb int32) *FlavorStorageClassesStorageClass { + this := FlavorStorageClassesStorageClass{} + this.Class = class + this.MaxIoPerSec = maxIoPerSec + this.MaxThroughInMb = maxThroughInMb + return &this +} + +// NewFlavorStorageClassesStorageClassWithDefaults instantiates a new FlavorStorageClassesStorageClass 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 NewFlavorStorageClassesStorageClassWithDefaults() *FlavorStorageClassesStorageClass { + this := FlavorStorageClassesStorageClass{} + return &this +} + +// GetClass returns the Class field value +func (o *FlavorStorageClassesStorageClass) GetClass() string { + if o == nil { + var ret string + return ret + } + + return o.Class +} + +// GetClassOk returns a tuple with the Class field value +// and a boolean to check if the value has been set. +func (o *FlavorStorageClassesStorageClass) GetClassOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Class, true +} + +// SetClass sets field value +func (o *FlavorStorageClassesStorageClass) SetClass(v string) { + o.Class = v +} + +// GetMaxIoPerSec returns the MaxIoPerSec field value +func (o *FlavorStorageClassesStorageClass) GetMaxIoPerSec() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MaxIoPerSec +} + +// GetMaxIoPerSecOk returns a tuple with the MaxIoPerSec field value +// and a boolean to check if the value has been set. +func (o *FlavorStorageClassesStorageClass) GetMaxIoPerSecOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MaxIoPerSec, true +} + +// SetMaxIoPerSec sets field value +func (o *FlavorStorageClassesStorageClass) SetMaxIoPerSec(v int32) { + o.MaxIoPerSec = v +} + +// GetMaxThroughInMb returns the MaxThroughInMb field value +func (o *FlavorStorageClassesStorageClass) GetMaxThroughInMb() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MaxThroughInMb +} + +// GetMaxThroughInMbOk returns a tuple with the MaxThroughInMb field value +// and a boolean to check if the value has been set. +func (o *FlavorStorageClassesStorageClass) GetMaxThroughInMbOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MaxThroughInMb, true +} + +// SetMaxThroughInMb sets field value +func (o *FlavorStorageClassesStorageClass) SetMaxThroughInMb(v int32) { + o.MaxThroughInMb = v +} + +func (o FlavorStorageClassesStorageClass) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FlavorStorageClassesStorageClass) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["class"] = o.Class + toSerialize["maxIoPerSec"] = o.MaxIoPerSec + toSerialize["maxThroughInMb"] = o.MaxThroughInMb + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *FlavorStorageClassesStorageClass) 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{ + "class", + "maxIoPerSec", + "maxThroughInMb", + } + + 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) + } + } + + varFlavorStorageClassesStorageClass := _FlavorStorageClassesStorageClass{} + + err = json.Unmarshal(data, &varFlavorStorageClassesStorageClass) + + if err != nil { + return err + } + + *o = FlavorStorageClassesStorageClass(varFlavorStorageClassesStorageClass) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "class") + delete(additionalProperties, "maxIoPerSec") + delete(additionalProperties, "maxThroughInMb") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableFlavorStorageClassesStorageClass struct { + value *FlavorStorageClassesStorageClass + isSet bool +} + +func (v NullableFlavorStorageClassesStorageClass) Get() *FlavorStorageClassesStorageClass { + return v.value +} + +func (v *NullableFlavorStorageClassesStorageClass) Set(val *FlavorStorageClassesStorageClass) { + v.value = val + v.isSet = true +} + +func (v NullableFlavorStorageClassesStorageClass) IsSet() bool { + return v.isSet +} + +func (v *NullableFlavorStorageClassesStorageClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFlavorStorageClassesStorageClass(val *FlavorStorageClassesStorageClass) *NullableFlavorStorageClassesStorageClass { + return &NullableFlavorStorageClassesStorageClass{value: val, isSet: true} +} + +func (v NullableFlavorStorageClassesStorageClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFlavorStorageClassesStorageClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_get_collations_response.go b/services/postgresflex/v3beta1api/model_get_collations_response.go new file mode 100644 index 000000000..29c00e121 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_get_collations_response.go @@ -0,0 +1,168 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetCollationsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCollationsResponse{} + +// GetCollationsResponse struct for GetCollationsResponse +type GetCollationsResponse struct { + // List of collations available for the instance. + Collations []string `json:"collations"` + AdditionalProperties map[string]interface{} +} + +type _GetCollationsResponse GetCollationsResponse + +// NewGetCollationsResponse instantiates a new GetCollationsResponse 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 NewGetCollationsResponse(collations []string) *GetCollationsResponse { + this := GetCollationsResponse{} + this.Collations = collations + return &this +} + +// NewGetCollationsResponseWithDefaults instantiates a new GetCollationsResponse 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 NewGetCollationsResponseWithDefaults() *GetCollationsResponse { + this := GetCollationsResponse{} + return &this +} + +// GetCollations returns the Collations field value +func (o *GetCollationsResponse) GetCollations() []string { + if o == nil { + var ret []string + return ret + } + + return o.Collations +} + +// GetCollationsOk returns a tuple with the Collations field value +// and a boolean to check if the value has been set. +func (o *GetCollationsResponse) GetCollationsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Collations, true +} + +// SetCollations sets field value +func (o *GetCollationsResponse) SetCollations(v []string) { + o.Collations = v +} + +func (o GetCollationsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetCollationsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["collations"] = o.Collations + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetCollationsResponse) 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{ + "collations", + } + + 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) + } + } + + varGetCollationsResponse := _GetCollationsResponse{} + + err = json.Unmarshal(data, &varGetCollationsResponse) + + if err != nil { + return err + } + + *o = GetCollationsResponse(varGetCollationsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "collations") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetCollationsResponse struct { + value *GetCollationsResponse + isSet bool +} + +func (v NullableGetCollationsResponse) Get() *GetCollationsResponse { + return v.value +} + +func (v *NullableGetCollationsResponse) Set(val *GetCollationsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetCollationsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCollationsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCollationsResponse(val *GetCollationsResponse) *NullableGetCollationsResponse { + return &NullableGetCollationsResponse{value: val, isSet: true} +} + +func (v NullableGetCollationsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCollationsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_get_database_response.go b/services/postgresflex/v3beta1api/model_get_database_response.go new file mode 100644 index 000000000..208c57a98 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_get_database_response.go @@ -0,0 +1,228 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetDatabaseResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetDatabaseResponse{} + +// GetDatabaseResponse struct for GetDatabaseResponse +type GetDatabaseResponse struct { + // The id of the database. + Id int32 `json:"id"` + // The name of the database. + Name string `json:"name"` + // The owner of the database. + Owner string `json:"owner"` + AdditionalProperties map[string]interface{} +} + +type _GetDatabaseResponse GetDatabaseResponse + +// NewGetDatabaseResponse instantiates a new GetDatabaseResponse 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 NewGetDatabaseResponse(id int32, name string, owner string) *GetDatabaseResponse { + this := GetDatabaseResponse{} + this.Id = id + this.Name = name + this.Owner = owner + return &this +} + +// NewGetDatabaseResponseWithDefaults instantiates a new GetDatabaseResponse 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 NewGetDatabaseResponseWithDefaults() *GetDatabaseResponse { + this := GetDatabaseResponse{} + return &this +} + +// GetId returns the Id field value +func (o *GetDatabaseResponse) GetId() int32 { + if o == nil { + var ret int32 + 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 *GetDatabaseResponse) GetIdOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *GetDatabaseResponse) SetId(v int32) { + o.Id = v +} + +// GetName returns the Name field value +func (o *GetDatabaseResponse) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GetDatabaseResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *GetDatabaseResponse) SetName(v string) { + o.Name = v +} + +// GetOwner returns the Owner field value +func (o *GetDatabaseResponse) GetOwner() string { + if o == nil { + var ret string + return ret + } + + return o.Owner +} + +// GetOwnerOk returns a tuple with the Owner field value +// and a boolean to check if the value has been set. +func (o *GetDatabaseResponse) GetOwnerOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Owner, true +} + +// SetOwner sets field value +func (o *GetDatabaseResponse) SetOwner(v string) { + o.Owner = v +} + +func (o GetDatabaseResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetDatabaseResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["owner"] = o.Owner + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetDatabaseResponse) 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{ + "id", + "name", + "owner", + } + + 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) + } + } + + varGetDatabaseResponse := _GetDatabaseResponse{} + + err = json.Unmarshal(data, &varGetDatabaseResponse) + + if err != nil { + return err + } + + *o = GetDatabaseResponse(varGetDatabaseResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "owner") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetDatabaseResponse struct { + value *GetDatabaseResponse + isSet bool +} + +func (v NullableGetDatabaseResponse) Get() *GetDatabaseResponse { + return v.value +} + +func (v *NullableGetDatabaseResponse) Set(val *GetDatabaseResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetDatabaseResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetDatabaseResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetDatabaseResponse(val *GetDatabaseResponse) *NullableGetDatabaseResponse { + return &NullableGetDatabaseResponse{value: val, isSet: true} +} + +func (v NullableGetDatabaseResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetDatabaseResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_get_flavors_response.go b/services/postgresflex/v3beta1api/model_get_flavors_response.go new file mode 100644 index 000000000..bc292abab --- /dev/null +++ b/services/postgresflex/v3beta1api/model_get_flavors_response.go @@ -0,0 +1,197 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetFlavorsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetFlavorsResponse{} + +// GetFlavorsResponse struct for GetFlavorsResponse +type GetFlavorsResponse struct { + // List of flavors available for the project. + Flavors []ListFlavors `json:"flavors"` + Pagination Pagination `json:"pagination"` + AdditionalProperties map[string]interface{} +} + +type _GetFlavorsResponse GetFlavorsResponse + +// NewGetFlavorsResponse instantiates a new GetFlavorsResponse 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 NewGetFlavorsResponse(flavors []ListFlavors, pagination Pagination) *GetFlavorsResponse { + this := GetFlavorsResponse{} + this.Flavors = flavors + this.Pagination = pagination + return &this +} + +// NewGetFlavorsResponseWithDefaults instantiates a new GetFlavorsResponse 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 NewGetFlavorsResponseWithDefaults() *GetFlavorsResponse { + this := GetFlavorsResponse{} + return &this +} + +// GetFlavors returns the Flavors field value +func (o *GetFlavorsResponse) GetFlavors() []ListFlavors { + if o == nil { + var ret []ListFlavors + return ret + } + + return o.Flavors +} + +// GetFlavorsOk returns a tuple with the Flavors field value +// and a boolean to check if the value has been set. +func (o *GetFlavorsResponse) GetFlavorsOk() ([]ListFlavors, bool) { + if o == nil { + return nil, false + } + return o.Flavors, true +} + +// SetFlavors sets field value +func (o *GetFlavorsResponse) SetFlavors(v []ListFlavors) { + o.Flavors = v +} + +// GetPagination returns the Pagination field value +func (o *GetFlavorsResponse) GetPagination() Pagination { + if o == nil { + var ret Pagination + return ret + } + + return o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value +// and a boolean to check if the value has been set. +func (o *GetFlavorsResponse) GetPaginationOk() (*Pagination, bool) { + if o == nil { + return nil, false + } + return &o.Pagination, true +} + +// SetPagination sets field value +func (o *GetFlavorsResponse) SetPagination(v Pagination) { + o.Pagination = v +} + +func (o GetFlavorsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetFlavorsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["flavors"] = o.Flavors + toSerialize["pagination"] = o.Pagination + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetFlavorsResponse) 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{ + "flavors", + "pagination", + } + + 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) + } + } + + varGetFlavorsResponse := _GetFlavorsResponse{} + + err = json.Unmarshal(data, &varGetFlavorsResponse) + + if err != nil { + return err + } + + *o = GetFlavorsResponse(varGetFlavorsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "flavors") + delete(additionalProperties, "pagination") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetFlavorsResponse struct { + value *GetFlavorsResponse + isSet bool +} + +func (v NullableGetFlavorsResponse) Get() *GetFlavorsResponse { + return v.value +} + +func (v *NullableGetFlavorsResponse) Set(val *GetFlavorsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetFlavorsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetFlavorsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetFlavorsResponse(val *GetFlavorsResponse) *NullableGetFlavorsResponse { + return &NullableGetFlavorsResponse{value: val, isSet: true} +} + +func (v NullableGetFlavorsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetFlavorsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_get_instance_response.go b/services/postgresflex/v3beta1api/model_get_instance_response.go new file mode 100644 index 000000000..46a60247a --- /dev/null +++ b/services/postgresflex/v3beta1api/model_get_instance_response.go @@ -0,0 +1,579 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetInstanceResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetInstanceResponse{} + +// GetInstanceResponse struct for GetInstanceResponse +type GetInstanceResponse struct { + // List of IPV4 cidr. + Acl []string `json:"acl,omitempty"` + // The schedule for when the database backup will be created. Currently, ONLY daily schedules are supported (every 24 hours). The schedule is written as a cron schedule. + BackupSchedule string `json:"backupSchedule"` + ConnectionInfo InstanceConnectionInfo `json:"connectionInfo"` + Encryption *InstanceEncryption `json:"encryption,omitempty"` + // The id of the instance flavor. + FlavorId string `json:"flavorId"` + // The ID of the instance. + Id string `json:"id"` + // Whether the instance can be deleted or not. + IsDeletable bool `json:"isDeletable"` + // Key-value pairs, 63 characters max, begin and end with an alphanumerical character, may contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character. Max 64 labels Regex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$ Regex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$ The stackit- prefix is reserved and cannot be used for Keys. + Labels *map[string]string `json:"labels,omitempty"` + // The name of the instance. + Name string `json:"name"` + Network InstanceNetwork `json:"network"` + // How long backups are retained. The value can only be between 32 and 90 days. + RetentionDays NullableInt32 `json:"retentionDays"` + State State `json:"state"` + Storage Storage `json:"storage"` + // The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3beta1#tag/Version) for supported version parameters. + Version string `json:"version"` + AdditionalProperties map[string]interface{} +} + +type _GetInstanceResponse GetInstanceResponse + +// NewGetInstanceResponse instantiates a new GetInstanceResponse 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 NewGetInstanceResponse(backupSchedule string, connectionInfo InstanceConnectionInfo, flavorId string, id string, isDeletable bool, name string, network InstanceNetwork, retentionDays NullableInt32, state State, storage Storage, version string) *GetInstanceResponse { + this := GetInstanceResponse{} + this.BackupSchedule = backupSchedule + this.ConnectionInfo = connectionInfo + this.FlavorId = flavorId + this.Id = id + this.IsDeletable = isDeletable + this.Name = name + this.Network = network + this.RetentionDays = retentionDays + this.State = state + this.Storage = storage + this.Version = version + return &this +} + +// NewGetInstanceResponseWithDefaults instantiates a new GetInstanceResponse 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 NewGetInstanceResponseWithDefaults() *GetInstanceResponse { + this := GetInstanceResponse{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *GetInstanceResponse) GetAcl() []string { + if o == nil || IsNil(o.Acl) { + var ret []string + return ret + } + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetAclOk() ([]string, bool) { + if o == nil || IsNil(o.Acl) { + return nil, false + } + return o.Acl, true +} + +// HasAcl returns a boolean if a field has been set. +func (o *GetInstanceResponse) HasAcl() bool { + if o != nil && !IsNil(o.Acl) { + return true + } + + return false +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *GetInstanceResponse) SetAcl(v []string) { + o.Acl = v +} + +// GetBackupSchedule returns the BackupSchedule field value +func (o *GetInstanceResponse) GetBackupSchedule() string { + if o == nil { + var ret string + return ret + } + + return o.BackupSchedule +} + +// GetBackupScheduleOk returns a tuple with the BackupSchedule field value +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetBackupScheduleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BackupSchedule, true +} + +// SetBackupSchedule sets field value +func (o *GetInstanceResponse) SetBackupSchedule(v string) { + o.BackupSchedule = v +} + +// GetConnectionInfo returns the ConnectionInfo field value +func (o *GetInstanceResponse) GetConnectionInfo() InstanceConnectionInfo { + if o == nil { + var ret InstanceConnectionInfo + return ret + } + + return o.ConnectionInfo +} + +// GetConnectionInfoOk returns a tuple with the ConnectionInfo field value +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetConnectionInfoOk() (*InstanceConnectionInfo, bool) { + if o == nil { + return nil, false + } + return &o.ConnectionInfo, true +} + +// SetConnectionInfo sets field value +func (o *GetInstanceResponse) SetConnectionInfo(v InstanceConnectionInfo) { + o.ConnectionInfo = v +} + +// GetEncryption returns the Encryption field value if set, zero value otherwise. +func (o *GetInstanceResponse) GetEncryption() InstanceEncryption { + if o == nil || IsNil(o.Encryption) { + var ret InstanceEncryption + return ret + } + return *o.Encryption +} + +// GetEncryptionOk returns a tuple with the Encryption field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetEncryptionOk() (*InstanceEncryption, bool) { + if o == nil || IsNil(o.Encryption) { + return nil, false + } + return o.Encryption, true +} + +// HasEncryption returns a boolean if a field has been set. +func (o *GetInstanceResponse) HasEncryption() bool { + if o != nil && !IsNil(o.Encryption) { + return true + } + + return false +} + +// SetEncryption gets a reference to the given InstanceEncryption and assigns it to the Encryption field. +func (o *GetInstanceResponse) SetEncryption(v InstanceEncryption) { + o.Encryption = &v +} + +// GetFlavorId returns the FlavorId field value +func (o *GetInstanceResponse) GetFlavorId() string { + if o == nil { + var ret string + return ret + } + + return o.FlavorId +} + +// GetFlavorIdOk returns a tuple with the FlavorId field value +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetFlavorIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FlavorId, true +} + +// SetFlavorId sets field value +func (o *GetInstanceResponse) SetFlavorId(v string) { + o.FlavorId = v +} + +// GetId returns the Id field value +func (o *GetInstanceResponse) 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 *GetInstanceResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *GetInstanceResponse) SetId(v string) { + o.Id = v +} + +// GetIsDeletable returns the IsDeletable field value +func (o *GetInstanceResponse) GetIsDeletable() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsDeletable +} + +// GetIsDeletableOk returns a tuple with the IsDeletable field value +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetIsDeletableOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsDeletable, true +} + +// SetIsDeletable sets field value +func (o *GetInstanceResponse) SetIsDeletable(v bool) { + o.IsDeletable = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *GetInstanceResponse) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *GetInstanceResponse) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *GetInstanceResponse) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value +func (o *GetInstanceResponse) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *GetInstanceResponse) SetName(v string) { + o.Name = v +} + +// GetNetwork returns the Network field value +func (o *GetInstanceResponse) GetNetwork() InstanceNetwork { + if o == nil { + var ret InstanceNetwork + return ret + } + + return o.Network +} + +// GetNetworkOk returns a tuple with the Network field value +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetNetworkOk() (*InstanceNetwork, bool) { + if o == nil { + return nil, false + } + return &o.Network, true +} + +// SetNetwork sets field value +func (o *GetInstanceResponse) SetNetwork(v InstanceNetwork) { + o.Network = v +} + +// GetRetentionDays returns the RetentionDays field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *GetInstanceResponse) GetRetentionDays() int32 { + if o == nil || o.RetentionDays.Get() == nil { + var ret int32 + return ret + } + + return *o.RetentionDays.Get() +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GetInstanceResponse) GetRetentionDaysOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.RetentionDays.Get(), o.RetentionDays.IsSet() +} + +// SetRetentionDays sets field value +func (o *GetInstanceResponse) SetRetentionDays(v int32) { + o.RetentionDays.Set(&v) +} + +// GetState returns the State field value +func (o *GetInstanceResponse) GetState() State { + if o == nil { + var ret State + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetStateOk() (*State, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *GetInstanceResponse) SetState(v State) { + o.State = v +} + +// GetStorage returns the Storage field value +func (o *GetInstanceResponse) GetStorage() Storage { + if o == nil { + var ret Storage + return ret + } + + return o.Storage +} + +// GetStorageOk returns a tuple with the Storage field value +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetStorageOk() (*Storage, bool) { + if o == nil { + return nil, false + } + return &o.Storage, true +} + +// SetStorage sets field value +func (o *GetInstanceResponse) SetStorage(v Storage) { + o.Storage = v +} + +// GetVersion returns the Version field value +func (o *GetInstanceResponse) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *GetInstanceResponse) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *GetInstanceResponse) SetVersion(v string) { + o.Version = v +} + +func (o GetInstanceResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetInstanceResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Acl) { + toSerialize["acl"] = o.Acl + } + toSerialize["backupSchedule"] = o.BackupSchedule + toSerialize["connectionInfo"] = o.ConnectionInfo + if !IsNil(o.Encryption) { + toSerialize["encryption"] = o.Encryption + } + toSerialize["flavorId"] = o.FlavorId + toSerialize["id"] = o.Id + toSerialize["isDeletable"] = o.IsDeletable + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + toSerialize["network"] = o.Network + toSerialize["retentionDays"] = o.RetentionDays.Get() + toSerialize["state"] = o.State + toSerialize["storage"] = o.Storage + toSerialize["version"] = o.Version + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetInstanceResponse) 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{ + "backupSchedule", + "connectionInfo", + "flavorId", + "id", + "isDeletable", + "name", + "network", + "retentionDays", + "state", + "storage", + "version", + } + + 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) + } + } + + varGetInstanceResponse := _GetInstanceResponse{} + + err = json.Unmarshal(data, &varGetInstanceResponse) + + if err != nil { + return err + } + + *o = GetInstanceResponse(varGetInstanceResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "acl") + delete(additionalProperties, "backupSchedule") + delete(additionalProperties, "connectionInfo") + delete(additionalProperties, "encryption") + delete(additionalProperties, "flavorId") + delete(additionalProperties, "id") + delete(additionalProperties, "isDeletable") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "network") + delete(additionalProperties, "retentionDays") + delete(additionalProperties, "state") + delete(additionalProperties, "storage") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetInstanceResponse struct { + value *GetInstanceResponse + isSet bool +} + +func (v NullableGetInstanceResponse) Get() *GetInstanceResponse { + return v.value +} + +func (v *NullableGetInstanceResponse) Set(val *GetInstanceResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetInstanceResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetInstanceResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetInstanceResponse(val *GetInstanceResponse) *NullableGetInstanceResponse { + return &NullableGetInstanceResponse{value: val, isSet: true} +} + +func (v NullableGetInstanceResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetInstanceResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_get_user_response.go b/services/postgresflex/v3beta1api/model_get_user_response.go new file mode 100644 index 000000000..c8fc74201 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_get_user_response.go @@ -0,0 +1,258 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetUserResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetUserResponse{} + +// GetUserResponse struct for GetUserResponse +type GetUserResponse struct { + // The ID of the user. + Id int32 `json:"id"` + // The name of the user. + Name string `json:"name"` + // A list of user roles. + Roles []string `json:"roles"` + // The current state of the user. + State string `json:"state"` + AdditionalProperties map[string]interface{} +} + +type _GetUserResponse GetUserResponse + +// NewGetUserResponse instantiates a new GetUserResponse 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 NewGetUserResponse(id int32, name string, roles []string, state string) *GetUserResponse { + this := GetUserResponse{} + this.Id = id + this.Name = name + this.Roles = roles + this.State = state + return &this +} + +// NewGetUserResponseWithDefaults instantiates a new GetUserResponse 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 NewGetUserResponseWithDefaults() *GetUserResponse { + this := GetUserResponse{} + return &this +} + +// GetId returns the Id field value +func (o *GetUserResponse) GetId() int32 { + if o == nil { + var ret int32 + 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 *GetUserResponse) GetIdOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *GetUserResponse) SetId(v int32) { + o.Id = v +} + +// GetName returns the Name field value +func (o *GetUserResponse) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *GetUserResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *GetUserResponse) SetName(v string) { + o.Name = v +} + +// GetRoles returns the Roles field value +func (o *GetUserResponse) GetRoles() []string { + if o == nil { + var ret []string + return ret + } + + return o.Roles +} + +// GetRolesOk returns a tuple with the Roles field value +// and a boolean to check if the value has been set. +func (o *GetUserResponse) GetRolesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Roles, true +} + +// SetRoles sets field value +func (o *GetUserResponse) SetRoles(v []string) { + o.Roles = v +} + +// GetState returns the State field value +func (o *GetUserResponse) GetState() string { + if o == nil { + var ret string + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *GetUserResponse) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *GetUserResponse) SetState(v string) { + o.State = v +} + +func (o GetUserResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetUserResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["roles"] = o.Roles + toSerialize["state"] = o.State + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetUserResponse) 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{ + "id", + "name", + "roles", + "state", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varGetUserResponse := _GetUserResponse{} + + err = json.Unmarshal(data, &varGetUserResponse) + + if err != nil { + return err + } + + *o = GetUserResponse(varGetUserResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "roles") + delete(additionalProperties, "state") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetUserResponse struct { + value *GetUserResponse + isSet bool +} + +func (v NullableGetUserResponse) Get() *GetUserResponse { + return v.value +} + +func (v *NullableGetUserResponse) Set(val *GetUserResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetUserResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetUserResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetUserResponse(val *GetUserResponse) *NullableGetUserResponse { + return &NullableGetUserResponse{value: val, isSet: true} +} + +func (v NullableGetUserResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetUserResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_get_versions_response.go b/services/postgresflex/v3beta1api/model_get_versions_response.go new file mode 100644 index 000000000..a3bfbb356 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_get_versions_response.go @@ -0,0 +1,168 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the GetVersionsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetVersionsResponse{} + +// GetVersionsResponse struct for GetVersionsResponse +type GetVersionsResponse struct { + // A list containing available postgres versions. + Versions []Version `json:"versions"` + AdditionalProperties map[string]interface{} +} + +type _GetVersionsResponse GetVersionsResponse + +// NewGetVersionsResponse instantiates a new GetVersionsResponse 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 NewGetVersionsResponse(versions []Version) *GetVersionsResponse { + this := GetVersionsResponse{} + this.Versions = versions + return &this +} + +// NewGetVersionsResponseWithDefaults instantiates a new GetVersionsResponse 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 NewGetVersionsResponseWithDefaults() *GetVersionsResponse { + this := GetVersionsResponse{} + return &this +} + +// GetVersions returns the Versions field value +func (o *GetVersionsResponse) GetVersions() []Version { + if o == nil { + var ret []Version + return ret + } + + return o.Versions +} + +// GetVersionsOk returns a tuple with the Versions field value +// and a boolean to check if the value has been set. +func (o *GetVersionsResponse) GetVersionsOk() ([]Version, bool) { + if o == nil { + return nil, false + } + return o.Versions, true +} + +// SetVersions sets field value +func (o *GetVersionsResponse) SetVersions(v []Version) { + o.Versions = v +} + +func (o GetVersionsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GetVersionsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["versions"] = o.Versions + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GetVersionsResponse) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "versions", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varGetVersionsResponse := _GetVersionsResponse{} + + err = json.Unmarshal(data, &varGetVersionsResponse) + + if err != nil { + return err + } + + *o = GetVersionsResponse(varGetVersionsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "versions") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGetVersionsResponse struct { + value *GetVersionsResponse + isSet bool +} + +func (v NullableGetVersionsResponse) Get() *GetVersionsResponse { + return v.value +} + +func (v *NullableGetVersionsResponse) Set(val *GetVersionsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetVersionsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetVersionsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetVersionsResponse(val *GetVersionsResponse) *NullableGetVersionsResponse { + return &NullableGetVersionsResponse{value: val, isSet: true} +} + +func (v NullableGetVersionsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetVersionsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_instance_connection_info.go b/services/postgresflex/v3beta1api/model_instance_connection_info.go new file mode 100644 index 000000000..f7d9a0a31 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_instance_connection_info.go @@ -0,0 +1,167 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the InstanceConnectionInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceConnectionInfo{} + +// InstanceConnectionInfo The connection information of the instance +type InstanceConnectionInfo struct { + Write InstanceConnectionInfoWrite `json:"write"` + AdditionalProperties map[string]interface{} +} + +type _InstanceConnectionInfo InstanceConnectionInfo + +// NewInstanceConnectionInfo instantiates a new InstanceConnectionInfo 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 NewInstanceConnectionInfo(write InstanceConnectionInfoWrite) *InstanceConnectionInfo { + this := InstanceConnectionInfo{} + this.Write = write + return &this +} + +// NewInstanceConnectionInfoWithDefaults instantiates a new InstanceConnectionInfo 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 NewInstanceConnectionInfoWithDefaults() *InstanceConnectionInfo { + this := InstanceConnectionInfo{} + return &this +} + +// GetWrite returns the Write field value +func (o *InstanceConnectionInfo) GetWrite() InstanceConnectionInfoWrite { + if o == nil { + var ret InstanceConnectionInfoWrite + return ret + } + + return o.Write +} + +// GetWriteOk returns a tuple with the Write field value +// and a boolean to check if the value has been set. +func (o *InstanceConnectionInfo) GetWriteOk() (*InstanceConnectionInfoWrite, bool) { + if o == nil { + return nil, false + } + return &o.Write, true +} + +// SetWrite sets field value +func (o *InstanceConnectionInfo) SetWrite(v InstanceConnectionInfoWrite) { + o.Write = v +} + +func (o InstanceConnectionInfo) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstanceConnectionInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["write"] = o.Write + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstanceConnectionInfo) 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{ + "write", + } + + 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) + } + } + + varInstanceConnectionInfo := _InstanceConnectionInfo{} + + err = json.Unmarshal(data, &varInstanceConnectionInfo) + + if err != nil { + return err + } + + *o = InstanceConnectionInfo(varInstanceConnectionInfo) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "write") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstanceConnectionInfo struct { + value *InstanceConnectionInfo + isSet bool +} + +func (v NullableInstanceConnectionInfo) Get() *InstanceConnectionInfo { + return v.value +} + +func (v *NullableInstanceConnectionInfo) Set(val *InstanceConnectionInfo) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceConnectionInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceConnectionInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceConnectionInfo(val *InstanceConnectionInfo) *NullableInstanceConnectionInfo { + return &NullableInstanceConnectionInfo{value: val, isSet: true} +} + +func (v NullableInstanceConnectionInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceConnectionInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_instance_connection_info_write.go b/services/postgresflex/v3beta1api/model_instance_connection_info_write.go new file mode 100644 index 000000000..af64cd1e3 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_instance_connection_info_write.go @@ -0,0 +1,198 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the InstanceConnectionInfoWrite type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceConnectionInfoWrite{} + +// InstanceConnectionInfoWrite The DNS name and port in the instance overview +type InstanceConnectionInfoWrite struct { + // The host of the instance. + Host string `json:"host"` + // The port of the instance. + Port int32 `json:"port"` + AdditionalProperties map[string]interface{} +} + +type _InstanceConnectionInfoWrite InstanceConnectionInfoWrite + +// NewInstanceConnectionInfoWrite instantiates a new InstanceConnectionInfoWrite 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 NewInstanceConnectionInfoWrite(host string, port int32) *InstanceConnectionInfoWrite { + this := InstanceConnectionInfoWrite{} + this.Host = host + this.Port = port + return &this +} + +// NewInstanceConnectionInfoWriteWithDefaults instantiates a new InstanceConnectionInfoWrite 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 NewInstanceConnectionInfoWriteWithDefaults() *InstanceConnectionInfoWrite { + this := InstanceConnectionInfoWrite{} + return &this +} + +// GetHost returns the Host field value +func (o *InstanceConnectionInfoWrite) GetHost() string { + if o == nil { + var ret string + return ret + } + + return o.Host +} + +// GetHostOk returns a tuple with the Host field value +// and a boolean to check if the value has been set. +func (o *InstanceConnectionInfoWrite) GetHostOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Host, true +} + +// SetHost sets field value +func (o *InstanceConnectionInfoWrite) SetHost(v string) { + o.Host = v +} + +// GetPort returns the Port field value +func (o *InstanceConnectionInfoWrite) GetPort() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Port +} + +// GetPortOk returns a tuple with the Port field value +// and a boolean to check if the value has been set. +func (o *InstanceConnectionInfoWrite) GetPortOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Port, true +} + +// SetPort sets field value +func (o *InstanceConnectionInfoWrite) SetPort(v int32) { + o.Port = v +} + +func (o InstanceConnectionInfoWrite) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstanceConnectionInfoWrite) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["host"] = o.Host + toSerialize["port"] = o.Port + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstanceConnectionInfoWrite) 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{ + "host", + "port", + } + + 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) + } + } + + varInstanceConnectionInfoWrite := _InstanceConnectionInfoWrite{} + + err = json.Unmarshal(data, &varInstanceConnectionInfoWrite) + + if err != nil { + return err + } + + *o = InstanceConnectionInfoWrite(varInstanceConnectionInfoWrite) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "host") + delete(additionalProperties, "port") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstanceConnectionInfoWrite struct { + value *InstanceConnectionInfoWrite + isSet bool +} + +func (v NullableInstanceConnectionInfoWrite) Get() *InstanceConnectionInfoWrite { + return v.value +} + +func (v *NullableInstanceConnectionInfoWrite) Set(val *InstanceConnectionInfoWrite) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceConnectionInfoWrite) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceConnectionInfoWrite) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceConnectionInfoWrite(val *InstanceConnectionInfoWrite) *NullableInstanceConnectionInfoWrite { + return &NullableInstanceConnectionInfoWrite{value: val, isSet: true} +} + +func (v NullableInstanceConnectionInfoWrite) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceConnectionInfoWrite) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_instance_encryption.go b/services/postgresflex/v3beta1api/model_instance_encryption.go new file mode 100644 index 000000000..dce518b70 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_instance_encryption.go @@ -0,0 +1,257 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the InstanceEncryption type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceEncryption{} + +// InstanceEncryption The configuration for instance's volume and backup storage encryption. ⚠️ **Note:** This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected. +type InstanceEncryption struct { + // The encryption-key key identifier + KekKeyId string `json:"kekKeyId"` + // The encryption-key keyring identifier + KekKeyRingId string `json:"kekKeyRingId"` + // The encryption-key version + KekKeyVersion string `json:"kekKeyVersion"` + ServiceAccount string `json:"serviceAccount"` + AdditionalProperties map[string]interface{} +} + +type _InstanceEncryption InstanceEncryption + +// NewInstanceEncryption instantiates a new InstanceEncryption 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 NewInstanceEncryption(kekKeyId string, kekKeyRingId string, kekKeyVersion string, serviceAccount string) *InstanceEncryption { + this := InstanceEncryption{} + this.KekKeyId = kekKeyId + this.KekKeyRingId = kekKeyRingId + this.KekKeyVersion = kekKeyVersion + this.ServiceAccount = serviceAccount + return &this +} + +// NewInstanceEncryptionWithDefaults instantiates a new InstanceEncryption 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 NewInstanceEncryptionWithDefaults() *InstanceEncryption { + this := InstanceEncryption{} + return &this +} + +// GetKekKeyId returns the KekKeyId field value +func (o *InstanceEncryption) GetKekKeyId() string { + if o == nil { + var ret string + return ret + } + + return o.KekKeyId +} + +// GetKekKeyIdOk returns a tuple with the KekKeyId field value +// and a boolean to check if the value has been set. +func (o *InstanceEncryption) GetKekKeyIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.KekKeyId, true +} + +// SetKekKeyId sets field value +func (o *InstanceEncryption) SetKekKeyId(v string) { + o.KekKeyId = v +} + +// GetKekKeyRingId returns the KekKeyRingId field value +func (o *InstanceEncryption) GetKekKeyRingId() string { + if o == nil { + var ret string + return ret + } + + return o.KekKeyRingId +} + +// GetKekKeyRingIdOk returns a tuple with the KekKeyRingId field value +// and a boolean to check if the value has been set. +func (o *InstanceEncryption) GetKekKeyRingIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.KekKeyRingId, true +} + +// SetKekKeyRingId sets field value +func (o *InstanceEncryption) SetKekKeyRingId(v string) { + o.KekKeyRingId = v +} + +// GetKekKeyVersion returns the KekKeyVersion field value +func (o *InstanceEncryption) GetKekKeyVersion() string { + if o == nil { + var ret string + return ret + } + + return o.KekKeyVersion +} + +// GetKekKeyVersionOk returns a tuple with the KekKeyVersion field value +// and a boolean to check if the value has been set. +func (o *InstanceEncryption) GetKekKeyVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.KekKeyVersion, true +} + +// SetKekKeyVersion sets field value +func (o *InstanceEncryption) SetKekKeyVersion(v string) { + o.KekKeyVersion = v +} + +// GetServiceAccount returns the ServiceAccount field value +func (o *InstanceEncryption) GetServiceAccount() string { + if o == nil { + var ret string + return ret + } + + return o.ServiceAccount +} + +// GetServiceAccountOk returns a tuple with the ServiceAccount field value +// and a boolean to check if the value has been set. +func (o *InstanceEncryption) GetServiceAccountOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ServiceAccount, true +} + +// SetServiceAccount sets field value +func (o *InstanceEncryption) SetServiceAccount(v string) { + o.ServiceAccount = v +} + +func (o InstanceEncryption) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstanceEncryption) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["kekKeyId"] = o.KekKeyId + toSerialize["kekKeyRingId"] = o.KekKeyRingId + toSerialize["kekKeyVersion"] = o.KekKeyVersion + toSerialize["serviceAccount"] = o.ServiceAccount + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstanceEncryption) 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{ + "kekKeyId", + "kekKeyRingId", + "kekKeyVersion", + "serviceAccount", + } + + 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) + } + } + + varInstanceEncryption := _InstanceEncryption{} + + err = json.Unmarshal(data, &varInstanceEncryption) + + if err != nil { + return err + } + + *o = InstanceEncryption(varInstanceEncryption) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "kekKeyId") + delete(additionalProperties, "kekKeyRingId") + delete(additionalProperties, "kekKeyVersion") + delete(additionalProperties, "serviceAccount") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstanceEncryption struct { + value *InstanceEncryption + isSet bool +} + +func (v NullableInstanceEncryption) Get() *InstanceEncryption { + return v.value +} + +func (v *NullableInstanceEncryption) Set(val *InstanceEncryption) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceEncryption) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceEncryption) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceEncryption(val *InstanceEncryption) *NullableInstanceEncryption { + return &NullableInstanceEncryption{value: val, isSet: true} +} + +func (v NullableInstanceEncryption) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceEncryption) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_instance_network.go b/services/postgresflex/v3beta1api/model_instance_network.go new file mode 100644 index 000000000..c4746e5b5 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_instance_network.go @@ -0,0 +1,283 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the InstanceNetwork type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceNetwork{} + +// InstanceNetwork The access configuration of the instance +type InstanceNetwork struct { + AccessScope *InstanceNetworkAccessScope `json:"accessScope,omitempty"` + // List of IPV4 cidr. + Acl []string `json:"acl"` + InstanceAddress *string `json:"instanceAddress,omitempty"` + RouterAddress *string `json:"routerAddress,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InstanceNetwork InstanceNetwork + +// NewInstanceNetwork instantiates a new InstanceNetwork 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 NewInstanceNetwork(acl []string) *InstanceNetwork { + this := InstanceNetwork{} + var accessScope InstanceNetworkAccessScope = INSTANCENETWORKACCESSSCOPE_PUBLIC + this.AccessScope = &accessScope + this.Acl = acl + return &this +} + +// NewInstanceNetworkWithDefaults instantiates a new InstanceNetwork 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 NewInstanceNetworkWithDefaults() *InstanceNetwork { + this := InstanceNetwork{} + var accessScope InstanceNetworkAccessScope = INSTANCENETWORKACCESSSCOPE_PUBLIC + this.AccessScope = &accessScope + return &this +} + +// GetAccessScope returns the AccessScope field value if set, zero value otherwise. +func (o *InstanceNetwork) GetAccessScope() InstanceNetworkAccessScope { + if o == nil || IsNil(o.AccessScope) { + var ret InstanceNetworkAccessScope + return ret + } + return *o.AccessScope +} + +// GetAccessScopeOk returns a tuple with the AccessScope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceNetwork) GetAccessScopeOk() (*InstanceNetworkAccessScope, bool) { + if o == nil || IsNil(o.AccessScope) { + return nil, false + } + return o.AccessScope, true +} + +// HasAccessScope returns a boolean if a field has been set. +func (o *InstanceNetwork) HasAccessScope() bool { + if o != nil && !IsNil(o.AccessScope) { + return true + } + + return false +} + +// SetAccessScope gets a reference to the given InstanceNetworkAccessScope and assigns it to the AccessScope field. +func (o *InstanceNetwork) SetAccessScope(v InstanceNetworkAccessScope) { + o.AccessScope = &v +} + +// GetAcl returns the Acl field value +func (o *InstanceNetwork) GetAcl() []string { + if o == nil { + var ret []string + return ret + } + + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value +// and a boolean to check if the value has been set. +func (o *InstanceNetwork) GetAclOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Acl, true +} + +// SetAcl sets field value +func (o *InstanceNetwork) SetAcl(v []string) { + o.Acl = v +} + +// GetInstanceAddress returns the InstanceAddress field value if set, zero value otherwise. +func (o *InstanceNetwork) GetInstanceAddress() string { + if o == nil || IsNil(o.InstanceAddress) { + var ret string + return ret + } + return *o.InstanceAddress +} + +// GetInstanceAddressOk returns a tuple with the InstanceAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceNetwork) GetInstanceAddressOk() (*string, bool) { + if o == nil || IsNil(o.InstanceAddress) { + return nil, false + } + return o.InstanceAddress, true +} + +// HasInstanceAddress returns a boolean if a field has been set. +func (o *InstanceNetwork) HasInstanceAddress() bool { + if o != nil && !IsNil(o.InstanceAddress) { + return true + } + + return false +} + +// SetInstanceAddress gets a reference to the given string and assigns it to the InstanceAddress field. +func (o *InstanceNetwork) SetInstanceAddress(v string) { + o.InstanceAddress = &v +} + +// GetRouterAddress returns the RouterAddress field value if set, zero value otherwise. +func (o *InstanceNetwork) GetRouterAddress() string { + if o == nil || IsNil(o.RouterAddress) { + var ret string + return ret + } + return *o.RouterAddress +} + +// GetRouterAddressOk returns a tuple with the RouterAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceNetwork) GetRouterAddressOk() (*string, bool) { + if o == nil || IsNil(o.RouterAddress) { + return nil, false + } + return o.RouterAddress, true +} + +// HasRouterAddress returns a boolean if a field has been set. +func (o *InstanceNetwork) HasRouterAddress() bool { + if o != nil && !IsNil(o.RouterAddress) { + return true + } + + return false +} + +// SetRouterAddress gets a reference to the given string and assigns it to the RouterAddress field. +func (o *InstanceNetwork) SetRouterAddress(v string) { + o.RouterAddress = &v +} + +func (o InstanceNetwork) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstanceNetwork) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AccessScope) { + toSerialize["accessScope"] = o.AccessScope + } + toSerialize["acl"] = o.Acl + if !IsNil(o.InstanceAddress) { + toSerialize["instanceAddress"] = o.InstanceAddress + } + if !IsNil(o.RouterAddress) { + toSerialize["routerAddress"] = o.RouterAddress + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstanceNetwork) 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{ + "acl", + } + + 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) + } + } + + varInstanceNetwork := _InstanceNetwork{} + + err = json.Unmarshal(data, &varInstanceNetwork) + + if err != nil { + return err + } + + *o = InstanceNetwork(varInstanceNetwork) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "accessScope") + delete(additionalProperties, "acl") + delete(additionalProperties, "instanceAddress") + delete(additionalProperties, "routerAddress") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstanceNetwork struct { + value *InstanceNetwork + isSet bool +} + +func (v NullableInstanceNetwork) Get() *InstanceNetwork { + return v.value +} + +func (v *NullableInstanceNetwork) Set(val *InstanceNetwork) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceNetwork(val *InstanceNetwork) *NullableInstanceNetwork { + return &NullableInstanceNetwork{value: val, isSet: true} +} + +func (v NullableInstanceNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_instance_network_access_scope.go b/services/postgresflex/v3beta1api/model_instance_network_access_scope.go new file mode 100644 index 000000000..55c0c53cc --- /dev/null +++ b/services/postgresflex/v3beta1api/model_instance_network_access_scope.go @@ -0,0 +1,114 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// InstanceNetworkAccessScope The access scope of the instance. It defines if the instance is public or airgapped. +type InstanceNetworkAccessScope string + +// List of instance.network.accessScope +const ( + INSTANCENETWORKACCESSSCOPE_PUBLIC InstanceNetworkAccessScope = "PUBLIC" + INSTANCENETWORKACCESSSCOPE_SNA InstanceNetworkAccessScope = "SNA" + INSTANCENETWORKACCESSSCOPE_UNKNOWN_DEFAULT_OPEN_API InstanceNetworkAccessScope = "unknown_default_open_api" +) + +// All allowed values of InstanceNetworkAccessScope enum +var AllowedInstanceNetworkAccessScopeEnumValues = []InstanceNetworkAccessScope{ + "PUBLIC", + "SNA", + "unknown_default_open_api", +} + +func (v *InstanceNetworkAccessScope) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := InstanceNetworkAccessScope(value) + for _, existing := range AllowedInstanceNetworkAccessScopeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = INSTANCENETWORKACCESSSCOPE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewInstanceNetworkAccessScopeFromValue returns a pointer to a valid InstanceNetworkAccessScope +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceNetworkAccessScopeFromValue(v string) (*InstanceNetworkAccessScope, error) { + ev := InstanceNetworkAccessScope(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceNetworkAccessScope: valid values are %v", v, AllowedInstanceNetworkAccessScopeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceNetworkAccessScope) IsValid() bool { + for _, existing := range AllowedInstanceNetworkAccessScopeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to instance.network.accessScope value +func (v InstanceNetworkAccessScope) Ptr() *InstanceNetworkAccessScope { + return &v +} + +type NullableInstanceNetworkAccessScope struct { + value *InstanceNetworkAccessScope + isSet bool +} + +func (v NullableInstanceNetworkAccessScope) Get() *InstanceNetworkAccessScope { + return v.value +} + +func (v *NullableInstanceNetworkAccessScope) Set(val *InstanceNetworkAccessScope) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceNetworkAccessScope) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceNetworkAccessScope) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceNetworkAccessScope(val *InstanceNetworkAccessScope) *NullableInstanceNetworkAccessScope { + return &NullableInstanceNetworkAccessScope{value: val, isSet: true} +} + +func (v NullableInstanceNetworkAccessScope) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceNetworkAccessScope) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_instance_network_create.go b/services/postgresflex/v3beta1api/model_instance_network_create.go new file mode 100644 index 000000000..fd6e2f8b8 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_instance_network_create.go @@ -0,0 +1,209 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the InstanceNetworkCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceNetworkCreate{} + +// InstanceNetworkCreate The access configuration of the instance +type InstanceNetworkCreate struct { + AccessScope *InstanceNetworkAccessScope `json:"accessScope,omitempty"` + // List of IPV4 cidr. + Acl []string `json:"acl"` + AdditionalProperties map[string]interface{} +} + +type _InstanceNetworkCreate InstanceNetworkCreate + +// NewInstanceNetworkCreate instantiates a new InstanceNetworkCreate 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 NewInstanceNetworkCreate(acl []string) *InstanceNetworkCreate { + this := InstanceNetworkCreate{} + var accessScope InstanceNetworkAccessScope = INSTANCENETWORKACCESSSCOPE_PUBLIC + this.AccessScope = &accessScope + this.Acl = acl + return &this +} + +// NewInstanceNetworkCreateWithDefaults instantiates a new InstanceNetworkCreate 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 NewInstanceNetworkCreateWithDefaults() *InstanceNetworkCreate { + this := InstanceNetworkCreate{} + var accessScope InstanceNetworkAccessScope = INSTANCENETWORKACCESSSCOPE_PUBLIC + this.AccessScope = &accessScope + return &this +} + +// GetAccessScope returns the AccessScope field value if set, zero value otherwise. +func (o *InstanceNetworkCreate) GetAccessScope() InstanceNetworkAccessScope { + if o == nil || IsNil(o.AccessScope) { + var ret InstanceNetworkAccessScope + return ret + } + return *o.AccessScope +} + +// GetAccessScopeOk returns a tuple with the AccessScope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceNetworkCreate) GetAccessScopeOk() (*InstanceNetworkAccessScope, bool) { + if o == nil || IsNil(o.AccessScope) { + return nil, false + } + return o.AccessScope, true +} + +// HasAccessScope returns a boolean if a field has been set. +func (o *InstanceNetworkCreate) HasAccessScope() bool { + if o != nil && !IsNil(o.AccessScope) { + return true + } + + return false +} + +// SetAccessScope gets a reference to the given InstanceNetworkAccessScope and assigns it to the AccessScope field. +func (o *InstanceNetworkCreate) SetAccessScope(v InstanceNetworkAccessScope) { + o.AccessScope = &v +} + +// GetAcl returns the Acl field value +func (o *InstanceNetworkCreate) GetAcl() []string { + if o == nil { + var ret []string + return ret + } + + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value +// and a boolean to check if the value has been set. +func (o *InstanceNetworkCreate) GetAclOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Acl, true +} + +// SetAcl sets field value +func (o *InstanceNetworkCreate) SetAcl(v []string) { + o.Acl = v +} + +func (o InstanceNetworkCreate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstanceNetworkCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AccessScope) { + toSerialize["accessScope"] = o.AccessScope + } + toSerialize["acl"] = o.Acl + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstanceNetworkCreate) 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{ + "acl", + } + + 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) + } + } + + varInstanceNetworkCreate := _InstanceNetworkCreate{} + + err = json.Unmarshal(data, &varInstanceNetworkCreate) + + if err != nil { + return err + } + + *o = InstanceNetworkCreate(varInstanceNetworkCreate) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "accessScope") + delete(additionalProperties, "acl") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstanceNetworkCreate struct { + value *InstanceNetworkCreate + isSet bool +} + +func (v NullableInstanceNetworkCreate) Get() *InstanceNetworkCreate { + return v.value +} + +func (v *NullableInstanceNetworkCreate) Set(val *InstanceNetworkCreate) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceNetworkCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceNetworkCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceNetworkCreate(val *InstanceNetworkCreate) *NullableInstanceNetworkCreate { + return &NullableInstanceNetworkCreate{value: val, isSet: true} +} + +func (v NullableInstanceNetworkCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceNetworkCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_instance_network_opt.go b/services/postgresflex/v3beta1api/model_instance_network_opt.go new file mode 100644 index 000000000..56eb199c5 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_instance_network_opt.go @@ -0,0 +1,155 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" +) + +// checks if the InstanceNetworkOpt type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceNetworkOpt{} + +// InstanceNetworkOpt The access configuration of the instance +type InstanceNetworkOpt struct { + // List of IPV4 cidr. + Acl []string `json:"acl,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _InstanceNetworkOpt InstanceNetworkOpt + +// NewInstanceNetworkOpt instantiates a new InstanceNetworkOpt 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 NewInstanceNetworkOpt() *InstanceNetworkOpt { + this := InstanceNetworkOpt{} + return &this +} + +// NewInstanceNetworkOptWithDefaults instantiates a new InstanceNetworkOpt 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 NewInstanceNetworkOptWithDefaults() *InstanceNetworkOpt { + this := InstanceNetworkOpt{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *InstanceNetworkOpt) GetAcl() []string { + if o == nil || IsNil(o.Acl) { + var ret []string + return ret + } + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *InstanceNetworkOpt) GetAclOk() ([]string, bool) { + if o == nil || IsNil(o.Acl) { + return nil, false + } + return o.Acl, true +} + +// HasAcl returns a boolean if a field has been set. +func (o *InstanceNetworkOpt) HasAcl() bool { + if o != nil && !IsNil(o.Acl) { + return true + } + + return false +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *InstanceNetworkOpt) SetAcl(v []string) { + o.Acl = v +} + +func (o InstanceNetworkOpt) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstanceNetworkOpt) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Acl) { + toSerialize["acl"] = o.Acl + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstanceNetworkOpt) UnmarshalJSON(data []byte) (err error) { + varInstanceNetworkOpt := _InstanceNetworkOpt{} + + err = json.Unmarshal(data, &varInstanceNetworkOpt) + + if err != nil { + return err + } + + *o = InstanceNetworkOpt(varInstanceNetworkOpt) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "acl") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstanceNetworkOpt struct { + value *InstanceNetworkOpt + isSet bool +} + +func (v NullableInstanceNetworkOpt) Get() *InstanceNetworkOpt { + return v.value +} + +func (v *NullableInstanceNetworkOpt) Set(val *InstanceNetworkOpt) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceNetworkOpt) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceNetworkOpt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceNetworkOpt(val *InstanceNetworkOpt) *NullableInstanceNetworkOpt { + return &NullableInstanceNetworkOpt{value: val, isSet: true} +} + +func (v NullableInstanceNetworkOpt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceNetworkOpt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_instance_network_update.go b/services/postgresflex/v3beta1api/model_instance_network_update.go new file mode 100644 index 000000000..678a6adce --- /dev/null +++ b/services/postgresflex/v3beta1api/model_instance_network_update.go @@ -0,0 +1,168 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the InstanceNetworkUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceNetworkUpdate{} + +// InstanceNetworkUpdate The access configuration of the instance +type InstanceNetworkUpdate struct { + // List of IPV4 cidr. + Acl []string `json:"acl"` + AdditionalProperties map[string]interface{} +} + +type _InstanceNetworkUpdate InstanceNetworkUpdate + +// NewInstanceNetworkUpdate instantiates a new InstanceNetworkUpdate 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 NewInstanceNetworkUpdate(acl []string) *InstanceNetworkUpdate { + this := InstanceNetworkUpdate{} + this.Acl = acl + return &this +} + +// NewInstanceNetworkUpdateWithDefaults instantiates a new InstanceNetworkUpdate 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 NewInstanceNetworkUpdateWithDefaults() *InstanceNetworkUpdate { + this := InstanceNetworkUpdate{} + return &this +} + +// GetAcl returns the Acl field value +func (o *InstanceNetworkUpdate) GetAcl() []string { + if o == nil { + var ret []string + return ret + } + + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value +// and a boolean to check if the value has been set. +func (o *InstanceNetworkUpdate) GetAclOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Acl, true +} + +// SetAcl sets field value +func (o *InstanceNetworkUpdate) SetAcl(v []string) { + o.Acl = v +} + +func (o InstanceNetworkUpdate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstanceNetworkUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["acl"] = o.Acl + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstanceNetworkUpdate) 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{ + "acl", + } + + 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) + } + } + + varInstanceNetworkUpdate := _InstanceNetworkUpdate{} + + err = json.Unmarshal(data, &varInstanceNetworkUpdate) + + if err != nil { + return err + } + + *o = InstanceNetworkUpdate(varInstanceNetworkUpdate) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "acl") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstanceNetworkUpdate struct { + value *InstanceNetworkUpdate + isSet bool +} + +func (v NullableInstanceNetworkUpdate) Get() *InstanceNetworkUpdate { + return v.value +} + +func (v *NullableInstanceNetworkUpdate) Set(val *InstanceNetworkUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceNetworkUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceNetworkUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceNetworkUpdate(val *InstanceNetworkUpdate) *NullableInstanceNetworkUpdate { + return &NullableInstanceNetworkUpdate{value: val, isSet: true} +} + +func (v NullableInstanceNetworkUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceNetworkUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_instance_sort.go b/services/postgresflex/v3beta1api/model_instance_sort.go new file mode 100644 index 000000000..2d9588147 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_instance_sort.go @@ -0,0 +1,126 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// InstanceSort the model 'InstanceSort' +type InstanceSort string + +// List of instance.sort +const ( + INSTANCESORT_ID_DESC InstanceSort = "id.desc" + INSTANCESORT_ID_ASC InstanceSort = "id.asc" + INSTANCESORT_IS_DELETABLE_DESC InstanceSort = "is_deletable.desc" + INSTANCESORT_IS_DELETABLE_ASC InstanceSort = "is_deletable.asc" + INSTANCESORT_NAME_ASC InstanceSort = "name.asc" + INSTANCESORT_NAME_DESC InstanceSort = "name.desc" + INSTANCESORT_STATE_ASC InstanceSort = "state.asc" + INSTANCESORT_STATE_DESC InstanceSort = "state.desc" + INSTANCESORT_UNKNOWN_DEFAULT_OPEN_API InstanceSort = "unknown_default_open_api" +) + +// All allowed values of InstanceSort enum +var AllowedInstanceSortEnumValues = []InstanceSort{ + "id.desc", + "id.asc", + "is_deletable.desc", + "is_deletable.asc", + "name.asc", + "name.desc", + "state.asc", + "state.desc", + "unknown_default_open_api", +} + +func (v *InstanceSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := InstanceSort(value) + for _, existing := range AllowedInstanceSortEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = INSTANCESORT_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewInstanceSortFromValue returns a pointer to a valid InstanceSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewInstanceSortFromValue(v string) (*InstanceSort, error) { + ev := InstanceSort(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for InstanceSort: valid values are %v", v, AllowedInstanceSortEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v InstanceSort) IsValid() bool { + for _, existing := range AllowedInstanceSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to instance.sort value +func (v InstanceSort) Ptr() *InstanceSort { + return &v +} + +type NullableInstanceSort struct { + value *InstanceSort + isSet bool +} + +func (v NullableInstanceSort) Get() *InstanceSort { + return v.value +} + +func (v *NullableInstanceSort) Set(val *InstanceSort) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceSort) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceSort) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceSort(val *InstanceSort) *NullableInstanceSort { + return &NullableInstanceSort{value: val, isSet: true} +} + +func (v NullableInstanceSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_instance_storage_range.go b/services/postgresflex/v3beta1api/model_instance_storage_range.go new file mode 100644 index 000000000..4162518ec --- /dev/null +++ b/services/postgresflex/v3beta1api/model_instance_storage_range.go @@ -0,0 +1,198 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the InstanceStorageRange type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &InstanceStorageRange{} + +// InstanceStorageRange Contains the minimum and maximum storage space. +type InstanceStorageRange struct { + // The maximum available amount of storage. + Max int32 `json:"max"` + // The minimum available amount of storage. + Min int32 `json:"min"` + AdditionalProperties map[string]interface{} +} + +type _InstanceStorageRange InstanceStorageRange + +// NewInstanceStorageRange instantiates a new InstanceStorageRange 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 NewInstanceStorageRange(max int32, min int32) *InstanceStorageRange { + this := InstanceStorageRange{} + this.Max = max + this.Min = min + return &this +} + +// NewInstanceStorageRangeWithDefaults instantiates a new InstanceStorageRange 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 NewInstanceStorageRangeWithDefaults() *InstanceStorageRange { + this := InstanceStorageRange{} + return &this +} + +// GetMax returns the Max field value +func (o *InstanceStorageRange) GetMax() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Max +} + +// GetMaxOk returns a tuple with the Max field value +// and a boolean to check if the value has been set. +func (o *InstanceStorageRange) GetMaxOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Max, true +} + +// SetMax sets field value +func (o *InstanceStorageRange) SetMax(v int32) { + o.Max = v +} + +// GetMin returns the Min field value +func (o *InstanceStorageRange) GetMin() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Min +} + +// GetMinOk returns a tuple with the Min field value +// and a boolean to check if the value has been set. +func (o *InstanceStorageRange) GetMinOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Min, true +} + +// SetMin sets field value +func (o *InstanceStorageRange) SetMin(v int32) { + o.Min = v +} + +func (o InstanceStorageRange) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o InstanceStorageRange) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["max"] = o.Max + toSerialize["min"] = o.Min + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *InstanceStorageRange) 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{ + "max", + "min", + } + + 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) + } + } + + varInstanceStorageRange := _InstanceStorageRange{} + + err = json.Unmarshal(data, &varInstanceStorageRange) + + if err != nil { + return err + } + + *o = InstanceStorageRange(varInstanceStorageRange) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "max") + delete(additionalProperties, "min") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableInstanceStorageRange struct { + value *InstanceStorageRange + isSet bool +} + +func (v NullableInstanceStorageRange) Get() *InstanceStorageRange { + return v.value +} + +func (v *NullableInstanceStorageRange) Set(val *InstanceStorageRange) { + v.value = val + v.isSet = true +} + +func (v NullableInstanceStorageRange) IsSet() bool { + return v.isSet +} + +func (v *NullableInstanceStorageRange) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInstanceStorageRange(val *InstanceStorageRange) *NullableInstanceStorageRange { + return &NullableInstanceStorageRange{value: val, isSet: true} +} + +func (v NullableInstanceStorageRange) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInstanceStorageRange) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_list_backup_response.go b/services/postgresflex/v3beta1api/model_list_backup_response.go new file mode 100644 index 000000000..29a5c1c63 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_list_backup_response.go @@ -0,0 +1,197 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListBackupResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListBackupResponse{} + +// ListBackupResponse struct for ListBackupResponse +type ListBackupResponse struct { + // The list containing the information about the backups. + Backups []BackupData `json:"backups"` + Pagination Pagination `json:"pagination"` + AdditionalProperties map[string]interface{} +} + +type _ListBackupResponse ListBackupResponse + +// NewListBackupResponse instantiates a new ListBackupResponse 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 NewListBackupResponse(backups []BackupData, pagination Pagination) *ListBackupResponse { + this := ListBackupResponse{} + this.Backups = backups + this.Pagination = pagination + return &this +} + +// NewListBackupResponseWithDefaults instantiates a new ListBackupResponse 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 NewListBackupResponseWithDefaults() *ListBackupResponse { + this := ListBackupResponse{} + return &this +} + +// GetBackups returns the Backups field value +func (o *ListBackupResponse) GetBackups() []BackupData { + if o == nil { + var ret []BackupData + return ret + } + + return o.Backups +} + +// GetBackupsOk returns a tuple with the Backups field value +// and a boolean to check if the value has been set. +func (o *ListBackupResponse) GetBackupsOk() ([]BackupData, bool) { + if o == nil { + return nil, false + } + return o.Backups, true +} + +// SetBackups sets field value +func (o *ListBackupResponse) SetBackups(v []BackupData) { + o.Backups = v +} + +// GetPagination returns the Pagination field value +func (o *ListBackupResponse) GetPagination() Pagination { + if o == nil { + var ret Pagination + return ret + } + + return o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value +// and a boolean to check if the value has been set. +func (o *ListBackupResponse) GetPaginationOk() (*Pagination, bool) { + if o == nil { + return nil, false + } + return &o.Pagination, true +} + +// SetPagination sets field value +func (o *ListBackupResponse) SetPagination(v Pagination) { + o.Pagination = v +} + +func (o ListBackupResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListBackupResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["backups"] = o.Backups + toSerialize["pagination"] = o.Pagination + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListBackupResponse) 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{ + "backups", + "pagination", + } + + 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) + } + } + + varListBackupResponse := _ListBackupResponse{} + + err = json.Unmarshal(data, &varListBackupResponse) + + if err != nil { + return err + } + + *o = ListBackupResponse(varListBackupResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "backups") + delete(additionalProperties, "pagination") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListBackupResponse struct { + value *ListBackupResponse + isSet bool +} + +func (v NullableListBackupResponse) Get() *ListBackupResponse { + return v.value +} + +func (v *NullableListBackupResponse) Set(val *ListBackupResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListBackupResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListBackupResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListBackupResponse(val *ListBackupResponse) *NullableListBackupResponse { + return &NullableListBackupResponse{value: val, isSet: true} +} + +func (v NullableListBackupResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListBackupResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_list_database.go b/services/postgresflex/v3beta1api/model_list_database.go new file mode 100644 index 000000000..558f2e67d --- /dev/null +++ b/services/postgresflex/v3beta1api/model_list_database.go @@ -0,0 +1,228 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListDatabase type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListDatabase{} + +// ListDatabase struct for ListDatabase +type ListDatabase struct { + // The id of the database. + Id int32 `json:"id"` + // The name of the database. + Name string `json:"name"` + // The owner of the database. + Owner string `json:"owner"` + AdditionalProperties map[string]interface{} +} + +type _ListDatabase ListDatabase + +// NewListDatabase instantiates a new ListDatabase 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 NewListDatabase(id int32, name string, owner string) *ListDatabase { + this := ListDatabase{} + this.Id = id + this.Name = name + this.Owner = owner + return &this +} + +// NewListDatabaseWithDefaults instantiates a new ListDatabase 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 NewListDatabaseWithDefaults() *ListDatabase { + this := ListDatabase{} + return &this +} + +// GetId returns the Id field value +func (o *ListDatabase) GetId() int32 { + if o == nil { + var ret int32 + 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 *ListDatabase) GetIdOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ListDatabase) SetId(v int32) { + o.Id = v +} + +// GetName returns the Name field value +func (o *ListDatabase) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ListDatabase) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ListDatabase) SetName(v string) { + o.Name = v +} + +// GetOwner returns the Owner field value +func (o *ListDatabase) GetOwner() string { + if o == nil { + var ret string + return ret + } + + return o.Owner +} + +// GetOwnerOk returns a tuple with the Owner field value +// and a boolean to check if the value has been set. +func (o *ListDatabase) GetOwnerOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Owner, true +} + +// SetOwner sets field value +func (o *ListDatabase) SetOwner(v string) { + o.Owner = v +} + +func (o ListDatabase) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListDatabase) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["owner"] = o.Owner + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListDatabase) 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{ + "id", + "name", + "owner", + } + + 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) + } + } + + varListDatabase := _ListDatabase{} + + err = json.Unmarshal(data, &varListDatabase) + + if err != nil { + return err + } + + *o = ListDatabase(varListDatabase) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "owner") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListDatabase struct { + value *ListDatabase + isSet bool +} + +func (v NullableListDatabase) Get() *ListDatabase { + return v.value +} + +func (v *NullableListDatabase) Set(val *ListDatabase) { + v.value = val + v.isSet = true +} + +func (v NullableListDatabase) IsSet() bool { + return v.isSet +} + +func (v *NullableListDatabase) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListDatabase(val *ListDatabase) *NullableListDatabase { + return &NullableListDatabase{value: val, isSet: true} +} + +func (v NullableListDatabase) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListDatabase) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_list_databases_response.go b/services/postgresflex/v3beta1api/model_list_databases_response.go new file mode 100644 index 000000000..1c036f529 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_list_databases_response.go @@ -0,0 +1,197 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListDatabasesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListDatabasesResponse{} + +// ListDatabasesResponse struct for ListDatabasesResponse +type ListDatabasesResponse struct { + // A list containing all databases for the instance. + Databases []ListDatabase `json:"databases"` + Pagination Pagination `json:"pagination"` + AdditionalProperties map[string]interface{} +} + +type _ListDatabasesResponse ListDatabasesResponse + +// NewListDatabasesResponse instantiates a new ListDatabasesResponse 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 NewListDatabasesResponse(databases []ListDatabase, pagination Pagination) *ListDatabasesResponse { + this := ListDatabasesResponse{} + this.Databases = databases + this.Pagination = pagination + return &this +} + +// NewListDatabasesResponseWithDefaults instantiates a new ListDatabasesResponse 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 NewListDatabasesResponseWithDefaults() *ListDatabasesResponse { + this := ListDatabasesResponse{} + return &this +} + +// GetDatabases returns the Databases field value +func (o *ListDatabasesResponse) GetDatabases() []ListDatabase { + if o == nil { + var ret []ListDatabase + return ret + } + + return o.Databases +} + +// GetDatabasesOk returns a tuple with the Databases field value +// and a boolean to check if the value has been set. +func (o *ListDatabasesResponse) GetDatabasesOk() ([]ListDatabase, bool) { + if o == nil { + return nil, false + } + return o.Databases, true +} + +// SetDatabases sets field value +func (o *ListDatabasesResponse) SetDatabases(v []ListDatabase) { + o.Databases = v +} + +// GetPagination returns the Pagination field value +func (o *ListDatabasesResponse) GetPagination() Pagination { + if o == nil { + var ret Pagination + return ret + } + + return o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value +// and a boolean to check if the value has been set. +func (o *ListDatabasesResponse) GetPaginationOk() (*Pagination, bool) { + if o == nil { + return nil, false + } + return &o.Pagination, true +} + +// SetPagination sets field value +func (o *ListDatabasesResponse) SetPagination(v Pagination) { + o.Pagination = v +} + +func (o ListDatabasesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListDatabasesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["databases"] = o.Databases + toSerialize["pagination"] = o.Pagination + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListDatabasesResponse) 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{ + "databases", + "pagination", + } + + 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) + } + } + + varListDatabasesResponse := _ListDatabasesResponse{} + + err = json.Unmarshal(data, &varListDatabasesResponse) + + if err != nil { + return err + } + + *o = ListDatabasesResponse(varListDatabasesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "databases") + delete(additionalProperties, "pagination") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListDatabasesResponse struct { + value *ListDatabasesResponse + isSet bool +} + +func (v NullableListDatabasesResponse) Get() *ListDatabasesResponse { + return v.value +} + +func (v *NullableListDatabasesResponse) Set(val *ListDatabasesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListDatabasesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListDatabasesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListDatabasesResponse(val *ListDatabasesResponse) *NullableListDatabasesResponse { + return &NullableListDatabasesResponse{value: val, isSet: true} +} + +func (v NullableListDatabasesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListDatabasesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_list_flavors.go b/services/postgresflex/v3beta1api/model_list_flavors.go new file mode 100644 index 000000000..b1cc58da6 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_list_flavors.go @@ -0,0 +1,378 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListFlavors type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListFlavors{} + +// ListFlavors The flavor of the instance containing the technical features. +type ListFlavors struct { + // The cpu count of the instance. + Cpu int32 `json:"cpu"` + // The flavor description. + Description string `json:"description"` + // The id of the instance flavor. + Id string `json:"id"` + // maximum storage which can be ordered for the flavor in Gigabyte. + MaxGB int32 `json:"maxGB"` + // The memory of the instance in Gibibyte. + Memory int32 `json:"memory"` + // minimum storage which is required to order in Gigabyte. + MinGB int32 `json:"minGB"` + // defines the nodeType it can be either single or replica + NodeType string `json:"nodeType"` + // maximum storage which can be ordered for the flavor in Gigabyte. + StorageClasses []FlavorStorageClassesStorageClass `json:"storageClasses"` + AdditionalProperties map[string]interface{} +} + +type _ListFlavors ListFlavors + +// NewListFlavors instantiates a new ListFlavors 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 NewListFlavors(cpu int32, description string, id string, maxGB int32, memory int32, minGB int32, nodeType string, storageClasses []FlavorStorageClassesStorageClass) *ListFlavors { + this := ListFlavors{} + this.Cpu = cpu + this.Description = description + this.Id = id + this.MaxGB = maxGB + this.Memory = memory + this.MinGB = minGB + this.NodeType = nodeType + this.StorageClasses = storageClasses + return &this +} + +// NewListFlavorsWithDefaults instantiates a new ListFlavors 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 NewListFlavorsWithDefaults() *ListFlavors { + this := ListFlavors{} + return &this +} + +// GetCpu returns the Cpu field value +func (o *ListFlavors) GetCpu() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Cpu +} + +// GetCpuOk returns a tuple with the Cpu field value +// and a boolean to check if the value has been set. +func (o *ListFlavors) GetCpuOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Cpu, true +} + +// SetCpu sets field value +func (o *ListFlavors) SetCpu(v int32) { + o.Cpu = v +} + +// GetDescription returns the Description field value +func (o *ListFlavors) 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 *ListFlavors) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Description, true +} + +// SetDescription sets field value +func (o *ListFlavors) SetDescription(v string) { + o.Description = v +} + +// GetId returns the Id field value +func (o *ListFlavors) 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 *ListFlavors) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ListFlavors) SetId(v string) { + o.Id = v +} + +// GetMaxGB returns the MaxGB field value +func (o *ListFlavors) GetMaxGB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MaxGB +} + +// GetMaxGBOk returns a tuple with the MaxGB field value +// and a boolean to check if the value has been set. +func (o *ListFlavors) GetMaxGBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MaxGB, true +} + +// SetMaxGB sets field value +func (o *ListFlavors) SetMaxGB(v int32) { + o.MaxGB = v +} + +// GetMemory returns the Memory field value +func (o *ListFlavors) GetMemory() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Memory +} + +// GetMemoryOk returns a tuple with the Memory field value +// and a boolean to check if the value has been set. +func (o *ListFlavors) GetMemoryOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Memory, true +} + +// SetMemory sets field value +func (o *ListFlavors) SetMemory(v int32) { + o.Memory = v +} + +// GetMinGB returns the MinGB field value +func (o *ListFlavors) GetMinGB() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MinGB +} + +// GetMinGBOk returns a tuple with the MinGB field value +// and a boolean to check if the value has been set. +func (o *ListFlavors) GetMinGBOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MinGB, true +} + +// SetMinGB sets field value +func (o *ListFlavors) SetMinGB(v int32) { + o.MinGB = v +} + +// GetNodeType returns the NodeType field value +func (o *ListFlavors) GetNodeType() string { + if o == nil { + var ret string + return ret + } + + return o.NodeType +} + +// GetNodeTypeOk returns a tuple with the NodeType field value +// and a boolean to check if the value has been set. +func (o *ListFlavors) GetNodeTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NodeType, true +} + +// SetNodeType sets field value +func (o *ListFlavors) SetNodeType(v string) { + o.NodeType = v +} + +// GetStorageClasses returns the StorageClasses field value +func (o *ListFlavors) GetStorageClasses() []FlavorStorageClassesStorageClass { + if o == nil { + var ret []FlavorStorageClassesStorageClass + return ret + } + + return o.StorageClasses +} + +// GetStorageClassesOk returns a tuple with the StorageClasses field value +// and a boolean to check if the value has been set. +func (o *ListFlavors) GetStorageClassesOk() ([]FlavorStorageClassesStorageClass, bool) { + if o == nil { + return nil, false + } + return o.StorageClasses, true +} + +// SetStorageClasses sets field value +func (o *ListFlavors) SetStorageClasses(v []FlavorStorageClassesStorageClass) { + o.StorageClasses = v +} + +func (o ListFlavors) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListFlavors) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["cpu"] = o.Cpu + toSerialize["description"] = o.Description + toSerialize["id"] = o.Id + toSerialize["maxGB"] = o.MaxGB + toSerialize["memory"] = o.Memory + toSerialize["minGB"] = o.MinGB + toSerialize["nodeType"] = o.NodeType + toSerialize["storageClasses"] = o.StorageClasses + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListFlavors) 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{ + "cpu", + "description", + "id", + "maxGB", + "memory", + "minGB", + "nodeType", + "storageClasses", + } + + 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) + } + } + + varListFlavors := _ListFlavors{} + + err = json.Unmarshal(data, &varListFlavors) + + if err != nil { + return err + } + + *o = ListFlavors(varListFlavors) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "cpu") + delete(additionalProperties, "description") + delete(additionalProperties, "id") + delete(additionalProperties, "maxGB") + delete(additionalProperties, "memory") + delete(additionalProperties, "minGB") + delete(additionalProperties, "nodeType") + delete(additionalProperties, "storageClasses") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListFlavors struct { + value *ListFlavors + isSet bool +} + +func (v NullableListFlavors) Get() *ListFlavors { + return v.value +} + +func (v *NullableListFlavors) Set(val *ListFlavors) { + v.value = val + v.isSet = true +} + +func (v NullableListFlavors) IsSet() bool { + return v.isSet +} + +func (v *NullableListFlavors) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListFlavors(val *ListFlavors) *NullableListFlavors { + return &NullableListFlavors{value: val, isSet: true} +} + +func (v NullableListFlavors) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListFlavors) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_list_instance.go b/services/postgresflex/v3beta1api/model_list_instance.go new file mode 100644 index 000000000..46427b194 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_list_instance.go @@ -0,0 +1,257 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListInstance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListInstance{} + +// ListInstance struct for ListInstance +type ListInstance struct { + // The ID of the instance. + Id string `json:"id"` + // Whether the instance can be deleted or not. + IsDeletable bool `json:"isDeletable"` + // The name of the instance. + Name string `json:"name"` + State State `json:"state"` + AdditionalProperties map[string]interface{} +} + +type _ListInstance ListInstance + +// NewListInstance instantiates a new ListInstance 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 NewListInstance(id string, isDeletable bool, name string, state State) *ListInstance { + this := ListInstance{} + this.Id = id + this.IsDeletable = isDeletable + this.Name = name + this.State = state + return &this +} + +// NewListInstanceWithDefaults instantiates a new ListInstance 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 NewListInstanceWithDefaults() *ListInstance { + this := ListInstance{} + return &this +} + +// GetId returns the Id field value +func (o *ListInstance) 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 *ListInstance) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ListInstance) SetId(v string) { + o.Id = v +} + +// GetIsDeletable returns the IsDeletable field value +func (o *ListInstance) GetIsDeletable() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsDeletable +} + +// GetIsDeletableOk returns a tuple with the IsDeletable field value +// and a boolean to check if the value has been set. +func (o *ListInstance) GetIsDeletableOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsDeletable, true +} + +// SetIsDeletable sets field value +func (o *ListInstance) SetIsDeletable(v bool) { + o.IsDeletable = v +} + +// GetName returns the Name field value +func (o *ListInstance) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ListInstance) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ListInstance) SetName(v string) { + o.Name = v +} + +// GetState returns the State field value +func (o *ListInstance) GetState() State { + if o == nil { + var ret State + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *ListInstance) GetStateOk() (*State, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *ListInstance) SetState(v State) { + o.State = v +} + +func (o ListInstance) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListInstance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["isDeletable"] = o.IsDeletable + toSerialize["name"] = o.Name + toSerialize["state"] = o.State + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListInstance) 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{ + "id", + "isDeletable", + "name", + "state", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varListInstance := _ListInstance{} + + err = json.Unmarshal(data, &varListInstance) + + if err != nil { + return err + } + + *o = ListInstance(varListInstance) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "isDeletable") + delete(additionalProperties, "name") + delete(additionalProperties, "state") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListInstance struct { + value *ListInstance + isSet bool +} + +func (v NullableListInstance) Get() *ListInstance { + return v.value +} + +func (v *NullableListInstance) Set(val *ListInstance) { + v.value = val + v.isSet = true +} + +func (v NullableListInstance) IsSet() bool { + return v.isSet +} + +func (v *NullableListInstance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListInstance(val *ListInstance) *NullableListInstance { + return &NullableListInstance{value: val, isSet: true} +} + +func (v NullableListInstance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListInstance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_list_instances_response.go b/services/postgresflex/v3beta1api/model_list_instances_response.go new file mode 100644 index 000000000..99564ab4c --- /dev/null +++ b/services/postgresflex/v3beta1api/model_list_instances_response.go @@ -0,0 +1,197 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListInstancesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListInstancesResponse{} + +// ListInstancesResponse struct for ListInstancesResponse +type ListInstancesResponse struct { + // List of owned instances and their current state. + Instances []ListInstance `json:"instances"` + Pagination Pagination `json:"pagination"` + AdditionalProperties map[string]interface{} +} + +type _ListInstancesResponse ListInstancesResponse + +// NewListInstancesResponse instantiates a new ListInstancesResponse 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 NewListInstancesResponse(instances []ListInstance, pagination Pagination) *ListInstancesResponse { + this := ListInstancesResponse{} + this.Instances = instances + this.Pagination = pagination + return &this +} + +// NewListInstancesResponseWithDefaults instantiates a new ListInstancesResponse 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 NewListInstancesResponseWithDefaults() *ListInstancesResponse { + this := ListInstancesResponse{} + return &this +} + +// GetInstances returns the Instances field value +func (o *ListInstancesResponse) GetInstances() []ListInstance { + if o == nil { + var ret []ListInstance + return ret + } + + return o.Instances +} + +// GetInstancesOk returns a tuple with the Instances field value +// and a boolean to check if the value has been set. +func (o *ListInstancesResponse) GetInstancesOk() ([]ListInstance, bool) { + if o == nil { + return nil, false + } + return o.Instances, true +} + +// SetInstances sets field value +func (o *ListInstancesResponse) SetInstances(v []ListInstance) { + o.Instances = v +} + +// GetPagination returns the Pagination field value +func (o *ListInstancesResponse) GetPagination() Pagination { + if o == nil { + var ret Pagination + return ret + } + + return o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value +// and a boolean to check if the value has been set. +func (o *ListInstancesResponse) GetPaginationOk() (*Pagination, bool) { + if o == nil { + return nil, false + } + return &o.Pagination, true +} + +// SetPagination sets field value +func (o *ListInstancesResponse) SetPagination(v Pagination) { + o.Pagination = v +} + +func (o ListInstancesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListInstancesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["instances"] = o.Instances + toSerialize["pagination"] = o.Pagination + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListInstancesResponse) 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{ + "instances", + "pagination", + } + + 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) + } + } + + varListInstancesResponse := _ListInstancesResponse{} + + err = json.Unmarshal(data, &varListInstancesResponse) + + if err != nil { + return err + } + + *o = ListInstancesResponse(varListInstancesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "instances") + delete(additionalProperties, "pagination") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListInstancesResponse struct { + value *ListInstancesResponse + isSet bool +} + +func (v NullableListInstancesResponse) Get() *ListInstancesResponse { + return v.value +} + +func (v *NullableListInstancesResponse) Set(val *ListInstancesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListInstancesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListInstancesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListInstancesResponse(val *ListInstancesResponse) *NullableListInstancesResponse { + return &NullableListInstancesResponse{value: val, isSet: true} +} + +func (v NullableListInstancesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListInstancesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_list_roles_response.go b/services/postgresflex/v3beta1api/model_list_roles_response.go new file mode 100644 index 000000000..d2bd0c344 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_list_roles_response.go @@ -0,0 +1,168 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListRolesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListRolesResponse{} + +// ListRolesResponse struct for ListRolesResponse +type ListRolesResponse struct { + // List of all role names available in the instance + Roles []string `json:"roles"` + AdditionalProperties map[string]interface{} +} + +type _ListRolesResponse ListRolesResponse + +// NewListRolesResponse instantiates a new ListRolesResponse 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 NewListRolesResponse(roles []string) *ListRolesResponse { + this := ListRolesResponse{} + this.Roles = roles + return &this +} + +// NewListRolesResponseWithDefaults instantiates a new ListRolesResponse 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 NewListRolesResponseWithDefaults() *ListRolesResponse { + this := ListRolesResponse{} + return &this +} + +// GetRoles returns the Roles field value +func (o *ListRolesResponse) GetRoles() []string { + if o == nil { + var ret []string + return ret + } + + return o.Roles +} + +// GetRolesOk returns a tuple with the Roles field value +// and a boolean to check if the value has been set. +func (o *ListRolesResponse) GetRolesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Roles, true +} + +// SetRoles sets field value +func (o *ListRolesResponse) SetRoles(v []string) { + o.Roles = v +} + +func (o ListRolesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListRolesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["roles"] = o.Roles + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListRolesResponse) 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{ + "roles", + } + + 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) + } + } + + varListRolesResponse := _ListRolesResponse{} + + err = json.Unmarshal(data, &varListRolesResponse) + + if err != nil { + return err + } + + *o = ListRolesResponse(varListRolesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "roles") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListRolesResponse struct { + value *ListRolesResponse + isSet bool +} + +func (v NullableListRolesResponse) Get() *ListRolesResponse { + return v.value +} + +func (v *NullableListRolesResponse) Set(val *ListRolesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListRolesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListRolesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListRolesResponse(val *ListRolesResponse) *NullableListRolesResponse { + return &NullableListRolesResponse{value: val, isSet: true} +} + +func (v NullableListRolesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListRolesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_list_user.go b/services/postgresflex/v3beta1api/model_list_user.go new file mode 100644 index 000000000..e123c7e92 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_list_user.go @@ -0,0 +1,228 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListUser type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListUser{} + +// ListUser struct for ListUser +type ListUser struct { + // The ID of the user. + Id int32 `json:"id"` + // The name of the user. + Name string `json:"name"` + // The current state of the user. + State string `json:"state"` + AdditionalProperties map[string]interface{} +} + +type _ListUser ListUser + +// NewListUser instantiates a new ListUser 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 NewListUser(id int32, name string, state string) *ListUser { + this := ListUser{} + this.Id = id + this.Name = name + this.State = state + return &this +} + +// NewListUserWithDefaults instantiates a new ListUser 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 NewListUserWithDefaults() *ListUser { + this := ListUser{} + return &this +} + +// GetId returns the Id field value +func (o *ListUser) GetId() int32 { + if o == nil { + var ret int32 + 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 *ListUser) GetIdOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ListUser) SetId(v int32) { + o.Id = v +} + +// GetName returns the Name field value +func (o *ListUser) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ListUser) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ListUser) SetName(v string) { + o.Name = v +} + +// GetState returns the State field value +func (o *ListUser) GetState() string { + if o == nil { + var ret string + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *ListUser) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *ListUser) SetState(v string) { + o.State = v +} + +func (o ListUser) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListUser) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["state"] = o.State + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListUser) 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{ + "id", + "name", + "state", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varListUser := _ListUser{} + + err = json.Unmarshal(data, &varListUser) + + if err != nil { + return err + } + + *o = ListUser(varListUser) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "id") + delete(additionalProperties, "name") + delete(additionalProperties, "state") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListUser struct { + value *ListUser + isSet bool +} + +func (v NullableListUser) Get() *ListUser { + return v.value +} + +func (v *NullableListUser) Set(val *ListUser) { + v.value = val + v.isSet = true +} + +func (v NullableListUser) IsSet() bool { + return v.isSet +} + +func (v *NullableListUser) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListUser(val *ListUser) *NullableListUser { + return &NullableListUser{value: val, isSet: true} +} + +func (v NullableListUser) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListUser) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_list_user_response.go b/services/postgresflex/v3beta1api/model_list_user_response.go new file mode 100644 index 000000000..bbec572f3 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_list_user_response.go @@ -0,0 +1,197 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ListUserResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListUserResponse{} + +// ListUserResponse struct for ListUserResponse +type ListUserResponse struct { + Pagination Pagination `json:"pagination"` + // List of all users inside an instance + Users []ListUser `json:"users"` + AdditionalProperties map[string]interface{} +} + +type _ListUserResponse ListUserResponse + +// NewListUserResponse instantiates a new ListUserResponse 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 NewListUserResponse(pagination Pagination, users []ListUser) *ListUserResponse { + this := ListUserResponse{} + this.Pagination = pagination + this.Users = users + return &this +} + +// NewListUserResponseWithDefaults instantiates a new ListUserResponse 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 NewListUserResponseWithDefaults() *ListUserResponse { + this := ListUserResponse{} + return &this +} + +// GetPagination returns the Pagination field value +func (o *ListUserResponse) GetPagination() Pagination { + if o == nil { + var ret Pagination + return ret + } + + return o.Pagination +} + +// GetPaginationOk returns a tuple with the Pagination field value +// and a boolean to check if the value has been set. +func (o *ListUserResponse) GetPaginationOk() (*Pagination, bool) { + if o == nil { + return nil, false + } + return &o.Pagination, true +} + +// SetPagination sets field value +func (o *ListUserResponse) SetPagination(v Pagination) { + o.Pagination = v +} + +// GetUsers returns the Users field value +func (o *ListUserResponse) GetUsers() []ListUser { + if o == nil { + var ret []ListUser + return ret + } + + return o.Users +} + +// GetUsersOk returns a tuple with the Users field value +// and a boolean to check if the value has been set. +func (o *ListUserResponse) GetUsersOk() ([]ListUser, bool) { + if o == nil { + return nil, false + } + return o.Users, true +} + +// SetUsers sets field value +func (o *ListUserResponse) SetUsers(v []ListUser) { + o.Users = v +} + +func (o ListUserResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListUserResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["pagination"] = o.Pagination + toSerialize["users"] = o.Users + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ListUserResponse) 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{ + "pagination", + "users", + } + + 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) + } + } + + varListUserResponse := _ListUserResponse{} + + err = json.Unmarshal(data, &varListUserResponse) + + if err != nil { + return err + } + + *o = ListUserResponse(varListUserResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "pagination") + delete(additionalProperties, "users") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableListUserResponse struct { + value *ListUserResponse + isSet bool +} + +func (v NullableListUserResponse) Get() *ListUserResponse { + return v.value +} + +func (v *NullableListUserResponse) Set(val *ListUserResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListUserResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListUserResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListUserResponse(val *ListUserResponse) *NullableListUserResponse { + return &NullableListUserResponse{value: val, isSet: true} +} + +func (v NullableListUserResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListUserResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_pagination.go b/services/postgresflex/v3beta1api/model_pagination.go new file mode 100644 index 000000000..5bd0ba9ca --- /dev/null +++ b/services/postgresflex/v3beta1api/model_pagination.go @@ -0,0 +1,283 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the Pagination type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Pagination{} + +// Pagination struct for Pagination +type Pagination struct { + Page int32 `json:"page"` + Size int32 `json:"size"` + Sort string `json:"sort"` + TotalPages int32 `json:"totalPages"` + TotalRows int32 `json:"totalRows"` + AdditionalProperties map[string]interface{} +} + +type _Pagination Pagination + +// NewPagination instantiates a new Pagination 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 NewPagination(page int32, size int32, sort string, totalPages int32, totalRows int32) *Pagination { + this := Pagination{} + this.Page = page + this.Size = size + this.Sort = sort + this.TotalPages = totalPages + this.TotalRows = totalRows + return &this +} + +// NewPaginationWithDefaults instantiates a new Pagination 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 NewPaginationWithDefaults() *Pagination { + this := Pagination{} + return &this +} + +// GetPage returns the Page field value +func (o *Pagination) GetPage() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Page +} + +// GetPageOk returns a tuple with the Page field value +// and a boolean to check if the value has been set. +func (o *Pagination) GetPageOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Page, true +} + +// SetPage sets field value +func (o *Pagination) SetPage(v int32) { + o.Page = v +} + +// GetSize returns the Size field value +func (o *Pagination) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *Pagination) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *Pagination) SetSize(v int32) { + o.Size = v +} + +// GetSort returns the Sort field value +func (o *Pagination) GetSort() string { + if o == nil { + var ret string + return ret + } + + return o.Sort +} + +// GetSortOk returns a tuple with the Sort field value +// and a boolean to check if the value has been set. +func (o *Pagination) GetSortOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Sort, true +} + +// SetSort sets field value +func (o *Pagination) SetSort(v string) { + o.Sort = v +} + +// GetTotalPages returns the TotalPages field value +func (o *Pagination) GetTotalPages() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.TotalPages +} + +// GetTotalPagesOk returns a tuple with the TotalPages field value +// and a boolean to check if the value has been set. +func (o *Pagination) GetTotalPagesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TotalPages, true +} + +// SetTotalPages sets field value +func (o *Pagination) SetTotalPages(v int32) { + o.TotalPages = v +} + +// GetTotalRows returns the TotalRows field value +func (o *Pagination) GetTotalRows() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.TotalRows +} + +// GetTotalRowsOk returns a tuple with the TotalRows field value +// and a boolean to check if the value has been set. +func (o *Pagination) GetTotalRowsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TotalRows, true +} + +// SetTotalRows sets field value +func (o *Pagination) SetTotalRows(v int32) { + o.TotalRows = v +} + +func (o Pagination) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Pagination) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["page"] = o.Page + toSerialize["size"] = o.Size + toSerialize["sort"] = o.Sort + toSerialize["totalPages"] = o.TotalPages + toSerialize["totalRows"] = o.TotalRows + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Pagination) 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{ + "page", + "size", + "sort", + "totalPages", + "totalRows", + } + + 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) + } + } + + varPagination := _Pagination{} + + err = json.Unmarshal(data, &varPagination) + + if err != nil { + return err + } + + *o = Pagination(varPagination) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "page") + delete(additionalProperties, "size") + delete(additionalProperties, "sort") + delete(additionalProperties, "totalPages") + delete(additionalProperties, "totalRows") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePagination struct { + value *Pagination + isSet bool +} + +func (v NullablePagination) Get() *Pagination { + return v.value +} + +func (v *NullablePagination) Set(val *Pagination) { + v.value = val + v.isSet = true +} + +func (v NullablePagination) IsSet() bool { + return v.isSet +} + +func (v *NullablePagination) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePagination(val *Pagination) *NullablePagination { + return &NullablePagination{value: val, isSet: true} +} + +func (v NullablePagination) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePagination) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_protect_instance_request_payload.go b/services/postgresflex/v3beta1api/model_protect_instance_request_payload.go new file mode 100644 index 000000000..38ca53ea9 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_protect_instance_request_payload.go @@ -0,0 +1,168 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ProtectInstanceRequestPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProtectInstanceRequestPayload{} + +// ProtectInstanceRequestPayload struct for ProtectInstanceRequestPayload +type ProtectInstanceRequestPayload struct { + // Protect instance from deletion. + IsDeletable bool `json:"isDeletable"` + AdditionalProperties map[string]interface{} +} + +type _ProtectInstanceRequestPayload ProtectInstanceRequestPayload + +// NewProtectInstanceRequestPayload instantiates a new ProtectInstanceRequestPayload 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 NewProtectInstanceRequestPayload(isDeletable bool) *ProtectInstanceRequestPayload { + this := ProtectInstanceRequestPayload{} + this.IsDeletable = isDeletable + return &this +} + +// NewProtectInstanceRequestPayloadWithDefaults instantiates a new ProtectInstanceRequestPayload 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 NewProtectInstanceRequestPayloadWithDefaults() *ProtectInstanceRequestPayload { + this := ProtectInstanceRequestPayload{} + return &this +} + +// GetIsDeletable returns the IsDeletable field value +func (o *ProtectInstanceRequestPayload) GetIsDeletable() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsDeletable +} + +// GetIsDeletableOk returns a tuple with the IsDeletable field value +// and a boolean to check if the value has been set. +func (o *ProtectInstanceRequestPayload) GetIsDeletableOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsDeletable, true +} + +// SetIsDeletable sets field value +func (o *ProtectInstanceRequestPayload) SetIsDeletable(v bool) { + o.IsDeletable = v +} + +func (o ProtectInstanceRequestPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProtectInstanceRequestPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["isDeletable"] = o.IsDeletable + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ProtectInstanceRequestPayload) 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{ + "isDeletable", + } + + 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) + } + } + + varProtectInstanceRequestPayload := _ProtectInstanceRequestPayload{} + + err = json.Unmarshal(data, &varProtectInstanceRequestPayload) + + if err != nil { + return err + } + + *o = ProtectInstanceRequestPayload(varProtectInstanceRequestPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "isDeletable") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProtectInstanceRequestPayload struct { + value *ProtectInstanceRequestPayload + isSet bool +} + +func (v NullableProtectInstanceRequestPayload) Get() *ProtectInstanceRequestPayload { + return v.value +} + +func (v *NullableProtectInstanceRequestPayload) Set(val *ProtectInstanceRequestPayload) { + v.value = val + v.isSet = true +} + +func (v NullableProtectInstanceRequestPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableProtectInstanceRequestPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProtectInstanceRequestPayload(val *ProtectInstanceRequestPayload) *NullableProtectInstanceRequestPayload { + return &NullableProtectInstanceRequestPayload{value: val, isSet: true} +} + +func (v NullableProtectInstanceRequestPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProtectInstanceRequestPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_protect_instance_response.go b/services/postgresflex/v3beta1api/model_protect_instance_response.go new file mode 100644 index 000000000..8466bb388 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_protect_instance_response.go @@ -0,0 +1,168 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ProtectInstanceResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProtectInstanceResponse{} + +// ProtectInstanceResponse struct for ProtectInstanceResponse +type ProtectInstanceResponse struct { + // Protect instance from deletion. + IsDeletable bool `json:"isDeletable"` + AdditionalProperties map[string]interface{} +} + +type _ProtectInstanceResponse ProtectInstanceResponse + +// NewProtectInstanceResponse instantiates a new ProtectInstanceResponse 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 NewProtectInstanceResponse(isDeletable bool) *ProtectInstanceResponse { + this := ProtectInstanceResponse{} + this.IsDeletable = isDeletable + return &this +} + +// NewProtectInstanceResponseWithDefaults instantiates a new ProtectInstanceResponse 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 NewProtectInstanceResponseWithDefaults() *ProtectInstanceResponse { + this := ProtectInstanceResponse{} + return &this +} + +// GetIsDeletable returns the IsDeletable field value +func (o *ProtectInstanceResponse) GetIsDeletable() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsDeletable +} + +// GetIsDeletableOk returns a tuple with the IsDeletable field value +// and a boolean to check if the value has been set. +func (o *ProtectInstanceResponse) GetIsDeletableOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsDeletable, true +} + +// SetIsDeletable sets field value +func (o *ProtectInstanceResponse) SetIsDeletable(v bool) { + o.IsDeletable = v +} + +func (o ProtectInstanceResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProtectInstanceResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["isDeletable"] = o.IsDeletable + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ProtectInstanceResponse) 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{ + "isDeletable", + } + + 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) + } + } + + varProtectInstanceResponse := _ProtectInstanceResponse{} + + err = json.Unmarshal(data, &varProtectInstanceResponse) + + if err != nil { + return err + } + + *o = ProtectInstanceResponse(varProtectInstanceResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "isDeletable") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProtectInstanceResponse struct { + value *ProtectInstanceResponse + isSet bool +} + +func (v NullableProtectInstanceResponse) Get() *ProtectInstanceResponse { + return v.value +} + +func (v *NullableProtectInstanceResponse) Set(val *ProtectInstanceResponse) { + v.value = val + v.isSet = true +} + +func (v NullableProtectInstanceResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableProtectInstanceResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProtectInstanceResponse(val *ProtectInstanceResponse) *NullableProtectInstanceResponse { + return &NullableProtectInstanceResponse{value: val, isSet: true} +} + +func (v NullableProtectInstanceResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProtectInstanceResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_reset_user_response.go b/services/postgresflex/v3beta1api/model_reset_user_response.go new file mode 100644 index 000000000..715d539d7 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_reset_user_response.go @@ -0,0 +1,228 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ResetUserResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResetUserResponse{} + +// ResetUserResponse struct for ResetUserResponse +type ResetUserResponse struct { + // The name of the user. + Name string `json:"name"` + // The password for the user. + Password string `json:"password"` + // The current state of the user. + State string `json:"state"` + AdditionalProperties map[string]interface{} +} + +type _ResetUserResponse ResetUserResponse + +// NewResetUserResponse instantiates a new ResetUserResponse 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 NewResetUserResponse(name string, password string, state string) *ResetUserResponse { + this := ResetUserResponse{} + this.Name = name + this.Password = password + this.State = state + return &this +} + +// NewResetUserResponseWithDefaults instantiates a new ResetUserResponse 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 NewResetUserResponseWithDefaults() *ResetUserResponse { + this := ResetUserResponse{} + return &this +} + +// GetName returns the Name field value +func (o *ResetUserResponse) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ResetUserResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ResetUserResponse) SetName(v string) { + o.Name = v +} + +// GetPassword returns the Password field value +func (o *ResetUserResponse) GetPassword() string { + if o == nil { + var ret string + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +func (o *ResetUserResponse) GetPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *ResetUserResponse) SetPassword(v string) { + o.Password = v +} + +// GetState returns the State field value +func (o *ResetUserResponse) GetState() string { + if o == nil { + var ret string + return ret + } + + return o.State +} + +// GetStateOk returns a tuple with the State field value +// and a boolean to check if the value has been set. +func (o *ResetUserResponse) GetStateOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.State, true +} + +// SetState sets field value +func (o *ResetUserResponse) SetState(v string) { + o.State = v +} + +func (o ResetUserResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ResetUserResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["password"] = o.Password + toSerialize["state"] = o.State + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ResetUserResponse) 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{ + "name", + "password", + "state", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varResetUserResponse := _ResetUserResponse{} + + err = json.Unmarshal(data, &varResetUserResponse) + + if err != nil { + return err + } + + *o = ResetUserResponse(varResetUserResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "password") + delete(additionalProperties, "state") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableResetUserResponse struct { + value *ResetUserResponse + isSet bool +} + +func (v NullableResetUserResponse) Get() *ResetUserResponse { + return v.value +} + +func (v *NullableResetUserResponse) Set(val *ResetUserResponse) { + v.value = val + v.isSet = true +} + +func (v NullableResetUserResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableResetUserResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResetUserResponse(val *ResetUserResponse) *NullableResetUserResponse { + return &NullableResetUserResponse{value: val, isSet: true} +} + +func (v NullableResetUserResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResetUserResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_state.go b/services/postgresflex/v3beta1api/model_state.go new file mode 100644 index 000000000..d01185540 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_state.go @@ -0,0 +1,122 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// State The current state of the instance. +type State string + +// List of state +const ( + STATE_READY State = "READY" + STATE_PENDING State = "PENDING" + STATE_PROGRESSING State = "PROGRESSING" + STATE_FAILURE State = "FAILURE" + STATE_UNKNOWN State = "UNKNOWN" + STATE_TERMINATING State = "TERMINATING" + STATE_UNKNOWN_DEFAULT_OPEN_API State = "unknown_default_open_api" +) + +// All allowed values of State enum +var AllowedStateEnumValues = []State{ + "READY", + "PENDING", + "PROGRESSING", + "FAILURE", + "UNKNOWN", + "TERMINATING", + "unknown_default_open_api", +} + +func (v *State) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := State(value) + for _, existing := range AllowedStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = STATE_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewStateFromValue returns a pointer to a valid State +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewStateFromValue(v string) (*State, error) { + ev := State(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for State: valid values are %v", v, AllowedStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v State) IsValid() bool { + for _, existing := range AllowedStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to state value +func (v State) Ptr() *State { + return &v +} + +type NullableState struct { + value *State + isSet bool +} + +func (v NullableState) Get() *State { + return v.value +} + +func (v *NullableState) Set(val *State) { + v.value = val + v.isSet = true +} + +func (v NullableState) IsSet() bool { + return v.isSet +} + +func (v *NullableState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableState(val *State) *NullableState { + return &NullableState{value: val, isSet: true} +} + +func (v NullableState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_storage.go b/services/postgresflex/v3beta1api/model_storage.go new file mode 100644 index 000000000..5a19ccf4a --- /dev/null +++ b/services/postgresflex/v3beta1api/model_storage.go @@ -0,0 +1,193 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" +) + +// checks if the Storage type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Storage{} + +// Storage The object containing information about the storage size and class. +type Storage struct { + // The storage class for the storage. + Class *string `json:"class,omitempty"` + // The storage size in Gigabytes. + Size *int32 `json:"size,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Storage Storage + +// NewStorage instantiates a new Storage 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 NewStorage() *Storage { + this := Storage{} + return &this +} + +// NewStorageWithDefaults instantiates a new Storage 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 NewStorageWithDefaults() *Storage { + this := Storage{} + return &this +} + +// GetClass returns the Class field value if set, zero value otherwise. +func (o *Storage) GetClass() string { + if o == nil || IsNil(o.Class) { + var ret string + return ret + } + return *o.Class +} + +// GetClassOk returns a tuple with the Class field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Storage) GetClassOk() (*string, bool) { + if o == nil || IsNil(o.Class) { + return nil, false + } + return o.Class, true +} + +// HasClass returns a boolean if a field has been set. +func (o *Storage) HasClass() bool { + if o != nil && !IsNil(o.Class) { + return true + } + + return false +} + +// SetClass gets a reference to the given string and assigns it to the Class field. +func (o *Storage) SetClass(v string) { + o.Class = &v +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Storage) GetSize() int32 { + if o == nil || IsNil(o.Size) { + var ret int32 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Storage) GetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *Storage) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given int32 and assigns it to the Size field. +func (o *Storage) SetSize(v int32) { + o.Size = &v +} + +func (o Storage) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Storage) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Class) { + toSerialize["class"] = o.Class + } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Storage) UnmarshalJSON(data []byte) (err error) { + varStorage := _Storage{} + + err = json.Unmarshal(data, &varStorage) + + if err != nil { + return err + } + + *o = Storage(varStorage) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "class") + delete(additionalProperties, "size") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableStorage struct { + value *Storage + isSet bool +} + +func (v NullableStorage) Get() *Storage { + return v.value +} + +func (v *NullableStorage) Set(val *Storage) { + v.value = val + v.isSet = true +} + +func (v NullableStorage) IsSet() bool { + return v.isSet +} + +func (v *NullableStorage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStorage(val *Storage) *NullableStorage { + return &NullableStorage{value: val, isSet: true} +} + +func (v NullableStorage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStorage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_storage_create.go b/services/postgresflex/v3beta1api/model_storage_create.go new file mode 100644 index 000000000..2cfd672b4 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_storage_create.go @@ -0,0 +1,206 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the StorageCreate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &StorageCreate{} + +// StorageCreate The object containing information about the storage size and class. +type StorageCreate struct { + // The storage class for the storage. + Class *string `json:"class,omitempty"` + // The storage size in Gigabytes. + Size int32 `json:"size"` + AdditionalProperties map[string]interface{} +} + +type _StorageCreate StorageCreate + +// NewStorageCreate instantiates a new StorageCreate 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 NewStorageCreate(size int32) *StorageCreate { + this := StorageCreate{} + this.Size = size + return &this +} + +// NewStorageCreateWithDefaults instantiates a new StorageCreate 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 NewStorageCreateWithDefaults() *StorageCreate { + this := StorageCreate{} + return &this +} + +// GetClass returns the Class field value if set, zero value otherwise. +func (o *StorageCreate) GetClass() string { + if o == nil || IsNil(o.Class) { + var ret string + return ret + } + return *o.Class +} + +// GetClassOk returns a tuple with the Class field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StorageCreate) GetClassOk() (*string, bool) { + if o == nil || IsNil(o.Class) { + return nil, false + } + return o.Class, true +} + +// HasClass returns a boolean if a field has been set. +func (o *StorageCreate) HasClass() bool { + if o != nil && !IsNil(o.Class) { + return true + } + + return false +} + +// SetClass gets a reference to the given string and assigns it to the Class field. +func (o *StorageCreate) SetClass(v string) { + o.Class = &v +} + +// GetSize returns the Size field value +func (o *StorageCreate) GetSize() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *StorageCreate) GetSizeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Size, true +} + +// SetSize sets field value +func (o *StorageCreate) SetSize(v int32) { + o.Size = v +} + +func (o StorageCreate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o StorageCreate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Class) { + toSerialize["class"] = o.Class + } + toSerialize["size"] = o.Size + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *StorageCreate) 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{ + "size", + } + + 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) + } + } + + varStorageCreate := _StorageCreate{} + + err = json.Unmarshal(data, &varStorageCreate) + + if err != nil { + return err + } + + *o = StorageCreate(varStorageCreate) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "class") + delete(additionalProperties, "size") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableStorageCreate struct { + value *StorageCreate + isSet bool +} + +func (v NullableStorageCreate) Get() *StorageCreate { + return v.value +} + +func (v *NullableStorageCreate) Set(val *StorageCreate) { + v.value = val + v.isSet = true +} + +func (v NullableStorageCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableStorageCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStorageCreate(val *StorageCreate) *NullableStorageCreate { + return &NullableStorageCreate{value: val, isSet: true} +} + +func (v NullableStorageCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStorageCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_storage_update.go b/services/postgresflex/v3beta1api/model_storage_update.go new file mode 100644 index 000000000..8adb0d673 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_storage_update.go @@ -0,0 +1,155 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" +) + +// checks if the StorageUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &StorageUpdate{} + +// StorageUpdate The object containing information about the storage size and class. +type StorageUpdate struct { + // The storage size in Gigabytes. + Size *int32 `json:"size,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _StorageUpdate StorageUpdate + +// NewStorageUpdate instantiates a new StorageUpdate 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 NewStorageUpdate() *StorageUpdate { + this := StorageUpdate{} + return &this +} + +// NewStorageUpdateWithDefaults instantiates a new StorageUpdate 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 NewStorageUpdateWithDefaults() *StorageUpdate { + this := StorageUpdate{} + return &this +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *StorageUpdate) GetSize() int32 { + if o == nil || IsNil(o.Size) { + var ret int32 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StorageUpdate) GetSizeOk() (*int32, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *StorageUpdate) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given int32 and assigns it to the Size field. +func (o *StorageUpdate) SetSize(v int32) { + o.Size = &v +} + +func (o StorageUpdate) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o StorageUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *StorageUpdate) UnmarshalJSON(data []byte) (err error) { + varStorageUpdate := _StorageUpdate{} + + err = json.Unmarshal(data, &varStorageUpdate) + + if err != nil { + return err + } + + *o = StorageUpdate(varStorageUpdate) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "size") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableStorageUpdate struct { + value *StorageUpdate + isSet bool +} + +func (v NullableStorageUpdate) Get() *StorageUpdate { + return v.value +} + +func (v *NullableStorageUpdate) Set(val *StorageUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableStorageUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableStorageUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStorageUpdate(val *StorageUpdate) *NullableStorageUpdate { + return &NullableStorageUpdate{value: val, isSet: true} +} + +func (v NullableStorageUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStorageUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_update_database_partially_request_payload.go b/services/postgresflex/v3beta1api/model_update_database_partially_request_payload.go new file mode 100644 index 000000000..9a0d92896 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_update_database_partially_request_payload.go @@ -0,0 +1,193 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" +) + +// checks if the UpdateDatabasePartiallyRequestPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateDatabasePartiallyRequestPayload{} + +// UpdateDatabasePartiallyRequestPayload struct for UpdateDatabasePartiallyRequestPayload +type UpdateDatabasePartiallyRequestPayload struct { + // The name of the database. + Name *string `json:"name,omitempty"` + // The owner of the database. + Owner *string `json:"owner,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateDatabasePartiallyRequestPayload UpdateDatabasePartiallyRequestPayload + +// NewUpdateDatabasePartiallyRequestPayload instantiates a new UpdateDatabasePartiallyRequestPayload 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 NewUpdateDatabasePartiallyRequestPayload() *UpdateDatabasePartiallyRequestPayload { + this := UpdateDatabasePartiallyRequestPayload{} + return &this +} + +// NewUpdateDatabasePartiallyRequestPayloadWithDefaults instantiates a new UpdateDatabasePartiallyRequestPayload 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 NewUpdateDatabasePartiallyRequestPayloadWithDefaults() *UpdateDatabasePartiallyRequestPayload { + this := UpdateDatabasePartiallyRequestPayload{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateDatabasePartiallyRequestPayload) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateDatabasePartiallyRequestPayload) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateDatabasePartiallyRequestPayload) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateDatabasePartiallyRequestPayload) SetName(v string) { + o.Name = &v +} + +// GetOwner returns the Owner field value if set, zero value otherwise. +func (o *UpdateDatabasePartiallyRequestPayload) GetOwner() string { + if o == nil || IsNil(o.Owner) { + var ret string + return ret + } + return *o.Owner +} + +// GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateDatabasePartiallyRequestPayload) GetOwnerOk() (*string, bool) { + if o == nil || IsNil(o.Owner) { + return nil, false + } + return o.Owner, true +} + +// HasOwner returns a boolean if a field has been set. +func (o *UpdateDatabasePartiallyRequestPayload) HasOwner() bool { + if o != nil && !IsNil(o.Owner) { + return true + } + + return false +} + +// SetOwner gets a reference to the given string and assigns it to the Owner field. +func (o *UpdateDatabasePartiallyRequestPayload) SetOwner(v string) { + o.Owner = &v +} + +func (o UpdateDatabasePartiallyRequestPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateDatabasePartiallyRequestPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Owner) { + toSerialize["owner"] = o.Owner + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateDatabasePartiallyRequestPayload) UnmarshalJSON(data []byte) (err error) { + varUpdateDatabasePartiallyRequestPayload := _UpdateDatabasePartiallyRequestPayload{} + + err = json.Unmarshal(data, &varUpdateDatabasePartiallyRequestPayload) + + if err != nil { + return err + } + + *o = UpdateDatabasePartiallyRequestPayload(varUpdateDatabasePartiallyRequestPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "owner") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateDatabasePartiallyRequestPayload struct { + value *UpdateDatabasePartiallyRequestPayload + isSet bool +} + +func (v NullableUpdateDatabasePartiallyRequestPayload) Get() *UpdateDatabasePartiallyRequestPayload { + return v.value +} + +func (v *NullableUpdateDatabasePartiallyRequestPayload) Set(val *UpdateDatabasePartiallyRequestPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateDatabasePartiallyRequestPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateDatabasePartiallyRequestPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateDatabasePartiallyRequestPayload(val *UpdateDatabasePartiallyRequestPayload) *NullableUpdateDatabasePartiallyRequestPayload { + return &NullableUpdateDatabasePartiallyRequestPayload{value: val, isSet: true} +} + +func (v NullableUpdateDatabasePartiallyRequestPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateDatabasePartiallyRequestPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_update_database_partially_response.go b/services/postgresflex/v3beta1api/model_update_database_partially_response.go new file mode 100644 index 000000000..3678e1db8 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_update_database_partially_response.go @@ -0,0 +1,167 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateDatabasePartiallyResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateDatabasePartiallyResponse{} + +// UpdateDatabasePartiallyResponse struct for UpdateDatabasePartiallyResponse +type UpdateDatabasePartiallyResponse struct { + Database ListDatabase `json:"database"` + AdditionalProperties map[string]interface{} +} + +type _UpdateDatabasePartiallyResponse UpdateDatabasePartiallyResponse + +// NewUpdateDatabasePartiallyResponse instantiates a new UpdateDatabasePartiallyResponse 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 NewUpdateDatabasePartiallyResponse(database ListDatabase) *UpdateDatabasePartiallyResponse { + this := UpdateDatabasePartiallyResponse{} + this.Database = database + return &this +} + +// NewUpdateDatabasePartiallyResponseWithDefaults instantiates a new UpdateDatabasePartiallyResponse 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 NewUpdateDatabasePartiallyResponseWithDefaults() *UpdateDatabasePartiallyResponse { + this := UpdateDatabasePartiallyResponse{} + return &this +} + +// GetDatabase returns the Database field value +func (o *UpdateDatabasePartiallyResponse) GetDatabase() ListDatabase { + if o == nil { + var ret ListDatabase + return ret + } + + return o.Database +} + +// GetDatabaseOk returns a tuple with the Database field value +// and a boolean to check if the value has been set. +func (o *UpdateDatabasePartiallyResponse) GetDatabaseOk() (*ListDatabase, bool) { + if o == nil { + return nil, false + } + return &o.Database, true +} + +// SetDatabase sets field value +func (o *UpdateDatabasePartiallyResponse) SetDatabase(v ListDatabase) { + o.Database = v +} + +func (o UpdateDatabasePartiallyResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateDatabasePartiallyResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["database"] = o.Database + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateDatabasePartiallyResponse) 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{ + "database", + } + + 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) + } + } + + varUpdateDatabasePartiallyResponse := _UpdateDatabasePartiallyResponse{} + + err = json.Unmarshal(data, &varUpdateDatabasePartiallyResponse) + + if err != nil { + return err + } + + *o = UpdateDatabasePartiallyResponse(varUpdateDatabasePartiallyResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "database") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateDatabasePartiallyResponse struct { + value *UpdateDatabasePartiallyResponse + isSet bool +} + +func (v NullableUpdateDatabasePartiallyResponse) Get() *UpdateDatabasePartiallyResponse { + return v.value +} + +func (v *NullableUpdateDatabasePartiallyResponse) Set(val *UpdateDatabasePartiallyResponse) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateDatabasePartiallyResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateDatabasePartiallyResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateDatabasePartiallyResponse(val *UpdateDatabasePartiallyResponse) *NullableUpdateDatabasePartiallyResponse { + return &NullableUpdateDatabasePartiallyResponse{value: val, isSet: true} +} + +func (v NullableUpdateDatabasePartiallyResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateDatabasePartiallyResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_update_database_request_payload.go b/services/postgresflex/v3beta1api/model_update_database_request_payload.go new file mode 100644 index 000000000..3247754b5 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_update_database_request_payload.go @@ -0,0 +1,198 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateDatabaseRequestPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateDatabaseRequestPayload{} + +// UpdateDatabaseRequestPayload struct for UpdateDatabaseRequestPayload +type UpdateDatabaseRequestPayload struct { + // The name of the database. + Name string `json:"name"` + // The owner of the database. + Owner string `json:"owner"` + AdditionalProperties map[string]interface{} +} + +type _UpdateDatabaseRequestPayload UpdateDatabaseRequestPayload + +// NewUpdateDatabaseRequestPayload instantiates a new UpdateDatabaseRequestPayload 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 NewUpdateDatabaseRequestPayload(name string, owner string) *UpdateDatabaseRequestPayload { + this := UpdateDatabaseRequestPayload{} + this.Name = name + this.Owner = owner + return &this +} + +// NewUpdateDatabaseRequestPayloadWithDefaults instantiates a new UpdateDatabaseRequestPayload 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 NewUpdateDatabaseRequestPayloadWithDefaults() *UpdateDatabaseRequestPayload { + this := UpdateDatabaseRequestPayload{} + return &this +} + +// GetName returns the Name field value +func (o *UpdateDatabaseRequestPayload) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *UpdateDatabaseRequestPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *UpdateDatabaseRequestPayload) SetName(v string) { + o.Name = v +} + +// GetOwner returns the Owner field value +func (o *UpdateDatabaseRequestPayload) GetOwner() string { + if o == nil { + var ret string + return ret + } + + return o.Owner +} + +// GetOwnerOk returns a tuple with the Owner field value +// and a boolean to check if the value has been set. +func (o *UpdateDatabaseRequestPayload) GetOwnerOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Owner, true +} + +// SetOwner sets field value +func (o *UpdateDatabaseRequestPayload) SetOwner(v string) { + o.Owner = v +} + +func (o UpdateDatabaseRequestPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateDatabaseRequestPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["owner"] = o.Owner + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateDatabaseRequestPayload) 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{ + "name", + "owner", + } + + 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) + } + } + + varUpdateDatabaseRequestPayload := _UpdateDatabaseRequestPayload{} + + err = json.Unmarshal(data, &varUpdateDatabaseRequestPayload) + + if err != nil { + return err + } + + *o = UpdateDatabaseRequestPayload(varUpdateDatabaseRequestPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "owner") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateDatabaseRequestPayload struct { + value *UpdateDatabaseRequestPayload + isSet bool +} + +func (v NullableUpdateDatabaseRequestPayload) Get() *UpdateDatabaseRequestPayload { + return v.value +} + +func (v *NullableUpdateDatabaseRequestPayload) Set(val *UpdateDatabaseRequestPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateDatabaseRequestPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateDatabaseRequestPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateDatabaseRequestPayload(val *UpdateDatabaseRequestPayload) *NullableUpdateDatabaseRequestPayload { + return &NullableUpdateDatabaseRequestPayload{value: val, isSet: true} +} + +func (v NullableUpdateDatabaseRequestPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateDatabaseRequestPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_update_database_response.go b/services/postgresflex/v3beta1api/model_update_database_response.go new file mode 100644 index 000000000..e0bbfbb2e --- /dev/null +++ b/services/postgresflex/v3beta1api/model_update_database_response.go @@ -0,0 +1,167 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateDatabaseResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateDatabaseResponse{} + +// UpdateDatabaseResponse struct for UpdateDatabaseResponse +type UpdateDatabaseResponse struct { + Database ListDatabase `json:"database"` + AdditionalProperties map[string]interface{} +} + +type _UpdateDatabaseResponse UpdateDatabaseResponse + +// NewUpdateDatabaseResponse instantiates a new UpdateDatabaseResponse 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 NewUpdateDatabaseResponse(database ListDatabase) *UpdateDatabaseResponse { + this := UpdateDatabaseResponse{} + this.Database = database + return &this +} + +// NewUpdateDatabaseResponseWithDefaults instantiates a new UpdateDatabaseResponse 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 NewUpdateDatabaseResponseWithDefaults() *UpdateDatabaseResponse { + this := UpdateDatabaseResponse{} + return &this +} + +// GetDatabase returns the Database field value +func (o *UpdateDatabaseResponse) GetDatabase() ListDatabase { + if o == nil { + var ret ListDatabase + return ret + } + + return o.Database +} + +// GetDatabaseOk returns a tuple with the Database field value +// and a boolean to check if the value has been set. +func (o *UpdateDatabaseResponse) GetDatabaseOk() (*ListDatabase, bool) { + if o == nil { + return nil, false + } + return &o.Database, true +} + +// SetDatabase sets field value +func (o *UpdateDatabaseResponse) SetDatabase(v ListDatabase) { + o.Database = v +} + +func (o UpdateDatabaseResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateDatabaseResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["database"] = o.Database + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateDatabaseResponse) 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{ + "database", + } + + 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) + } + } + + varUpdateDatabaseResponse := _UpdateDatabaseResponse{} + + err = json.Unmarshal(data, &varUpdateDatabaseResponse) + + if err != nil { + return err + } + + *o = UpdateDatabaseResponse(varUpdateDatabaseResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "database") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateDatabaseResponse struct { + value *UpdateDatabaseResponse + isSet bool +} + +func (v NullableUpdateDatabaseResponse) Get() *UpdateDatabaseResponse { + return v.value +} + +func (v *NullableUpdateDatabaseResponse) Set(val *UpdateDatabaseResponse) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateDatabaseResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateDatabaseResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateDatabaseResponse(val *UpdateDatabaseResponse) *NullableUpdateDatabaseResponse { + return &NullableUpdateDatabaseResponse{value: val, isSet: true} +} + +func (v NullableUpdateDatabaseResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateDatabaseResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_update_instance_partially_request_payload.go b/services/postgresflex/v3beta1api/model_update_instance_partially_request_payload.go new file mode 100644 index 000000000..0bc3ca443 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_update_instance_partially_request_payload.go @@ -0,0 +1,419 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" +) + +// checks if the UpdateInstancePartiallyRequestPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateInstancePartiallyRequestPayload{} + +// UpdateInstancePartiallyRequestPayload struct for UpdateInstancePartiallyRequestPayload +type UpdateInstancePartiallyRequestPayload struct { + // The schedule for when the database backup will be created. Currently, ONLY daily schedules are supported (every 24 hours). The schedule is written as a cron schedule. + BackupSchedule *string `json:"backupSchedule,omitempty"` + // The id of the instance flavor. + FlavorId *string `json:"flavorId,omitempty"` + // Key-value pairs, 63 characters max, begin and end with an alphanumerical character, may contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character. Max 64 labels Regex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$ Regex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$ The stackit- prefix is reserved and cannot be used for Keys. + Labels *map[string]string `json:"labels,omitempty"` + // The name of the instance. + Name *string `json:"name,omitempty"` + Network *InstanceNetworkOpt `json:"network,omitempty"` + // How long backups are retained. The value can only be between 32 and 90 days. + RetentionDays *int32 `json:"retentionDays,omitempty"` + Storage *StorageUpdate `json:"storage,omitempty"` + // The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3beta1#tag/Version) for supported version parameters. + Version *string `json:"version,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateInstancePartiallyRequestPayload UpdateInstancePartiallyRequestPayload + +// NewUpdateInstancePartiallyRequestPayload instantiates a new UpdateInstancePartiallyRequestPayload 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 NewUpdateInstancePartiallyRequestPayload() *UpdateInstancePartiallyRequestPayload { + this := UpdateInstancePartiallyRequestPayload{} + return &this +} + +// NewUpdateInstancePartiallyRequestPayloadWithDefaults instantiates a new UpdateInstancePartiallyRequestPayload 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 NewUpdateInstancePartiallyRequestPayloadWithDefaults() *UpdateInstancePartiallyRequestPayload { + this := UpdateInstancePartiallyRequestPayload{} + return &this +} + +// GetBackupSchedule returns the BackupSchedule field value if set, zero value otherwise. +func (o *UpdateInstancePartiallyRequestPayload) GetBackupSchedule() string { + if o == nil || IsNil(o.BackupSchedule) { + var ret string + return ret + } + return *o.BackupSchedule +} + +// GetBackupScheduleOk returns a tuple with the BackupSchedule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstancePartiallyRequestPayload) GetBackupScheduleOk() (*string, bool) { + if o == nil || IsNil(o.BackupSchedule) { + return nil, false + } + return o.BackupSchedule, true +} + +// HasBackupSchedule returns a boolean if a field has been set. +func (o *UpdateInstancePartiallyRequestPayload) HasBackupSchedule() bool { + if o != nil && !IsNil(o.BackupSchedule) { + return true + } + + return false +} + +// SetBackupSchedule gets a reference to the given string and assigns it to the BackupSchedule field. +func (o *UpdateInstancePartiallyRequestPayload) SetBackupSchedule(v string) { + o.BackupSchedule = &v +} + +// GetFlavorId returns the FlavorId field value if set, zero value otherwise. +func (o *UpdateInstancePartiallyRequestPayload) GetFlavorId() string { + if o == nil || IsNil(o.FlavorId) { + var ret string + return ret + } + return *o.FlavorId +} + +// GetFlavorIdOk returns a tuple with the FlavorId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstancePartiallyRequestPayload) GetFlavorIdOk() (*string, bool) { + if o == nil || IsNil(o.FlavorId) { + return nil, false + } + return o.FlavorId, true +} + +// HasFlavorId returns a boolean if a field has been set. +func (o *UpdateInstancePartiallyRequestPayload) HasFlavorId() bool { + if o != nil && !IsNil(o.FlavorId) { + return true + } + + return false +} + +// SetFlavorId gets a reference to the given string and assigns it to the FlavorId field. +func (o *UpdateInstancePartiallyRequestPayload) SetFlavorId(v string) { + o.FlavorId = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateInstancePartiallyRequestPayload) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstancePartiallyRequestPayload) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateInstancePartiallyRequestPayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateInstancePartiallyRequestPayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateInstancePartiallyRequestPayload) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstancePartiallyRequestPayload) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateInstancePartiallyRequestPayload) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateInstancePartiallyRequestPayload) SetName(v string) { + o.Name = &v +} + +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *UpdateInstancePartiallyRequestPayload) GetNetwork() InstanceNetworkOpt { + if o == nil || IsNil(o.Network) { + var ret InstanceNetworkOpt + return ret + } + return *o.Network +} + +// GetNetworkOk returns a tuple with the Network field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstancePartiallyRequestPayload) GetNetworkOk() (*InstanceNetworkOpt, bool) { + if o == nil || IsNil(o.Network) { + return nil, false + } + return o.Network, true +} + +// HasNetwork returns a boolean if a field has been set. +func (o *UpdateInstancePartiallyRequestPayload) HasNetwork() bool { + if o != nil && !IsNil(o.Network) { + return true + } + + return false +} + +// SetNetwork gets a reference to the given InstanceNetworkOpt and assigns it to the Network field. +func (o *UpdateInstancePartiallyRequestPayload) SetNetwork(v InstanceNetworkOpt) { + o.Network = &v +} + +// GetRetentionDays returns the RetentionDays field value if set, zero value otherwise. +func (o *UpdateInstancePartiallyRequestPayload) GetRetentionDays() int32 { + if o == nil || IsNil(o.RetentionDays) { + var ret int32 + return ret + } + return *o.RetentionDays +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstancePartiallyRequestPayload) GetRetentionDaysOk() (*int32, bool) { + if o == nil || IsNil(o.RetentionDays) { + return nil, false + } + return o.RetentionDays, true +} + +// HasRetentionDays returns a boolean if a field has been set. +func (o *UpdateInstancePartiallyRequestPayload) HasRetentionDays() bool { + if o != nil && !IsNil(o.RetentionDays) { + return true + } + + return false +} + +// SetRetentionDays gets a reference to the given int32 and assigns it to the RetentionDays field. +func (o *UpdateInstancePartiallyRequestPayload) SetRetentionDays(v int32) { + o.RetentionDays = &v +} + +// GetStorage returns the Storage field value if set, zero value otherwise. +func (o *UpdateInstancePartiallyRequestPayload) GetStorage() StorageUpdate { + if o == nil || IsNil(o.Storage) { + var ret StorageUpdate + return ret + } + return *o.Storage +} + +// GetStorageOk returns a tuple with the Storage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstancePartiallyRequestPayload) GetStorageOk() (*StorageUpdate, bool) { + if o == nil || IsNil(o.Storage) { + return nil, false + } + return o.Storage, true +} + +// HasStorage returns a boolean if a field has been set. +func (o *UpdateInstancePartiallyRequestPayload) HasStorage() bool { + if o != nil && !IsNil(o.Storage) { + return true + } + + return false +} + +// SetStorage gets a reference to the given StorageUpdate and assigns it to the Storage field. +func (o *UpdateInstancePartiallyRequestPayload) SetStorage(v StorageUpdate) { + o.Storage = &v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *UpdateInstancePartiallyRequestPayload) GetVersion() string { + if o == nil || IsNil(o.Version) { + var ret string + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstancePartiallyRequestPayload) GetVersionOk() (*string, bool) { + if o == nil || IsNil(o.Version) { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *UpdateInstancePartiallyRequestPayload) HasVersion() bool { + if o != nil && !IsNil(o.Version) { + return true + } + + return false +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *UpdateInstancePartiallyRequestPayload) SetVersion(v string) { + o.Version = &v +} + +func (o UpdateInstancePartiallyRequestPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateInstancePartiallyRequestPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BackupSchedule) { + toSerialize["backupSchedule"] = o.BackupSchedule + } + if !IsNil(o.FlavorId) { + toSerialize["flavorId"] = o.FlavorId + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Network) { + toSerialize["network"] = o.Network + } + if !IsNil(o.RetentionDays) { + toSerialize["retentionDays"] = o.RetentionDays + } + if !IsNil(o.Storage) { + toSerialize["storage"] = o.Storage + } + if !IsNil(o.Version) { + toSerialize["version"] = o.Version + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateInstancePartiallyRequestPayload) UnmarshalJSON(data []byte) (err error) { + varUpdateInstancePartiallyRequestPayload := _UpdateInstancePartiallyRequestPayload{} + + err = json.Unmarshal(data, &varUpdateInstancePartiallyRequestPayload) + + if err != nil { + return err + } + + *o = UpdateInstancePartiallyRequestPayload(varUpdateInstancePartiallyRequestPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "backupSchedule") + delete(additionalProperties, "flavorId") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "network") + delete(additionalProperties, "retentionDays") + delete(additionalProperties, "storage") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateInstancePartiallyRequestPayload struct { + value *UpdateInstancePartiallyRequestPayload + isSet bool +} + +func (v NullableUpdateInstancePartiallyRequestPayload) Get() *UpdateInstancePartiallyRequestPayload { + return v.value +} + +func (v *NullableUpdateInstancePartiallyRequestPayload) Set(val *UpdateInstancePartiallyRequestPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateInstancePartiallyRequestPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateInstancePartiallyRequestPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateInstancePartiallyRequestPayload(val *UpdateInstancePartiallyRequestPayload) *NullableUpdateInstancePartiallyRequestPayload { + return &NullableUpdateInstancePartiallyRequestPayload{value: val, isSet: true} +} + +func (v NullableUpdateInstancePartiallyRequestPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateInstancePartiallyRequestPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_update_instance_request_payload.go b/services/postgresflex/v3beta1api/model_update_instance_request_payload.go new file mode 100644 index 000000000..5c7610af2 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_update_instance_request_payload.go @@ -0,0 +1,386 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateInstanceRequestPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateInstanceRequestPayload{} + +// UpdateInstanceRequestPayload struct for UpdateInstanceRequestPayload +type UpdateInstanceRequestPayload struct { + // The schedule for when the database backup will be created. Currently, ONLY daily schedules are supported (every 24 hours). The schedule is written as a cron schedule. + BackupSchedule string `json:"backupSchedule"` + // The id of the instance flavor. + FlavorId string `json:"flavorId"` + // Key-value pairs, 63 characters max, begin and end with an alphanumerical character, may contain dashes (-), underscores (_), dots (.), and alphanumerics between. Key MUST be at least 1 character. Max 64 labels Regex for keys: ^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$ Regex for values: ^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$ The stackit- prefix is reserved and cannot be used for Keys. + Labels *map[string]string `json:"labels,omitempty"` + // The name of the instance. + Name string `json:"name"` + Network InstanceNetworkUpdate `json:"network"` + // How long backups are retained. The value can only be between 32 and 90 days. + RetentionDays NullableInt32 `json:"retentionDays"` + Storage StorageUpdate `json:"storage"` + // The Postgres version used for the instance. See [Versions Endpoint](/documentation/postgres-flex-service/version/v3beta1#tag/Version) for supported version parameters. + Version string `json:"version"` + AdditionalProperties map[string]interface{} +} + +type _UpdateInstanceRequestPayload UpdateInstanceRequestPayload + +// NewUpdateInstanceRequestPayload instantiates a new UpdateInstanceRequestPayload 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 NewUpdateInstanceRequestPayload(backupSchedule string, flavorId string, name string, network InstanceNetworkUpdate, retentionDays NullableInt32, storage StorageUpdate, version string) *UpdateInstanceRequestPayload { + this := UpdateInstanceRequestPayload{} + this.BackupSchedule = backupSchedule + this.FlavorId = flavorId + this.Name = name + this.Network = network + this.RetentionDays = retentionDays + this.Storage = storage + this.Version = version + return &this +} + +// NewUpdateInstanceRequestPayloadWithDefaults instantiates a new UpdateInstanceRequestPayload 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 NewUpdateInstanceRequestPayloadWithDefaults() *UpdateInstanceRequestPayload { + this := UpdateInstanceRequestPayload{} + return &this +} + +// GetBackupSchedule returns the BackupSchedule field value +func (o *UpdateInstanceRequestPayload) GetBackupSchedule() string { + if o == nil { + var ret string + return ret + } + + return o.BackupSchedule +} + +// GetBackupScheduleOk returns a tuple with the BackupSchedule field value +// and a boolean to check if the value has been set. +func (o *UpdateInstanceRequestPayload) GetBackupScheduleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BackupSchedule, true +} + +// SetBackupSchedule sets field value +func (o *UpdateInstanceRequestPayload) SetBackupSchedule(v string) { + o.BackupSchedule = v +} + +// GetFlavorId returns the FlavorId field value +func (o *UpdateInstanceRequestPayload) GetFlavorId() string { + if o == nil { + var ret string + return ret + } + + return o.FlavorId +} + +// GetFlavorIdOk returns a tuple with the FlavorId field value +// and a boolean to check if the value has been set. +func (o *UpdateInstanceRequestPayload) GetFlavorIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FlavorId, true +} + +// SetFlavorId sets field value +func (o *UpdateInstanceRequestPayload) SetFlavorId(v string) { + o.FlavorId = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateInstanceRequestPayload) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateInstanceRequestPayload) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateInstanceRequestPayload) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *UpdateInstanceRequestPayload) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetName returns the Name field value +func (o *UpdateInstanceRequestPayload) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *UpdateInstanceRequestPayload) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *UpdateInstanceRequestPayload) SetName(v string) { + o.Name = v +} + +// GetNetwork returns the Network field value +func (o *UpdateInstanceRequestPayload) GetNetwork() InstanceNetworkUpdate { + if o == nil { + var ret InstanceNetworkUpdate + return ret + } + + return o.Network +} + +// GetNetworkOk returns a tuple with the Network field value +// and a boolean to check if the value has been set. +func (o *UpdateInstanceRequestPayload) GetNetworkOk() (*InstanceNetworkUpdate, bool) { + if o == nil { + return nil, false + } + return &o.Network, true +} + +// SetNetwork sets field value +func (o *UpdateInstanceRequestPayload) SetNetwork(v InstanceNetworkUpdate) { + o.Network = v +} + +// GetRetentionDays returns the RetentionDays field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *UpdateInstanceRequestPayload) GetRetentionDays() int32 { + if o == nil || o.RetentionDays.Get() == nil { + var ret int32 + return ret + } + + return *o.RetentionDays.Get() +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateInstanceRequestPayload) GetRetentionDaysOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.RetentionDays.Get(), o.RetentionDays.IsSet() +} + +// SetRetentionDays sets field value +func (o *UpdateInstanceRequestPayload) SetRetentionDays(v int32) { + o.RetentionDays.Set(&v) +} + +// GetStorage returns the Storage field value +func (o *UpdateInstanceRequestPayload) GetStorage() StorageUpdate { + if o == nil { + var ret StorageUpdate + return ret + } + + return o.Storage +} + +// GetStorageOk returns a tuple with the Storage field value +// and a boolean to check if the value has been set. +func (o *UpdateInstanceRequestPayload) GetStorageOk() (*StorageUpdate, bool) { + if o == nil { + return nil, false + } + return &o.Storage, true +} + +// SetStorage sets field value +func (o *UpdateInstanceRequestPayload) SetStorage(v StorageUpdate) { + o.Storage = v +} + +// GetVersion returns the Version field value +func (o *UpdateInstanceRequestPayload) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *UpdateInstanceRequestPayload) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *UpdateInstanceRequestPayload) SetVersion(v string) { + o.Version = v +} + +func (o UpdateInstanceRequestPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateInstanceRequestPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["backupSchedule"] = o.BackupSchedule + toSerialize["flavorId"] = o.FlavorId + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["name"] = o.Name + toSerialize["network"] = o.Network + toSerialize["retentionDays"] = o.RetentionDays.Get() + toSerialize["storage"] = o.Storage + toSerialize["version"] = o.Version + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateInstanceRequestPayload) 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{ + "backupSchedule", + "flavorId", + "name", + "network", + "retentionDays", + "storage", + "version", + } + + 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) + } + } + + varUpdateInstanceRequestPayload := _UpdateInstanceRequestPayload{} + + err = json.Unmarshal(data, &varUpdateInstanceRequestPayload) + + if err != nil { + return err + } + + *o = UpdateInstanceRequestPayload(varUpdateInstanceRequestPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "backupSchedule") + delete(additionalProperties, "flavorId") + delete(additionalProperties, "labels") + delete(additionalProperties, "name") + delete(additionalProperties, "network") + delete(additionalProperties, "retentionDays") + delete(additionalProperties, "storage") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateInstanceRequestPayload struct { + value *UpdateInstanceRequestPayload + isSet bool +} + +func (v NullableUpdateInstanceRequestPayload) Get() *UpdateInstanceRequestPayload { + return v.value +} + +func (v *NullableUpdateInstanceRequestPayload) Set(val *UpdateInstanceRequestPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateInstanceRequestPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateInstanceRequestPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateInstanceRequestPayload(val *UpdateInstanceRequestPayload) *NullableUpdateInstanceRequestPayload { + return &NullableUpdateInstanceRequestPayload{value: val, isSet: true} +} + +func (v NullableUpdateInstanceRequestPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateInstanceRequestPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_update_user_partially_request_payload.go b/services/postgresflex/v3beta1api/model_update_user_partially_request_payload.go new file mode 100644 index 000000000..6d283f87e --- /dev/null +++ b/services/postgresflex/v3beta1api/model_update_user_partially_request_payload.go @@ -0,0 +1,193 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" +) + +// checks if the UpdateUserPartiallyRequestPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateUserPartiallyRequestPayload{} + +// UpdateUserPartiallyRequestPayload struct for UpdateUserPartiallyRequestPayload +type UpdateUserPartiallyRequestPayload struct { + // The name of the user. + Name *string `json:"name,omitempty"` + // A list containing the user roles for the instance. Please refer to the List Roles endpoint for a list of all available Roles. + Roles []string `json:"roles,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateUserPartiallyRequestPayload UpdateUserPartiallyRequestPayload + +// NewUpdateUserPartiallyRequestPayload instantiates a new UpdateUserPartiallyRequestPayload 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 NewUpdateUserPartiallyRequestPayload() *UpdateUserPartiallyRequestPayload { + this := UpdateUserPartiallyRequestPayload{} + return &this +} + +// NewUpdateUserPartiallyRequestPayloadWithDefaults instantiates a new UpdateUserPartiallyRequestPayload 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 NewUpdateUserPartiallyRequestPayloadWithDefaults() *UpdateUserPartiallyRequestPayload { + this := UpdateUserPartiallyRequestPayload{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateUserPartiallyRequestPayload) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateUserPartiallyRequestPayload) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateUserPartiallyRequestPayload) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateUserPartiallyRequestPayload) SetName(v string) { + o.Name = &v +} + +// GetRoles returns the Roles field value if set, zero value otherwise. +func (o *UpdateUserPartiallyRequestPayload) GetRoles() []string { + if o == nil || IsNil(o.Roles) { + var ret []string + return ret + } + return o.Roles +} + +// GetRolesOk returns a tuple with the Roles field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateUserPartiallyRequestPayload) GetRolesOk() ([]string, bool) { + if o == nil || IsNil(o.Roles) { + return nil, false + } + return o.Roles, true +} + +// HasRoles returns a boolean if a field has been set. +func (o *UpdateUserPartiallyRequestPayload) HasRoles() bool { + if o != nil && !IsNil(o.Roles) { + return true + } + + return false +} + +// SetRoles gets a reference to the given []string and assigns it to the Roles field. +func (o *UpdateUserPartiallyRequestPayload) SetRoles(v []string) { + o.Roles = v +} + +func (o UpdateUserPartiallyRequestPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateUserPartiallyRequestPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Roles) { + toSerialize["roles"] = o.Roles + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateUserPartiallyRequestPayload) UnmarshalJSON(data []byte) (err error) { + varUpdateUserPartiallyRequestPayload := _UpdateUserPartiallyRequestPayload{} + + err = json.Unmarshal(data, &varUpdateUserPartiallyRequestPayload) + + if err != nil { + return err + } + + *o = UpdateUserPartiallyRequestPayload(varUpdateUserPartiallyRequestPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "roles") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateUserPartiallyRequestPayload struct { + value *UpdateUserPartiallyRequestPayload + isSet bool +} + +func (v NullableUpdateUserPartiallyRequestPayload) Get() *UpdateUserPartiallyRequestPayload { + return v.value +} + +func (v *NullableUpdateUserPartiallyRequestPayload) Set(val *UpdateUserPartiallyRequestPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateUserPartiallyRequestPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateUserPartiallyRequestPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateUserPartiallyRequestPayload(val *UpdateUserPartiallyRequestPayload) *NullableUpdateUserPartiallyRequestPayload { + return &NullableUpdateUserPartiallyRequestPayload{value: val, isSet: true} +} + +func (v NullableUpdateUserPartiallyRequestPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateUserPartiallyRequestPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_update_user_request_payload.go b/services/postgresflex/v3beta1api/model_update_user_request_payload.go new file mode 100644 index 000000000..793bdbe54 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_update_user_request_payload.go @@ -0,0 +1,206 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the UpdateUserRequestPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateUserRequestPayload{} + +// UpdateUserRequestPayload struct for UpdateUserRequestPayload +type UpdateUserRequestPayload struct { + // The name of the user. + Name *string `json:"name,omitempty"` + // A list containing the user roles for the instance. Please refer to the List Roles endpoint for a list of all available Roles. + Roles []string `json:"roles"` + AdditionalProperties map[string]interface{} +} + +type _UpdateUserRequestPayload UpdateUserRequestPayload + +// NewUpdateUserRequestPayload instantiates a new UpdateUserRequestPayload 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 NewUpdateUserRequestPayload(roles []string) *UpdateUserRequestPayload { + this := UpdateUserRequestPayload{} + this.Roles = roles + return &this +} + +// NewUpdateUserRequestPayloadWithDefaults instantiates a new UpdateUserRequestPayload 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 NewUpdateUserRequestPayloadWithDefaults() *UpdateUserRequestPayload { + this := UpdateUserRequestPayload{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateUserRequestPayload) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateUserRequestPayload) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateUserRequestPayload) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateUserRequestPayload) SetName(v string) { + o.Name = &v +} + +// GetRoles returns the Roles field value +func (o *UpdateUserRequestPayload) GetRoles() []string { + if o == nil { + var ret []string + return ret + } + + return o.Roles +} + +// GetRolesOk returns a tuple with the Roles field value +// and a boolean to check if the value has been set. +func (o *UpdateUserRequestPayload) GetRolesOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Roles, true +} + +// SetRoles sets field value +func (o *UpdateUserRequestPayload) SetRoles(v []string) { + o.Roles = v +} + +func (o UpdateUserRequestPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateUserRequestPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + toSerialize["roles"] = o.Roles + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateUserRequestPayload) 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{ + "roles", + } + + 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) + } + } + + varUpdateUserRequestPayload := _UpdateUserRequestPayload{} + + err = json.Unmarshal(data, &varUpdateUserRequestPayload) + + if err != nil { + return err + } + + *o = UpdateUserRequestPayload(varUpdateUserRequestPayload) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "roles") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateUserRequestPayload struct { + value *UpdateUserRequestPayload + isSet bool +} + +func (v NullableUpdateUserRequestPayload) Get() *UpdateUserRequestPayload { + return v.value +} + +func (v *NullableUpdateUserRequestPayload) Set(val *UpdateUserRequestPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateUserRequestPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateUserRequestPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateUserRequestPayload(val *UpdateUserRequestPayload) *NullableUpdateUserRequestPayload { + return &NullableUpdateUserRequestPayload{value: val, isSet: true} +} + +func (v NullableUpdateUserRequestPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateUserRequestPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_user_sort.go b/services/postgresflex/v3beta1api/model_user_sort.go new file mode 100644 index 000000000..78bea8037 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_user_sort.go @@ -0,0 +1,122 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// UserSort the model 'UserSort' +type UserSort string + +// List of user.sort +const ( + USERSORT_ID_ASC UserSort = "id.asc" + USERSORT_ID_DESC UserSort = "id.desc" + USERSORT_NAME_DESC UserSort = "name.desc" + USERSORT_NAME_ASC UserSort = "name.asc" + USERSORT_STATE_DESC UserSort = "state.desc" + USERSORT_STATE_ASC UserSort = "state.asc" + USERSORT_UNKNOWN_DEFAULT_OPEN_API UserSort = "unknown_default_open_api" +) + +// All allowed values of UserSort enum +var AllowedUserSortEnumValues = []UserSort{ + "id.asc", + "id.desc", + "name.desc", + "name.asc", + "state.desc", + "state.asc", + "unknown_default_open_api", +} + +func (v *UserSort) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := UserSort(value) + for _, existing := range AllowedUserSortEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + *v = USERSORT_UNKNOWN_DEFAULT_OPEN_API + return nil +} + +// NewUserSortFromValue returns a pointer to a valid UserSort +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewUserSortFromValue(v string) (*UserSort, error) { + ev := UserSort(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for UserSort: valid values are %v", v, AllowedUserSortEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v UserSort) IsValid() bool { + for _, existing := range AllowedUserSortEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to user.sort value +func (v UserSort) Ptr() *UserSort { + return &v +} + +type NullableUserSort struct { + value *UserSort + isSet bool +} + +func (v NullableUserSort) Get() *UserSort { + return v.value +} + +func (v *NullableUserSort) Set(val *UserSort) { + v.value = val + v.isSet = true +} + +func (v NullableUserSort) IsSet() bool { + return v.isSet +} + +func (v *NullableUserSort) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUserSort(val *UserSort) *NullableUserSort { + return &NullableUserSort{value: val, isSet: true} +} + +func (v NullableUserSort) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUserSort) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_validation_error.go b/services/postgresflex/v3beta1api/model_validation_error.go new file mode 100644 index 000000000..a7c62052d --- /dev/null +++ b/services/postgresflex/v3beta1api/model_validation_error.go @@ -0,0 +1,198 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ValidationError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ValidationError{} + +// ValidationError struct for ValidationError +type ValidationError struct { + // the http error should be always 422 for validationError + Code int32 `json:"code"` + // errors for all fields where the error happened + Validation []ValidationErrorValidationInner `json:"validation"` + AdditionalProperties map[string]interface{} +} + +type _ValidationError ValidationError + +// NewValidationError instantiates a new ValidationError 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 NewValidationError(code int32, validation []ValidationErrorValidationInner) *ValidationError { + this := ValidationError{} + this.Code = code + this.Validation = validation + return &this +} + +// NewValidationErrorWithDefaults instantiates a new ValidationError 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 NewValidationErrorWithDefaults() *ValidationError { + this := ValidationError{} + return &this +} + +// GetCode returns the Code field value +func (o *ValidationError) GetCode() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Code +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *ValidationError) GetCodeOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Code, true +} + +// SetCode sets field value +func (o *ValidationError) SetCode(v int32) { + o.Code = v +} + +// GetValidation returns the Validation field value +func (o *ValidationError) GetValidation() []ValidationErrorValidationInner { + if o == nil { + var ret []ValidationErrorValidationInner + return ret + } + + return o.Validation +} + +// GetValidationOk returns a tuple with the Validation field value +// and a boolean to check if the value has been set. +func (o *ValidationError) GetValidationOk() ([]ValidationErrorValidationInner, bool) { + if o == nil { + return nil, false + } + return o.Validation, true +} + +// SetValidation sets field value +func (o *ValidationError) SetValidation(v []ValidationErrorValidationInner) { + o.Validation = v +} + +func (o ValidationError) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ValidationError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["code"] = o.Code + toSerialize["validation"] = o.Validation + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ValidationError) 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{ + "code", + "validation", + } + + 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) + } + } + + varValidationError := _ValidationError{} + + err = json.Unmarshal(data, &varValidationError) + + if err != nil { + return err + } + + *o = ValidationError(varValidationError) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "validation") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableValidationError struct { + value *ValidationError + isSet bool +} + +func (v NullableValidationError) Get() *ValidationError { + return v.value +} + +func (v *NullableValidationError) Set(val *ValidationError) { + v.value = val + v.isSet = true +} + +func (v NullableValidationError) IsSet() bool { + return v.isSet +} + +func (v *NullableValidationError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableValidationError(val *ValidationError) *NullableValidationError { + return &NullableValidationError{value: val, isSet: true} +} + +func (v NullableValidationError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableValidationError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_validation_error_validation_inner.go b/services/postgresflex/v3beta1api/model_validation_error_validation_inner.go new file mode 100644 index 000000000..93169734a --- /dev/null +++ b/services/postgresflex/v3beta1api/model_validation_error_validation_inner.go @@ -0,0 +1,196 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the ValidationErrorValidationInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ValidationErrorValidationInner{} + +// ValidationErrorValidationInner struct for ValidationErrorValidationInner +type ValidationErrorValidationInner struct { + Field string `json:"field"` + Message string `json:"message"` + AdditionalProperties map[string]interface{} +} + +type _ValidationErrorValidationInner ValidationErrorValidationInner + +// NewValidationErrorValidationInner instantiates a new ValidationErrorValidationInner 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 NewValidationErrorValidationInner(field string, message string) *ValidationErrorValidationInner { + this := ValidationErrorValidationInner{} + this.Field = field + this.Message = message + return &this +} + +// NewValidationErrorValidationInnerWithDefaults instantiates a new ValidationErrorValidationInner 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 NewValidationErrorValidationInnerWithDefaults() *ValidationErrorValidationInner { + this := ValidationErrorValidationInner{} + return &this +} + +// GetField returns the Field field value +func (o *ValidationErrorValidationInner) GetField() string { + if o == nil { + var ret string + return ret + } + + return o.Field +} + +// GetFieldOk returns a tuple with the Field field value +// and a boolean to check if the value has been set. +func (o *ValidationErrorValidationInner) GetFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Field, true +} + +// SetField sets field value +func (o *ValidationErrorValidationInner) SetField(v string) { + o.Field = v +} + +// GetMessage returns the Message field value +func (o *ValidationErrorValidationInner) 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 *ValidationErrorValidationInner) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *ValidationErrorValidationInner) SetMessage(v string) { + o.Message = v +} + +func (o ValidationErrorValidationInner) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ValidationErrorValidationInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["field"] = o.Field + toSerialize["message"] = o.Message + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ValidationErrorValidationInner) 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{ + "field", + "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) + } + } + + varValidationErrorValidationInner := _ValidationErrorValidationInner{} + + err = json.Unmarshal(data, &varValidationErrorValidationInner) + + if err != nil { + return err + } + + *o = ValidationErrorValidationInner(varValidationErrorValidationInner) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "field") + delete(additionalProperties, "message") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableValidationErrorValidationInner struct { + value *ValidationErrorValidationInner + isSet bool +} + +func (v NullableValidationErrorValidationInner) Get() *ValidationErrorValidationInner { + return v.value +} + +func (v *NullableValidationErrorValidationInner) Set(val *ValidationErrorValidationInner) { + v.value = val + v.isSet = true +} + +func (v NullableValidationErrorValidationInner) IsSet() bool { + return v.isSet +} + +func (v *NullableValidationErrorValidationInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableValidationErrorValidationInner(val *ValidationErrorValidationInner) *NullableValidationErrorValidationInner { + return &NullableValidationErrorValidationInner{value: val, isSet: true} +} + +func (v NullableValidationErrorValidationInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableValidationErrorValidationInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/model_version.go b/services/postgresflex/v3beta1api/model_version.go new file mode 100644 index 000000000..712525ca4 --- /dev/null +++ b/services/postgresflex/v3beta1api/model_version.go @@ -0,0 +1,258 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +import ( + "encoding/json" + "fmt" +) + +// checks if the Version type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Version{} + +// Version The version of the postgres instance and more details. +type Version struct { + // Flag if the version is a beta version. If set the version may contain bugs and is not fully tested. + Beta bool `json:"beta"` + // Timestamp in RFC3339 format which says when the version will no longer be supported by STACKIT. + Deprecated string `json:"deprecated"` + // Flag if the version is recommend by the STACKIT Team. + Recommend bool `json:"recommend"` + // The postgres version used for the instance. + Version string `json:"version"` + AdditionalProperties map[string]interface{} +} + +type _Version Version + +// NewVersion instantiates a new Version object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVersion(beta bool, deprecated string, recommend bool, version string) *Version { + this := Version{} + this.Beta = beta + this.Deprecated = deprecated + this.Recommend = recommend + this.Version = version + return &this +} + +// NewVersionWithDefaults instantiates a new Version object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVersionWithDefaults() *Version { + this := Version{} + return &this +} + +// GetBeta returns the Beta field value +func (o *Version) GetBeta() bool { + if o == nil { + var ret bool + return ret + } + + return o.Beta +} + +// GetBetaOk returns a tuple with the Beta field value +// and a boolean to check if the value has been set. +func (o *Version) GetBetaOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Beta, true +} + +// SetBeta sets field value +func (o *Version) SetBeta(v bool) { + o.Beta = v +} + +// GetDeprecated returns the Deprecated field value +func (o *Version) GetDeprecated() string { + if o == nil { + var ret string + return ret + } + + return o.Deprecated +} + +// GetDeprecatedOk returns a tuple with the Deprecated field value +// and a boolean to check if the value has been set. +func (o *Version) GetDeprecatedOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Deprecated, true +} + +// SetDeprecated sets field value +func (o *Version) SetDeprecated(v string) { + o.Deprecated = v +} + +// GetRecommend returns the Recommend field value +func (o *Version) GetRecommend() bool { + if o == nil { + var ret bool + return ret + } + + return o.Recommend +} + +// GetRecommendOk returns a tuple with the Recommend field value +// and a boolean to check if the value has been set. +func (o *Version) GetRecommendOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Recommend, true +} + +// SetRecommend sets field value +func (o *Version) SetRecommend(v bool) { + o.Recommend = v +} + +// GetVersion returns the Version field value +func (o *Version) GetVersion() string { + if o == nil { + var ret string + return ret + } + + return o.Version +} + +// GetVersionOk returns a tuple with the Version field value +// and a boolean to check if the value has been set. +func (o *Version) GetVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Version, true +} + +// SetVersion sets field value +func (o *Version) SetVersion(v string) { + o.Version = v +} + +func (o Version) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Version) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["beta"] = o.Beta + toSerialize["deprecated"] = o.Deprecated + toSerialize["recommend"] = o.Recommend + toSerialize["version"] = o.Version + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Version) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "beta", + "deprecated", + "recommend", + "version", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varVersion := _Version{} + + err = json.Unmarshal(data, &varVersion) + + if err != nil { + return err + } + + *o = Version(varVersion) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "beta") + delete(additionalProperties, "deprecated") + delete(additionalProperties, "recommend") + delete(additionalProperties, "version") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableVersion struct { + value *Version + isSet bool +} + +func (v NullableVersion) Get() *Version { + return v.value +} + +func (v *NullableVersion) Set(val *Version) { + v.value = val + v.isSet = true +} + +func (v NullableVersion) IsSet() bool { + return v.isSet +} + +func (v *NullableVersion) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVersion(val *Version) *NullableVersion { + return &NullableVersion{value: val, isSet: true} +} + +func (v NullableVersion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVersion) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/postgresflex/v3beta1api/response.go b/services/postgresflex/v3beta1api/response.go new file mode 100644 index 000000000..24c38d0d2 --- /dev/null +++ b/services/postgresflex/v3beta1api/response.go @@ -0,0 +1,48 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +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/postgresflex/v3beta1api/utils.go b/services/postgresflex/v3beta1api/utils.go new file mode 100644 index 000000000..4946ccc3f --- /dev/null +++ b/services/postgresflex/v3beta1api/utils.go @@ -0,0 +1,362 @@ +/* +STACKIT PostgreSQL Flex API + +This is the documentation for the STACKIT Postgres Flex service + +API version: 3beta1 +Contact: support@stackit.cloud +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v3beta1api + +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...) +}