diff --git a/CHANGELOG.md b/CHANGELOG.md index 7950cf6f4..84756634b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ ## 6.6.4 - upcoming release +### New Product - **Object Storage Management**: +- `Resources`: + - [ionoscloud_object_storage_accesskey](docs/resources/object_storage_accesskey.md) +- `Data Sources`: + - [ionoscloud_object_storage_accesskey](docs/data-sources/object_storage_accesskey.md) + - [ionoscloud_object_storage_region](docs/data-sources/object_storage_region.md) ### Fixes - Refactor `ionoscloud_share` and `ionoscloud_nic` data sources - Remove sleep and delete from `ionoscloud_share` resource diff --git a/docs/data-sources/object_storage_accesskey.md b/docs/data-sources/object_storage_accesskey.md new file mode 100644 index 000000000..f22580a5a --- /dev/null +++ b/docs/data-sources/object_storage_accesskey.md @@ -0,0 +1,37 @@ +--- +subcategory: "Object storage management" +layout: "ionoscloud" +page_title: "IonosCloud : object_storage_accesskey" +sidebar_current: "docs-datasource-object_storage_accesskey" +description: |- + Get information on a IonosCloud Object storage Accesskey +--- + +# ionoscloud_object_storage_accesskey + +The **Object Storage Accesskey data source** can be used to search for and return an existing Object Storage Accesskeys. + +## Example Usage + +### By ID +```hcl +data "ionoscloud_object_storage_accesskey" "example" { + id = "accesskey_id" +} +``` + +## Argument Reference + + * `id` - (Optional) Id of an existing object storage accesskey that you want to search for. + * `accesskey` - (Optional) Access key metadata is a string of 92 characters. + * `description` - (Optional) Description of the Access key. + +## Attributes Reference + +The following attributes are returned by the datasource: + +- `id` - The ID (UUID) of the AccessKey. +- `description` - Description of the Access key. +- `accesskey` - Access key metadata is a string of 92 characters. +- `canonical_user_id` - The canonical user ID which is valid for user-owned buckets. +- `contract_user_id` - The contract user ID which is valid for contract-owned buckets diff --git a/docs/data-sources/object_storage_region.md b/docs/data-sources/object_storage_region.md new file mode 100644 index 000000000..986f06a1b --- /dev/null +++ b/docs/data-sources/object_storage_region.md @@ -0,0 +1,39 @@ +--- +subcategory: "Object storage management" +layout: "ionoscloud" +page_title: "IonosCloud : object_storage_region" +sidebar_current: "docs-datasource-object_storage_region" +description: |- + Get information on a IonosCloud Object Storage Region +--- + +# ionoscloud_object_storage_region + +The **Object storage region data source** can be used to search for and return an existing S3 Regions. + +## Example Usage + +### By ID +```hcl +data "ionoscloud_object_storage_region" "example" { + id = "region_id" +} +``` + +## Argument Reference + + * `id` - (Required) Id of an existing object storage Region that you want to search for. + +## Attributes Reference + +The following attributes are returned by the datasource: + +- `id` - The id of the region +- `version` - The version of the region properties +- `endpoint` - The endpoint URL for the region +- `website` - The website URL for the region +- `storage_classes` - The available classes in the region +- `location` - The data center location of the region as per [Get Location](/docs/cloud/v6/#tag/Locations/operation/locationsGet). *Can't be used as `LocationConstraint` on bucket creation.* +- `capability` - The capabilities of the region + * `iam` - Indicates if IAM policy based access is supported + * `s3select` - Indicates if S3 Select is supported diff --git a/docs/resources/object_storage_accesskey.md b/docs/resources/object_storage_accesskey.md new file mode 100644 index 000000000..a7ac39bf5 --- /dev/null +++ b/docs/resources/object_storage_accesskey.md @@ -0,0 +1,44 @@ +--- +subcategory: "Object storage management" +layout: "ionoscloud" +page_title: "IonosCloud: object_storage_accesskey" +sidebar_current: "docs-resource-object_storage_accesskey" +description: |- + Creates and manages IonosCloud Object Storage Accesskeys. +--- + +# ionoscloud_object_storage_accesskey + +Manages an **Object Storage Accesskey** on IonosCloud. + +## Example Usage + +```hcl +resource "ionoscloud_object_storage_accesskey" "example" { + description = "my description" +} +``` + +## Argument Reference + +The following arguments are supported: + +- `description` - (Optional)[string] Description of the Access key. +- `id` - (Computed) The ID (UUID) of the AccessKey. +- `accesskey` - (Computed) Access key metadata is a string of 92 characters. +- `secretkey` - (Computed) The secret key of the Access key. +- `canonical_user_id` - (Computed) The canonical user ID which is valid for user-owned buckets. +- `contract_user_id` - (Computed) The contract user ID which is valid for contract-owned buckets +- `timeouts` - (Optional) Timeouts for this resource. + - `create` - (Optional)[string] Time to wait for the bucket to be created. Default is `10m`. + - `delete` - (Optional)[string] Time to wait for the bucket to be deleted. Default is `10m`. + +## Import + +An object storage accesskey resource can be imported using its `resource id`, e.g. + +```shell +terraform import ionoscloud_object_storage_accesskey.demo {objectStorageAccesskeyId} +``` + +This can be helpful when you want to import Object Storage Accesskeys which you have already created manually or using other means, outside of terraform. diff --git a/gitbook_docs/summary.md b/gitbook_docs/summary.md index 68023ab77..7bc920464 100644 --- a/gitbook_docs/summary.md +++ b/gitbook_docs/summary.md @@ -216,6 +216,13 @@ * [Bucket Policy](../docs/data-sources/s3_bucket_policy.md) * [Object](../docs/data-sources/s3_object.md) * [Objects](../docs/data-sources/s3_objects.md) + +* Object Storage Management + * Resources + * [Access Key](../docs/resources/object_storage_accesskey.md) + * Data Sources + * [Access Key](../docs/data-sources/object_storage_accesskey.md) + * [Region](../docs/data-sources/object_storage_region.md) * CDN * Resources diff --git a/go.mod b/go.mod index 7de969bea..7b8c8cb37 100644 --- a/go.mod +++ b/go.mod @@ -31,6 +31,7 @@ require ( github.com/ionos-cloud/sdk-go-kafka v1.0.0 github.com/ionos-cloud/sdk-go-nfs v1.0.0 github.com/ionos-cloud/sdk-go-object-storage v1.1.0 + github.com/ionos-cloud/sdk-go-object-storage-management v1.0.0 github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.1 github.com/ionos-cloud/sdk-go/v6 v6.3.0 github.com/mitchellh/go-homedir v1.1.0 diff --git a/go.sum b/go.sum index 1a4914206..47fa8919a 100644 --- a/go.sum +++ b/go.sum @@ -144,6 +144,8 @@ github.com/ionos-cloud/sdk-go-nfs v1.0.0 h1:CyiemTDPg2jAjtTT4JHzvOpjq6lqe7YbXx2i github.com/ionos-cloud/sdk-go-nfs v1.0.0/go.mod h1:ffyMIPVknZ7dpi/+RomWXNNYV7ZjtK8KYSsGjVlbqgA= github.com/ionos-cloud/sdk-go-object-storage v1.1.0 h1:4JTsxrbzFltF9liAHZ2I9f53rpkrXm8642UwQoQ+pMc= github.com/ionos-cloud/sdk-go-object-storage v1.1.0/go.mod h1:GMNkyZp5B70QInLTS79LWbZ7hoEy4F8TWL82zeInwBo= +github.com/ionos-cloud/sdk-go-object-storage-management v1.0.0 h1:pHRKSNT+cCcr5ghWMkCgY2ErxrcQCAjlCJu/VrdexUw= +github.com/ionos-cloud/sdk-go-object-storage-management v1.0.0/go.mod h1:BnEapZcQp6FEirEin6pY9NICXD1mCrI4sJ+wOSKpyCY= github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.1 h1:KABL25MC7DrIHn9lQzKSPkwXhqvRkPYtFd+1HEogmAE= github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.1/go.mod h1:Q5d1R6silarsX5jWLPBHd/1PSC5zZNf2ONvXB+fygC0= github.com/ionos-cloud/sdk-go/v6 v6.3.0 h1:/lTieTH9Mo/CWm3cTlFLnK10jgxjUGkAqRffGqvPteY= diff --git a/internal/framework/provider/provider.go b/internal/framework/provider/provider.go index 846685a2f..d058b8a3d 100644 --- a/internal/framework/provider/provider.go +++ b/internal/framework/provider/provider.go @@ -2,8 +2,11 @@ package provider import ( "context" + "fmt" "log" + "net/http" "os" + "runtime" "strconv" "github.com/hashicorp/terraform-plugin-framework/datasource" @@ -12,9 +15,31 @@ import ( "github.com/hashicorp/terraform-plugin-framework/provider/schema" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-sdk/v2/meta" + + ionoscloud "github.com/ionos-cloud/sdk-go/v6" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/internal/framework/services/objectstorage" - objstorage "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/internal/framework/services/objectstoragemanagement" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" + apiGatewayService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/apigateway" + autoscalingService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/autoscaling" + cdnService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cdn" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cert" + crService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/containerregistry" + dataplatformService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/dataplatform" + dbaasService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/dbaas" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/dbaas/inmemorydb" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/dbaas/mariadb" + dnsService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/dns" + kafkaService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/kafka" + loggingService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/logging" + nfsService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/nfs" + objectStorageService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" + objectStorageManagementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstoragemanagement" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/vpn" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" ) // ClientOptions is the configuration for the provider. @@ -128,6 +153,9 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu secretKey := os.Getenv("IONOS_S3_SECRET_KEY") region := os.Getenv("IONOS_S3_REGION") endpoint := os.Getenv("IONOS_API_URL") + terraformVersion := req.TerraformVersion + version := ionoscloud.Version + insecureStr := os.Getenv("IONOS_ALLOW_INSECURE") insecureBool := false if insecureStr != "" { @@ -176,15 +204,55 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu return } + cleanedEndpoint := utils.CleanURL(endpoint) + if insecureBool == true { resp.Diagnostics.AddWarning("insecure mode enabled", "This is not recommended for production environments.") } - client := objstorage.NewClient(accessKey, secretKey, region, endpoint, insecureBool) + client := &services.SdkBundle{ + CDNClient: cdnService.NewCDNClient(username, password, token, endpoint, version, terraformVersion, insecureBool), + AutoscalingClient: autoscalingService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion, insecureBool), + CertManagerClient: cert.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion, insecureBool), + CloudApiClient: newCloudapiClient(username, password, token, endpoint, "DEV", terraformVersion, insecureBool), + ContainerClient: crService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion, insecureBool), + DataplatformClient: dataplatformService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion, insecureBool), + DNSClient: dnsService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion, insecureBool), + LoggingClient: loggingService.NewClient(username, password, token, cleanedEndpoint, terraformVersion, insecureBool), + MariaDBClient: mariadb.NewMariaDBClient(username, password, token, cleanedEndpoint, version, terraformVersion, insecureBool), + MongoClient: dbaasService.NewMongoClient(username, password, token, cleanedEndpoint, version, terraformVersion, insecureBool), + NFSClient: nfsService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion, insecureBool), + PsqlClient: dbaasService.NewPsqlClient(username, password, token, cleanedEndpoint, version, terraformVersion, insecureBool), + KafkaClient: kafkaService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion, insecureBool), + APIGatewayClient: apiGatewayService.NewClient( + username, password, token, cleanedEndpoint, version, terraformVersion, insecureBool, + ), + VPNClient: vpn.NewClient(username, password, token, cleanedEndpoint, terraformVersion, insecureBool), + InMemoryDBClient: inmemorydb.NewInMemoryDBClient(username, password, token, cleanedEndpoint, version, terraformVersion, insecureBool), + S3Client: objectStorageService.NewClient(accessKey, secretKey, region, endpoint, insecureBool), + ObjectStorageManagementClient: objectStorageManagementService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion, insecureBool), + } + resp.DataSourceData = client resp.ResourceData = client } +func newCloudapiClient(username, password, token, endpoint, version, terraformVersion string, insecure bool) *ionoscloud.APIClient { + newConfig := ionoscloud.NewConfiguration(username, password, token, endpoint) + newConfig.UserAgent = fmt.Sprintf( + "terraform-provider/%s_ionos-cloud-sdk-go/%s_hashicorp-terraform/%s_terraform-plugin-sdk/%s_os/%s_arch/%s", + version, ionoscloud.Version, terraformVersion, meta.SDKVersionString(), runtime.GOOS, runtime.GOARCH, //nolint:staticcheck + ) + if os.Getenv(constant.IonosDebug) != "" { + newConfig.Debug = true + } + newConfig.MaxRetries = constant.MaxRetries + newConfig.WaitTime = constant.MaxWaitTime + newConfig.HTTPClient = &http.Client{Transport: utils.CreateTransport(insecure)} + client := ionoscloud.NewAPIClient(newConfig) + return client +} + // Resources returns the resources for the provider. func (p *IonosCloudProvider) Resources(_ context.Context) []func() resource.Resource { return []func() resource.Resource{ @@ -199,6 +267,7 @@ func (p *IonosCloudProvider) Resources(_ context.Context) []func() resource.Reso objectstorage.NewBucketCorsConfigurationResource, objectstorage.NewBucketLifecycleConfigurationResource, objectstorage.NewBucketWebsiteConfigurationResource, + objectstoragemanagement.NewAccesskeyResource, } } @@ -209,5 +278,7 @@ func (p *IonosCloudProvider) DataSources(_ context.Context) []func() datasource. objectstorage.NewObjectDataSource, objectstorage.NewBucketPolicyDataSource, objectstorage.NewObjectsDataSource, + objectstoragemanagement.NewRegionDataSource, + objectstoragemanagement.NewAccesskeyDataSource, } } diff --git a/internal/framework/services/objectstorage/data_source_bucket.go b/internal/framework/services/objectstorage/data_source_bucket.go index ab909f41f..24ea0e2e4 100644 --- a/internal/framework/services/objectstorage/data_source_bucket.go +++ b/internal/framework/services/objectstorage/data_source_bucket.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" "github.com/hashicorp/terraform-plugin-framework/datasource" @@ -34,17 +35,17 @@ func (d *bucketDataSource) Configure(ctx context.Context, req datasource.Configu return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - d.client = client + d.client = clientBundle.S3Client } // Schema returns the schema for the data source. diff --git a/internal/framework/services/objectstorage/data_source_bucket_policy.go b/internal/framework/services/objectstorage/data_source_bucket_policy.go index f07fa4489..9be78089b 100644 --- a/internal/framework/services/objectstorage/data_source_bucket_policy.go +++ b/internal/framework/services/objectstorage/data_source_bucket_policy.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes" @@ -35,17 +36,17 @@ func (d *bucketPolicyDataSource) Configure(ctx context.Context, req datasource.C return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - d.client = client + d.client = clientBundle.S3Client } // Schema returns the schema for the data source. diff --git a/internal/framework/services/objectstorage/data_source_object.go b/internal/framework/services/objectstorage/data_source_object.go index 54e88e559..feef5e59b 100644 --- a/internal/framework/services/objectstorage/data_source_object.go +++ b/internal/framework/services/objectstorage/data_source_object.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" ) @@ -39,17 +40,17 @@ func (d *objectDataSource) Configure(ctx context.Context, req datasource.Configu return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - d.client = client + d.client = clientBundle.S3Client } // Schema returns the schema for the object data source. diff --git a/internal/framework/services/objectstorage/data_source_objects.go b/internal/framework/services/objectstorage/data_source_objects.go index 6cc790df4..87daafd46 100644 --- a/internal/framework/services/objectstorage/data_source_objects.go +++ b/internal/framework/services/objectstorage/data_source_objects.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" @@ -75,17 +76,17 @@ func (d *objectsDataSource) Configure(ctx context.Context, req datasource.Config return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - d.client = client + d.client = clientBundle.S3Client } func (d *objectsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { diff --git a/internal/framework/services/objectstorage/resource_bucket.go b/internal/framework/services/objectstorage/resource_bucket.go index ab556680a..f3022f7ef 100644 --- a/internal/framework/services/objectstorage/resource_bucket.go +++ b/internal/framework/services/objectstorage/resource_bucket.go @@ -18,6 +18,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/internal/tags" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" @@ -113,17 +114,17 @@ func (r *bucketResource) Configure(_ context.Context, req resource.ConfigureRequ return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.APIClient, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - r.client = client + r.client = clientBundle.S3Client } // Create creates the bucket. diff --git a/internal/framework/services/objectstorage/resource_bucket_cors_configuration.go b/internal/framework/services/objectstorage/resource_bucket_cors_configuration.go index 282463f32..dfb118f94 100644 --- a/internal/framework/services/objectstorage/resource_bucket_cors_configuration.go +++ b/internal/framework/services/objectstorage/resource_bucket_cors_configuration.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" "github.com/hashicorp/terraform-plugin-framework-validators/setvalidator" @@ -102,17 +103,17 @@ func (r *bucketCorsConfiguration) Configure(_ context.Context, req resource.Conf return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.APIClient, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - r.client = client + r.client = clientBundle.S3Client } // Create creates the bucket CORS configuration. diff --git a/internal/framework/services/objectstorage/resource_bucket_lifecycle_configuration.go b/internal/framework/services/objectstorage/resource_bucket_lifecycle_configuration.go index 877c81fd5..1e9648029 100644 --- a/internal/framework/services/objectstorage/resource_bucket_lifecycle_configuration.go +++ b/internal/framework/services/objectstorage/resource_bucket_lifecycle_configuration.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" "github.com/hashicorp/terraform-plugin-framework-validators/int64validator" @@ -132,17 +133,17 @@ func (r *bucketLifecycleConfiguration) Configure(_ context.Context, req resource return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.APIClient, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - r.client = client + r.client = clientBundle.S3Client } // Create creates the bucket lifecycle configuration resource. diff --git a/internal/framework/services/objectstorage/resource_bucket_object_lock_configuration.go b/internal/framework/services/objectstorage/resource_bucket_object_lock_configuration.go index 87b029269..f73f5aa7b 100644 --- a/internal/framework/services/objectstorage/resource_bucket_object_lock_configuration.go +++ b/internal/framework/services/objectstorage/resource_bucket_object_lock_configuration.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" "github.com/hashicorp/terraform-plugin-framework-validators/int64validator" @@ -101,17 +102,17 @@ func (r *objectLockConfiguration) Configure(_ context.Context, req resource.Conf return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.APIClient, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - r.client = client + r.client = clientBundle.S3Client } // Create creates the bucket object lock configuration resource. diff --git a/internal/framework/services/objectstorage/resource_bucket_policy.go b/internal/framework/services/objectstorage/resource_bucket_policy.go index 34d9d2b2b..2cdad41d8 100644 --- a/internal/framework/services/objectstorage/resource_bucket_policy.go +++ b/internal/framework/services/objectstorage/resource_bucket_policy.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" ) @@ -59,17 +60,17 @@ func (r *bucketPolicyResource) Configure(_ context.Context, req resource.Configu return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - r.client = client + r.client = clientBundle.S3Client } // Create creates the bucket policy. diff --git a/internal/framework/services/objectstorage/resource_bucket_public_access_block.go b/internal/framework/services/objectstorage/resource_bucket_public_access_block.go index 90e69333f..80c8e2a33 100644 --- a/internal/framework/services/objectstorage/resource_bucket_public_access_block.go +++ b/internal/framework/services/objectstorage/resource_bucket_public_access_block.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" @@ -80,17 +81,17 @@ func (r *bucketPublicAccessBlockResource) Configure(_ context.Context, req resou return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - r.client = client + r.client = clientBundle.S3Client } // Create creates the bucket. diff --git a/internal/framework/services/objectstorage/resource_bucket_sse_configuration.go b/internal/framework/services/objectstorage/resource_bucket_sse_configuration.go index b2d3d2b21..d6f08b888 100644 --- a/internal/framework/services/objectstorage/resource_bucket_sse_configuration.go +++ b/internal/framework/services/objectstorage/resource_bucket_sse_configuration.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" @@ -77,17 +78,17 @@ func (r *serverSideEncryptionConfiguration) Configure(_ context.Context, req res return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - r.client = client + r.client = clientBundle.S3Client } // Create creates the server side encryption configuration. diff --git a/internal/framework/services/objectstorage/resource_bucket_versioning.go b/internal/framework/services/objectstorage/resource_bucket_versioning.go index 7052aca9a..589c614e6 100644 --- a/internal/framework/services/objectstorage/resource_bucket_versioning.go +++ b/internal/framework/services/objectstorage/resource_bucket_versioning.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" @@ -75,17 +76,17 @@ func (r *bucketVersioningResource) Configure(_ context.Context, req resource.Con return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - r.client = client + r.client = clientBundle.S3Client } // Create creates the bucket versioning resource. diff --git a/internal/framework/services/objectstorage/resource_bucket_website_configuration.go b/internal/framework/services/objectstorage/resource_bucket_website_configuration.go index 75f0d2f6d..83fd49e02 100644 --- a/internal/framework/services/objectstorage/resource_bucket_website_configuration.go +++ b/internal/framework/services/objectstorage/resource_bucket_website_configuration.go @@ -6,6 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework-validators/objectvalidator" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" "github.com/hashicorp/terraform-plugin-framework-validators/resourcevalidator" @@ -161,17 +162,17 @@ func (r *bucketWebsiteConfiguration) Configure(_ context.Context, req resource.C return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - r.client = client + r.client = clientBundle.S3Client } // Create creates the bucket website configuration. diff --git a/internal/framework/services/objectstorage/resource_object.go b/internal/framework/services/objectstorage/resource_object.go index 3a40c5d77..4d2ef8899 100644 --- a/internal/framework/services/objectstorage/resource_object.go +++ b/internal/framework/services/objectstorage/resource_object.go @@ -19,7 +19,8 @@ import ( "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" + objectstorage "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" ) var ( @@ -189,17 +190,17 @@ func (r *objectResource) Configure(_ context.Context, req resource.ConfigureRequ return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - r.client = client + r.client = clientBundle.S3Client } func (r *objectResource) ConfigValidators(_ context.Context) []resource.ConfigValidator { diff --git a/internal/framework/services/objectstorage/resource_object_copy.go b/internal/framework/services/objectstorage/resource_object_copy.go index 7b686ab13..b31f5b937 100644 --- a/internal/framework/services/objectstorage/resource_object_copy.go +++ b/internal/framework/services/objectstorage/resource_object_copy.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" ) @@ -215,17 +216,17 @@ func (r *objectCopyResource) Configure(_ context.Context, req resource.Configure return } - client, ok := req.ProviderData.(*objectstorage.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *objectstorage.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - r.client = client + r.client = clientBundle.S3Client } // Create creates the object copy. diff --git a/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go new file mode 100644 index 000000000..eb5900b5a --- /dev/null +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go @@ -0,0 +1,184 @@ +package objectstoragemanagement + +import ( + "context" + "fmt" + + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstoragemanagement" + objectStorageManagementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstoragemanagement" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + objectstoragemanagementApi "github.com/ionos-cloud/sdk-go-object-storage-management" +) + +var _ datasource.DataSourceWithConfigure = (*accessKeyDataSource)(nil) + +// NewAccesskeyDataSource creates a new data source for the accesskey resource. +func NewAccesskeyDataSource() datasource.DataSource { + return &accessKeyDataSource{} +} + +type accessKeyDataSource struct { + client *objectStorageManagementService.Client +} + +// Metadata returns the metadata for the data source. +func (d *accessKeyDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_object_storage_accesskey" +} + +// Configure configures the data source. +func (d *accessKeyDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + // Add a nil check when handling ProviderData because Terraform + // sets that data after it calls the ConfigureProvider RPC. + if req.ProviderData == nil { + return + } + + clientBundle, ok := req.ProviderData.(*services.SdkBundle) + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *services.SdkBundle: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = clientBundle.ObjectStorageManagementClient +} + +// Schema returns the schema for the data source. +func (d *accessKeyDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Optional: true, + Description: "The ID (UUID) of the AccessKey.", + Computed: true, + }, + "description": schema.StringAttribute{ + Optional: true, + Description: "Description of the Access key.", + Computed: true, + }, + "accesskey": schema.StringAttribute{ + Optional: true, + Description: "Access key metadata is a string of 92 characters.", + Computed: true, + }, + "canonical_user_id": schema.StringAttribute{ + Description: "The canonical user ID which is valid for user-owned buckets.", + Computed: true, + }, + "contract_user_id": schema.StringAttribute{ + Description: "The contract user ID which is valid for contract-owned buckets", + Computed: true, + }, + }, + } +} + +// Read reads the data source. +func (d *accessKeyDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + if d.client == nil { + resp.Diagnostics.AddError("object storage management api client not configured", "The provider client is not configured") + return + } + + var data *objectstoragemanagement.AccessKeyDataSourceModel + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + if resp.Diagnostics.HasError() { + return + } + + id := data.ID.ValueString() + accessKeyID := data.AccessKey.ValueString() + description := data.Description.ValueString() + + var accessKey objectstoragemanagementApi.AccessKeyRead + var accessKeys objectstoragemanagementApi.AccessKeyReadList + var apiResponse *objectstoragemanagementApi.APIResponse + var err error + switch { + case !data.ID.IsNull(): + accessKey, apiResponse, err = d.client.GetAccessKey(ctx, id) + + if apiResponse.HttpNotFound() { + resp.Diagnostics.AddError("accesskey not found", "The accesskey was not found") + return + } + if err != nil { + resp.Diagnostics.AddError("an error occurred while fetching the accesskey with", err.Error()) + return + } + if !data.AccessKey.IsNull() && *accessKey.Properties.AccessKey != accessKeyID { + resp.Diagnostics.AddError( + "accesskeyID does not match", + fmt.Sprintf( + "accesskey property of Accesskey (UUID=%s, accesskey=%s) does not match expected accesskey: %s", + *accessKey.Id, *accessKey.Properties.AccessKey, accessKeyID, + ), + ) + return + } + if !data.Description.IsNull() && *accessKey.Properties.Description != description { + resp.Diagnostics.AddError( + "accesskeyID does not match", + fmt.Sprintf( + "description of Accesskey (UUID=%s, description=%s) does not match expected description: %s", + *accessKey.Id, *accessKey.Properties.Description, description, + ), + ) + return + } + case !data.AccessKey.IsNull(): + accessKeys, _, err = d.client.ListAccessKeysFilter(ctx, accessKeyID) + if err != nil { + resp.Diagnostics.AddError("an error occurred while fetching the accesskeys", err.Error()) + return + } + if len(*accessKeys.Items) != 0 { + accessKey = (*accessKeys.Items)[0] + } else { + resp.Diagnostics.AddError("accesskey not found", "The accesskey was not found") + return + } + if !data.Description.IsNull() && *accessKey.Properties.Description != description { + resp.Diagnostics.AddError( + "accesskeyID does not match", + fmt.Sprintf( + "description of Accesskey (UUID=%s, description=%s) does not match expected description: %s", + *accessKey.Id, *accessKey.Properties.Description, description, + ), + ) + return + } + case !data.Description.IsNull(): + accessKeys, _, err = d.client.ListAccessKeys(ctx) + if err != nil { + resp.Diagnostics.AddError("an error occurred while fetching the accesskeys", err.Error()) + return + } + found := false + for _, item := range *accessKeys.Items { + if *item.Properties.Description == description { + accessKey = item + found = true + break + } + } + if !found { + resp.Diagnostics.AddError("accesskey not found", "The accesskey was not found") + return + } + default: + resp.Diagnostics.AddError("ID, accesskeyId or description must be set", "ID, accesskeyId or description must be set") + return + } + + objectStorageManagementService.SetAccessKeyPropertiesToDataSourcePlan(data, accessKey) + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} diff --git a/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey_test.go b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey_test.go new file mode 100644 index 000000000..0054b9ae8 --- /dev/null +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey_test.go @@ -0,0 +1,118 @@ +//go:build all || objectstorage || objectstoragemanagement +// +build all objectstorage objectstoragemanagement + +package objectstoragemanagement_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/internal/acctest" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" +) + +func TestAccS3AccesskeyDataSource(t *testing.T) { + name := "data.ionoscloud_object_storage_accesskey.testres" + resource.Test(t, resource.TestCase{ + ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, + PreCheck: func() { + acctest.PreCheck(t) + }, + Steps: []resource.TestStep{ + { + Config: testAccAccesskeyDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(name, "description", "desc"), + resource.TestCheckResourceAttrSet(name, "id"), + resource.TestCheckResourceAttrSet(name, "accesskey"), + resource.TestCheckResourceAttrSet(name, "canonical_user_id"), + resource.TestCheckResourceAttrSet(name, "contract_user_id"), + ), + }, + { + Config: testAccAccesskeyDataSourceConfigBasicDescription(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(name, "description", "desc"), + resource.TestCheckResourceAttrSet(name, "id"), + resource.TestCheckResourceAttrSet(name, "accesskey"), + resource.TestCheckResourceAttrSet(name, "canonical_user_id"), + resource.TestCheckResourceAttrSet(name, "contract_user_id"), + ), + }, + { + Config: testAccAccesskeyDataSourceConfigBasicAccesskey(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(name, "description", "desc"), + resource.TestCheckResourceAttrSet(name, "id"), + resource.TestCheckResourceAttrSet(name, "accesskey"), + resource.TestCheckResourceAttrSet(name, "canonical_user_id"), + resource.TestCheckResourceAttrSet(name, "contract_user_id"), + ), + }, + { + Config: testAccAccesskeyDataSourceConfigBasicAccesskeyAndDesc(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(name, "description", "desc"), + resource.TestCheckResourceAttrSet(name, "id"), + resource.TestCheckResourceAttrSet(name, "accesskey"), + resource.TestCheckResourceAttrSet(name, "canonical_user_id"), + resource.TestCheckResourceAttrSet(name, "contract_user_id"), + ), + }, + { + Config: testAccAccesskeyDataSourceConfigBasicAll(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(name, "description", "desc"), + resource.TestCheckResourceAttrSet(name, "id"), + resource.TestCheckResourceAttrSet(name, "accesskey"), + resource.TestCheckResourceAttrSet(name, "canonical_user_id"), + resource.TestCheckResourceAttrSet(name, "contract_user_id"), + ), + }, + }, + }) +} + +func testAccAccesskeyDataSourceConfigBasic() string { + return utils.ConfigCompose(testAccAccesskeyConfigDescription("desc"), ` +data "ionoscloud_object_storage_accesskey" "testres" { + id = ionoscloud_object_storage_accesskey.test.id +} +`) +} + +func testAccAccesskeyDataSourceConfigBasicDescription() string { + return utils.ConfigCompose(testAccAccesskeyConfigDescription("desc"), ` +data "ionoscloud_object_storage_accesskey" "testres" { + description = "desc" +} +`) +} + +func testAccAccesskeyDataSourceConfigBasicAccesskey() string { + return utils.ConfigCompose(testAccAccesskeyConfigDescription("desc"), ` +data "ionoscloud_object_storage_accesskey" "testres" { + accesskey = ionoscloud_object_storage_accesskey.test.accesskey +} +`) +} + +func testAccAccesskeyDataSourceConfigBasicAccesskeyAndDesc() string { + return utils.ConfigCompose(testAccAccesskeyConfigDescription("desc"), ` +data "ionoscloud_object_storage_accesskey" "testres" { + accesskey = ionoscloud_object_storage_accesskey.test.accesskey + description = "desc" +} +`) +} + +func testAccAccesskeyDataSourceConfigBasicAll() string { + return utils.ConfigCompose(testAccAccesskeyConfigDescription("desc"), ` +data "ionoscloud_object_storage_accesskey" "testres" { + id = ionoscloud_object_storage_accesskey.test.id + accesskey = ionoscloud_object_storage_accesskey.test.accesskey + description = "desc" +} +`) +} diff --git a/internal/framework/services/objectstoragemanagement/data_source_object_storage_region.go b/internal/framework/services/objectstoragemanagement/data_source_object_storage_region.go new file mode 100644 index 000000000..f3d2886bc --- /dev/null +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_region.go @@ -0,0 +1,124 @@ +package objectstoragemanagement + +import ( + "context" + "fmt" + + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" + objectStorageManagementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstoragemanagement" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" +) + +var _ datasource.DataSourceWithConfigure = (*regionDataSource)(nil) + +// NewRegionDataSource creates a new data source for the region resource. +func NewRegionDataSource() datasource.DataSource { + return ®ionDataSource{} +} + +type regionDataSource struct { + client *objectStorageManagementService.Client +} + +// Metadata returns the metadata for the data source. +func (d *regionDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_object_storage_region" +} + +// Configure configures the data source. +func (d *regionDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + // Add a nil check when handling ProviderData because Terraform + // sets that data after it calls the ConfigureProvider RPC. + if req.ProviderData == nil { + return + } + + clientbundle, ok := req.ProviderData.(*services.SdkBundle) + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = clientbundle.ObjectStorageManagementClient +} + +// Schema returns the schema for the data source. +func (d *regionDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Description: "The id of the region", + Required: true, + }, + "version": schema.Int32Attribute{ + Description: "The version of the region properties", + Computed: true, + }, + "endpoint": schema.StringAttribute{ + Description: "The endpoint URL for the region", + Computed: true, + }, + "website": schema.StringAttribute{ + Description: "The website URL for the region", + Computed: true, + }, + "storage_classes": schema.ListAttribute{ + Description: "The available classes in the region", + Computed: true, + ElementType: types.StringType, + }, + "location": schema.StringAttribute{ + Description: "The data center location of the region as per [Get Location](/docs/cloud/v6/#tag/Locations/operation/locationsGet). *Can't be used as `LocationConstraint` on bucket creation.*", + Computed: true, + }, + "capability": schema.SingleNestedAttribute{ + Description: "The capabilities of the region", + Computed: true, + Attributes: map[string]schema.Attribute{ + "iam": schema.BoolAttribute{ + Description: "Indicates if IAM policy based access is supported", + Computed: true, + }, + "s3select": schema.BoolAttribute{ + Description: "Indicates if S3 Select is supported", + Computed: true, + }, + }, + }, + }, + } +} + +// Read reads the data source. +func (d *regionDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + if d.client == nil { + resp.Diagnostics.AddError("api client not configured", "The provider client is not configured") + return + } + + var data *objectStorageManagementService.RegionDataSourceModel + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + if resp.Diagnostics.HasError() { + return + } + + region, apiResponse, err := d.client.GetRegion(ctx, data.ID.ValueString(), 1) + + if apiResponse.HttpNotFound() { + resp.Diagnostics.AddError("region not found", "The region was not found") + return + } + if err != nil { + resp.Diagnostics.AddError("failed to get region", err.Error()) + return + } + + resp.Diagnostics.Append(resp.State.Set(ctx, objectStorageManagementService.BuildRegionModelFromAPIResponse(®ion))...) +} diff --git a/internal/framework/services/objectstoragemanagement/data_source_object_storage_region_test.go b/internal/framework/services/objectstoragemanagement/data_source_object_storage_region_test.go new file mode 100644 index 000000000..1bcbe4e1b --- /dev/null +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_region_test.go @@ -0,0 +1,42 @@ +//go:build all || objectstorage || objectstoragemanagement +// +build all objectstorage objectstoragemanagement + +package objectstoragemanagement_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/internal/acctest" +) + +func TestAccS3RegionDataSource(t *testing.T) { + name := "data.ionoscloud_object_storage_region.testreg" + resource.Test(t, resource.TestCase{ + ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, + PreCheck: func() { + acctest.PreCheck(t) + }, + Steps: []resource.TestStep{ + { + Config: testAccRegionDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(name, "id", "de"), + resource.TestCheckResourceAttr(name, "endpoint", "s3.eu-central-1.ionoscloud.com"), + resource.TestCheckResourceAttr(name, "website", "s3-website.de-central.profitbricks.com"), + resource.TestCheckResourceAttr(name, "storage_classes.0", "standard"), + resource.TestCheckResourceAttr(name, "capability.iam", "false"), + ), + }, + }, + }) +} + +func testAccRegionDataSourceConfigBasic() string { + return ` +data "ionoscloud_object_storage_region" "testreg" { + id = "de" +} +` +} diff --git a/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey.go b/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey.go new file mode 100644 index 000000000..e399fe8dd --- /dev/null +++ b/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey.go @@ -0,0 +1,233 @@ +package objectstoragemanagement + +import ( + "context" + "fmt" + + "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + + objectStorageManagement "github.com/ionos-cloud/sdk-go-object-storage-management" + + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" + objectStorageManagementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstoragemanagement" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" +) + +var ( + _ resource.ResourceWithImportState = (*accesskeyResource)(nil) + _ resource.ResourceWithConfigure = (*accesskeyResource)(nil) +) + +// NewAccesskeyResource creates a new resource for the accesskey resource. +func NewAccesskeyResource() resource.Resource { + return &accesskeyResource{} +} + +type accesskeyResource struct { + client *objectStorageManagementService.Client +} + +// Metadata returns the metadata for the accesskey resource. +func (r *accesskeyResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_object_storage_accesskey" +} + +// Schema returns the schema for the accesskey resource. +func (r *accesskeyResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + Description: "The ID (UUID) of the AccessKey.", + }, + "description": schema.StringAttribute{ + Description: "Description of the Access key.", + Optional: true, + Computed: true, + }, + "accesskey": schema.StringAttribute{ + Description: "Access key metadata is a string of 92 characters.", + Computed: true, + }, + "secretkey": schema.StringAttribute{ + Description: "The secret key of the Access key.", + Computed: true, + }, + "canonical_user_id": schema.StringAttribute{ + Description: "The canonical user ID which is valid for user-owned buckets.", + Computed: true, + }, + "contract_user_id": schema.StringAttribute{ + Description: "The contract user ID which is valid for contract-owned buckets", + Computed: true, + }, + }, + Blocks: map[string]schema.Block{ + "timeouts": timeouts.Block(ctx, timeouts.Opts{ + Create: true, + Read: true, + Delete: true, + }), + }, + } +} + +// Configure configures the accesskey resource. +func (r *accesskeyResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + if req.ProviderData == nil { + return + } + + clientBundle, ok := req.ProviderData.(*services.SdkBundle) + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *services.SdkBundle, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = clientBundle.ObjectStorageManagementClient +} + +// Create creates the accesskey. +func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + if r.client == nil { + resp.Diagnostics.AddError("object storage management api client not configured", "The provider client is not configured") + return + } + + var data *objectStorageManagementService.AccesskeyResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + if resp.Diagnostics.HasError() { + return + } + + createTimeout, diags := data.Timeouts.Create(ctx, utils.DefaultTimeout) + resp.Diagnostics.Append(diags...) + ctx, cancel := context.WithTimeout(ctx, createTimeout) + defer cancel() + + var accessKey = objectStorageManagement.AccessKeyCreate{ + Properties: &objectStorageManagement.AccessKey{ + Description: data.Description.ValueStringPointer(), + }, + } + accessKeyResponse, _, err := r.client.CreateAccessKey(ctx, accessKey, createTimeout) + if err != nil { + resp.Diagnostics.AddError("failed to create accessKey", err.Error()) + return + } + // we need this because secretkey is only available on create response + objectStorageManagementService.SetAccessKeyPropertiesToPlan(data, accessKeyResponse) + + accessKeyRead, _, err := r.client.GetAccessKey(ctx, data.ID.ValueString()) + if err != nil { + resp.Diagnostics.AddError("Access Key API error", err.Error()) + return + } + + // we need this because canonical_user_id not available on create response + objectStorageManagementService.SetAccessKeyPropertiesToPlan(data, accessKeyRead) + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} + +// Read reads the accesskey. +func (r *accesskeyResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + if r.client == nil { + resp.Diagnostics.AddError("object storage management api client not configured", "The provider client is not configured") + return + } + + var data objectStorageManagementService.AccesskeyResourceModel + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + if resp.Diagnostics.HasError() { + return + } + + accessKey, _, err := r.client.GetAccessKey(ctx, data.ID.ValueString()) + if err != nil { + resp.Diagnostics.AddError("Access Key API error", err.Error()) + return + } + + objectStorageManagementService.SetAccessKeyPropertiesToPlan(&data, accessKey) + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} + +// ImportState imports the state of the accessKey. +func (r *accesskeyResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) +} + +// Update updates the accesskey. +func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + var plan, state *objectStorageManagementService.AccesskeyResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + if resp.Diagnostics.HasError() { + return + } + + updateTimeout, diags := plan.Timeouts.Update(ctx, utils.DefaultTimeout) + resp.Diagnostics.Append(diags...) + ctx, cancel := context.WithTimeout(ctx, updateTimeout) + defer cancel() + + var accessKey = objectStorageManagement.AccessKeyEnsure{ + Properties: &objectStorageManagement.AccessKey{ + Description: plan.Description.ValueStringPointer(), + }, + } + + accessKeyResponse, _, err := r.client.UpdateAccessKey(ctx, state.ID.ValueString(), accessKey, updateTimeout) + if err != nil { + resp.Diagnostics.AddError("failed to update accessKey", err.Error()) + return + } + + plan.ID = basetypes.NewStringPointerValue(accessKeyResponse.Id) + + accessKeyRead, _, err := r.client.GetAccessKey(ctx, *accessKeyResponse.Id) + if err != nil { + resp.Diagnostics.AddError("Access Key API error", err.Error()) + return + } + + objectStorageManagementService.SetAccessKeyPropertiesToPlan(state, accessKeyRead) + resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) +} + +// Delete deletes the accessKey. +func (r *accesskeyResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + if r.client == nil { + resp.Diagnostics.AddError("object storage management api client not configured", "The provider client is not configured") + return + } + + var data *objectStorageManagementService.AccesskeyResourceModel + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + if resp.Diagnostics.HasError() { + return + } + + deleteTimeout, diags := data.Timeouts.Delete(ctx, utils.DefaultTimeout) + if diags.HasError() { + resp.Diagnostics.Append(diags...) + return + } + ctx, cancel := context.WithTimeout(ctx, deleteTimeout) + defer cancel() + + if _, err := r.client.DeleteAccessKey(ctx, data.ID.ValueString(), deleteTimeout); err != nil { + resp.Diagnostics.AddError("failed to delete accesskey", err.Error()) + return + } +} diff --git a/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey_test.go b/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey_test.go new file mode 100644 index 000000000..5e6b10bed --- /dev/null +++ b/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey_test.go @@ -0,0 +1,57 @@ +//go:build all || objectstorage || objectstoragemanagement +// +build all objectstorage objectstoragemanagement + +package objectstoragemanagement_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/internal/acctest" +) + +func TestAccACcesskeyResource(t *testing.T) { + description := acctest.GenerateRandomResourceName("description") + descriptionUpdated := acctest.GenerateRandomResourceName("description") + name := "ionoscloud_object_storage_accesskey.test" + + resource.Test(t, resource.TestCase{ + ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, + PreCheck: func() { + acctest.PreCheck(t) + }, + Steps: []resource.TestStep{ + { + Config: testAccAccesskeyConfigDescription(description), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(name, "description", description), + resource.TestCheckResourceAttrSet(name, "id"), + resource.TestCheckResourceAttrSet(name, "accesskey"), + resource.TestCheckResourceAttrSet(name, "secretkey"), + resource.TestCheckResourceAttrSet(name, "canonical_user_id"), + resource.TestCheckResourceAttrSet(name, "contract_user_id"), + ), + }, + { + Config: testAccAccesskeyConfigDescription(descriptionUpdated), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(name, "description", descriptionUpdated), + resource.TestCheckResourceAttrSet(name, "id"), + resource.TestCheckResourceAttrSet(name, "accesskey"), + resource.TestCheckResourceAttrSet(name, "secretkey"), + resource.TestCheckResourceAttrSet(name, "canonical_user_id"), + resource.TestCheckResourceAttrSet(name, "contract_user_id"), + ), + }, + }, + }) +} + +func testAccAccesskeyConfigDescription(description string) string { + return fmt.Sprintf(` +resource "ionoscloud_object_storage_accesskey" "test" { + description = %[1]q +} +`, description) +} diff --git a/ionoscloud/data_source_cube_server.go b/ionoscloud/data_source_cube_server.go index 268d44f01..e3332d9ba 100644 --- a/ionoscloud/data_source_cube_server.go +++ b/ionoscloud/data_source_cube_server.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi/nsg" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" diff --git a/ionoscloud/data_source_server.go b/ionoscloud/data_source_server.go index 1f5fe1195..13c8b716d 100644 --- a/ionoscloud/data_source_server.go +++ b/ionoscloud/data_source_server.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" diff --git a/services/clients.go b/services/clients.go index f84227ef3..cf0db1e7a 100644 --- a/services/clients.go +++ b/services/clients.go @@ -16,24 +16,28 @@ import ( "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/kafka" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/logging" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/nfs" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstorage" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstoragemanagement" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/vpn" ) type SdkBundle struct { - CloudApiClient *ionoscloud.APIClient - InMemoryDBClient *inmemorydb.InMemoryDBClient - PsqlClient *dbaas.PsqlClient - MongoClient *dbaas.MongoClient - MariaDBClient *mariadb.MariaDBClient - NFSClient *nfs.Client - CertManagerClient *cert.Client - ContainerClient *containerregistry.Client - DataplatformClient *dataplatform.Client - DNSClient *dns.Client - LoggingClient *logging.Client - AutoscalingClient *autoscaling.Client - KafkaClient *kafka.Client - CDNClient *cdn.Client - APIGatewayClient *apigateway.Client - VPNClient *vpn.Client + CloudApiClient *ionoscloud.APIClient + InMemoryDBClient *inmemorydb.InMemoryDBClient + PsqlClient *dbaas.PsqlClient + MongoClient *dbaas.MongoClient + MariaDBClient *mariadb.MariaDBClient + NFSClient *nfs.Client + CertManagerClient *cert.Client + ContainerClient *containerregistry.Client + DataplatformClient *dataplatform.Client + DNSClient *dns.Client + LoggingClient *logging.Client + AutoscalingClient *autoscaling.Client + KafkaClient *kafka.Client + CDNClient *cdn.Client + APIGatewayClient *apigateway.Client + VPNClient *vpn.Client + S3Client *objectstorage.Client + ObjectStorageManagementClient *objectstoragemanagement.Client } diff --git a/services/objectstoragemanagement/accesskeys.go b/services/objectstoragemanagement/accesskeys.go new file mode 100644 index 000000000..16e2f2451 --- /dev/null +++ b/services/objectstoragemanagement/accesskeys.go @@ -0,0 +1,190 @@ +package objectstoragemanagement + +import ( + "context" + "fmt" + "time" + + "github.com/cenkalti/backoff/v4" + "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + objectstoragemanagement "github.com/ionos-cloud/sdk-go-object-storage-management" +) + +// AccesskeyResourceModel is used to represent an accesskey +type AccesskeyResourceModel struct { + AccessKey types.String `tfsdk:"accesskey"` + SecretKey types.String `tfsdk:"secretkey"` + CanonicalUserID types.String `tfsdk:"canonical_user_id"` + ContractUserID types.String `tfsdk:"contract_user_id"` + Description types.String `tfsdk:"description"` + ID types.String `tfsdk:"id"` + Timeouts timeouts.Value `tfsdk:"timeouts"` +} + +// AccessKeyDataSourceModel is used to represent an accesskey for a data source. +type AccessKeyDataSourceModel struct { + AccessKey types.String `tfsdk:"accesskey"` + CanonicalUserID types.String `tfsdk:"canonical_user_id"` + ContractUserID types.String `tfsdk:"contract_user_id"` + Description types.String `tfsdk:"description"` + ID types.String `tfsdk:"id"` +} + +// GetAccessKey retrieves an accesskey +func (c *Client) GetAccessKey(ctx context.Context, accessKeyID string) (objectstoragemanagement.AccessKeyRead, *objectstoragemanagement.APIResponse, error) { + accessKey, apiResponse, err := c.client.AccesskeysApi.AccesskeysFindById(ctx, accessKeyID).Execute() + apiResponse.LogInfo() + return accessKey, apiResponse, err +} + +// ListAccessKeys retrieves all accesskeys +func (c *Client) ListAccessKeys(ctx context.Context) (objectstoragemanagement.AccessKeyReadList, *objectstoragemanagement.APIResponse, error) { + accessKeys, apiResponse, err := c.client.AccesskeysApi.AccesskeysGet(ctx).Execute() + apiResponse.LogInfo() + return accessKeys, apiResponse, err +} + +// ListAccessKeysFilter retrieves accesskeys using the accessKeyId filter +func (c *Client) ListAccessKeysFilter(ctx context.Context, accessKeyID string) (objectstoragemanagement.AccessKeyReadList, *objectstoragemanagement.APIResponse, error) { + accessKeys, apiResponse, err := c.client.AccesskeysApi.AccesskeysGet(ctx).FilterAccesskeyId(accessKeyID).Execute() + apiResponse.LogInfo() + return accessKeys, apiResponse, err +} + +// CreateAccessKey creates an accesskey +func (c *Client) CreateAccessKey(ctx context.Context, accessKey objectstoragemanagement.AccessKeyCreate, timeout time.Duration) (objectstoragemanagement.AccessKeyRead, *objectstoragemanagement.APIResponse, error) { + accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPost(ctx).AccessKeyCreate(accessKey).Execute() + apiResponse.LogInfo() + + if err != nil || accessKeyResponse.Id == nil { + return accessKeyResponse, apiResponse, err + } + + err = backoff.Retry(func() error { + return c.accessKeyAvailableCheck(ctx, *accessKeyResponse.Id) + }, backoff.NewExponentialBackOff(backoff.WithMaxElapsedTime(timeout))) + if err != nil { + return accessKeyResponse, apiResponse, fmt.Errorf("failed to wait for accessKey available: %w", err) + } + + return accessKeyResponse, apiResponse, err +} + +// UpdateAccessKey updates an accesskey +func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyID string, accessKey objectstoragemanagement.AccessKeyEnsure, timeout time.Duration) (objectstoragemanagement.AccessKeyRead, *objectstoragemanagement.APIResponse, error) { + accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPut(ctx, accessKeyID).AccessKeyEnsure(accessKey).Execute() + apiResponse.LogInfo() + + if err != nil || accessKeyResponse.Id == nil { + return accessKeyResponse, apiResponse, err + } + + err = backoff.Retry(func() error { + return c.accessKeyAvailableCheck(ctx, accessKeyID) + }, backoff.NewExponentialBackOff(backoff.WithMaxElapsedTime(timeout))) + if err != nil { + return accessKeyResponse, apiResponse, fmt.Errorf("failed to wait for accessKey available: %w", err) + } + + return accessKeyResponse, apiResponse, err +} + +// DeleteAccessKey deletes an accesskey +func (c *Client) DeleteAccessKey(ctx context.Context, accessKeyID string, timeout time.Duration) (*objectstoragemanagement.APIResponse, error) { + apiResponse, err := c.client.AccesskeysApi.AccesskeysDelete(ctx, accessKeyID).Execute() + apiResponse.LogInfo() + + if err != nil { + return apiResponse, err + } + + err = backoff.Retry(func() error { + return c.accessKeyDeletedCheck(ctx, accessKeyID) + }, backoff.NewExponentialBackOff(backoff.WithMaxElapsedTime(timeout))) + if err != nil { + return apiResponse, fmt.Errorf("failed to wait for accessKey available: %w", err) + } + + return apiResponse, err +} + +// SetAccessKeyPropertiesToPlan sets accesskey properties from an SDK object to a AccesskeyResourceModel +func SetAccessKeyPropertiesToPlan(plan *AccesskeyResourceModel, accessKey objectstoragemanagement.AccessKeyRead) { + + if accessKey.Properties != nil { + // Here we check the properties because based on the request not all are set and we do not want to overwrite with nil + if accessKey.Properties.AccessKey != nil { + plan.AccessKey = basetypes.NewStringPointerValue(accessKey.Properties.AccessKey) + } + if accessKey.Properties.CanonicalUserId != nil { + plan.CanonicalUserID = basetypes.NewStringPointerValue(accessKey.Properties.CanonicalUserId) + } + if accessKey.Properties.ContractUserId != nil { + plan.ContractUserID = basetypes.NewStringPointerValue(accessKey.Properties.ContractUserId) + } + if accessKey.Properties.Description != nil { + plan.Description = basetypes.NewStringPointerValue(accessKey.Properties.Description) + } + if accessKey.Properties.SecretKey != nil { + plan.SecretKey = basetypes.NewStringPointerValue(accessKey.Properties.SecretKey) + } + } + if accessKey.Id != nil { + plan.ID = basetypes.NewStringPointerValue(accessKey.Id) + } +} + +// SetAccessKeyPropertiesToDataSourcePlan sets accesskey properties from an SDK object to a AccessKeyDataSourceModel +func SetAccessKeyPropertiesToDataSourcePlan(plan *AccessKeyDataSourceModel, accessKey objectstoragemanagement.AccessKeyRead) { + + if accessKey.Properties != nil { + // Here we check the properties because based on the request not all are set and we do not want to overwrite with nil + if accessKey.Properties.AccessKey != nil { + plan.AccessKey = basetypes.NewStringPointerValue(accessKey.Properties.AccessKey) + } + if accessKey.Properties.CanonicalUserId != nil { + plan.CanonicalUserID = basetypes.NewStringPointerValue(accessKey.Properties.CanonicalUserId) + } + if accessKey.Properties.ContractUserId != nil { + plan.ContractUserID = basetypes.NewStringPointerValue(accessKey.Properties.ContractUserId) + } + if accessKey.Properties.Description != nil { + plan.Description = basetypes.NewStringPointerValue(accessKey.Properties.Description) + } + } + if accessKey.Id != nil { + plan.ID = basetypes.NewStringPointerValue(accessKey.Id) + } +} + +func (c *Client) accessKeyDeletedCheck(ctx context.Context, id string) error { + _, apiResponse, err := c.GetAccessKey(ctx, id) + if apiResponse.HttpNotFound() { + return nil + } + + if err != nil { + return backoff.Permanent(fmt.Errorf("failed to check if accessKey exists: %w", err)) + } + + return fmt.Errorf("accessKey still exists") +} + +func (c *Client) accessKeyAvailableCheck(ctx context.Context, id string) error { + accessKey, apiResponse, err := c.GetAccessKey(ctx, id) + if apiResponse.HttpNotFound() { + return fmt.Errorf("accessKey not found") + } + + if err != nil { + return backoff.Permanent(fmt.Errorf("failed to check if accessKey exists: %w", err)) + } + + if *accessKey.Metadata.Status != "AVAILABLE" { + return fmt.Errorf("accessKey status is not 'AVAILABLE'") + } + + return nil +} diff --git a/services/objectstoragemanagement/client.go b/services/objectstoragemanagement/client.go new file mode 100644 index 000000000..0557cbd8f --- /dev/null +++ b/services/objectstoragemanagement/client.go @@ -0,0 +1,42 @@ +package objectstoragemanagement + +import ( + "fmt" + "net/http" + "os" + "runtime" + + "github.com/hashicorp/terraform-plugin-sdk/v2/meta" + + objectstoragemanagement "github.com/ionos-cloud/sdk-go-object-storage-management" + + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" +) + +// Client is a wrapper around the S3 client. +type Client struct { + client *objectstoragemanagement.APIClient +} + +// GetBaseClient returns the base client. +func (c *Client) GetBaseClient() *objectstoragemanagement.APIClient { + return c.client +} + +// NewClient creates a new S3 client with the given credentials and region. +func NewClient(username, password, token, url, version, terraformVersion string, insecure bool) *Client { + newObjectStorageManagementConfig := objectstoragemanagement.NewConfiguration(username, password, token, url) + + if os.Getenv(constant.IonosDebug) != "" { + newObjectStorageManagementConfig.Debug = true + } + newObjectStorageManagementConfig.MaxRetries = constant.MaxRetries + newObjectStorageManagementConfig.MaxWaitTime = constant.MaxWaitTime + newObjectStorageManagementConfig.HTTPClient = &http.Client{Transport: utils.CreateTransport(insecure)} + newObjectStorageManagementConfig.UserAgent = fmt.Sprintf( + "terraform-provider/%s_ionos-cloud-sdk-go-object-storage-management/%s_hashicorp-terraform/%s_terraform-plugin-sdk/%s_os/%s_arch/%s", + version, objectstoragemanagement.Version, terraformVersion, meta.SDKVersionString(), runtime.GOOS, runtime.GOARCH) //nolint:staticcheck + + return &Client{client: objectstoragemanagement.NewAPIClient(newObjectStorageManagementConfig)} +} diff --git a/services/objectstoragemanagement/regions.go b/services/objectstoragemanagement/regions.go new file mode 100644 index 000000000..4f74dee4d --- /dev/null +++ b/services/objectstoragemanagement/regions.go @@ -0,0 +1,74 @@ +package objectstoragemanagement + +import ( + "context" + + "github.com/hashicorp/terraform-plugin-framework/types" + objectstoragemanagement "github.com/ionos-cloud/sdk-go-object-storage-management" +) + +// RegionDataSourceModel is used to represent an region for a data source. +type RegionDataSourceModel struct { + Version types.Int32 `tfsdk:"version"` + Endpoint types.String `tfsdk:"endpoint"` + Website types.String `tfsdk:"website"` + Capability *capability `tfsdk:"capability"` + Storageclasses []types.String `tfsdk:"storage_classes"` + Location types.String `tfsdk:"location"` + ID types.String `tfsdk:"id"` +} + +type capability struct { + Iam types.Bool `tfsdk:"iam"` + S3select types.Bool `tfsdk:"s3select"` +} + +// GetRegion retrieves a region +func (c *Client) GetRegion(ctx context.Context, regionID string, depth float32) (objectstoragemanagement.RegionRead, *objectstoragemanagement.APIResponse, error) { + region, apiResponse, err := c.client.RegionsApi.RegionsFindByRegion(ctx, regionID).Execute() + apiResponse.LogInfo() + return region, apiResponse, err +} + +// ListRegions lists all regions +func (c *Client) ListRegions(ctx context.Context) (objectstoragemanagement.RegionReadList, *objectstoragemanagement.APIResponse, error) { + regions, apiResponse, err := c.client.RegionsApi.RegionsGet(ctx).Execute() + apiResponse.LogInfo() + return regions, apiResponse, err +} + +// BuildRegionModelFromAPIResponse builds an RegionDataSourceModel from a region SDK object +func BuildRegionModelFromAPIResponse(output *objectstoragemanagement.RegionRead) *RegionDataSourceModel { + built := &RegionDataSourceModel{} + + if output.Id != nil { + built.ID = types.StringPointerValue(output.Id) + } + if output.Properties != nil { + if output.Properties.Version != nil { + built.Version = types.Int32PointerValue(output.Properties.Version) + } + if output.Properties.Endpoint != nil { + built.Endpoint = types.StringPointerValue(output.Properties.Endpoint) + } + if output.Properties.Website != nil { + built.Website = types.StringPointerValue(output.Properties.Website) + } + + if output.Properties.Capability != nil { + built.Capability = &capability{ + Iam: types.BoolPointerValue(output.Properties.Capability.Iam), + S3select: types.BoolPointerValue(output.Properties.Capability.S3select), + } + } + + if output.Properties.StorageClasses != nil { + built.Storageclasses = make([]types.String, 0, len(*output.Properties.StorageClasses)) + for i := range *output.Properties.StorageClasses { + built.Storageclasses = append(built.Storageclasses, types.StringPointerValue(&(*output.Properties.StorageClasses)[i])) + } + } + } + + return built +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/.gitignore b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/.gitignore new file mode 100644 index 000000000..daf913b1b --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/.travis.yml b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/.travis.yml new file mode 100644 index 000000000..f5cb2ce9a --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/LICENSE b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/README.md b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/README.md new file mode 100644 index 000000000..7b203c186 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/README.md @@ -0,0 +1,131 @@ +[![Gitter](https://img.shields.io/gitter/room/ionos-cloud/sdk-general)](https://gitter.im/ionos-cloud/sdk-general) + +# Go API client for ionoscloud + +Object Storage Management API is a RESTful API that manages the object storage +service configuration for IONOS Cloud. + + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 0.1.0 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/oauth2 +go get golang.org/x/net/context +go get github.com/antihax/optional +``` + +Put the package under your project folder and add the following in import: + +```golang +import "./ionoscloud" +``` + +## Authentication + +All available server URLs are: + +- *https://s3.ionos.com* - Production + +By default, *https://s3.ionos.com* is used, however this can be overriden at authentication, either +by setting the `IONOS_API_URL` environment variable or by specifying the `hostUrl` parameter when +initializing the sdk client. + +The username and password or the authentication token can be manually specified when initializing +the sdk client: + +```golang + +client := ionoscloud.NewAPIClient(ionoscloud.NewConfiguration(username, password, token, hostUrl)) + +``` + +Environment variables can also be used. The sdk uses the following variables: +- IONOS_TOKEN - login via token. This is the recommended way to authenticate. +- IONOS_USERNAME - to specify the username used to login +- IONOS_PASSWORD - to specify the password +- IONOS_API_URL - to specify the API server URL + +In this case, the client configuration needs to be initialized using `NewConfigurationFromEnv()`. + +```golang + +client := ionoscloud.NewAPIClient(ionoscloud.NewConfigurationFromEnv()) + +``` + + +## Documentation for API Endpoints + +All URIs are relative to *https://s3.ionos.com* +
+ API Endpoints table + + +| Class | Method | HTTP request | Description | +| ------------- | ------------- | ------------- | ------------- | +| AccesskeysApi | [**AccesskeysDelete**](docs/api/AccesskeysApi.md#AccesskeysDelete) | **Delete** /accesskeys/{accesskeyId} | Delete AccessKey | +| AccesskeysApi | [**AccesskeysFindById**](docs/api/AccesskeysApi.md#AccesskeysFindById) | **Get** /accesskeys/{accesskeyId} | Retrieve AccessKey | +| AccesskeysApi | [**AccesskeysGet**](docs/api/AccesskeysApi.md#AccesskeysGet) | **Get** /accesskeys | Retrieve all Accesskeys | +| AccesskeysApi | [**AccesskeysPost**](docs/api/AccesskeysApi.md#AccesskeysPost) | **Post** /accesskeys | Create AccessKey | +| AccesskeysApi | [**AccesskeysPut**](docs/api/AccesskeysApi.md#AccesskeysPut) | **Put** /accesskeys/{accesskeyId} | Ensure AccessKey | +| AccesskeysApi | [**AccesskeysRenew**](docs/api/AccesskeysApi.md#AccesskeysRenew) | **Put** /accesskeys/{accesskeyId}/renew | Ensure AccessKey | +| RegionsApi | [**RegionsFindByRegion**](docs/api/RegionsApi.md#RegionsFindByRegion) | **Get** /regions/{region} | Retrieve Region | +| RegionsApi | [**RegionsGet**](docs/api/RegionsApi.md#RegionsGet) | **Get** /regions | Retrieve all Regions | + +
+ +## Documentation For Models + +All URIs are relative to *https://s3.ionos.com* +
+API models list + + - [AccessKey](docs/models/AccessKey) + - [AccessKeyCreate](docs/models/AccessKeyCreate) + - [AccessKeyEnsure](docs/models/AccessKeyEnsure) + - [AccessKeyRead](docs/models/AccessKeyRead) + - [AccessKeyReadList](docs/models/AccessKeyReadList) + - [AccessKeyReadListAllOf](docs/models/AccessKeyReadListAllOf) + - [Bucket](docs/models/Bucket) + - [BucketCreate](docs/models/BucketCreate) + - [BucketEnsure](docs/models/BucketEnsure) + - [BucketRead](docs/models/BucketRead) + - [BucketReadList](docs/models/BucketReadList) + - [BucketReadListAllOf](docs/models/BucketReadListAllOf) + - [Error](docs/models/Error) + - [ErrorMessages](docs/models/ErrorMessages) + - [Links](docs/models/Links) + - [Metadata](docs/models/Metadata) + - [MetadataWithStatus](docs/models/MetadataWithStatus) + - [MetadataWithStatusAllOf](docs/models/MetadataWithStatusAllOf) + - [MetadataWithSupportedRegions](docs/models/MetadataWithSupportedRegions) + - [MetadataWithSupportedRegionsAllOf](docs/models/MetadataWithSupportedRegionsAllOf) + - [Pagination](docs/models/Pagination) + - [Region](docs/models/Region) + - [RegionCapability](docs/models/RegionCapability) + - [RegionCreate](docs/models/RegionCreate) + - [RegionEnsure](docs/models/RegionEnsure) + - [RegionRead](docs/models/RegionRead) + - [RegionReadList](docs/models/RegionReadList) + - [RegionReadListAllOf](docs/models/RegionReadListAllOf) + - [StorageClass](docs/models/StorageClass) + - [StorageClassCreate](docs/models/StorageClassCreate) + - [StorageClassEnsure](docs/models/StorageClassEnsure) + - [StorageClassRead](docs/models/StorageClassRead) + - [StorageClassReadList](docs/models/StorageClassReadList) + - [StorageClassReadListAllOf](docs/models/StorageClassReadListAllOf) + + +[[Back to API list]](#documentation-for-api-endpoints) [[Back to Model list]](#documentation-for-models) + +
diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/api_accesskeys.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/api_accesskeys.go new file mode 100644 index 000000000..854c58855 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/api_accesskeys.go @@ -0,0 +1,1196 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + _context "context" + "fmt" + "io" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// AccesskeysApiService AccesskeysApi service +type AccesskeysApiService service + +type ApiAccesskeysDeleteRequest struct { + ctx _context.Context + ApiService *AccesskeysApiService + accesskeyId string +} + +func (r ApiAccesskeysDeleteRequest) Execute() (*APIResponse, error) { + return r.ApiService.AccesskeysDeleteExecute(r) +} + +/* + * AccesskeysDelete Delete AccessKey + * Deletes the specified AccessKey. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param accesskeyId The ID (UUID) of the AccessKey. + * @return ApiAccesskeysDeleteRequest + */ +func (a *AccesskeysApiService) AccesskeysDelete(ctx _context.Context, accesskeyId string) ApiAccesskeysDeleteRequest { + return ApiAccesskeysDeleteRequest{ + ApiService: a, + ctx: ctx, + accesskeyId: accesskeyId, + } +} + +/* + * Execute executes the request + */ +func (a *AccesskeysApiService) AccesskeysDeleteExecute(r ApiAccesskeysDeleteRequest) (*APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AccesskeysApiService.AccesskeysDelete") + if err != nil { + return nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/accesskeys/{accesskeyId}" + localVarPath = strings.Replace(localVarPath, "{"+"accesskeyId"+"}", _neturl.PathEscape(parameterToString(r.accesskeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "AccesskeysDelete", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarAPIResponse, newErr + } + newErr.model = v + return localVarAPIResponse, newErr + } + + return localVarAPIResponse, nil +} + +type ApiAccesskeysFindByIdRequest struct { + ctx _context.Context + ApiService *AccesskeysApiService + accesskeyId string +} + +func (r ApiAccesskeysFindByIdRequest) Execute() (AccessKeyRead, *APIResponse, error) { + return r.ApiService.AccesskeysFindByIdExecute(r) +} + +/* + * AccesskeysFindById Retrieve AccessKey + * Returns the AccessKey by ID. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param accesskeyId The ID (UUID) of the AccessKey. + * @return ApiAccesskeysFindByIdRequest + */ +func (a *AccesskeysApiService) AccesskeysFindById(ctx _context.Context, accesskeyId string) ApiAccesskeysFindByIdRequest { + return ApiAccesskeysFindByIdRequest{ + ApiService: a, + ctx: ctx, + accesskeyId: accesskeyId, + } +} + +/* + * Execute executes the request + * @return AccessKeyRead + */ +func (a *AccesskeysApiService) AccesskeysFindByIdExecute(r ApiAccesskeysFindByIdRequest) (AccessKeyRead, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccessKeyRead + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AccesskeysApiService.AccesskeysFindById") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/accesskeys/{accesskeyId}" + localVarPath = strings.Replace(localVarPath, "{"+"accesskeyId"+"}", _neturl.PathEscape(parameterToString(r.accesskeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "AccesskeysFindById", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiAccesskeysGetRequest struct { + ctx _context.Context + ApiService *AccesskeysApiService + offset *int32 + limit *int32 + filterAccesskeyId *string +} + +func (r ApiAccesskeysGetRequest) Offset(offset int32) ApiAccesskeysGetRequest { + r.offset = &offset + return r +} +func (r ApiAccesskeysGetRequest) Limit(limit int32) ApiAccesskeysGetRequest { + r.limit = &limit + return r +} +func (r ApiAccesskeysGetRequest) FilterAccesskeyId(filterAccesskeyId string) ApiAccesskeysGetRequest { + r.filterAccesskeyId = &filterAccesskeyId + return r +} + +func (r ApiAccesskeysGetRequest) Execute() (AccessKeyReadList, *APIResponse, error) { + return r.ApiService.AccesskeysGetExecute(r) +} + +/* + - AccesskeysGet Retrieve all Accesskeys + - This endpoint enables retrieving all Accesskeys using + +pagination and optional filters. + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @return ApiAccesskeysGetRequest +*/ +func (a *AccesskeysApiService) AccesskeysGet(ctx _context.Context) ApiAccesskeysGetRequest { + return ApiAccesskeysGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return AccessKeyReadList + */ +func (a *AccesskeysApiService) AccesskeysGetExecute(r ApiAccesskeysGetRequest) (AccessKeyReadList, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccessKeyReadList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AccesskeysApiService.AccesskeysGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/accesskeys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.offset != nil { + localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) + } + if r.limit != nil { + localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) + } + if r.filterAccesskeyId != nil { + localVarQueryParams.Add("filter.accesskeyId", parameterToString(*r.filterAccesskeyId, "")) + } + // 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, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "AccesskeysGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiAccesskeysPostRequest struct { + ctx _context.Context + ApiService *AccesskeysApiService + accessKeyCreate *AccessKeyCreate +} + +func (r ApiAccesskeysPostRequest) AccessKeyCreate(accessKeyCreate AccessKeyCreate) ApiAccesskeysPostRequest { + r.accessKeyCreate = &accessKeyCreate + return r +} + +func (r ApiAccesskeysPostRequest) Execute() (AccessKeyRead, *APIResponse, error) { + return r.ApiService.AccesskeysPostExecute(r) +} + +/* + - AccesskeysPost Create AccessKey + - Creates a new AccessKey. + +The full AccessKey needs to be provided to create the object. +Optional data will be filled with defaults or left empty. + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @return ApiAccesskeysPostRequest +*/ +func (a *AccesskeysApiService) AccesskeysPost(ctx _context.Context) ApiAccesskeysPostRequest { + return ApiAccesskeysPostRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return AccessKeyRead + */ +func (a *AccesskeysApiService) AccesskeysPostExecute(r ApiAccesskeysPostRequest) (AccessKeyRead, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccessKeyRead + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AccesskeysApiService.AccesskeysPost") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/accesskeys" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.accessKeyCreate == nil { + return localVarReturnValue, nil, reportError("accessKeyCreate 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.accessKeyCreate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "AccesskeysPost", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 415 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiAccesskeysPutRequest struct { + ctx _context.Context + ApiService *AccesskeysApiService + accesskeyId string + accessKeyEnsure *AccessKeyEnsure +} + +func (r ApiAccesskeysPutRequest) AccessKeyEnsure(accessKeyEnsure AccessKeyEnsure) ApiAccesskeysPutRequest { + r.accessKeyEnsure = &accessKeyEnsure + return r +} + +func (r ApiAccesskeysPutRequest) Execute() (AccessKeyRead, *APIResponse, error) { + return r.ApiService.AccesskeysPutExecute(r) +} + +/* + - AccesskeysPut Ensure AccessKey + - Ensures that the AccessKey with the provided ID is created or modified. + +The full AccessKey needs to be provided to ensure +(either update or create) the AccessKey. Non present data will +only be filled with defaults or left empty, but not take +previous values into consideration. + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @param accesskeyId The ID (UUID) of the AccessKey. + - @return ApiAccesskeysPutRequest +*/ +func (a *AccesskeysApiService) AccesskeysPut(ctx _context.Context, accesskeyId string) ApiAccesskeysPutRequest { + return ApiAccesskeysPutRequest{ + ApiService: a, + ctx: ctx, + accesskeyId: accesskeyId, + } +} + +/* + * Execute executes the request + * @return AccessKeyRead + */ +func (a *AccesskeysApiService) AccesskeysPutExecute(r ApiAccesskeysPutRequest) (AccessKeyRead, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccessKeyRead + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AccesskeysApiService.AccesskeysPut") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/accesskeys/{accesskeyId}" + localVarPath = strings.Replace(localVarPath, "{"+"accesskeyId"+"}", _neturl.PathEscape(parameterToString(r.accesskeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.accessKeyEnsure == nil { + return localVarReturnValue, nil, reportError("accessKeyEnsure 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.accessKeyEnsure + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "AccesskeysPut", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 415 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 422 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiAccesskeysRenewRequest struct { + ctx _context.Context + ApiService *AccesskeysApiService + accesskeyId string +} + +func (r ApiAccesskeysRenewRequest) Execute() (AccessKeyRead, *APIResponse, error) { + return r.ApiService.AccesskeysRenewExecute(r) +} + +/* +* AccesskeysRenew Ensure AccessKey +* Renew will replace the existing secret access key with a new one. + +* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). +* @param accesskeyId The ID (UUID) of the AccessKey that should be ensured. +* @return ApiAccesskeysRenewRequest + */ +func (a *AccesskeysApiService) AccesskeysRenew(ctx _context.Context, accesskeyId string) ApiAccesskeysRenewRequest { + return ApiAccesskeysRenewRequest{ + ApiService: a, + ctx: ctx, + accesskeyId: accesskeyId, + } +} + +/* + * Execute executes the request + * @return AccessKeyRead + */ +func (a *AccesskeysApiService) AccesskeysRenewExecute(r ApiAccesskeysRenewRequest) (AccessKeyRead, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccessKeyRead + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AccesskeysApiService.AccesskeysRenew") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/accesskeys/{accesskeyId}/renew" + localVarPath = strings.Replace(localVarPath, "{"+"accesskeyId"+"}", _neturl.PathEscape(parameterToString(r.accesskeyId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "AccesskeysRenew", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/api_regions.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/api_regions.go new file mode 100644 index 000000000..52e2a5d30 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/api_regions.go @@ -0,0 +1,407 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + _context "context" + "fmt" + "io" + _nethttp "net/http" + _neturl "net/url" + "strings" +) + +// Linger please +var ( + _ _context.Context +) + +// RegionsApiService RegionsApi service +type RegionsApiService service + +type ApiRegionsFindByRegionRequest struct { + ctx _context.Context + ApiService *RegionsApiService + region string +} + +func (r ApiRegionsFindByRegionRequest) Execute() (RegionRead, *APIResponse, error) { + return r.ApiService.RegionsFindByRegionExecute(r) +} + +/* + * RegionsFindByRegion Retrieve Region + * Returns the Region by Region. + * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + * @param region The Region of the Region. + * @return ApiRegionsFindByRegionRequest + */ +func (a *RegionsApiService) RegionsFindByRegion(ctx _context.Context, region string) ApiRegionsFindByRegionRequest { + return ApiRegionsFindByRegionRequest{ + ApiService: a, + ctx: ctx, + region: region, + } +} + +/* + * Execute executes the request + * @return RegionRead + */ +func (a *RegionsApiService) RegionsFindByRegionExecute(r ApiRegionsFindByRegionRequest) (RegionRead, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RegionRead + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RegionsApiService.RegionsFindByRegion") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/regions/{region}" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", _neturl.PathEscape(parameterToString(r.region, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.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, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "RegionsFindByRegion", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} + +type ApiRegionsGetRequest struct { + ctx _context.Context + ApiService *RegionsApiService + offset *int32 + limit *int32 +} + +func (r ApiRegionsGetRequest) Offset(offset int32) ApiRegionsGetRequest { + r.offset = &offset + return r +} +func (r ApiRegionsGetRequest) Limit(limit int32) ApiRegionsGetRequest { + r.limit = &limit + return r +} + +func (r ApiRegionsGetRequest) Execute() (RegionReadList, *APIResponse, error) { + return r.ApiService.RegionsGetExecute(r) +} + +/* + - RegionsGet Retrieve all Regions + - This endpoint enables retrieving all Regions using + +pagination and optional filters. + + - @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + - @return ApiRegionsGetRequest +*/ +func (a *RegionsApiService) RegionsGet(ctx _context.Context) ApiRegionsGetRequest { + return ApiRegionsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +/* + * Execute executes the request + * @return RegionReadList + */ +func (a *RegionsApiService) RegionsGetExecute(r ApiRegionsGetRequest) (RegionReadList, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RegionReadList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RegionsApiService.RegionsGet") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/regions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + + if r.offset != nil { + localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) + } + if r.limit != nil { + localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) + } + // 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, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) + + localVarAPIResponse := &APIResponse{ + Response: localVarHTTPResponse, + Method: localVarHTTPMethod, + RequestTime: httpRequestTime, + RequestURL: localVarPath, + Operation: "RegionsGet", + } + + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarAPIResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarAPIResponse.Payload = localVarBody + if err != nil { + return localVarReturnValue, localVarAPIResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody)), + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + if localVarHTTPResponse.StatusCode == 503 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarAPIResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarAPIResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + statusCode: localVarHTTPResponse.StatusCode, + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarAPIResponse, newErr + } + + return localVarReturnValue, localVarAPIResponse, nil +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/client.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/client.go new file mode 100644 index 000000000..a29104836 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/client.go @@ -0,0 +1,745 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "bytes" + "context" + "crypto/sha256" + "crypto/tls" + "crypto/x509" + "encoding/hex" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "mime/multipart" + "net" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)\/(?:vnd\.[^;]+|problem\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) +) + +const ( + RequestStatusQueued = "QUEUED" + RequestStatusRunning = "RUNNING" + RequestStatusFailed = "FAILED" + RequestStatusDone = "DONE" + + Version = "1.0.0" +) + +// APIClient manages communication with the IONOS Cloud - Object Storage Management API API v0.1.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + AccesskeysApi *AccesskeysApiService + + RegionsApi *RegionsApiService +} + +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(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + //enable certificate pinning if the env variable is set + pkFingerprint := os.Getenv(IonosPinnedCertEnvVar) + if pkFingerprint != "" { + httpTransport := &http.Transport{} + AddPinnedCert(httpTransport, pkFingerprint) + cfg.HTTPClient.Transport = httpTransport + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.AccesskeysApi = (*AccesskeysApiService)(&c.common) + c.RegionsApi = (*RegionsApiService)(&c.common) + + return c +} + +// AddPinnedCert - enables pinning of the sha256 public fingerprint to the http client's transport +func AddPinnedCert(transport *http.Transport, pkFingerprint string) { + if pkFingerprint != "" { + transport.DialTLSContext = addPinnedCertVerification([]byte(pkFingerprint), new(tls.Config)) + } +} + +// TLSDial can be assigned to a http.Transport's DialTLS field. +type TLSDial func(ctx context.Context, network, addr string) (net.Conn, error) + +// addPinnedCertVerification returns a TLSDial function which checks that +// the remote server provides a certificate whose SHA256 fingerprint matches +// the provided value. +// +// The returned dialer function can be plugged into a http.Transport's DialTLS +// field to allow for certificate pinning. +func addPinnedCertVerification(fingerprint []byte, tlsConfig *tls.Config) TLSDial { + return func(ctx context.Context, network, addr string) (net.Conn, error) { + //fingerprints can be added with ':', we need to trim + fingerprint = bytes.ReplaceAll(fingerprint, []byte(":"), []byte("")) + fingerprint = bytes.ReplaceAll(fingerprint, []byte(" "), []byte("")) + //we are manually checking a certificate, so we need to enable insecure + tlsConfig.InsecureSkipVerify = true + + // Dial the connection to get certificates to check + conn, err := tls.Dial(network, addr, tlsConfig) + if err != nil { + return nil, err + } + + if err := verifyPinnedCert(fingerprint, conn.ConnectionState().PeerCertificates); err != nil { + _ = conn.Close() + return nil, err + } + + return conn, nil + } +} + +// verifyPinnedCert iterates the list of peer certificates and attempts to +// locate a certificate that is not a CA and whose public key fingerprint matches pkFingerprint. +func verifyPinnedCert(pkFingerprint []byte, peerCerts []*x509.Certificate) error { + for _, cert := range peerCerts { + fingerprint := sha256.Sum256(cert.Raw) + + var bytesFingerPrint = make([]byte, hex.EncodedLen(len(fingerprint[:]))) + hex.Encode(bytesFingerPrint, fingerprint[:]) + + // we have a match, and it's not an authority certificate + if cert.IsCA == false && bytes.EqualFold(bytesFingerPrint, pkFingerprint) { + return nil + } + } + + return fmt.Errorf("remote server presented a certificate which does not match the provided fingerprint") +} + +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 insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(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 +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + return t.Format(time.RFC3339) + } + + return fmt.Sprintf("%v", obj) +} + +// 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, time.Duration, error) { + retryCount := 0 + + var resp *http.Response + var httpRequestTime time.Duration + var err error + + for { + + retryCount++ + + /* we need to clone the request with every retry time because Body closes after the request */ + var clonedRequest *http.Request = request.Clone(request.Context()) + if request.Body != nil { + clonedRequest.Body, err = request.GetBody() + if err != nil { + return nil, httpRequestTime, err + } + } + + if c.cfg.Debug || c.cfg.LogLevel.Satisfies(Trace) { + dump, err := httputil.DumpRequestOut(clonedRequest, true) + if err == nil { + c.cfg.Logger.Printf(" DumpRequestOut : %s\n", string(dump)) + } else { + c.cfg.Logger.Printf(" DumpRequestOut err: %+v", err) + } + c.cfg.Logger.Printf("\n try no: %d\n", retryCount) + } + + httpRequestStartTime := time.Now() + clonedRequest.Close = true + resp, err = c.cfg.HTTPClient.Do(clonedRequest) + httpRequestTime = time.Since(httpRequestStartTime) + if err != nil { + return resp, httpRequestTime, err + } + + if c.cfg.Debug || c.cfg.LogLevel.Satisfies(Trace) { + dump, err := httputil.DumpResponse(resp, true) + if err == nil { + c.cfg.Logger.Printf("\n DumpResponse : %s\n", string(dump)) + } else { + c.cfg.Logger.Printf(" DumpResponse err %+v", err) + } + } + + var backoffTime time.Duration + + switch resp.StatusCode { + case http.StatusServiceUnavailable, + http.StatusGatewayTimeout, + http.StatusBadGateway: + if request.Method == http.MethodPost { + return resp, httpRequestTime, err + } + backoffTime = c.GetConfig().WaitTime + + case http.StatusTooManyRequests: + if retryAfterSeconds := resp.Header.Get("Retry-After"); retryAfterSeconds != "" { + waitTime, err := time.ParseDuration(retryAfterSeconds + "s") + if err != nil { + return resp, httpRequestTime, err + } + backoffTime = waitTime + } else { + backoffTime = c.GetConfig().WaitTime + } + default: + return resp, httpRequestTime, err + + } + + if retryCount >= c.GetConfig().MaxRetries { + if c.cfg.Debug || c.cfg.LogLevel.Satisfies(Debug) { + c.cfg.Logger.Printf(" Number of maximum retries exceeded (%d retries)\n", c.cfg.MaxRetries) + } + break + } else { + c.backOff(request.Context(), backoffTime) + } + } + + return resp, httpRequestTime, err +} + +func (c *APIClient) backOff(ctx context.Context, t time.Duration) { + if t > c.GetConfig().MaxWaitTime { + t = c.GetConfig().MaxWaitTime + } + if c.cfg.Debug || c.cfg.LogLevel.Satisfies(Debug) { + c.cfg.Logger.Printf(" Sleeping %s before retrying request\n", t.String()) + } + if t <= 0 { + return + } + + timer := time.NewTimer(t) + defer timer.Stop() + + select { + case <-ctx.Done(): + case <-timer.C: + } +} + +// 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() *Configuration { + return c.cfg +} + +// 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, + formFileName string, + fileName string, + fileBytes []byte) (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(fileBytes) > 0 && fileName != "") { + 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) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile(formFileName, filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(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() + /* adding default query params */ + for k, v := range c.cfg.DefaultQueryParams { + if _, ok := queryParams[k]; !ok { + queryParams[k] = v + } + } + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // 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.Set(h, v) + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if c.cfg.Token != "" { + localVarRequest.Header.Add("Authorization", "Bearer "+c.cfg.Token) + } else { + if c.cfg.Username != "" { + localVarRequest.SetBasicAuth(c.cfg.Username, c.cfg.Password) + } + } + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + + } + + 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 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 fmt.Errorf("undefined response type for content %s", contentType) +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(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 +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// 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 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) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + 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) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + statusCode int + body []byte + error string + model interface{} +} + +// NewGenericOpenAPIError - constructor for GenericOpenAPIError +func NewGenericOpenAPIError(message string, body []byte, model interface{}, statusCode int) *GenericOpenAPIError { + return &GenericOpenAPIError{ + statusCode: statusCode, + body: body, + error: message, + model: model, + } +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// SetError sets the error string +func (e *GenericOpenAPIError) SetError(error string) { + e.error = error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// SetBody sets the raw body of the error +func (e *GenericOpenAPIError) SetBody(body []byte) { + e.body = body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// SetModel sets the model of the error +func (e *GenericOpenAPIError) SetModel(model interface{}) { + e.model = model +} + +// StatusCode returns the status code of the error +func (e GenericOpenAPIError) StatusCode() int { + return e.statusCode +} + +// SetStatusCode sets the status code of the error +func (e *GenericOpenAPIError) SetStatusCode(statusCode int) { + e.statusCode = statusCode +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/configuration.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/configuration.go new file mode 100644 index 000000000..6f9c35140 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/configuration.go @@ -0,0 +1,292 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "context" + "fmt" + "net/http" + "net/url" + "os" + "strings" + "time" +) + +const ( + IonosUsernameEnvVar = "IONOS_USERNAME" + IonosPasswordEnvVar = "IONOS_PASSWORD" + IonosTokenEnvVar = "IONOS_TOKEN" + IonosApiUrlEnvVar = "IONOS_API_URL" + IonosPinnedCertEnvVar = "IONOS_PINNED_CERT" + IonosLogLevelEnvVar = "IONOS_LOG_LEVEL" + DefaultIonosServerUrl = "https://s3.ionos.com" + DefaultIonosBasePath = "" + defaultMaxRetries = 3 + defaultWaitTime = time.Duration(100) * time.Millisecond + defaultMaxWaitTime = time.Duration(2000) * time.Millisecond +) + +var ( + IonosServerUrls = []string{ + "https://s3.ionos.com", + } +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. + ContextHttpSignatureAuth = contextKey("httpsignature") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + DefaultQueryParams url.Values `json:"defaultQueryParams,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client + LogLevel LogLevel + Logger Logger + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + Token string `json:"token,omitempty"` + MaxRetries int `json:"maxRetries,omitempty"` + WaitTime time.Duration `json:"waitTime,omitempty"` + MaxWaitTime time.Duration `json:"maxWaitTime,omitempty"` +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration(username, password, token, hostUrl string) *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + DefaultQueryParams: url.Values{}, + UserAgent: "ionos-cloud-sdk-go-object-storage-management/v1.0.0", + Debug: false, + Username: username, + Password: password, + Token: token, + MaxRetries: defaultMaxRetries, + MaxWaitTime: defaultMaxWaitTime, + WaitTime: defaultWaitTime, + Logger: NewDefaultLogger(), + LogLevel: getLogLevelFromEnv(), + Servers: ServerConfigurations{ + { + URL: getServerUrl(hostUrl), + Description: "Production", + }, + }, + OperationServers: map[string]ServerConfigurations{}, + } + return cfg +} + +func NewConfigurationFromEnv() *Configuration { + return NewConfiguration(os.Getenv(IonosUsernameEnvVar), os.Getenv(IonosPasswordEnvVar), os.Getenv(IonosTokenEnvVar), os.Getenv(IonosApiUrlEnvVar)) +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +func (c *Configuration) AddDefaultQueryParam(key string, value string) { + c.DefaultQueryParams[key] = []string{value} +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +func getServerUrl(serverUrl string) string { + if serverUrl == "" { + return DefaultIonosServerUrl + } + // Support both HTTPS & HTTP schemas + if !strings.HasPrefix(serverUrl, "https://") && !strings.HasPrefix(serverUrl, "http://") { + serverUrl = fmt.Sprintf("https://%s", serverUrl) + } + if !strings.HasSuffix(serverUrl, DefaultIonosBasePath) { + serverUrl = fmt.Sprintf("%s%s", serverUrl, DefaultIonosBasePath) + } + return serverUrl +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/logger.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/logger.go new file mode 100644 index 000000000..a6fb5483e --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/logger.go @@ -0,0 +1,80 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "log" + "os" + "strings" +) + +type LogLevel uint + +func (l *LogLevel) Get() LogLevel { + if l != nil { + return *l + } + return Off +} + +// Satisfies returns true if this LogLevel is at least high enough for v +func (l *LogLevel) Satisfies(v LogLevel) bool { + return l.Get() >= v +} + +const ( + Off LogLevel = 0x100 * iota + Debug + // Trace We recommend you only set this field for debugging purposes. + // Disable it in your production environments because it can log sensitive data. + // It logs the full request and response without encryption, even for an HTTPS call. + // Verbose request and response logging can also significantly impact your application's performance. + Trace +) + +var LogLevelMap = map[string]LogLevel{ + "off": Off, + "debug": Debug, + "trace": Trace, +} + +// getLogLevelFromEnv - gets LogLevel type from env variable IONOS_LOG_LEVEL +// returns Off if an invalid log level is encountered +func getLogLevelFromEnv() LogLevel { + strLogLevel := "off" + if os.Getenv(IonosLogLevelEnvVar) != "" { + strLogLevel = os.Getenv(IonosLogLevelEnvVar) + } + + logLevel, ok := LogLevelMap[strings.ToLower(strLogLevel)] + if !ok { + log.Printf("Cannot set logLevel for value: %s, setting loglevel to Off", strLogLevel) + } + return logLevel +} + +type Logger interface { + Printf(format string, args ...interface{}) +} + +func NewDefaultLogger() Logger { + return &defaultLogger{ + logger: log.New(os.Stderr, "IONOSLOG ", log.LstdFlags), + } +} + +type defaultLogger struct { + logger *log.Logger +} + +func (l defaultLogger) Printf(format string, args ...interface{}) { + l.logger.Printf(format, args...) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key.go new file mode 100644 index 000000000..5abc7fb36 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key.go @@ -0,0 +1,302 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// AccessKey Per user access key. +type AccessKey struct { + // Description of the Access key. + Description *string `json:"description"` + // Access key metadata is a string of 92 characters. + AccessKey *string `json:"accessKey"` + // The secret key of the Access key. + SecretKey *string `json:"secretKey"` + // The canonical user ID which is valid for user-owned buckets. + CanonicalUserId *string `json:"canonicalUserId,omitempty"` + // The contract user ID which is valid for contract-owned buckets. + ContractUserId *string `json:"contractUserId,omitempty"` +} + +// NewAccessKey instantiates a new AccessKey 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 NewAccessKey(description string, accessKey string, secretKey string) *AccessKey { + this := AccessKey{} + + this.Description = &description + this.AccessKey = &accessKey + this.SecretKey = &secretKey + + return &this +} + +// NewAccessKeyWithDefaults instantiates a new AccessKey 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 NewAccessKeyWithDefaults() *AccessKey { + this := AccessKey{} + return &this +} + +// GetDescription returns the Description field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKey) GetDescription() *string { + if o == nil { + return nil + } + + return o.Description + +} + +// GetDescriptionOk returns a tuple with the Description 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 *AccessKey) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Description, true +} + +// SetDescription sets field value +func (o *AccessKey) SetDescription(v string) { + + o.Description = &v + +} + +// HasDescription returns a boolean if a field has been set. +func (o *AccessKey) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// GetAccessKey returns the AccessKey field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKey) GetAccessKey() *string { + if o == nil { + return nil + } + + return o.AccessKey + +} + +// GetAccessKeyOk returns a tuple with the AccessKey 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 *AccessKey) GetAccessKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.AccessKey, true +} + +// SetAccessKey sets field value +func (o *AccessKey) SetAccessKey(v string) { + + o.AccessKey = &v + +} + +// HasAccessKey returns a boolean if a field has been set. +func (o *AccessKey) HasAccessKey() bool { + if o != nil && o.AccessKey != nil { + return true + } + + return false +} + +// GetSecretKey returns the SecretKey field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKey) GetSecretKey() *string { + if o == nil { + return nil + } + + return o.SecretKey + +} + +// GetSecretKeyOk returns a tuple with the SecretKey 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 *AccessKey) GetSecretKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.SecretKey, true +} + +// SetSecretKey sets field value +func (o *AccessKey) SetSecretKey(v string) { + + o.SecretKey = &v + +} + +// HasSecretKey returns a boolean if a field has been set. +func (o *AccessKey) HasSecretKey() bool { + if o != nil && o.SecretKey != nil { + return true + } + + return false +} + +// GetCanonicalUserId returns the CanonicalUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKey) GetCanonicalUserId() *string { + if o == nil { + return nil + } + + return o.CanonicalUserId + +} + +// GetCanonicalUserIdOk returns a tuple with the CanonicalUserId 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 *AccessKey) GetCanonicalUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CanonicalUserId, true +} + +// SetCanonicalUserId sets field value +func (o *AccessKey) SetCanonicalUserId(v string) { + + o.CanonicalUserId = &v + +} + +// HasCanonicalUserId returns a boolean if a field has been set. +func (o *AccessKey) HasCanonicalUserId() bool { + if o != nil && o.CanonicalUserId != nil { + return true + } + + return false +} + +// GetContractUserId returns the ContractUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKey) GetContractUserId() *string { + if o == nil { + return nil + } + + return o.ContractUserId + +} + +// GetContractUserIdOk returns a tuple with the ContractUserId 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 *AccessKey) GetContractUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.ContractUserId, true +} + +// SetContractUserId sets field value +func (o *AccessKey) SetContractUserId(v string) { + + o.ContractUserId = &v + +} + +// HasContractUserId returns a boolean if a field has been set. +func (o *AccessKey) HasContractUserId() bool { + if o != nil && o.ContractUserId != nil { + return true + } + + return false +} + +func (o AccessKey) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Description != nil { + toSerialize["description"] = o.Description + } + + if o.AccessKey != nil { + toSerialize["accessKey"] = o.AccessKey + } + + if o.SecretKey != nil { + toSerialize["secretKey"] = o.SecretKey + } + + if o.CanonicalUserId != nil { + toSerialize["canonicalUserId"] = o.CanonicalUserId + } + + if o.ContractUserId != nil { + toSerialize["contractUserId"] = o.ContractUserId + } + + return json.Marshal(toSerialize) +} + +type NullableAccessKey struct { + value *AccessKey + isSet bool +} + +func (v NullableAccessKey) Get() *AccessKey { + return v.value +} + +func (v *NullableAccessKey) Set(val *AccessKey) { + v.value = val + v.isSet = true +} + +func (v NullableAccessKey) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessKey) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessKey(val *AccessKey) *NullableAccessKey { + return &NullableAccessKey{value: val, isSet: true} +} + +func (v NullableAccessKey) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessKey) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_create.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_create.go new file mode 100644 index 000000000..edcb5b2ce --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_create.go @@ -0,0 +1,167 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// AccessKeyCreate struct for AccessKeyCreate +type AccessKeyCreate struct { + // Metadata + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Properties *AccessKey `json:"properties"` +} + +// NewAccessKeyCreate instantiates a new AccessKeyCreate 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 NewAccessKeyCreate(properties AccessKey) *AccessKeyCreate { + this := AccessKeyCreate{} + + this.Properties = &properties + + return &this +} + +// NewAccessKeyCreateWithDefaults instantiates a new AccessKeyCreate 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 NewAccessKeyCreateWithDefaults() *AccessKeyCreate { + this := AccessKeyCreate{} + return &this +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for map[string]interface{} will be returned +func (o *AccessKeyCreate) GetMetadata() *map[string]interface{} { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata 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 *AccessKeyCreate) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *AccessKeyCreate) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *AccessKeyCreate) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for AccessKey will be returned +func (o *AccessKeyCreate) GetProperties() *AccessKey { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties 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 *AccessKeyCreate) GetPropertiesOk() (*AccessKey, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *AccessKeyCreate) SetProperties(v AccessKey) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *AccessKeyCreate) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o AccessKeyCreate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableAccessKeyCreate struct { + value *AccessKeyCreate + isSet bool +} + +func (v NullableAccessKeyCreate) Get() *AccessKeyCreate { + return v.value +} + +func (v *NullableAccessKeyCreate) Set(val *AccessKeyCreate) { + v.value = val + v.isSet = true +} + +func (v NullableAccessKeyCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessKeyCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessKeyCreate(val *AccessKeyCreate) *NullableAccessKeyCreate { + return &NullableAccessKeyCreate{value: val, isSet: true} +} + +func (v NullableAccessKeyCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessKeyCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_ensure.go new file mode 100644 index 000000000..559603b1a --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_ensure.go @@ -0,0 +1,212 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// AccessKeyEnsure struct for AccessKeyEnsure +type AccessKeyEnsure struct { + // The ID (UUID) of the AccessKey. + Id *string `json:"id"` + // Metadata + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Properties *AccessKey `json:"properties"` +} + +// NewAccessKeyEnsure instantiates a new AccessKeyEnsure 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 NewAccessKeyEnsure(id string, properties AccessKey) *AccessKeyEnsure { + this := AccessKeyEnsure{} + + this.Id = &id + this.Properties = &properties + + return &this +} + +// NewAccessKeyEnsureWithDefaults instantiates a new AccessKeyEnsure 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 NewAccessKeyEnsureWithDefaults() *AccessKeyEnsure { + this := AccessKeyEnsure{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKeyEnsure) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *AccessKeyEnsure) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *AccessKeyEnsure) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *AccessKeyEnsure) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for map[string]interface{} will be returned +func (o *AccessKeyEnsure) GetMetadata() *map[string]interface{} { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata 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 *AccessKeyEnsure) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *AccessKeyEnsure) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *AccessKeyEnsure) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for AccessKey will be returned +func (o *AccessKeyEnsure) GetProperties() *AccessKey { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties 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 *AccessKeyEnsure) GetPropertiesOk() (*AccessKey, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *AccessKeyEnsure) SetProperties(v AccessKey) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *AccessKeyEnsure) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o AccessKeyEnsure) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableAccessKeyEnsure struct { + value *AccessKeyEnsure + isSet bool +} + +func (v NullableAccessKeyEnsure) Get() *AccessKeyEnsure { + return v.value +} + +func (v *NullableAccessKeyEnsure) Set(val *AccessKeyEnsure) { + v.value = val + v.isSet = true +} + +func (v NullableAccessKeyEnsure) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessKeyEnsure) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessKeyEnsure(val *AccessKeyEnsure) *NullableAccessKeyEnsure { + return &NullableAccessKeyEnsure{value: val, isSet: true} +} + +func (v NullableAccessKeyEnsure) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessKeyEnsure) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read.go new file mode 100644 index 000000000..2550ede3c --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read.go @@ -0,0 +1,302 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// AccessKeyRead struct for AccessKeyRead +type AccessKeyRead struct { + // The ID (UUID) of the AccessKey. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the AccessKey. + Href *string `json:"href"` + Metadata *MetadataWithSupportedRegions `json:"metadata"` + Properties *AccessKey `json:"properties"` +} + +// NewAccessKeyRead instantiates a new AccessKeyRead 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 NewAccessKeyRead(id string, type_ string, href string, metadata MetadataWithSupportedRegions, properties AccessKey) *AccessKeyRead { + this := AccessKeyRead{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Metadata = &metadata + this.Properties = &properties + + return &this +} + +// NewAccessKeyReadWithDefaults instantiates a new AccessKeyRead 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 NewAccessKeyReadWithDefaults() *AccessKeyRead { + this := AccessKeyRead{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKeyRead) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *AccessKeyRead) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *AccessKeyRead) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *AccessKeyRead) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKeyRead) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type 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 *AccessKeyRead) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *AccessKeyRead) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *AccessKeyRead) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKeyRead) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href 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 *AccessKeyRead) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *AccessKeyRead) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *AccessKeyRead) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for MetadataWithSupportedRegions will be returned +func (o *AccessKeyRead) GetMetadata() *MetadataWithSupportedRegions { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata 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 *AccessKeyRead) GetMetadataOk() (*MetadataWithSupportedRegions, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *AccessKeyRead) SetMetadata(v MetadataWithSupportedRegions) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *AccessKeyRead) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for AccessKey will be returned +func (o *AccessKeyRead) GetProperties() *AccessKey { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties 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 *AccessKeyRead) GetPropertiesOk() (*AccessKey, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *AccessKeyRead) SetProperties(v AccessKey) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *AccessKeyRead) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o AccessKeyRead) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableAccessKeyRead struct { + value *AccessKeyRead + isSet bool +} + +func (v NullableAccessKeyRead) Get() *AccessKeyRead { + return v.value +} + +func (v *NullableAccessKeyRead) Set(val *AccessKeyRead) { + v.value = val + v.isSet = true +} + +func (v NullableAccessKeyRead) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessKeyRead) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessKeyRead(val *AccessKeyRead) *NullableAccessKeyRead { + return &NullableAccessKeyRead{value: val, isSet: true} +} + +func (v NullableAccessKeyRead) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessKeyRead) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read_list.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read_list.go new file mode 100644 index 000000000..3e942b7b2 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read_list.go @@ -0,0 +1,392 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// AccessKeyReadList struct for AccessKeyReadList +type AccessKeyReadList struct { + // ID of the list of AccessKey resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of AccessKey resources. + Href *string `json:"href"` + // The list of AccessKey resources. + Items *[]AccessKeyRead `json:"items,omitempty"` + // The offset specified in the request (if none was specified, the default offset is 0). + Offset *int32 `json:"offset"` + // The limit specified in the request (if none was specified, use the endpoint's default pagination limit). + Limit *int32 `json:"limit"` + Links *Links `json:"_links"` +} + +// NewAccessKeyReadList instantiates a new AccessKeyReadList 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 NewAccessKeyReadList(id string, type_ string, href string, offset int32, limit int32, links Links) *AccessKeyReadList { + this := AccessKeyReadList{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Offset = &offset + this.Limit = &limit + this.Links = &links + + return &this +} + +// NewAccessKeyReadListWithDefaults instantiates a new AccessKeyReadList 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 NewAccessKeyReadListWithDefaults() *AccessKeyReadList { + this := AccessKeyReadList{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKeyReadList) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *AccessKeyReadList) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *AccessKeyReadList) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *AccessKeyReadList) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKeyReadList) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type 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 *AccessKeyReadList) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *AccessKeyReadList) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *AccessKeyReadList) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKeyReadList) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href 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 *AccessKeyReadList) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *AccessKeyReadList) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *AccessKeyReadList) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []AccessKeyRead will be returned +func (o *AccessKeyReadList) GetItems() *[]AccessKeyRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items 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 *AccessKeyReadList) GetItemsOk() (*[]AccessKeyRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *AccessKeyReadList) SetItems(v []AccessKeyRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *AccessKeyReadList) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +// GetOffset returns the Offset field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *AccessKeyReadList) GetOffset() *int32 { + if o == nil { + return nil + } + + return o.Offset + +} + +// GetOffsetOk returns a tuple with the Offset 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 *AccessKeyReadList) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Offset, true +} + +// SetOffset sets field value +func (o *AccessKeyReadList) SetOffset(v int32) { + + o.Offset = &v + +} + +// HasOffset returns a boolean if a field has been set. +func (o *AccessKeyReadList) HasOffset() bool { + if o != nil && o.Offset != nil { + return true + } + + return false +} + +// GetLimit returns the Limit field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *AccessKeyReadList) GetLimit() *int32 { + if o == nil { + return nil + } + + return o.Limit + +} + +// GetLimitOk returns a tuple with the Limit 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 *AccessKeyReadList) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Limit, true +} + +// SetLimit sets field value +func (o *AccessKeyReadList) SetLimit(v int32) { + + o.Limit = &v + +} + +// HasLimit returns a boolean if a field has been set. +func (o *AccessKeyReadList) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// GetLinks returns the Links field value +// If the value is explicit nil, the zero value for Links will be returned +func (o *AccessKeyReadList) GetLinks() *Links { + if o == nil { + return nil + } + + return o.Links + +} + +// GetLinksOk returns a tuple with the Links 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 *AccessKeyReadList) GetLinksOk() (*Links, bool) { + if o == nil { + return nil, false + } + + return o.Links, true +} + +// SetLinks sets field value +func (o *AccessKeyReadList) SetLinks(v Links) { + + o.Links = &v + +} + +// HasLinks returns a boolean if a field has been set. +func (o *AccessKeyReadList) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +func (o AccessKeyReadList) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + if o.Offset != nil { + toSerialize["offset"] = o.Offset + } + + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + if o.Links != nil { + toSerialize["_links"] = o.Links + } + + return json.Marshal(toSerialize) +} + +type NullableAccessKeyReadList struct { + value *AccessKeyReadList + isSet bool +} + +func (v NullableAccessKeyReadList) Get() *AccessKeyReadList { + return v.value +} + +func (v *NullableAccessKeyReadList) Set(val *AccessKeyReadList) { + v.value = val + v.isSet = true +} + +func (v NullableAccessKeyReadList) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessKeyReadList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessKeyReadList(val *AccessKeyReadList) *NullableAccessKeyReadList { + return &NullableAccessKeyReadList{value: val, isSet: true} +} + +func (v NullableAccessKeyReadList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessKeyReadList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read_list_all_of.go new file mode 100644 index 000000000..abf9c88c7 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read_list_all_of.go @@ -0,0 +1,258 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// AccessKeyReadListAllOf struct for AccessKeyReadListAllOf +type AccessKeyReadListAllOf struct { + // ID of the list of AccessKey resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of AccessKey resources. + Href *string `json:"href"` + // The list of AccessKey resources. + Items *[]AccessKeyRead `json:"items,omitempty"` +} + +// NewAccessKeyReadListAllOf instantiates a new AccessKeyReadListAllOf 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 NewAccessKeyReadListAllOf(id string, type_ string, href string) *AccessKeyReadListAllOf { + this := AccessKeyReadListAllOf{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + + return &this +} + +// NewAccessKeyReadListAllOfWithDefaults instantiates a new AccessKeyReadListAllOf 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 NewAccessKeyReadListAllOfWithDefaults() *AccessKeyReadListAllOf { + this := AccessKeyReadListAllOf{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKeyReadListAllOf) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *AccessKeyReadListAllOf) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *AccessKeyReadListAllOf) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *AccessKeyReadListAllOf) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKeyReadListAllOf) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type 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 *AccessKeyReadListAllOf) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *AccessKeyReadListAllOf) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *AccessKeyReadListAllOf) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKeyReadListAllOf) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href 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 *AccessKeyReadListAllOf) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *AccessKeyReadListAllOf) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *AccessKeyReadListAllOf) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []AccessKeyRead will be returned +func (o *AccessKeyReadListAllOf) GetItems() *[]AccessKeyRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items 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 *AccessKeyReadListAllOf) GetItemsOk() (*[]AccessKeyRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *AccessKeyReadListAllOf) SetItems(v []AccessKeyRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *AccessKeyReadListAllOf) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +func (o AccessKeyReadListAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableAccessKeyReadListAllOf struct { + value *AccessKeyReadListAllOf + isSet bool +} + +func (v NullableAccessKeyReadListAllOf) Get() *AccessKeyReadListAllOf { + return v.value +} + +func (v *NullableAccessKeyReadListAllOf) Set(val *AccessKeyReadListAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableAccessKeyReadListAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessKeyReadListAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessKeyReadListAllOf(val *AccessKeyReadListAllOf) *NullableAccessKeyReadListAllOf { + return &NullableAccessKeyReadListAllOf{value: val, isSet: true} +} + +func (v NullableAccessKeyReadListAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessKeyReadListAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket.go new file mode 100644 index 000000000..c4697bec3 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket.go @@ -0,0 +1,169 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// Bucket Buckets visible to the user. +type Bucket struct { + // The region where the bucket is located + Region *string `json:"region"` + // The website URL for the bucket + Website *string `json:"website"` +} + +// NewBucket instantiates a new Bucket 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 NewBucket(region string, website string) *Bucket { + this := Bucket{} + + this.Region = ®ion + this.Website = &website + + return &this +} + +// NewBucketWithDefaults instantiates a new Bucket 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 NewBucketWithDefaults() *Bucket { + this := Bucket{} + return &this +} + +// GetRegion returns the Region field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Bucket) GetRegion() *string { + if o == nil { + return nil + } + + return o.Region + +} + +// GetRegionOk returns a tuple with the Region 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 *Bucket) GetRegionOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Region, true +} + +// SetRegion sets field value +func (o *Bucket) SetRegion(v string) { + + o.Region = &v + +} + +// HasRegion returns a boolean if a field has been set. +func (o *Bucket) HasRegion() bool { + if o != nil && o.Region != nil { + return true + } + + return false +} + +// GetWebsite returns the Website field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Bucket) GetWebsite() *string { + if o == nil { + return nil + } + + return o.Website + +} + +// GetWebsiteOk returns a tuple with the Website 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 *Bucket) GetWebsiteOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Website, true +} + +// SetWebsite sets field value +func (o *Bucket) SetWebsite(v string) { + + o.Website = &v + +} + +// HasWebsite returns a boolean if a field has been set. +func (o *Bucket) HasWebsite() bool { + if o != nil && o.Website != nil { + return true + } + + return false +} + +func (o Bucket) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Region != nil { + toSerialize["region"] = o.Region + } + + if o.Website != nil { + toSerialize["website"] = o.Website + } + + return json.Marshal(toSerialize) +} + +type NullableBucket struct { + value *Bucket + isSet bool +} + +func (v NullableBucket) Get() *Bucket { + return v.value +} + +func (v *NullableBucket) Set(val *Bucket) { + v.value = val + v.isSet = true +} + +func (v NullableBucket) IsSet() bool { + return v.isSet +} + +func (v *NullableBucket) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBucket(val *Bucket) *NullableBucket { + return &NullableBucket{value: val, isSet: true} +} + +func (v NullableBucket) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBucket) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_create.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_create.go new file mode 100644 index 000000000..4754e7bbd --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_create.go @@ -0,0 +1,167 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// BucketCreate struct for BucketCreate +type BucketCreate struct { + // Metadata + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Properties *Bucket `json:"properties"` +} + +// NewBucketCreate instantiates a new BucketCreate 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 NewBucketCreate(properties Bucket) *BucketCreate { + this := BucketCreate{} + + this.Properties = &properties + + return &this +} + +// NewBucketCreateWithDefaults instantiates a new BucketCreate 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 NewBucketCreateWithDefaults() *BucketCreate { + this := BucketCreate{} + return &this +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for map[string]interface{} will be returned +func (o *BucketCreate) GetMetadata() *map[string]interface{} { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata 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 *BucketCreate) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *BucketCreate) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *BucketCreate) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for Bucket will be returned +func (o *BucketCreate) GetProperties() *Bucket { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties 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 *BucketCreate) GetPropertiesOk() (*Bucket, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *BucketCreate) SetProperties(v Bucket) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *BucketCreate) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o BucketCreate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableBucketCreate struct { + value *BucketCreate + isSet bool +} + +func (v NullableBucketCreate) Get() *BucketCreate { + return v.value +} + +func (v *NullableBucketCreate) Set(val *BucketCreate) { + v.value = val + v.isSet = true +} + +func (v NullableBucketCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableBucketCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBucketCreate(val *BucketCreate) *NullableBucketCreate { + return &NullableBucketCreate{value: val, isSet: true} +} + +func (v NullableBucketCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBucketCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_ensure.go new file mode 100644 index 000000000..17d8dae73 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_ensure.go @@ -0,0 +1,212 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// BucketEnsure struct for BucketEnsure +type BucketEnsure struct { + // The Bucket of the Bucket. + Id *string `json:"id"` + // Metadata + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Properties *Bucket `json:"properties"` +} + +// NewBucketEnsure instantiates a new BucketEnsure 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 NewBucketEnsure(id string, properties Bucket) *BucketEnsure { + this := BucketEnsure{} + + this.Id = &id + this.Properties = &properties + + return &this +} + +// NewBucketEnsureWithDefaults instantiates a new BucketEnsure 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 NewBucketEnsureWithDefaults() *BucketEnsure { + this := BucketEnsure{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BucketEnsure) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *BucketEnsure) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *BucketEnsure) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *BucketEnsure) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for map[string]interface{} will be returned +func (o *BucketEnsure) GetMetadata() *map[string]interface{} { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata 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 *BucketEnsure) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *BucketEnsure) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *BucketEnsure) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for Bucket will be returned +func (o *BucketEnsure) GetProperties() *Bucket { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties 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 *BucketEnsure) GetPropertiesOk() (*Bucket, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *BucketEnsure) SetProperties(v Bucket) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *BucketEnsure) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o BucketEnsure) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableBucketEnsure struct { + value *BucketEnsure + isSet bool +} + +func (v NullableBucketEnsure) Get() *BucketEnsure { + return v.value +} + +func (v *NullableBucketEnsure) Set(val *BucketEnsure) { + v.value = val + v.isSet = true +} + +func (v NullableBucketEnsure) IsSet() bool { + return v.isSet +} + +func (v *NullableBucketEnsure) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBucketEnsure(val *BucketEnsure) *NullableBucketEnsure { + return &NullableBucketEnsure{value: val, isSet: true} +} + +func (v NullableBucketEnsure) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBucketEnsure) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read.go new file mode 100644 index 000000000..3ea51afe3 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read.go @@ -0,0 +1,302 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// BucketRead struct for BucketRead +type BucketRead struct { + // The Bucket of the Bucket. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the Bucket. + Href *string `json:"href"` + Metadata *map[string]interface{} `json:"metadata"` + Properties *Bucket `json:"properties"` +} + +// NewBucketRead instantiates a new BucketRead 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 NewBucketRead(id string, type_ string, href string, metadata map[string]interface{}, properties Bucket) *BucketRead { + this := BucketRead{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Metadata = &metadata + this.Properties = &properties + + return &this +} + +// NewBucketReadWithDefaults instantiates a new BucketRead 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 NewBucketReadWithDefaults() *BucketRead { + this := BucketRead{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BucketRead) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *BucketRead) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *BucketRead) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *BucketRead) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BucketRead) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type 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 *BucketRead) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *BucketRead) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *BucketRead) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BucketRead) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href 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 *BucketRead) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *BucketRead) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *BucketRead) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for map[string]interface{} will be returned +func (o *BucketRead) GetMetadata() *map[string]interface{} { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata 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 *BucketRead) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *BucketRead) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *BucketRead) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for Bucket will be returned +func (o *BucketRead) GetProperties() *Bucket { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties 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 *BucketRead) GetPropertiesOk() (*Bucket, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *BucketRead) SetProperties(v Bucket) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *BucketRead) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o BucketRead) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableBucketRead struct { + value *BucketRead + isSet bool +} + +func (v NullableBucketRead) Get() *BucketRead { + return v.value +} + +func (v *NullableBucketRead) Set(val *BucketRead) { + v.value = val + v.isSet = true +} + +func (v NullableBucketRead) IsSet() bool { + return v.isSet +} + +func (v *NullableBucketRead) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBucketRead(val *BucketRead) *NullableBucketRead { + return &NullableBucketRead{value: val, isSet: true} +} + +func (v NullableBucketRead) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBucketRead) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read_list.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read_list.go new file mode 100644 index 000000000..b77ed701e --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read_list.go @@ -0,0 +1,392 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// BucketReadList struct for BucketReadList +type BucketReadList struct { + // ID of the list of Bucket resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of Bucket resources. + Href *string `json:"href"` + // The list of Bucket resources. + Items *[]BucketRead `json:"items,omitempty"` + // The offset specified in the request (if none was specified, the default offset is 0). + Offset *int32 `json:"offset"` + // The limit specified in the request (if none was specified, use the endpoint's default pagination limit). + Limit *int32 `json:"limit"` + Links *Links `json:"_links"` +} + +// NewBucketReadList instantiates a new BucketReadList 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 NewBucketReadList(id string, type_ string, href string, offset int32, limit int32, links Links) *BucketReadList { + this := BucketReadList{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Offset = &offset + this.Limit = &limit + this.Links = &links + + return &this +} + +// NewBucketReadListWithDefaults instantiates a new BucketReadList 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 NewBucketReadListWithDefaults() *BucketReadList { + this := BucketReadList{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BucketReadList) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *BucketReadList) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *BucketReadList) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *BucketReadList) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BucketReadList) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type 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 *BucketReadList) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *BucketReadList) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *BucketReadList) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BucketReadList) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href 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 *BucketReadList) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *BucketReadList) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *BucketReadList) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []BucketRead will be returned +func (o *BucketReadList) GetItems() *[]BucketRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items 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 *BucketReadList) GetItemsOk() (*[]BucketRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *BucketReadList) SetItems(v []BucketRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *BucketReadList) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +// GetOffset returns the Offset field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *BucketReadList) GetOffset() *int32 { + if o == nil { + return nil + } + + return o.Offset + +} + +// GetOffsetOk returns a tuple with the Offset 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 *BucketReadList) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Offset, true +} + +// SetOffset sets field value +func (o *BucketReadList) SetOffset(v int32) { + + o.Offset = &v + +} + +// HasOffset returns a boolean if a field has been set. +func (o *BucketReadList) HasOffset() bool { + if o != nil && o.Offset != nil { + return true + } + + return false +} + +// GetLimit returns the Limit field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *BucketReadList) GetLimit() *int32 { + if o == nil { + return nil + } + + return o.Limit + +} + +// GetLimitOk returns a tuple with the Limit 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 *BucketReadList) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Limit, true +} + +// SetLimit sets field value +func (o *BucketReadList) SetLimit(v int32) { + + o.Limit = &v + +} + +// HasLimit returns a boolean if a field has been set. +func (o *BucketReadList) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// GetLinks returns the Links field value +// If the value is explicit nil, the zero value for Links will be returned +func (o *BucketReadList) GetLinks() *Links { + if o == nil { + return nil + } + + return o.Links + +} + +// GetLinksOk returns a tuple with the Links 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 *BucketReadList) GetLinksOk() (*Links, bool) { + if o == nil { + return nil, false + } + + return o.Links, true +} + +// SetLinks sets field value +func (o *BucketReadList) SetLinks(v Links) { + + o.Links = &v + +} + +// HasLinks returns a boolean if a field has been set. +func (o *BucketReadList) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +func (o BucketReadList) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + if o.Offset != nil { + toSerialize["offset"] = o.Offset + } + + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + if o.Links != nil { + toSerialize["_links"] = o.Links + } + + return json.Marshal(toSerialize) +} + +type NullableBucketReadList struct { + value *BucketReadList + isSet bool +} + +func (v NullableBucketReadList) Get() *BucketReadList { + return v.value +} + +func (v *NullableBucketReadList) Set(val *BucketReadList) { + v.value = val + v.isSet = true +} + +func (v NullableBucketReadList) IsSet() bool { + return v.isSet +} + +func (v *NullableBucketReadList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBucketReadList(val *BucketReadList) *NullableBucketReadList { + return &NullableBucketReadList{value: val, isSet: true} +} + +func (v NullableBucketReadList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBucketReadList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read_list_all_of.go new file mode 100644 index 000000000..3b234e8d9 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read_list_all_of.go @@ -0,0 +1,258 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// BucketReadListAllOf struct for BucketReadListAllOf +type BucketReadListAllOf struct { + // ID of the list of Bucket resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of Bucket resources. + Href *string `json:"href"` + // The list of Bucket resources. + Items *[]BucketRead `json:"items,omitempty"` +} + +// NewBucketReadListAllOf instantiates a new BucketReadListAllOf 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 NewBucketReadListAllOf(id string, type_ string, href string) *BucketReadListAllOf { + this := BucketReadListAllOf{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + + return &this +} + +// NewBucketReadListAllOfWithDefaults instantiates a new BucketReadListAllOf 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 NewBucketReadListAllOfWithDefaults() *BucketReadListAllOf { + this := BucketReadListAllOf{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BucketReadListAllOf) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *BucketReadListAllOf) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *BucketReadListAllOf) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *BucketReadListAllOf) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BucketReadListAllOf) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type 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 *BucketReadListAllOf) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *BucketReadListAllOf) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *BucketReadListAllOf) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *BucketReadListAllOf) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href 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 *BucketReadListAllOf) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *BucketReadListAllOf) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *BucketReadListAllOf) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []BucketRead will be returned +func (o *BucketReadListAllOf) GetItems() *[]BucketRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items 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 *BucketReadListAllOf) GetItemsOk() (*[]BucketRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *BucketReadListAllOf) SetItems(v []BucketRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *BucketReadListAllOf) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +func (o BucketReadListAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableBucketReadListAllOf struct { + value *BucketReadListAllOf + isSet bool +} + +func (v NullableBucketReadListAllOf) Get() *BucketReadListAllOf { + return v.value +} + +func (v *NullableBucketReadListAllOf) Set(val *BucketReadListAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableBucketReadListAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableBucketReadListAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBucketReadListAllOf(val *BucketReadListAllOf) *NullableBucketReadListAllOf { + return &NullableBucketReadListAllOf{value: val, isSet: true} +} + +func (v NullableBucketReadListAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBucketReadListAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_error.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_error.go new file mode 100644 index 000000000..1fcd7252e --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_error.go @@ -0,0 +1,166 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// Error The Error object is used to represent an error response from the API. +type Error struct { + // The HTTP status code of the operation. + HttpStatus *int32 `json:"httpStatus,omitempty"` + // A list of error messages. + Messages *[]ErrorMessages `json:"messages,omitempty"` +} + +// 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() *Error { + this := Error{} + + 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 +} + +// GetHttpStatus returns the HttpStatus field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *Error) GetHttpStatus() *int32 { + if o == nil { + return nil + } + + return o.HttpStatus + +} + +// GetHttpStatusOk returns a tuple with the HttpStatus 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 *Error) GetHttpStatusOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.HttpStatus, true +} + +// SetHttpStatus sets field value +func (o *Error) SetHttpStatus(v int32) { + + o.HttpStatus = &v + +} + +// HasHttpStatus returns a boolean if a field has been set. +func (o *Error) HasHttpStatus() bool { + if o != nil && o.HttpStatus != nil { + return true + } + + return false +} + +// GetMessages returns the Messages field value +// If the value is explicit nil, the zero value for []ErrorMessages will be returned +func (o *Error) GetMessages() *[]ErrorMessages { + if o == nil { + return nil + } + + return o.Messages + +} + +// GetMessagesOk returns a tuple with the Messages 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 *Error) GetMessagesOk() (*[]ErrorMessages, bool) { + if o == nil { + return nil, false + } + + return o.Messages, true +} + +// SetMessages sets field value +func (o *Error) SetMessages(v []ErrorMessages) { + + o.Messages = &v + +} + +// HasMessages returns a boolean if a field has been set. +func (o *Error) HasMessages() bool { + if o != nil && o.Messages != nil { + return true + } + + return false +} + +func (o Error) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.HttpStatus != nil { + toSerialize["httpStatus"] = o.HttpStatus + } + + if o.Messages != nil { + toSerialize["messages"] = o.Messages + } + + return json.Marshal(toSerialize) +} + +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/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_error_messages.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_error_messages.go new file mode 100644 index 000000000..92ee45788 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_error_messages.go @@ -0,0 +1,166 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// ErrorMessages struct for ErrorMessages +type ErrorMessages struct { + // Application internal error code + ErrorCode *string `json:"errorCode,omitempty"` + // A human readable explanation specific to this occurrence of the problem. + Message *string `json:"message,omitempty"` +} + +// NewErrorMessages instantiates a new ErrorMessages 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 NewErrorMessages() *ErrorMessages { + this := ErrorMessages{} + + return &this +} + +// NewErrorMessagesWithDefaults instantiates a new ErrorMessages 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 NewErrorMessagesWithDefaults() *ErrorMessages { + this := ErrorMessages{} + return &this +} + +// GetErrorCode returns the ErrorCode field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ErrorMessages) GetErrorCode() *string { + if o == nil { + return nil + } + + return o.ErrorCode + +} + +// GetErrorCodeOk returns a tuple with the ErrorCode 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 *ErrorMessages) GetErrorCodeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.ErrorCode, true +} + +// SetErrorCode sets field value +func (o *ErrorMessages) SetErrorCode(v string) { + + o.ErrorCode = &v + +} + +// HasErrorCode returns a boolean if a field has been set. +func (o *ErrorMessages) HasErrorCode() bool { + if o != nil && o.ErrorCode != nil { + return true + } + + return false +} + +// GetMessage returns the Message field value +// If the value is explicit nil, the zero value for string will be returned +func (o *ErrorMessages) GetMessage() *string { + if o == nil { + return nil + } + + return o.Message + +} + +// GetMessageOk returns a tuple with the Message 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 *ErrorMessages) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Message, true +} + +// SetMessage sets field value +func (o *ErrorMessages) SetMessage(v string) { + + o.Message = &v + +} + +// HasMessage returns a boolean if a field has been set. +func (o *ErrorMessages) HasMessage() bool { + if o != nil && o.Message != nil { + return true + } + + return false +} + +func (o ErrorMessages) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.ErrorCode != nil { + toSerialize["errorCode"] = o.ErrorCode + } + + if o.Message != nil { + toSerialize["message"] = o.Message + } + + return json.Marshal(toSerialize) +} + +type NullableErrorMessages struct { + value *ErrorMessages + isSet bool +} + +func (v NullableErrorMessages) Get() *ErrorMessages { + return v.value +} + +func (v *NullableErrorMessages) Set(val *ErrorMessages) { + v.value = val + v.isSet = true +} + +func (v NullableErrorMessages) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorMessages) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorMessages(val *ErrorMessages) *NullableErrorMessages { + return &NullableErrorMessages{value: val, isSet: true} +} + +func (v NullableErrorMessages) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorMessages) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_links.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_links.go new file mode 100644 index 000000000..74a607c16 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_links.go @@ -0,0 +1,210 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// Links URLs to navigate the different pages. As of now we always only return a single page. +type Links struct { + // URL (with offset and limit parameters) of the previous page; only present if offset is greater than 0. + Prev *string `json:"prev,omitempty"` + // URL (with offset and limit parameters) of the current page. + Self *string `json:"self,omitempty"` + // URL (with offset and limit parameters) of the next page; only present if offset + limit is less than the total number of elements. + Next *string `json:"next,omitempty"` +} + +// NewLinks instantiates a new Links 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 NewLinks() *Links { + this := Links{} + + return &this +} + +// NewLinksWithDefaults instantiates a new Links 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 NewLinksWithDefaults() *Links { + this := Links{} + return &this +} + +// GetPrev returns the Prev field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Links) GetPrev() *string { + if o == nil { + return nil + } + + return o.Prev + +} + +// GetPrevOk returns a tuple with the Prev 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 *Links) GetPrevOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Prev, true +} + +// SetPrev sets field value +func (o *Links) SetPrev(v string) { + + o.Prev = &v + +} + +// HasPrev returns a boolean if a field has been set. +func (o *Links) HasPrev() bool { + if o != nil && o.Prev != nil { + return true + } + + return false +} + +// GetSelf returns the Self field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Links) GetSelf() *string { + if o == nil { + return nil + } + + return o.Self + +} + +// GetSelfOk returns a tuple with the Self 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 *Links) GetSelfOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Self, true +} + +// SetSelf sets field value +func (o *Links) SetSelf(v string) { + + o.Self = &v + +} + +// HasSelf returns a boolean if a field has been set. +func (o *Links) HasSelf() bool { + if o != nil && o.Self != nil { + return true + } + + return false +} + +// GetNext returns the Next field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Links) GetNext() *string { + if o == nil { + return nil + } + + return o.Next + +} + +// GetNextOk returns a tuple with the Next 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 *Links) GetNextOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Next, true +} + +// SetNext sets field value +func (o *Links) SetNext(v string) { + + o.Next = &v + +} + +// HasNext returns a boolean if a field has been set. +func (o *Links) HasNext() bool { + if o != nil && o.Next != nil { + return true + } + + return false +} + +func (o Links) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Prev != nil { + toSerialize["prev"] = o.Prev + } + + if o.Self != nil { + toSerialize["self"] = o.Self + } + + if o.Next != nil { + toSerialize["next"] = o.Next + } + + return json.Marshal(toSerialize) +} + +type NullableLinks struct { + value *Links + isSet bool +} + +func (v NullableLinks) Get() *Links { + return v.value +} + +func (v *NullableLinks) Set(val *Links) { + v.value = val + v.isSet = true +} + +func (v NullableLinks) IsSet() bool { + return v.isSet +} + +func (v *NullableLinks) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLinks(val *Links) *NullableLinks { + return &NullableLinks{value: val, isSet: true} +} + +func (v NullableLinks) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLinks) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata.go new file mode 100644 index 000000000..7e130f9c6 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata.go @@ -0,0 +1,401 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" + "time" +) + +// Metadata Metadata of the resource. +type Metadata struct { + // The ISO 8601 creation timestamp. + CreatedDate *IonosTime `json:"createdDate,omitempty"` + // Unique name of the identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // Unique id of the identity that created the resource. + CreatedByUserId *string `json:"createdByUserId,omitempty"` + // The ISO 8601 modified timestamp. + LastModifiedDate *IonosTime `json:"lastModifiedDate,omitempty"` + // Unique name of the identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // Unique id of the identity that last modified the resource. + LastModifiedByUserId *string `json:"lastModifiedByUserId,omitempty"` + // Unique name of the resource. + ResourceURN *string `json:"resourceURN,omitempty"` +} + +// NewMetadata instantiates a new Metadata 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 NewMetadata() *Metadata { + this := Metadata{} + + return &this +} + +// NewMetadataWithDefaults instantiates a new Metadata 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 NewMetadataWithDefaults() *Metadata { + this := Metadata{} + return &this +} + +// GetCreatedDate returns the CreatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *Metadata) GetCreatedDate() *time.Time { + if o == nil { + return nil + } + + if o.CreatedDate == nil { + return nil + } + return &o.CreatedDate.Time + +} + +// GetCreatedDateOk returns a tuple with the CreatedDate 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 *Metadata) GetCreatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.CreatedDate == nil { + return nil, false + } + return &o.CreatedDate.Time, true + +} + +// SetCreatedDate sets field value +func (o *Metadata) SetCreatedDate(v time.Time) { + + o.CreatedDate = &IonosTime{v} + +} + +// HasCreatedDate returns a boolean if a field has been set. +func (o *Metadata) HasCreatedDate() bool { + if o != nil && o.CreatedDate != nil { + return true + } + + return false +} + +// GetCreatedBy returns the CreatedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Metadata) GetCreatedBy() *string { + if o == nil { + return nil + } + + return o.CreatedBy + +} + +// GetCreatedByOk returns a tuple with the CreatedBy 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 *Metadata) GetCreatedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedBy, true +} + +// SetCreatedBy sets field value +func (o *Metadata) SetCreatedBy(v string) { + + o.CreatedBy = &v + +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *Metadata) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + +// GetCreatedByUserId returns the CreatedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Metadata) GetCreatedByUserId() *string { + if o == nil { + return nil + } + + return o.CreatedByUserId + +} + +// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId 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 *Metadata) GetCreatedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedByUserId, true +} + +// SetCreatedByUserId sets field value +func (o *Metadata) SetCreatedByUserId(v string) { + + o.CreatedByUserId = &v + +} + +// HasCreatedByUserId returns a boolean if a field has been set. +func (o *Metadata) HasCreatedByUserId() bool { + if o != nil && o.CreatedByUserId != nil { + return true + } + + return false +} + +// GetLastModifiedDate returns the LastModifiedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *Metadata) GetLastModifiedDate() *time.Time { + if o == nil { + return nil + } + + if o.LastModifiedDate == nil { + return nil + } + return &o.LastModifiedDate.Time + +} + +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate 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 *Metadata) GetLastModifiedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.LastModifiedDate == nil { + return nil, false + } + return &o.LastModifiedDate.Time, true + +} + +// SetLastModifiedDate sets field value +func (o *Metadata) SetLastModifiedDate(v time.Time) { + + o.LastModifiedDate = &IonosTime{v} + +} + +// HasLastModifiedDate returns a boolean if a field has been set. +func (o *Metadata) HasLastModifiedDate() bool { + if o != nil && o.LastModifiedDate != nil { + return true + } + + return false +} + +// GetLastModifiedBy returns the LastModifiedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Metadata) GetLastModifiedBy() *string { + if o == nil { + return nil + } + + return o.LastModifiedBy + +} + +// GetLastModifiedByOk returns a tuple with the LastModifiedBy 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 *Metadata) GetLastModifiedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedBy, true +} + +// SetLastModifiedBy sets field value +func (o *Metadata) SetLastModifiedBy(v string) { + + o.LastModifiedBy = &v + +} + +// HasLastModifiedBy returns a boolean if a field has been set. +func (o *Metadata) HasLastModifiedBy() bool { + if o != nil && o.LastModifiedBy != nil { + return true + } + + return false +} + +// GetLastModifiedByUserId returns the LastModifiedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Metadata) GetLastModifiedByUserId() *string { + if o == nil { + return nil + } + + return o.LastModifiedByUserId + +} + +// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId 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 *Metadata) GetLastModifiedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedByUserId, true +} + +// SetLastModifiedByUserId sets field value +func (o *Metadata) SetLastModifiedByUserId(v string) { + + o.LastModifiedByUserId = &v + +} + +// HasLastModifiedByUserId returns a boolean if a field has been set. +func (o *Metadata) HasLastModifiedByUserId() bool { + if o != nil && o.LastModifiedByUserId != nil { + return true + } + + return false +} + +// GetResourceURN returns the ResourceURN field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Metadata) GetResourceURN() *string { + if o == nil { + return nil + } + + return o.ResourceURN + +} + +// GetResourceURNOk returns a tuple with the ResourceURN 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 *Metadata) GetResourceURNOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.ResourceURN, true +} + +// SetResourceURN sets field value +func (o *Metadata) SetResourceURN(v string) { + + o.ResourceURN = &v + +} + +// HasResourceURN returns a boolean if a field has been set. +func (o *Metadata) HasResourceURN() bool { + if o != nil && o.ResourceURN != nil { + return true + } + + return false +} + +func (o Metadata) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.CreatedDate != nil { + toSerialize["createdDate"] = o.CreatedDate + } + + if o.CreatedBy != nil { + toSerialize["createdBy"] = o.CreatedBy + } + + if o.CreatedByUserId != nil { + toSerialize["createdByUserId"] = o.CreatedByUserId + } + + if o.LastModifiedDate != nil { + toSerialize["lastModifiedDate"] = o.LastModifiedDate + } + + if o.LastModifiedBy != nil { + toSerialize["lastModifiedBy"] = o.LastModifiedBy + } + + if o.LastModifiedByUserId != nil { + toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId + } + + if o.ResourceURN != nil { + toSerialize["resourceURN"] = o.ResourceURN + } + + return json.Marshal(toSerialize) +} + +type NullableMetadata struct { + value *Metadata + isSet bool +} + +func (v NullableMetadata) Get() *Metadata { + return v.value +} + +func (v *NullableMetadata) Set(val *Metadata) { + v.value = val + v.isSet = true +} + +func (v NullableMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadata(val *Metadata) *NullableMetadata { + return &NullableMetadata{value: val, isSet: true} +} + +func (v NullableMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_status.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_status.go new file mode 100644 index 000000000..4ac633629 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_status.go @@ -0,0 +1,535 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" + "time" +) + +// MetadataWithStatus struct for MetadataWithStatus +type MetadataWithStatus struct { + // The ISO 8601 creation timestamp. + CreatedDate *IonosTime `json:"createdDate,omitempty"` + // Unique name of the identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // Unique id of the identity that created the resource. + CreatedByUserId *string `json:"createdByUserId,omitempty"` + // The ISO 8601 modified timestamp. + LastModifiedDate *IonosTime `json:"lastModifiedDate,omitempty"` + // Unique name of the identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // Unique id of the identity that last modified the resource. + LastModifiedByUserId *string `json:"lastModifiedByUserId,omitempty"` + // Unique name of the resource. + ResourceURN *string `json:"resourceURN,omitempty"` + // The status of the object. The status can be: * `AVAILABLE` - resource exists and is healthy. * `PROVISIONING` - resource is being created or updated. * `DESTROYING` - delete command was issued, the resource is being deleted. * `FAILED` - resource failed, details in `failureMessage`. + Status *string `json:"status"` + // The message of the failure if the status is `FAILED`. + StatusMessage *string `json:"statusMessage,omitempty"` + // Indicates if the key is an administrative key. Administrative keys can create buckets and set bucket policies. + Administrative *bool `json:"administrative,omitempty"` +} + +// NewMetadataWithStatus instantiates a new MetadataWithStatus 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 NewMetadataWithStatus(status string) *MetadataWithStatus { + this := MetadataWithStatus{} + + this.Status = &status + + return &this +} + +// NewMetadataWithStatusWithDefaults instantiates a new MetadataWithStatus 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 NewMetadataWithStatusWithDefaults() *MetadataWithStatus { + this := MetadataWithStatus{} + return &this +} + +// GetCreatedDate returns the CreatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *MetadataWithStatus) GetCreatedDate() *time.Time { + if o == nil { + return nil + } + + if o.CreatedDate == nil { + return nil + } + return &o.CreatedDate.Time + +} + +// GetCreatedDateOk returns a tuple with the CreatedDate 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 *MetadataWithStatus) GetCreatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.CreatedDate == nil { + return nil, false + } + return &o.CreatedDate.Time, true + +} + +// SetCreatedDate sets field value +func (o *MetadataWithStatus) SetCreatedDate(v time.Time) { + + o.CreatedDate = &IonosTime{v} + +} + +// HasCreatedDate returns a boolean if a field has been set. +func (o *MetadataWithStatus) HasCreatedDate() bool { + if o != nil && o.CreatedDate != nil { + return true + } + + return false +} + +// GetCreatedBy returns the CreatedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithStatus) GetCreatedBy() *string { + if o == nil { + return nil + } + + return o.CreatedBy + +} + +// GetCreatedByOk returns a tuple with the CreatedBy 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 *MetadataWithStatus) GetCreatedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedBy, true +} + +// SetCreatedBy sets field value +func (o *MetadataWithStatus) SetCreatedBy(v string) { + + o.CreatedBy = &v + +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *MetadataWithStatus) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + +// GetCreatedByUserId returns the CreatedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithStatus) GetCreatedByUserId() *string { + if o == nil { + return nil + } + + return o.CreatedByUserId + +} + +// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId 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 *MetadataWithStatus) GetCreatedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedByUserId, true +} + +// SetCreatedByUserId sets field value +func (o *MetadataWithStatus) SetCreatedByUserId(v string) { + + o.CreatedByUserId = &v + +} + +// HasCreatedByUserId returns a boolean if a field has been set. +func (o *MetadataWithStatus) HasCreatedByUserId() bool { + if o != nil && o.CreatedByUserId != nil { + return true + } + + return false +} + +// GetLastModifiedDate returns the LastModifiedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *MetadataWithStatus) GetLastModifiedDate() *time.Time { + if o == nil { + return nil + } + + if o.LastModifiedDate == nil { + return nil + } + return &o.LastModifiedDate.Time + +} + +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate 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 *MetadataWithStatus) GetLastModifiedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.LastModifiedDate == nil { + return nil, false + } + return &o.LastModifiedDate.Time, true + +} + +// SetLastModifiedDate sets field value +func (o *MetadataWithStatus) SetLastModifiedDate(v time.Time) { + + o.LastModifiedDate = &IonosTime{v} + +} + +// HasLastModifiedDate returns a boolean if a field has been set. +func (o *MetadataWithStatus) HasLastModifiedDate() bool { + if o != nil && o.LastModifiedDate != nil { + return true + } + + return false +} + +// GetLastModifiedBy returns the LastModifiedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithStatus) GetLastModifiedBy() *string { + if o == nil { + return nil + } + + return o.LastModifiedBy + +} + +// GetLastModifiedByOk returns a tuple with the LastModifiedBy 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 *MetadataWithStatus) GetLastModifiedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedBy, true +} + +// SetLastModifiedBy sets field value +func (o *MetadataWithStatus) SetLastModifiedBy(v string) { + + o.LastModifiedBy = &v + +} + +// HasLastModifiedBy returns a boolean if a field has been set. +func (o *MetadataWithStatus) HasLastModifiedBy() bool { + if o != nil && o.LastModifiedBy != nil { + return true + } + + return false +} + +// GetLastModifiedByUserId returns the LastModifiedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithStatus) GetLastModifiedByUserId() *string { + if o == nil { + return nil + } + + return o.LastModifiedByUserId + +} + +// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId 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 *MetadataWithStatus) GetLastModifiedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedByUserId, true +} + +// SetLastModifiedByUserId sets field value +func (o *MetadataWithStatus) SetLastModifiedByUserId(v string) { + + o.LastModifiedByUserId = &v + +} + +// HasLastModifiedByUserId returns a boolean if a field has been set. +func (o *MetadataWithStatus) HasLastModifiedByUserId() bool { + if o != nil && o.LastModifiedByUserId != nil { + return true + } + + return false +} + +// GetResourceURN returns the ResourceURN field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithStatus) GetResourceURN() *string { + if o == nil { + return nil + } + + return o.ResourceURN + +} + +// GetResourceURNOk returns a tuple with the ResourceURN 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 *MetadataWithStatus) GetResourceURNOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.ResourceURN, true +} + +// SetResourceURN sets field value +func (o *MetadataWithStatus) SetResourceURN(v string) { + + o.ResourceURN = &v + +} + +// HasResourceURN returns a boolean if a field has been set. +func (o *MetadataWithStatus) HasResourceURN() bool { + if o != nil && o.ResourceURN != nil { + return true + } + + return false +} + +// GetStatus returns the Status field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithStatus) GetStatus() *string { + if o == nil { + return nil + } + + return o.Status + +} + +// GetStatusOk returns a tuple with the Status 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 *MetadataWithStatus) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Status, true +} + +// SetStatus sets field value +func (o *MetadataWithStatus) SetStatus(v string) { + + o.Status = &v + +} + +// HasStatus returns a boolean if a field has been set. +func (o *MetadataWithStatus) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// GetStatusMessage returns the StatusMessage field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithStatus) GetStatusMessage() *string { + if o == nil { + return nil + } + + return o.StatusMessage + +} + +// GetStatusMessageOk returns a tuple with the StatusMessage 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 *MetadataWithStatus) GetStatusMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.StatusMessage, true +} + +// SetStatusMessage sets field value +func (o *MetadataWithStatus) SetStatusMessage(v string) { + + o.StatusMessage = &v + +} + +// HasStatusMessage returns a boolean if a field has been set. +func (o *MetadataWithStatus) HasStatusMessage() bool { + if o != nil && o.StatusMessage != nil { + return true + } + + return false +} + +// GetAdministrative returns the Administrative field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *MetadataWithStatus) GetAdministrative() *bool { + if o == nil { + return nil + } + + return o.Administrative + +} + +// GetAdministrativeOk returns a tuple with the Administrative 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 *MetadataWithStatus) GetAdministrativeOk() (*bool, bool) { + if o == nil { + return nil, false + } + + return o.Administrative, true +} + +// SetAdministrative sets field value +func (o *MetadataWithStatus) SetAdministrative(v bool) { + + o.Administrative = &v + +} + +// HasAdministrative returns a boolean if a field has been set. +func (o *MetadataWithStatus) HasAdministrative() bool { + if o != nil && o.Administrative != nil { + return true + } + + return false +} + +func (o MetadataWithStatus) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.CreatedDate != nil { + toSerialize["createdDate"] = o.CreatedDate + } + + if o.CreatedBy != nil { + toSerialize["createdBy"] = o.CreatedBy + } + + if o.CreatedByUserId != nil { + toSerialize["createdByUserId"] = o.CreatedByUserId + } + + if o.LastModifiedDate != nil { + toSerialize["lastModifiedDate"] = o.LastModifiedDate + } + + if o.LastModifiedBy != nil { + toSerialize["lastModifiedBy"] = o.LastModifiedBy + } + + if o.LastModifiedByUserId != nil { + toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId + } + + if o.ResourceURN != nil { + toSerialize["resourceURN"] = o.ResourceURN + } + + if o.Status != nil { + toSerialize["status"] = o.Status + } + + if o.StatusMessage != nil { + toSerialize["statusMessage"] = o.StatusMessage + } + + if o.Administrative != nil { + toSerialize["administrative"] = o.Administrative + } + + return json.Marshal(toSerialize) +} + +type NullableMetadataWithStatus struct { + value *MetadataWithStatus + isSet bool +} + +func (v NullableMetadataWithStatus) Get() *MetadataWithStatus { + return v.value +} + +func (v *NullableMetadataWithStatus) Set(val *MetadataWithStatus) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataWithStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataWithStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataWithStatus(val *MetadataWithStatus) *NullableMetadataWithStatus { + return &NullableMetadataWithStatus{value: val, isSet: true} +} + +func (v NullableMetadataWithStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataWithStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_status_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_status_all_of.go new file mode 100644 index 000000000..11bffc82e --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_status_all_of.go @@ -0,0 +1,212 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// MetadataWithStatusAllOf struct for MetadataWithStatusAllOf +type MetadataWithStatusAllOf struct { + // The status of the object. The status can be: * `AVAILABLE` - resource exists and is healthy. * `PROVISIONING` - resource is being created or updated. * `DESTROYING` - delete command was issued, the resource is being deleted. * `FAILED` - resource failed, details in `failureMessage`. + Status *string `json:"status"` + // The message of the failure if the status is `FAILED`. + StatusMessage *string `json:"statusMessage,omitempty"` + // Indicates if the key is an administrative key. Administrative keys can create buckets and set bucket policies. + Administrative *bool `json:"administrative,omitempty"` +} + +// NewMetadataWithStatusAllOf instantiates a new MetadataWithStatusAllOf 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 NewMetadataWithStatusAllOf(status string) *MetadataWithStatusAllOf { + this := MetadataWithStatusAllOf{} + + this.Status = &status + + return &this +} + +// NewMetadataWithStatusAllOfWithDefaults instantiates a new MetadataWithStatusAllOf 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 NewMetadataWithStatusAllOfWithDefaults() *MetadataWithStatusAllOf { + this := MetadataWithStatusAllOf{} + return &this +} + +// GetStatus returns the Status field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithStatusAllOf) GetStatus() *string { + if o == nil { + return nil + } + + return o.Status + +} + +// GetStatusOk returns a tuple with the Status 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 *MetadataWithStatusAllOf) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Status, true +} + +// SetStatus sets field value +func (o *MetadataWithStatusAllOf) SetStatus(v string) { + + o.Status = &v + +} + +// HasStatus returns a boolean if a field has been set. +func (o *MetadataWithStatusAllOf) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// GetStatusMessage returns the StatusMessage field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithStatusAllOf) GetStatusMessage() *string { + if o == nil { + return nil + } + + return o.StatusMessage + +} + +// GetStatusMessageOk returns a tuple with the StatusMessage 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 *MetadataWithStatusAllOf) GetStatusMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.StatusMessage, true +} + +// SetStatusMessage sets field value +func (o *MetadataWithStatusAllOf) SetStatusMessage(v string) { + + o.StatusMessage = &v + +} + +// HasStatusMessage returns a boolean if a field has been set. +func (o *MetadataWithStatusAllOf) HasStatusMessage() bool { + if o != nil && o.StatusMessage != nil { + return true + } + + return false +} + +// GetAdministrative returns the Administrative field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *MetadataWithStatusAllOf) GetAdministrative() *bool { + if o == nil { + return nil + } + + return o.Administrative + +} + +// GetAdministrativeOk returns a tuple with the Administrative 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 *MetadataWithStatusAllOf) GetAdministrativeOk() (*bool, bool) { + if o == nil { + return nil, false + } + + return o.Administrative, true +} + +// SetAdministrative sets field value +func (o *MetadataWithStatusAllOf) SetAdministrative(v bool) { + + o.Administrative = &v + +} + +// HasAdministrative returns a boolean if a field has been set. +func (o *MetadataWithStatusAllOf) HasAdministrative() bool { + if o != nil && o.Administrative != nil { + return true + } + + return false +} + +func (o MetadataWithStatusAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Status != nil { + toSerialize["status"] = o.Status + } + + if o.StatusMessage != nil { + toSerialize["statusMessage"] = o.StatusMessage + } + + if o.Administrative != nil { + toSerialize["administrative"] = o.Administrative + } + + return json.Marshal(toSerialize) +} + +type NullableMetadataWithStatusAllOf struct { + value *MetadataWithStatusAllOf + isSet bool +} + +func (v NullableMetadataWithStatusAllOf) Get() *MetadataWithStatusAllOf { + return v.value +} + +func (v *NullableMetadataWithStatusAllOf) Set(val *MetadataWithStatusAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataWithStatusAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataWithStatusAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataWithStatusAllOf(val *MetadataWithStatusAllOf) *NullableMetadataWithStatusAllOf { + return &NullableMetadataWithStatusAllOf{value: val, isSet: true} +} + +func (v NullableMetadataWithStatusAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataWithStatusAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_supported_regions.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_supported_regions.go new file mode 100644 index 000000000..e4705448d --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_supported_regions.go @@ -0,0 +1,580 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" + "time" +) + +// MetadataWithSupportedRegions struct for MetadataWithSupportedRegions +type MetadataWithSupportedRegions struct { + // The ISO 8601 creation timestamp. + CreatedDate *IonosTime `json:"createdDate,omitempty"` + // Unique name of the identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // Unique id of the identity that created the resource. + CreatedByUserId *string `json:"createdByUserId,omitempty"` + // The ISO 8601 modified timestamp. + LastModifiedDate *IonosTime `json:"lastModifiedDate,omitempty"` + // Unique name of the identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // Unique id of the identity that last modified the resource. + LastModifiedByUserId *string `json:"lastModifiedByUserId,omitempty"` + // Unique name of the resource. + ResourceURN *string `json:"resourceURN,omitempty"` + // The status of the object. The status can be: * `AVAILABLE` - resource exists and is healthy. * `PROVISIONING` - resource is being created or updated. * `DESTROYING` - delete command was issued, the resource is being deleted. * `FAILED` - resource failed, details in `failureMessage`. + Status *string `json:"status"` + // The message of the failure if the status is `FAILED`. + StatusMessage *string `json:"statusMessage,omitempty"` + // Indicates if the key is an administrative key. Administrative keys can create buckets and set bucket policies. + Administrative *bool `json:"administrative,omitempty"` + // The list of supported regions. + SupportedRegions *[]string `json:"supportedRegions"` +} + +// NewMetadataWithSupportedRegions instantiates a new MetadataWithSupportedRegions 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 NewMetadataWithSupportedRegions(status string, supportedRegions []string) *MetadataWithSupportedRegions { + this := MetadataWithSupportedRegions{} + + this.Status = &status + this.SupportedRegions = &supportedRegions + + return &this +} + +// NewMetadataWithSupportedRegionsWithDefaults instantiates a new MetadataWithSupportedRegions 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 NewMetadataWithSupportedRegionsWithDefaults() *MetadataWithSupportedRegions { + this := MetadataWithSupportedRegions{} + return &this +} + +// GetCreatedDate returns the CreatedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *MetadataWithSupportedRegions) GetCreatedDate() *time.Time { + if o == nil { + return nil + } + + if o.CreatedDate == nil { + return nil + } + return &o.CreatedDate.Time + +} + +// GetCreatedDateOk returns a tuple with the CreatedDate 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 *MetadataWithSupportedRegions) GetCreatedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.CreatedDate == nil { + return nil, false + } + return &o.CreatedDate.Time, true + +} + +// SetCreatedDate sets field value +func (o *MetadataWithSupportedRegions) SetCreatedDate(v time.Time) { + + o.CreatedDate = &IonosTime{v} + +} + +// HasCreatedDate returns a boolean if a field has been set. +func (o *MetadataWithSupportedRegions) HasCreatedDate() bool { + if o != nil && o.CreatedDate != nil { + return true + } + + return false +} + +// GetCreatedBy returns the CreatedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithSupportedRegions) GetCreatedBy() *string { + if o == nil { + return nil + } + + return o.CreatedBy + +} + +// GetCreatedByOk returns a tuple with the CreatedBy 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 *MetadataWithSupportedRegions) GetCreatedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedBy, true +} + +// SetCreatedBy sets field value +func (o *MetadataWithSupportedRegions) SetCreatedBy(v string) { + + o.CreatedBy = &v + +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *MetadataWithSupportedRegions) HasCreatedBy() bool { + if o != nil && o.CreatedBy != nil { + return true + } + + return false +} + +// GetCreatedByUserId returns the CreatedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithSupportedRegions) GetCreatedByUserId() *string { + if o == nil { + return nil + } + + return o.CreatedByUserId + +} + +// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId 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 *MetadataWithSupportedRegions) GetCreatedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CreatedByUserId, true +} + +// SetCreatedByUserId sets field value +func (o *MetadataWithSupportedRegions) SetCreatedByUserId(v string) { + + o.CreatedByUserId = &v + +} + +// HasCreatedByUserId returns a boolean if a field has been set. +func (o *MetadataWithSupportedRegions) HasCreatedByUserId() bool { + if o != nil && o.CreatedByUserId != nil { + return true + } + + return false +} + +// GetLastModifiedDate returns the LastModifiedDate field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *MetadataWithSupportedRegions) GetLastModifiedDate() *time.Time { + if o == nil { + return nil + } + + if o.LastModifiedDate == nil { + return nil + } + return &o.LastModifiedDate.Time + +} + +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate 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 *MetadataWithSupportedRegions) GetLastModifiedDateOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + + if o.LastModifiedDate == nil { + return nil, false + } + return &o.LastModifiedDate.Time, true + +} + +// SetLastModifiedDate sets field value +func (o *MetadataWithSupportedRegions) SetLastModifiedDate(v time.Time) { + + o.LastModifiedDate = &IonosTime{v} + +} + +// HasLastModifiedDate returns a boolean if a field has been set. +func (o *MetadataWithSupportedRegions) HasLastModifiedDate() bool { + if o != nil && o.LastModifiedDate != nil { + return true + } + + return false +} + +// GetLastModifiedBy returns the LastModifiedBy field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithSupportedRegions) GetLastModifiedBy() *string { + if o == nil { + return nil + } + + return o.LastModifiedBy + +} + +// GetLastModifiedByOk returns a tuple with the LastModifiedBy 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 *MetadataWithSupportedRegions) GetLastModifiedByOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedBy, true +} + +// SetLastModifiedBy sets field value +func (o *MetadataWithSupportedRegions) SetLastModifiedBy(v string) { + + o.LastModifiedBy = &v + +} + +// HasLastModifiedBy returns a boolean if a field has been set. +func (o *MetadataWithSupportedRegions) HasLastModifiedBy() bool { + if o != nil && o.LastModifiedBy != nil { + return true + } + + return false +} + +// GetLastModifiedByUserId returns the LastModifiedByUserId field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithSupportedRegions) GetLastModifiedByUserId() *string { + if o == nil { + return nil + } + + return o.LastModifiedByUserId + +} + +// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId 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 *MetadataWithSupportedRegions) GetLastModifiedByUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.LastModifiedByUserId, true +} + +// SetLastModifiedByUserId sets field value +func (o *MetadataWithSupportedRegions) SetLastModifiedByUserId(v string) { + + o.LastModifiedByUserId = &v + +} + +// HasLastModifiedByUserId returns a boolean if a field has been set. +func (o *MetadataWithSupportedRegions) HasLastModifiedByUserId() bool { + if o != nil && o.LastModifiedByUserId != nil { + return true + } + + return false +} + +// GetResourceURN returns the ResourceURN field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithSupportedRegions) GetResourceURN() *string { + if o == nil { + return nil + } + + return o.ResourceURN + +} + +// GetResourceURNOk returns a tuple with the ResourceURN 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 *MetadataWithSupportedRegions) GetResourceURNOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.ResourceURN, true +} + +// SetResourceURN sets field value +func (o *MetadataWithSupportedRegions) SetResourceURN(v string) { + + o.ResourceURN = &v + +} + +// HasResourceURN returns a boolean if a field has been set. +func (o *MetadataWithSupportedRegions) HasResourceURN() bool { + if o != nil && o.ResourceURN != nil { + return true + } + + return false +} + +// GetStatus returns the Status field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithSupportedRegions) GetStatus() *string { + if o == nil { + return nil + } + + return o.Status + +} + +// GetStatusOk returns a tuple with the Status 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 *MetadataWithSupportedRegions) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Status, true +} + +// SetStatus sets field value +func (o *MetadataWithSupportedRegions) SetStatus(v string) { + + o.Status = &v + +} + +// HasStatus returns a boolean if a field has been set. +func (o *MetadataWithSupportedRegions) HasStatus() bool { + if o != nil && o.Status != nil { + return true + } + + return false +} + +// GetStatusMessage returns the StatusMessage field value +// If the value is explicit nil, the zero value for string will be returned +func (o *MetadataWithSupportedRegions) GetStatusMessage() *string { + if o == nil { + return nil + } + + return o.StatusMessage + +} + +// GetStatusMessageOk returns a tuple with the StatusMessage 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 *MetadataWithSupportedRegions) GetStatusMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.StatusMessage, true +} + +// SetStatusMessage sets field value +func (o *MetadataWithSupportedRegions) SetStatusMessage(v string) { + + o.StatusMessage = &v + +} + +// HasStatusMessage returns a boolean if a field has been set. +func (o *MetadataWithSupportedRegions) HasStatusMessage() bool { + if o != nil && o.StatusMessage != nil { + return true + } + + return false +} + +// GetAdministrative returns the Administrative field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *MetadataWithSupportedRegions) GetAdministrative() *bool { + if o == nil { + return nil + } + + return o.Administrative + +} + +// GetAdministrativeOk returns a tuple with the Administrative 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 *MetadataWithSupportedRegions) GetAdministrativeOk() (*bool, bool) { + if o == nil { + return nil, false + } + + return o.Administrative, true +} + +// SetAdministrative sets field value +func (o *MetadataWithSupportedRegions) SetAdministrative(v bool) { + + o.Administrative = &v + +} + +// HasAdministrative returns a boolean if a field has been set. +func (o *MetadataWithSupportedRegions) HasAdministrative() bool { + if o != nil && o.Administrative != nil { + return true + } + + return false +} + +// GetSupportedRegions returns the SupportedRegions field value +// If the value is explicit nil, the zero value for []string will be returned +func (o *MetadataWithSupportedRegions) GetSupportedRegions() *[]string { + if o == nil { + return nil + } + + return o.SupportedRegions + +} + +// GetSupportedRegionsOk returns a tuple with the SupportedRegions 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 *MetadataWithSupportedRegions) GetSupportedRegionsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + + return o.SupportedRegions, true +} + +// SetSupportedRegions sets field value +func (o *MetadataWithSupportedRegions) SetSupportedRegions(v []string) { + + o.SupportedRegions = &v + +} + +// HasSupportedRegions returns a boolean if a field has been set. +func (o *MetadataWithSupportedRegions) HasSupportedRegions() bool { + if o != nil && o.SupportedRegions != nil { + return true + } + + return false +} + +func (o MetadataWithSupportedRegions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.CreatedDate != nil { + toSerialize["createdDate"] = o.CreatedDate + } + + if o.CreatedBy != nil { + toSerialize["createdBy"] = o.CreatedBy + } + + if o.CreatedByUserId != nil { + toSerialize["createdByUserId"] = o.CreatedByUserId + } + + if o.LastModifiedDate != nil { + toSerialize["lastModifiedDate"] = o.LastModifiedDate + } + + if o.LastModifiedBy != nil { + toSerialize["lastModifiedBy"] = o.LastModifiedBy + } + + if o.LastModifiedByUserId != nil { + toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId + } + + if o.ResourceURN != nil { + toSerialize["resourceURN"] = o.ResourceURN + } + + if o.Status != nil { + toSerialize["status"] = o.Status + } + + if o.StatusMessage != nil { + toSerialize["statusMessage"] = o.StatusMessage + } + + if o.Administrative != nil { + toSerialize["administrative"] = o.Administrative + } + + if o.SupportedRegions != nil { + toSerialize["supportedRegions"] = o.SupportedRegions + } + + return json.Marshal(toSerialize) +} + +type NullableMetadataWithSupportedRegions struct { + value *MetadataWithSupportedRegions + isSet bool +} + +func (v NullableMetadataWithSupportedRegions) Get() *MetadataWithSupportedRegions { + return v.value +} + +func (v *NullableMetadataWithSupportedRegions) Set(val *MetadataWithSupportedRegions) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataWithSupportedRegions) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataWithSupportedRegions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataWithSupportedRegions(val *MetadataWithSupportedRegions) *NullableMetadataWithSupportedRegions { + return &NullableMetadataWithSupportedRegions{value: val, isSet: true} +} + +func (v NullableMetadataWithSupportedRegions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataWithSupportedRegions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_supported_regions_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_supported_regions_all_of.go new file mode 100644 index 000000000..4577dd2d5 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_supported_regions_all_of.go @@ -0,0 +1,124 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// MetadataWithSupportedRegionsAllOf struct for MetadataWithSupportedRegionsAllOf +type MetadataWithSupportedRegionsAllOf struct { + // The list of supported regions. + SupportedRegions *[]string `json:"supportedRegions"` +} + +// NewMetadataWithSupportedRegionsAllOf instantiates a new MetadataWithSupportedRegionsAllOf 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 NewMetadataWithSupportedRegionsAllOf(supportedRegions []string) *MetadataWithSupportedRegionsAllOf { + this := MetadataWithSupportedRegionsAllOf{} + + this.SupportedRegions = &supportedRegions + + return &this +} + +// NewMetadataWithSupportedRegionsAllOfWithDefaults instantiates a new MetadataWithSupportedRegionsAllOf 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 NewMetadataWithSupportedRegionsAllOfWithDefaults() *MetadataWithSupportedRegionsAllOf { + this := MetadataWithSupportedRegionsAllOf{} + return &this +} + +// GetSupportedRegions returns the SupportedRegions field value +// If the value is explicit nil, the zero value for []string will be returned +func (o *MetadataWithSupportedRegionsAllOf) GetSupportedRegions() *[]string { + if o == nil { + return nil + } + + return o.SupportedRegions + +} + +// GetSupportedRegionsOk returns a tuple with the SupportedRegions 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 *MetadataWithSupportedRegionsAllOf) GetSupportedRegionsOk() (*[]string, bool) { + if o == nil { + return nil, false + } + + return o.SupportedRegions, true +} + +// SetSupportedRegions sets field value +func (o *MetadataWithSupportedRegionsAllOf) SetSupportedRegions(v []string) { + + o.SupportedRegions = &v + +} + +// HasSupportedRegions returns a boolean if a field has been set. +func (o *MetadataWithSupportedRegionsAllOf) HasSupportedRegions() bool { + if o != nil && o.SupportedRegions != nil { + return true + } + + return false +} + +func (o MetadataWithSupportedRegionsAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.SupportedRegions != nil { + toSerialize["supportedRegions"] = o.SupportedRegions + } + + return json.Marshal(toSerialize) +} + +type NullableMetadataWithSupportedRegionsAllOf struct { + value *MetadataWithSupportedRegionsAllOf + isSet bool +} + +func (v NullableMetadataWithSupportedRegionsAllOf) Get() *MetadataWithSupportedRegionsAllOf { + return v.value +} + +func (v *NullableMetadataWithSupportedRegionsAllOf) Set(val *MetadataWithSupportedRegionsAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableMetadataWithSupportedRegionsAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableMetadataWithSupportedRegionsAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMetadataWithSupportedRegionsAllOf(val *MetadataWithSupportedRegionsAllOf) *NullableMetadataWithSupportedRegionsAllOf { + return &NullableMetadataWithSupportedRegionsAllOf{value: val, isSet: true} +} + +func (v NullableMetadataWithSupportedRegionsAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMetadataWithSupportedRegionsAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_pagination.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_pagination.go new file mode 100644 index 000000000..12780cb7e --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_pagination.go @@ -0,0 +1,213 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// Pagination Pagination information. The offset and limit parameters are used to navigate the list of elements. The _links object contains URLs to navigate the different pages. +type Pagination struct { + // The offset specified in the request (if none was specified, the default offset is 0). + Offset *int32 `json:"offset"` + // The limit specified in the request (if none was specified, use the endpoint's default pagination limit). + Limit *int32 `json:"limit"` + Links *Links `json:"_links"` +} + +// 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(offset int32, limit int32, links Links) *Pagination { + this := Pagination{} + + this.Offset = &offset + this.Limit = &limit + this.Links = &links + + 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 +} + +// GetOffset returns the Offset field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *Pagination) GetOffset() *int32 { + if o == nil { + return nil + } + + return o.Offset + +} + +// GetOffsetOk returns a tuple with the Offset 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 *Pagination) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Offset, true +} + +// SetOffset sets field value +func (o *Pagination) SetOffset(v int32) { + + o.Offset = &v + +} + +// HasOffset returns a boolean if a field has been set. +func (o *Pagination) HasOffset() bool { + if o != nil && o.Offset != nil { + return true + } + + return false +} + +// GetLimit returns the Limit field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *Pagination) GetLimit() *int32 { + if o == nil { + return nil + } + + return o.Limit + +} + +// GetLimitOk returns a tuple with the Limit 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 *Pagination) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Limit, true +} + +// SetLimit sets field value +func (o *Pagination) SetLimit(v int32) { + + o.Limit = &v + +} + +// HasLimit returns a boolean if a field has been set. +func (o *Pagination) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// GetLinks returns the Links field value +// If the value is explicit nil, the zero value for Links will be returned +func (o *Pagination) GetLinks() *Links { + if o == nil { + return nil + } + + return o.Links + +} + +// GetLinksOk returns a tuple with the Links 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 *Pagination) GetLinksOk() (*Links, bool) { + if o == nil { + return nil, false + } + + return o.Links, true +} + +// SetLinks sets field value +func (o *Pagination) SetLinks(v Links) { + + o.Links = &v + +} + +// HasLinks returns a boolean if a field has been set. +func (o *Pagination) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +func (o Pagination) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Offset != nil { + toSerialize["offset"] = o.Offset + } + + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + if o.Links != nil { + toSerialize["_links"] = o.Links + } + + return json.Marshal(toSerialize) +} + +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/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region.go new file mode 100644 index 000000000..33919d4c0 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region.go @@ -0,0 +1,347 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// Region IONOS Cloud object storage regions they define the location of the bucket, can also be used as `LocationConstraint` for bucket creation. +type Region struct { + // The version of the region properties + Version *int32 `json:"version"` + // The endpoint URL for the region + Endpoint *string `json:"endpoint"` + // The website URL for the region + Website *string `json:"website"` + Capability *RegionCapability `json:"capability"` + // The available classes in the region + StorageClasses *[]string `json:"storageClasses,omitempty"` + // The data center location of the region as per [Get Location](/docs/cloud/v6/#tag/Locations/operation/locationsGet). *Can't be used as `LocationConstraint` on bucket creation.* + Location *string `json:"location"` +} + +// NewRegion instantiates a new Region 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 NewRegion(version int32, endpoint string, website string, capability RegionCapability, location string) *Region { + this := Region{} + + this.Version = &version + this.Endpoint = &endpoint + this.Website = &website + this.Capability = &capability + this.Location = &location + + return &this +} + +// NewRegionWithDefaults instantiates a new Region 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 NewRegionWithDefaults() *Region { + this := Region{} + return &this +} + +// GetVersion returns the Version field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *Region) GetVersion() *int32 { + if o == nil { + return nil + } + + return o.Version + +} + +// GetVersionOk returns a tuple with the Version 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 *Region) GetVersionOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Version, true +} + +// SetVersion sets field value +func (o *Region) SetVersion(v int32) { + + o.Version = &v + +} + +// HasVersion returns a boolean if a field has been set. +func (o *Region) HasVersion() bool { + if o != nil && o.Version != nil { + return true + } + + return false +} + +// GetEndpoint returns the Endpoint field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Region) GetEndpoint() *string { + if o == nil { + return nil + } + + return o.Endpoint + +} + +// GetEndpointOk returns a tuple with the Endpoint 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 *Region) GetEndpointOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Endpoint, true +} + +// SetEndpoint sets field value +func (o *Region) SetEndpoint(v string) { + + o.Endpoint = &v + +} + +// HasEndpoint returns a boolean if a field has been set. +func (o *Region) HasEndpoint() bool { + if o != nil && o.Endpoint != nil { + return true + } + + return false +} + +// GetWebsite returns the Website field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Region) GetWebsite() *string { + if o == nil { + return nil + } + + return o.Website + +} + +// GetWebsiteOk returns a tuple with the Website 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 *Region) GetWebsiteOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Website, true +} + +// SetWebsite sets field value +func (o *Region) SetWebsite(v string) { + + o.Website = &v + +} + +// HasWebsite returns a boolean if a field has been set. +func (o *Region) HasWebsite() bool { + if o != nil && o.Website != nil { + return true + } + + return false +} + +// GetCapability returns the Capability field value +// If the value is explicit nil, the zero value for RegionCapability will be returned +func (o *Region) GetCapability() *RegionCapability { + if o == nil { + return nil + } + + return o.Capability + +} + +// GetCapabilityOk returns a tuple with the Capability 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 *Region) GetCapabilityOk() (*RegionCapability, bool) { + if o == nil { + return nil, false + } + + return o.Capability, true +} + +// SetCapability sets field value +func (o *Region) SetCapability(v RegionCapability) { + + o.Capability = &v + +} + +// HasCapability returns a boolean if a field has been set. +func (o *Region) HasCapability() bool { + if o != nil && o.Capability != nil { + return true + } + + return false +} + +// GetStorageClasses returns the StorageClasses field value +// If the value is explicit nil, the zero value for []string will be returned +func (o *Region) GetStorageClasses() *[]string { + if o == nil { + return nil + } + + return o.StorageClasses + +} + +// GetStorageClassesOk returns a tuple with the StorageClasses 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 *Region) GetStorageClassesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + + return o.StorageClasses, true +} + +// SetStorageClasses sets field value +func (o *Region) SetStorageClasses(v []string) { + + o.StorageClasses = &v + +} + +// HasStorageClasses returns a boolean if a field has been set. +func (o *Region) HasStorageClasses() bool { + if o != nil && o.StorageClasses != nil { + return true + } + + return false +} + +// GetLocation returns the Location field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Region) GetLocation() *string { + if o == nil { + return nil + } + + return o.Location + +} + +// GetLocationOk returns a tuple with the Location 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 *Region) GetLocationOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Location, true +} + +// SetLocation sets field value +func (o *Region) SetLocation(v string) { + + o.Location = &v + +} + +// HasLocation returns a boolean if a field has been set. +func (o *Region) HasLocation() bool { + if o != nil && o.Location != nil { + return true + } + + return false +} + +func (o Region) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Version != nil { + toSerialize["version"] = o.Version + } + + if o.Endpoint != nil { + toSerialize["endpoint"] = o.Endpoint + } + + if o.Website != nil { + toSerialize["website"] = o.Website + } + + if o.Capability != nil { + toSerialize["capability"] = o.Capability + } + + if o.StorageClasses != nil { + toSerialize["storageClasses"] = o.StorageClasses + } + + if o.Location != nil { + toSerialize["location"] = o.Location + } + + return json.Marshal(toSerialize) +} + +type NullableRegion struct { + value *Region + isSet bool +} + +func (v NullableRegion) Get() *Region { + return v.value +} + +func (v *NullableRegion) Set(val *Region) { + v.value = val + v.isSet = true +} + +func (v NullableRegion) IsSet() bool { + return v.isSet +} + +func (v *NullableRegion) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegion(val *Region) *NullableRegion { + return &NullableRegion{value: val, isSet: true} +} + +func (v NullableRegion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegion) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_capability.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_capability.go new file mode 100644 index 000000000..fbe6f17c3 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_capability.go @@ -0,0 +1,166 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// RegionCapability The capabilities of the region +type RegionCapability struct { + // Indicates if IAM policy based access is supported + Iam *bool `json:"iam,omitempty"` + // Indicates if S3 Select is supported + S3select *bool `json:"s3select,omitempty"` +} + +// NewRegionCapability instantiates a new RegionCapability 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 NewRegionCapability() *RegionCapability { + this := RegionCapability{} + + return &this +} + +// NewRegionCapabilityWithDefaults instantiates a new RegionCapability 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 NewRegionCapabilityWithDefaults() *RegionCapability { + this := RegionCapability{} + return &this +} + +// GetIam returns the Iam field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *RegionCapability) GetIam() *bool { + if o == nil { + return nil + } + + return o.Iam + +} + +// GetIamOk returns a tuple with the Iam 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 *RegionCapability) GetIamOk() (*bool, bool) { + if o == nil { + return nil, false + } + + return o.Iam, true +} + +// SetIam sets field value +func (o *RegionCapability) SetIam(v bool) { + + o.Iam = &v + +} + +// HasIam returns a boolean if a field has been set. +func (o *RegionCapability) HasIam() bool { + if o != nil && o.Iam != nil { + return true + } + + return false +} + +// GetS3select returns the S3select field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *RegionCapability) GetS3select() *bool { + if o == nil { + return nil + } + + return o.S3select + +} + +// GetS3selectOk returns a tuple with the S3select 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 *RegionCapability) GetS3selectOk() (*bool, bool) { + if o == nil { + return nil, false + } + + return o.S3select, true +} + +// SetS3select sets field value +func (o *RegionCapability) SetS3select(v bool) { + + o.S3select = &v + +} + +// HasS3select returns a boolean if a field has been set. +func (o *RegionCapability) HasS3select() bool { + if o != nil && o.S3select != nil { + return true + } + + return false +} + +func (o RegionCapability) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Iam != nil { + toSerialize["iam"] = o.Iam + } + + if o.S3select != nil { + toSerialize["s3select"] = o.S3select + } + + return json.Marshal(toSerialize) +} + +type NullableRegionCapability struct { + value *RegionCapability + isSet bool +} + +func (v NullableRegionCapability) Get() *RegionCapability { + return v.value +} + +func (v *NullableRegionCapability) Set(val *RegionCapability) { + v.value = val + v.isSet = true +} + +func (v NullableRegionCapability) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionCapability) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionCapability(val *RegionCapability) *NullableRegionCapability { + return &NullableRegionCapability{value: val, isSet: true} +} + +func (v NullableRegionCapability) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionCapability) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_create.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_create.go new file mode 100644 index 000000000..8949b590d --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_create.go @@ -0,0 +1,167 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// RegionCreate struct for RegionCreate +type RegionCreate struct { + // Metadata + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Properties *Region `json:"properties"` +} + +// NewRegionCreate instantiates a new RegionCreate 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 NewRegionCreate(properties Region) *RegionCreate { + this := RegionCreate{} + + this.Properties = &properties + + return &this +} + +// NewRegionCreateWithDefaults instantiates a new RegionCreate 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 NewRegionCreateWithDefaults() *RegionCreate { + this := RegionCreate{} + return &this +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for map[string]interface{} will be returned +func (o *RegionCreate) GetMetadata() *map[string]interface{} { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata 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 *RegionCreate) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *RegionCreate) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *RegionCreate) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for Region will be returned +func (o *RegionCreate) GetProperties() *Region { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties 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 *RegionCreate) GetPropertiesOk() (*Region, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *RegionCreate) SetProperties(v Region) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *RegionCreate) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o RegionCreate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableRegionCreate struct { + value *RegionCreate + isSet bool +} + +func (v NullableRegionCreate) Get() *RegionCreate { + return v.value +} + +func (v *NullableRegionCreate) Set(val *RegionCreate) { + v.value = val + v.isSet = true +} + +func (v NullableRegionCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionCreate(val *RegionCreate) *NullableRegionCreate { + return &NullableRegionCreate{value: val, isSet: true} +} + +func (v NullableRegionCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_ensure.go new file mode 100644 index 000000000..e83934556 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_ensure.go @@ -0,0 +1,212 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// RegionEnsure struct for RegionEnsure +type RegionEnsure struct { + // The Region of the Region. + Id *string `json:"id"` + // Metadata + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Properties *Region `json:"properties"` +} + +// NewRegionEnsure instantiates a new RegionEnsure 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 NewRegionEnsure(id string, properties Region) *RegionEnsure { + this := RegionEnsure{} + + this.Id = &id + this.Properties = &properties + + return &this +} + +// NewRegionEnsureWithDefaults instantiates a new RegionEnsure 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 NewRegionEnsureWithDefaults() *RegionEnsure { + this := RegionEnsure{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RegionEnsure) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *RegionEnsure) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *RegionEnsure) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *RegionEnsure) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for map[string]interface{} will be returned +func (o *RegionEnsure) GetMetadata() *map[string]interface{} { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata 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 *RegionEnsure) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *RegionEnsure) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *RegionEnsure) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for Region will be returned +func (o *RegionEnsure) GetProperties() *Region { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties 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 *RegionEnsure) GetPropertiesOk() (*Region, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *RegionEnsure) SetProperties(v Region) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *RegionEnsure) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o RegionEnsure) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableRegionEnsure struct { + value *RegionEnsure + isSet bool +} + +func (v NullableRegionEnsure) Get() *RegionEnsure { + return v.value +} + +func (v *NullableRegionEnsure) Set(val *RegionEnsure) { + v.value = val + v.isSet = true +} + +func (v NullableRegionEnsure) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionEnsure) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionEnsure(val *RegionEnsure) *NullableRegionEnsure { + return &NullableRegionEnsure{value: val, isSet: true} +} + +func (v NullableRegionEnsure) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionEnsure) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read.go new file mode 100644 index 000000000..92f389dbc --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read.go @@ -0,0 +1,302 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// RegionRead struct for RegionRead +type RegionRead struct { + // The Region of the Region. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the Region. + Href *string `json:"href"` + Metadata *map[string]interface{} `json:"metadata"` + Properties *Region `json:"properties"` +} + +// NewRegionRead instantiates a new RegionRead 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 NewRegionRead(id string, type_ string, href string, metadata map[string]interface{}, properties Region) *RegionRead { + this := RegionRead{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Metadata = &metadata + this.Properties = &properties + + return &this +} + +// NewRegionReadWithDefaults instantiates a new RegionRead 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 NewRegionReadWithDefaults() *RegionRead { + this := RegionRead{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RegionRead) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *RegionRead) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *RegionRead) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *RegionRead) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RegionRead) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type 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 *RegionRead) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *RegionRead) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *RegionRead) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RegionRead) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href 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 *RegionRead) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *RegionRead) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *RegionRead) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for map[string]interface{} will be returned +func (o *RegionRead) GetMetadata() *map[string]interface{} { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata 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 *RegionRead) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *RegionRead) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *RegionRead) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for Region will be returned +func (o *RegionRead) GetProperties() *Region { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties 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 *RegionRead) GetPropertiesOk() (*Region, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *RegionRead) SetProperties(v Region) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *RegionRead) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o RegionRead) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableRegionRead struct { + value *RegionRead + isSet bool +} + +func (v NullableRegionRead) Get() *RegionRead { + return v.value +} + +func (v *NullableRegionRead) Set(val *RegionRead) { + v.value = val + v.isSet = true +} + +func (v NullableRegionRead) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionRead) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionRead(val *RegionRead) *NullableRegionRead { + return &NullableRegionRead{value: val, isSet: true} +} + +func (v NullableRegionRead) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionRead) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read_list.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read_list.go new file mode 100644 index 000000000..7e78cf2ee --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read_list.go @@ -0,0 +1,392 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// RegionReadList struct for RegionReadList +type RegionReadList struct { + // ID of the list of Region resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of Region resources. + Href *string `json:"href"` + // The list of Region resources. + Items *[]RegionRead `json:"items,omitempty"` + // The offset specified in the request (if none was specified, the default offset is 0). + Offset *int32 `json:"offset"` + // The limit specified in the request (if none was specified, use the endpoint's default pagination limit). + Limit *int32 `json:"limit"` + Links *Links `json:"_links"` +} + +// NewRegionReadList instantiates a new RegionReadList 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 NewRegionReadList(id string, type_ string, href string, offset int32, limit int32, links Links) *RegionReadList { + this := RegionReadList{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Offset = &offset + this.Limit = &limit + this.Links = &links + + return &this +} + +// NewRegionReadListWithDefaults instantiates a new RegionReadList 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 NewRegionReadListWithDefaults() *RegionReadList { + this := RegionReadList{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RegionReadList) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *RegionReadList) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *RegionReadList) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *RegionReadList) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RegionReadList) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type 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 *RegionReadList) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *RegionReadList) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *RegionReadList) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RegionReadList) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href 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 *RegionReadList) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *RegionReadList) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *RegionReadList) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []RegionRead will be returned +func (o *RegionReadList) GetItems() *[]RegionRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items 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 *RegionReadList) GetItemsOk() (*[]RegionRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *RegionReadList) SetItems(v []RegionRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *RegionReadList) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +// GetOffset returns the Offset field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *RegionReadList) GetOffset() *int32 { + if o == nil { + return nil + } + + return o.Offset + +} + +// GetOffsetOk returns a tuple with the Offset 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 *RegionReadList) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Offset, true +} + +// SetOffset sets field value +func (o *RegionReadList) SetOffset(v int32) { + + o.Offset = &v + +} + +// HasOffset returns a boolean if a field has been set. +func (o *RegionReadList) HasOffset() bool { + if o != nil && o.Offset != nil { + return true + } + + return false +} + +// GetLimit returns the Limit field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *RegionReadList) GetLimit() *int32 { + if o == nil { + return nil + } + + return o.Limit + +} + +// GetLimitOk returns a tuple with the Limit 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 *RegionReadList) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Limit, true +} + +// SetLimit sets field value +func (o *RegionReadList) SetLimit(v int32) { + + o.Limit = &v + +} + +// HasLimit returns a boolean if a field has been set. +func (o *RegionReadList) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// GetLinks returns the Links field value +// If the value is explicit nil, the zero value for Links will be returned +func (o *RegionReadList) GetLinks() *Links { + if o == nil { + return nil + } + + return o.Links + +} + +// GetLinksOk returns a tuple with the Links 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 *RegionReadList) GetLinksOk() (*Links, bool) { + if o == nil { + return nil, false + } + + return o.Links, true +} + +// SetLinks sets field value +func (o *RegionReadList) SetLinks(v Links) { + + o.Links = &v + +} + +// HasLinks returns a boolean if a field has been set. +func (o *RegionReadList) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +func (o RegionReadList) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + if o.Offset != nil { + toSerialize["offset"] = o.Offset + } + + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + if o.Links != nil { + toSerialize["_links"] = o.Links + } + + return json.Marshal(toSerialize) +} + +type NullableRegionReadList struct { + value *RegionReadList + isSet bool +} + +func (v NullableRegionReadList) Get() *RegionReadList { + return v.value +} + +func (v *NullableRegionReadList) Set(val *RegionReadList) { + v.value = val + v.isSet = true +} + +func (v NullableRegionReadList) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionReadList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionReadList(val *RegionReadList) *NullableRegionReadList { + return &NullableRegionReadList{value: val, isSet: true} +} + +func (v NullableRegionReadList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionReadList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read_list_all_of.go new file mode 100644 index 000000000..7d632de6e --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read_list_all_of.go @@ -0,0 +1,258 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// RegionReadListAllOf struct for RegionReadListAllOf +type RegionReadListAllOf struct { + // ID of the list of Region resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of Region resources. + Href *string `json:"href"` + // The list of Region resources. + Items *[]RegionRead `json:"items,omitempty"` +} + +// NewRegionReadListAllOf instantiates a new RegionReadListAllOf 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 NewRegionReadListAllOf(id string, type_ string, href string) *RegionReadListAllOf { + this := RegionReadListAllOf{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + + return &this +} + +// NewRegionReadListAllOfWithDefaults instantiates a new RegionReadListAllOf 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 NewRegionReadListAllOfWithDefaults() *RegionReadListAllOf { + this := RegionReadListAllOf{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RegionReadListAllOf) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *RegionReadListAllOf) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *RegionReadListAllOf) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *RegionReadListAllOf) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RegionReadListAllOf) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type 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 *RegionReadListAllOf) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *RegionReadListAllOf) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *RegionReadListAllOf) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RegionReadListAllOf) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href 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 *RegionReadListAllOf) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *RegionReadListAllOf) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *RegionReadListAllOf) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []RegionRead will be returned +func (o *RegionReadListAllOf) GetItems() *[]RegionRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items 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 *RegionReadListAllOf) GetItemsOk() (*[]RegionRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *RegionReadListAllOf) SetItems(v []RegionRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *RegionReadListAllOf) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +func (o RegionReadListAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableRegionReadListAllOf struct { + value *RegionReadListAllOf + isSet bool +} + +func (v NullableRegionReadListAllOf) Get() *RegionReadListAllOf { + return v.value +} + +func (v *NullableRegionReadListAllOf) Set(val *RegionReadListAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableRegionReadListAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionReadListAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionReadListAllOf(val *RegionReadListAllOf) *NullableRegionReadListAllOf { + return &NullableRegionReadListAllOf{value: val, isSet: true} +} + +func (v NullableRegionReadListAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionReadListAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class.go new file mode 100644 index 000000000..f4426a652 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class.go @@ -0,0 +1,214 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// StorageClass Details the cross functional aspects of the given storage class. +type StorageClass struct { + // Explains the motivation for the storage class + Description *string `json:"description"` + // The durability of the storage class + Durability *string `json:"durability"` + // The availability of the storage class + Availability *string `json:"availability"` +} + +// NewStorageClass instantiates a new StorageClass 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 NewStorageClass(description string, durability string, availability string) *StorageClass { + this := StorageClass{} + + this.Description = &description + this.Durability = &durability + this.Availability = &availability + + return &this +} + +// NewStorageClassWithDefaults instantiates a new StorageClass 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 NewStorageClassWithDefaults() *StorageClass { + this := StorageClass{} + return &this +} + +// GetDescription returns the Description field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClass) GetDescription() *string { + if o == nil { + return nil + } + + return o.Description + +} + +// GetDescriptionOk returns a tuple with the Description 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 *StorageClass) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Description, true +} + +// SetDescription sets field value +func (o *StorageClass) SetDescription(v string) { + + o.Description = &v + +} + +// HasDescription returns a boolean if a field has been set. +func (o *StorageClass) HasDescription() bool { + if o != nil && o.Description != nil { + return true + } + + return false +} + +// GetDurability returns the Durability field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClass) GetDurability() *string { + if o == nil { + return nil + } + + return o.Durability + +} + +// GetDurabilityOk returns a tuple with the Durability 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 *StorageClass) GetDurabilityOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Durability, true +} + +// SetDurability sets field value +func (o *StorageClass) SetDurability(v string) { + + o.Durability = &v + +} + +// HasDurability returns a boolean if a field has been set. +func (o *StorageClass) HasDurability() bool { + if o != nil && o.Durability != nil { + return true + } + + return false +} + +// GetAvailability returns the Availability field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClass) GetAvailability() *string { + if o == nil { + return nil + } + + return o.Availability + +} + +// GetAvailabilityOk returns a tuple with the Availability 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 *StorageClass) GetAvailabilityOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Availability, true +} + +// SetAvailability sets field value +func (o *StorageClass) SetAvailability(v string) { + + o.Availability = &v + +} + +// HasAvailability returns a boolean if a field has been set. +func (o *StorageClass) HasAvailability() bool { + if o != nil && o.Availability != nil { + return true + } + + return false +} + +func (o StorageClass) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Description != nil { + toSerialize["description"] = o.Description + } + + if o.Durability != nil { + toSerialize["durability"] = o.Durability + } + + if o.Availability != nil { + toSerialize["availability"] = o.Availability + } + + return json.Marshal(toSerialize) +} + +type NullableStorageClass struct { + value *StorageClass + isSet bool +} + +func (v NullableStorageClass) Get() *StorageClass { + return v.value +} + +func (v *NullableStorageClass) Set(val *StorageClass) { + v.value = val + v.isSet = true +} + +func (v NullableStorageClass) IsSet() bool { + return v.isSet +} + +func (v *NullableStorageClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStorageClass(val *StorageClass) *NullableStorageClass { + return &NullableStorageClass{value: val, isSet: true} +} + +func (v NullableStorageClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStorageClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_create.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_create.go new file mode 100644 index 000000000..99d2add7f --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_create.go @@ -0,0 +1,167 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// StorageClassCreate struct for StorageClassCreate +type StorageClassCreate struct { + // Metadata + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Properties *StorageClass `json:"properties"` +} + +// NewStorageClassCreate instantiates a new StorageClassCreate 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 NewStorageClassCreate(properties StorageClass) *StorageClassCreate { + this := StorageClassCreate{} + + this.Properties = &properties + + return &this +} + +// NewStorageClassCreateWithDefaults instantiates a new StorageClassCreate 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 NewStorageClassCreateWithDefaults() *StorageClassCreate { + this := StorageClassCreate{} + return &this +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for map[string]interface{} will be returned +func (o *StorageClassCreate) GetMetadata() *map[string]interface{} { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata 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 *StorageClassCreate) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *StorageClassCreate) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *StorageClassCreate) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for StorageClass will be returned +func (o *StorageClassCreate) GetProperties() *StorageClass { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties 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 *StorageClassCreate) GetPropertiesOk() (*StorageClass, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *StorageClassCreate) SetProperties(v StorageClass) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *StorageClassCreate) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o StorageClassCreate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableStorageClassCreate struct { + value *StorageClassCreate + isSet bool +} + +func (v NullableStorageClassCreate) Get() *StorageClassCreate { + return v.value +} + +func (v *NullableStorageClassCreate) Set(val *StorageClassCreate) { + v.value = val + v.isSet = true +} + +func (v NullableStorageClassCreate) IsSet() bool { + return v.isSet +} + +func (v *NullableStorageClassCreate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStorageClassCreate(val *StorageClassCreate) *NullableStorageClassCreate { + return &NullableStorageClassCreate{value: val, isSet: true} +} + +func (v NullableStorageClassCreate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStorageClassCreate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_ensure.go new file mode 100644 index 000000000..682b882db --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_ensure.go @@ -0,0 +1,212 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// StorageClassEnsure struct for StorageClassEnsure +type StorageClassEnsure struct { + // The StorageClass of the StorageClass. + Id *string `json:"id"` + // Metadata + Metadata *map[string]interface{} `json:"metadata,omitempty"` + Properties *StorageClass `json:"properties"` +} + +// NewStorageClassEnsure instantiates a new StorageClassEnsure 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 NewStorageClassEnsure(id string, properties StorageClass) *StorageClassEnsure { + this := StorageClassEnsure{} + + this.Id = &id + this.Properties = &properties + + return &this +} + +// NewStorageClassEnsureWithDefaults instantiates a new StorageClassEnsure 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 NewStorageClassEnsureWithDefaults() *StorageClassEnsure { + this := StorageClassEnsure{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClassEnsure) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *StorageClassEnsure) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *StorageClassEnsure) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *StorageClassEnsure) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for map[string]interface{} will be returned +func (o *StorageClassEnsure) GetMetadata() *map[string]interface{} { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata 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 *StorageClassEnsure) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *StorageClassEnsure) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *StorageClassEnsure) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for StorageClass will be returned +func (o *StorageClassEnsure) GetProperties() *StorageClass { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties 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 *StorageClassEnsure) GetPropertiesOk() (*StorageClass, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *StorageClassEnsure) SetProperties(v StorageClass) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *StorageClassEnsure) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o StorageClassEnsure) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableStorageClassEnsure struct { + value *StorageClassEnsure + isSet bool +} + +func (v NullableStorageClassEnsure) Get() *StorageClassEnsure { + return v.value +} + +func (v *NullableStorageClassEnsure) Set(val *StorageClassEnsure) { + v.value = val + v.isSet = true +} + +func (v NullableStorageClassEnsure) IsSet() bool { + return v.isSet +} + +func (v *NullableStorageClassEnsure) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStorageClassEnsure(val *StorageClassEnsure) *NullableStorageClassEnsure { + return &NullableStorageClassEnsure{value: val, isSet: true} +} + +func (v NullableStorageClassEnsure) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStorageClassEnsure) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read.go new file mode 100644 index 000000000..38497bb79 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read.go @@ -0,0 +1,302 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// StorageClassRead struct for StorageClassRead +type StorageClassRead struct { + // The StorageClass of the StorageClass. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the StorageClass. + Href *string `json:"href"` + Metadata *map[string]interface{} `json:"metadata"` + Properties *StorageClass `json:"properties"` +} + +// NewStorageClassRead instantiates a new StorageClassRead 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 NewStorageClassRead(id string, type_ string, href string, metadata map[string]interface{}, properties StorageClass) *StorageClassRead { + this := StorageClassRead{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Metadata = &metadata + this.Properties = &properties + + return &this +} + +// NewStorageClassReadWithDefaults instantiates a new StorageClassRead 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 NewStorageClassReadWithDefaults() *StorageClassRead { + this := StorageClassRead{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClassRead) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *StorageClassRead) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *StorageClassRead) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *StorageClassRead) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClassRead) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type 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 *StorageClassRead) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *StorageClassRead) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *StorageClassRead) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClassRead) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href 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 *StorageClassRead) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *StorageClassRead) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *StorageClassRead) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetMetadata returns the Metadata field value +// If the value is explicit nil, the zero value for map[string]interface{} will be returned +func (o *StorageClassRead) GetMetadata() *map[string]interface{} { + if o == nil { + return nil + } + + return o.Metadata + +} + +// GetMetadataOk returns a tuple with the Metadata 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 *StorageClassRead) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *StorageClassRead) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *StorageClassRead) HasMetadata() bool { + if o != nil && o.Metadata != nil { + return true + } + + return false +} + +// GetProperties returns the Properties field value +// If the value is explicit nil, the zero value for StorageClass will be returned +func (o *StorageClassRead) GetProperties() *StorageClass { + if o == nil { + return nil + } + + return o.Properties + +} + +// GetPropertiesOk returns a tuple with the Properties 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 *StorageClassRead) GetPropertiesOk() (*StorageClass, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *StorageClassRead) SetProperties(v StorageClass) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *StorageClassRead) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o StorageClassRead) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + + if o.Properties != nil { + toSerialize["properties"] = o.Properties + } + + return json.Marshal(toSerialize) +} + +type NullableStorageClassRead struct { + value *StorageClassRead + isSet bool +} + +func (v NullableStorageClassRead) Get() *StorageClassRead { + return v.value +} + +func (v *NullableStorageClassRead) Set(val *StorageClassRead) { + v.value = val + v.isSet = true +} + +func (v NullableStorageClassRead) IsSet() bool { + return v.isSet +} + +func (v *NullableStorageClassRead) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStorageClassRead(val *StorageClassRead) *NullableStorageClassRead { + return &NullableStorageClassRead{value: val, isSet: true} +} + +func (v NullableStorageClassRead) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStorageClassRead) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read_list.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read_list.go new file mode 100644 index 000000000..9a655f16c --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read_list.go @@ -0,0 +1,392 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// StorageClassReadList struct for StorageClassReadList +type StorageClassReadList struct { + // ID of the list of StorageClass resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of StorageClass resources. + Href *string `json:"href"` + // The list of StorageClass resources. + Items *[]StorageClassRead `json:"items,omitempty"` + // The offset specified in the request (if none was specified, the default offset is 0). + Offset *int32 `json:"offset"` + // The limit specified in the request (if none was specified, use the endpoint's default pagination limit). + Limit *int32 `json:"limit"` + Links *Links `json:"_links"` +} + +// NewStorageClassReadList instantiates a new StorageClassReadList 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 NewStorageClassReadList(id string, type_ string, href string, offset int32, limit int32, links Links) *StorageClassReadList { + this := StorageClassReadList{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Offset = &offset + this.Limit = &limit + this.Links = &links + + return &this +} + +// NewStorageClassReadListWithDefaults instantiates a new StorageClassReadList 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 NewStorageClassReadListWithDefaults() *StorageClassReadList { + this := StorageClassReadList{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClassReadList) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *StorageClassReadList) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *StorageClassReadList) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *StorageClassReadList) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClassReadList) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type 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 *StorageClassReadList) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *StorageClassReadList) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *StorageClassReadList) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClassReadList) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href 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 *StorageClassReadList) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *StorageClassReadList) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *StorageClassReadList) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []StorageClassRead will be returned +func (o *StorageClassReadList) GetItems() *[]StorageClassRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items 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 *StorageClassReadList) GetItemsOk() (*[]StorageClassRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *StorageClassReadList) SetItems(v []StorageClassRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *StorageClassReadList) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +// GetOffset returns the Offset field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *StorageClassReadList) GetOffset() *int32 { + if o == nil { + return nil + } + + return o.Offset + +} + +// GetOffsetOk returns a tuple with the Offset 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 *StorageClassReadList) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Offset, true +} + +// SetOffset sets field value +func (o *StorageClassReadList) SetOffset(v int32) { + + o.Offset = &v + +} + +// HasOffset returns a boolean if a field has been set. +func (o *StorageClassReadList) HasOffset() bool { + if o != nil && o.Offset != nil { + return true + } + + return false +} + +// GetLimit returns the Limit field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *StorageClassReadList) GetLimit() *int32 { + if o == nil { + return nil + } + + return o.Limit + +} + +// GetLimitOk returns a tuple with the Limit 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 *StorageClassReadList) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Limit, true +} + +// SetLimit sets field value +func (o *StorageClassReadList) SetLimit(v int32) { + + o.Limit = &v + +} + +// HasLimit returns a boolean if a field has been set. +func (o *StorageClassReadList) HasLimit() bool { + if o != nil && o.Limit != nil { + return true + } + + return false +} + +// GetLinks returns the Links field value +// If the value is explicit nil, the zero value for Links will be returned +func (o *StorageClassReadList) GetLinks() *Links { + if o == nil { + return nil + } + + return o.Links + +} + +// GetLinksOk returns a tuple with the Links 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 *StorageClassReadList) GetLinksOk() (*Links, bool) { + if o == nil { + return nil, false + } + + return o.Links, true +} + +// SetLinks sets field value +func (o *StorageClassReadList) SetLinks(v Links) { + + o.Links = &v + +} + +// HasLinks returns a boolean if a field has been set. +func (o *StorageClassReadList) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +func (o StorageClassReadList) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + if o.Offset != nil { + toSerialize["offset"] = o.Offset + } + + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + + if o.Links != nil { + toSerialize["_links"] = o.Links + } + + return json.Marshal(toSerialize) +} + +type NullableStorageClassReadList struct { + value *StorageClassReadList + isSet bool +} + +func (v NullableStorageClassReadList) Get() *StorageClassReadList { + return v.value +} + +func (v *NullableStorageClassReadList) Set(val *StorageClassReadList) { + v.value = val + v.isSet = true +} + +func (v NullableStorageClassReadList) IsSet() bool { + return v.isSet +} + +func (v *NullableStorageClassReadList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStorageClassReadList(val *StorageClassReadList) *NullableStorageClassReadList { + return &NullableStorageClassReadList{value: val, isSet: true} +} + +func (v NullableStorageClassReadList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStorageClassReadList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read_list_all_of.go new file mode 100644 index 000000000..b5699ad49 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read_list_all_of.go @@ -0,0 +1,258 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// StorageClassReadListAllOf struct for StorageClassReadListAllOf +type StorageClassReadListAllOf struct { + // ID of the list of StorageClass resources. + Id *string `json:"id"` + // The type of the resource. + Type *string `json:"type"` + // The URL of the list of StorageClass resources. + Href *string `json:"href"` + // The list of StorageClass resources. + Items *[]StorageClassRead `json:"items,omitempty"` +} + +// NewStorageClassReadListAllOf instantiates a new StorageClassReadListAllOf 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 NewStorageClassReadListAllOf(id string, type_ string, href string) *StorageClassReadListAllOf { + this := StorageClassReadListAllOf{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + + return &this +} + +// NewStorageClassReadListAllOfWithDefaults instantiates a new StorageClassReadListAllOf 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 NewStorageClassReadListAllOfWithDefaults() *StorageClassReadListAllOf { + this := StorageClassReadListAllOf{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClassReadListAllOf) GetId() *string { + if o == nil { + return nil + } + + return o.Id + +} + +// GetIdOk returns a tuple with the Id 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 *StorageClassReadListAllOf) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *StorageClassReadListAllOf) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *StorageClassReadListAllOf) HasId() bool { + if o != nil && o.Id != nil { + return true + } + + return false +} + +// GetType returns the Type field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClassReadListAllOf) GetType() *string { + if o == nil { + return nil + } + + return o.Type + +} + +// GetTypeOk returns a tuple with the Type 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 *StorageClassReadListAllOf) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *StorageClassReadListAllOf) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *StorageClassReadListAllOf) HasType() bool { + if o != nil && o.Type != nil { + return true + } + + return false +} + +// GetHref returns the Href field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClassReadListAllOf) GetHref() *string { + if o == nil { + return nil + } + + return o.Href + +} + +// GetHrefOk returns a tuple with the Href 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 *StorageClassReadListAllOf) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *StorageClassReadListAllOf) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *StorageClassReadListAllOf) HasHref() bool { + if o != nil && o.Href != nil { + return true + } + + return false +} + +// GetItems returns the Items field value +// If the value is explicit nil, the zero value for []StorageClassRead will be returned +func (o *StorageClassReadListAllOf) GetItems() *[]StorageClassRead { + if o == nil { + return nil + } + + return o.Items + +} + +// GetItemsOk returns a tuple with the Items 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 *StorageClassReadListAllOf) GetItemsOk() (*[]StorageClassRead, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *StorageClassReadListAllOf) SetItems(v []StorageClassRead) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *StorageClassReadListAllOf) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +func (o StorageClassReadListAllOf) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.Id != nil { + toSerialize["id"] = o.Id + } + + if o.Type != nil { + toSerialize["type"] = o.Type + } + + if o.Href != nil { + toSerialize["href"] = o.Href + } + + if o.Items != nil { + toSerialize["items"] = o.Items + } + + return json.Marshal(toSerialize) +} + +type NullableStorageClassReadListAllOf struct { + value *StorageClassReadListAllOf + isSet bool +} + +func (v NullableStorageClassReadListAllOf) Get() *StorageClassReadListAllOf { + return v.value +} + +func (v *NullableStorageClassReadListAllOf) Set(val *StorageClassReadListAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableStorageClassReadListAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableStorageClassReadListAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStorageClassReadListAllOf(val *StorageClassReadListAllOf) *NullableStorageClassReadListAllOf { + return &NullableStorageClassReadListAllOf{value: val, isSet: true} +} + +func (v NullableStorageClassReadListAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStorageClassReadListAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/response.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/response.go new file mode 100644 index 000000000..715454726 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/response.go @@ -0,0 +1,73 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "log" + "net/http" + "time" +) + +// 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"` + // RequestTime is the time duration from the moment the APIClient sends + // the HTTP request to the moment it receives an HTTP response. + RequestTime time.Duration `json:"duration,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 +} + +// HttpNotFound - returns true if a 404 status code was returned +// returns false for nil APIResponse values +func (resp *APIResponse) HttpNotFound() bool { + if resp != nil && resp.Response != nil && resp.StatusCode == http.StatusNotFound { + return true + } + return false +} + +// LogInfo - logs APIResponse values like RequestTime, Operation and StatusCode +// does not print anything for nil APIResponse values +func (resp *APIResponse) LogInfo() { + if resp != nil { + log.Printf("[DEBUG] Request time : %s for operation : %s", + resp.RequestTime, resp.Operation) + if resp.Response != nil { + log.Printf("[DEBUG] response status code : %d\n", resp.StatusCode) + } + } +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/utils.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/utils.go new file mode 100644 index 000000000..1e090d8a0 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/utils.go @@ -0,0 +1,776 @@ +/* + * IONOS Cloud - Object Storage Management API + * + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. + * + * API version: 0.1.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" + "reflect" + "time" +) + +// ToPtr - returns a pointer to the given value. +func ToPtr[T any](v T) *T { + return &v +} + +// ToValue - returns the value of the pointer passed in +func ToValue[T any](ptr *T) T { + return *ptr +} + +// ToValueDefault - returns the value of the pointer passed in, or the default type value if the pointer is nil +func ToValueDefault[T any](ptr *T) T { + var defaultVal T + if ptr == nil { + return defaultVal + } + return *ptr +} + +func SliceToValueDefault[T any](ptrSlice *[]T) []T { + return append([]T{}, *ptrSlice...) +} + +// PtrBool - returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt - returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 - returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 - returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 - returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 - returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString - returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime - returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +// ToBool - returns the value of the bool pointer passed in +func ToBool(ptr *bool) bool { + return *ptr +} + +// ToBoolDefault - returns the value of the bool pointer passed in, or false if the pointer is nil +func ToBoolDefault(ptr *bool) bool { + var defaultVal bool + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToBoolSlice - returns a bool slice of the pointer passed in +func ToBoolSlice(ptrSlice *[]bool) []bool { + valSlice := make([]bool, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToByte - returns the value of the byte pointer passed in +func ToByte(ptr *byte) byte { + return *ptr +} + +// ToByteDefault - returns the value of the byte pointer passed in, or 0 if the pointer is nil +func ToByteDefault(ptr *byte) byte { + var defaultVal byte + if ptr == nil { + return defaultVal + } + + return *ptr +} + +// ToByteSlice - returns a byte slice of the pointer passed in +func ToByteSlice(ptrSlice *[]byte) []byte { + valSlice := make([]byte, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToString - returns the value of the string pointer passed in +func ToString(ptr *string) string { + return *ptr +} + +// ToStringDefault - returns the value of the string pointer passed in, or "" if the pointer is nil +func ToStringDefault(ptr *string) string { + var defaultVal string + if ptr == nil { + return defaultVal + } + + return *ptr +} + +// ToStringSlice - returns a string slice of the pointer passed in +func ToStringSlice(ptrSlice *[]string) []string { + valSlice := make([]string, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToInt - returns the value of the int pointer passed in +func ToInt(ptr *int) int { + return *ptr +} + +// ToIntDefault - returns the value of the int pointer passed in, or 0 if the pointer is nil +func ToIntDefault(ptr *int) int { + var defaultVal int + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToIntSlice - returns a int slice of the pointer passed in +func ToIntSlice(ptrSlice *[]int) []int { + valSlice := make([]int, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToInt8 - returns the value of the int8 pointer passed in +func ToInt8(ptr *int8) int8 { + return *ptr +} + +// ToInt8Default - returns the value of the int8 pointer passed in, or 0 if the pointer is nil +func ToInt8Default(ptr *int8) int8 { + var defaultVal int8 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToInt8Slice - returns a int8 slice of the pointer passed in +func ToInt8Slice(ptrSlice *[]int8) []int8 { + valSlice := make([]int8, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToInt16 - returns the value of the int16 pointer passed in +func ToInt16(ptr *int16) int16 { + return *ptr +} + +// ToInt16Default - returns the value of the int16 pointer passed in, or 0 if the pointer is nil +func ToInt16Default(ptr *int16) int16 { + var defaultVal int16 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToInt16Slice - returns a int16 slice of the pointer passed in +func ToInt16Slice(ptrSlice *[]int16) []int16 { + valSlice := make([]int16, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToInt32 - returns the value of the int32 pointer passed in +func ToInt32(ptr *int32) int32 { + return *ptr +} + +// ToInt32Default - returns the value of the int32 pointer passed in, or 0 if the pointer is nil +func ToInt32Default(ptr *int32) int32 { + var defaultVal int32 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToInt32Slice - returns a int32 slice of the pointer passed in +func ToInt32Slice(ptrSlice *[]int32) []int32 { + valSlice := make([]int32, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToInt64 - returns the value of the int64 pointer passed in +func ToInt64(ptr *int64) int64 { + return *ptr +} + +// ToInt64Default - returns the value of the int64 pointer passed in, or 0 if the pointer is nil +func ToInt64Default(ptr *int64) int64 { + var defaultVal int64 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToInt64Slice - returns a int64 slice of the pointer passed in +func ToInt64Slice(ptrSlice *[]int64) []int64 { + valSlice := make([]int64, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToUint - returns the value of the uint pointer passed in +func ToUint(ptr *uint) uint { + return *ptr +} + +// ToUintDefault - returns the value of the uint pointer passed in, or 0 if the pointer is nil +func ToUintDefault(ptr *uint) uint { + var defaultVal uint + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToUintSlice - returns a uint slice of the pointer passed in +func ToUintSlice(ptrSlice *[]uint) []uint { + valSlice := make([]uint, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToUint8 -returns the value of the uint8 pointer passed in +func ToUint8(ptr *uint8) uint8 { + return *ptr +} + +// ToUint8Default - returns the value of the uint8 pointer passed in, or 0 if the pointer is nil +func ToUint8Default(ptr *uint8) uint8 { + var defaultVal uint8 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToUint8Slice - returns a uint8 slice of the pointer passed in +func ToUint8Slice(ptrSlice *[]uint8) []uint8 { + valSlice := make([]uint8, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToUint16 - returns the value of the uint16 pointer passed in +func ToUint16(ptr *uint16) uint16 { + return *ptr +} + +// ToUint16Default - returns the value of the uint16 pointer passed in, or 0 if the pointer is nil +func ToUint16Default(ptr *uint16) uint16 { + var defaultVal uint16 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToUint16Slice - returns a uint16 slice of the pointer passed in +func ToUint16Slice(ptrSlice *[]uint16) []uint16 { + valSlice := make([]uint16, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToUint32 - returns the value of the uint32 pointer passed in +func ToUint32(ptr *uint32) uint32 { + return *ptr +} + +// ToUint32Default - returns the value of the uint32 pointer passed in, or 0 if the pointer is nil +func ToUint32Default(ptr *uint32) uint32 { + var defaultVal uint32 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToUint32Slice - returns a uint32 slice of the pointer passed in +func ToUint32Slice(ptrSlice *[]uint32) []uint32 { + valSlice := make([]uint32, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToUint64 - returns the value of the uint64 pointer passed in +func ToUint64(ptr *uint64) uint64 { + return *ptr +} + +// ToUint64Default - returns the value of the uint64 pointer passed in, or 0 if the pointer is nil +func ToUint64Default(ptr *uint64) uint64 { + var defaultVal uint64 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToUint64Slice - returns a uint63 slice of the pointer passed in +func ToUint64Slice(ptrSlice *[]uint64) []uint64 { + valSlice := make([]uint64, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToFloat32 - returns the value of the float32 pointer passed in +func ToFloat32(ptr *float32) float32 { + return *ptr +} + +// ToFloat32Default - returns the value of the float32 pointer passed in, or 0 if the pointer is nil +func ToFloat32Default(ptr *float32) float32 { + var defaultVal float32 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToFloat32Slice - returns a float32 slice of the pointer passed in +func ToFloat32Slice(ptrSlice *[]float32) []float32 { + valSlice := make([]float32, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToFloat64 - returns the value of the float64 pointer passed in +func ToFloat64(ptr *float64) float64 { + return *ptr +} + +// ToFloat64Default - returns the value of the float64 pointer passed in, or 0 if the pointer is nil +func ToFloat64Default(ptr *float64) float64 { + var defaultVal float64 + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToFloat64Slice - returns a float64 slice of the pointer passed in +func ToFloat64Slice(ptrSlice *[]float64) []float64 { + valSlice := make([]float64, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +// ToTime - returns the value of the Time pointer passed in +func ToTime(ptr *time.Time) time.Time { + return *ptr +} + +// ToTimeDefault - returns the value of the Time pointer passed in, or 0001-01-01 00:00:00 +0000 UTC if the pointer is nil +func ToTimeDefault(ptr *time.Time) time.Time { + var defaultVal time.Time + if ptr == nil { + return defaultVal + } + return *ptr +} + +// ToTimeSlice - returns a Time slice of the pointer passed in +func ToTimeSlice(ptrSlice *[]time.Time) []time.Time { + valSlice := make([]time.Time, len(*ptrSlice)) + for i, v := range *ptrSlice { + valSlice[i] = v + } + + return valSlice +} + +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 v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type IonosTime struct { + time.Time +} + +func (t *IonosTime) UnmarshalJSON(data []byte) error { + str := string(data) + if strlen(str) == 0 { + t = nil + return nil + } + if str[0] == '"' { + str = str[1:] + } + if str[len(str)-1] == '"' { + str = str[:len(str)-1] + } + tt, err := time.Parse(time.RFC3339, str) + if err != nil { + return err + } + *t = IonosTime{tt} + return nil +} + +// 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 +} diff --git a/vendor/modules.txt b/vendor/modules.txt index e3cf6c5b3..de5e474fe 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -355,6 +355,9 @@ github.com/ionos-cloud/sdk-go-nfs # github.com/ionos-cloud/sdk-go-object-storage v1.1.0 ## explicit; go 1.18 github.com/ionos-cloud/sdk-go-object-storage +# github.com/ionos-cloud/sdk-go-object-storage-management v1.0.0 +## explicit; go 1.18 +github.com/ionos-cloud/sdk-go-object-storage-management # github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.1 ## explicit; go 1.18 github.com/ionos-cloud/sdk-go-vm-autoscaling