From a79edeef34111ac3edef44f002981af29a807367 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Tue, 17 Sep 2024 16:21:32 +0300 Subject: [PATCH 01/30] feat: added accessKeys resource --- .../s3-management/resource_accesskey.go | 264 ++++++++++++++++++ services/s3management/accesskeys.go | 94 +++++++ services/s3management/client.go | 40 +++ services/s3management/regions.go | 19 ++ 4 files changed, 417 insertions(+) create mode 100644 internal/framework/services/s3-management/resource_accesskey.go create mode 100644 services/s3management/accesskeys.go create mode 100644 services/s3management/client.go create mode 100644 services/s3management/regions.go diff --git a/internal/framework/services/s3-management/resource_accesskey.go b/internal/framework/services/s3-management/resource_accesskey.go new file mode 100644 index 000000000..2b1ef2ef1 --- /dev/null +++ b/internal/framework/services/s3-management/resource_accesskey.go @@ -0,0 +1,264 @@ +package s3 + +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" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + + s3management "github.com/ionos-cloud/sdk-go-s3-management" + s3managementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" + "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 *s3managementService.Client +} + +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"` +} + +// Metadata returns the metadata for the bucket resource. +func (r *accesskeyResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_s3_accesskey" +} + +// Schema returns the schema for the bucket 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, + }, + "access_key": schema.StringAttribute{ + Description: "Access key metadata is a string of 92 characters.", + Computed: true, + }, + "secret_key": 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 bucket resource. +func (r *accesskeyResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*s3managementService.Client) + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *s3.APIClient, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client +} + +// Create creates the bucket. +func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + if r.client == nil { + resp.Diagnostics.AddError("s3 api client not configured", "The provider client is not configured") + return + } + + var data *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 = s3management.AccessKeyCreate{ + Properties: &s3management.AccessKeyProperties{ + 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 + } + + data.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 + } + + data.AccessKey = basetypes.NewStringPointerValue(accessKeyRead.Properties.AccessKey) + data.CanonicalUserId = basetypes.NewStringPointerValue(accessKeyRead.Properties.CanonicalUserId) + data.ContractUserId = basetypes.NewStringPointerValue(accessKeyRead.Properties.ContractUserId) + data.Description = basetypes.NewStringPointerValue(accessKeyRead.Properties.Description) + data.SecretKey = basetypes.NewStringPointerValue(accessKeyRead.Properties.SecretKey) + data.ID = basetypes.NewStringPointerValue(accessKeyRead.Id) + + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} + +// Read reads the bucket. +func (r *accesskeyResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + if r.client == nil { + resp.Diagnostics.AddError("s3 api client not configured", "The provider client is not configured") + return + } + + var data accesskeyResourceModel + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + if resp.Diagnostics.HasError() { + return + } + + accessKey, _, err := r.client.GetAccessKey(ctx, data.ID.String()) + if err != nil { + resp.Diagnostics.AddError("Access Key API error", err.Error()) + return + } + + data.AccessKey = basetypes.NewStringPointerValue(accessKey.Properties.AccessKey) + data.CanonicalUserId = basetypes.NewStringPointerValue(accessKey.Properties.CanonicalUserId) + data.ContractUserId = basetypes.NewStringPointerValue(accessKey.Properties.ContractUserId) + data.Description = basetypes.NewStringPointerValue(accessKey.Properties.Description) + data.SecretKey = basetypes.NewStringPointerValue(accessKey.Properties.SecretKey) + data.ID = basetypes.NewStringPointerValue(accessKey.Id) + + 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 bucket. +func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + var plan, state *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 + } + + var data *accesskeyResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + if resp.Diagnostics.HasError() { + return + } + + updateTimeout, diags := data.Timeouts.Update(ctx, utils.DefaultTimeout) + resp.Diagnostics.Append(diags...) + ctx, cancel := context.WithTimeout(ctx, updateTimeout) + defer cancel() + + var accessKey = s3management.AccessKeyEnsure{ + Properties: &s3management.AccessKeyProperties{ + Description: data.Description.ValueStringPointer(), + }, + } + accessKeyResponse, _, err := r.client.UpdateAccessKey(ctx, data.ID.String(), accessKey, updateTimeout) + if err != nil { + resp.Diagnostics.AddError("failed to update accessKey", err.Error()) + return + } + + data.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 + } + + data.AccessKey = basetypes.NewStringPointerValue(accessKeyRead.Properties.AccessKey) + data.CanonicalUserId = basetypes.NewStringPointerValue(accessKeyRead.Properties.CanonicalUserId) + data.ContractUserId = basetypes.NewStringPointerValue(accessKeyRead.Properties.ContractUserId) + data.Description = basetypes.NewStringPointerValue(accessKeyRead.Properties.Description) + data.SecretKey = basetypes.NewStringPointerValue(accessKeyRead.Properties.SecretKey) + data.ID = basetypes.NewStringPointerValue(accessKeyRead.Id) + + plan.ID = state.ID + resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) +} + +// Delete deletes the accessKey. +func (r *accesskeyResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + if r.client == nil { + resp.Diagnostics.AddError("s3 api client not configured", "The provider client is not configured") + return + } + + var data *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.String(), deleteTimeout); err != nil { + resp.Diagnostics.AddError("failed to delete bucket", err.Error()) + return + } +} diff --git a/services/s3management/accesskeys.go b/services/s3management/accesskeys.go new file mode 100644 index 000000000..eb9f5c452 --- /dev/null +++ b/services/s3management/accesskeys.go @@ -0,0 +1,94 @@ +package s3management + +import ( + "context" + "fmt" + "time" + + "github.com/cenkalti/backoff/v4" + s3management "github.com/ionos-cloud/sdk-go-s3-management" +) + +func (c *Client) GetAccessKey(ctx context.Context, accessKeyId string) (s3management.AccessKey, *s3management.APIResponse, error) { + accessKey, apiResponse, err := c.client.AccesskeysApi.AccesskeysFindById(ctx, accessKeyId).Execute() + apiResponse.LogInfo() + return accessKey, apiResponse, err +} + +func (c *Client) ListAccessKeys(ctx context.Context) (s3management.AccessKeyList, *s3management.APIResponse, error) { + accessKeys, apiResponse, err := c.client.AccesskeysApi.AccesskeysGet(ctx).Execute() + apiResponse.LogInfo() + return accessKeys, apiResponse, err +} + +func (c *Client) CreateAccessKey(ctx context.Context, accessKey s3management.AccessKeyCreate, timeout time.Duration) (s3management.AccessKey, *s3management.APIResponse, error) { + accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPost(ctx).AccessKeyCreate(accessKey).Execute() + apiResponse.LogInfo() + + 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 +} + +func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyId string, accessKey s3management.AccessKeyEnsure, timeout time.Duration) (s3management.AccessKey, *s3management.APIResponse, error) { + accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPut(ctx, accessKeyId).AccessKeyEnsure(accessKey).Execute() + apiResponse.LogInfo() + + 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 +} + +func (c *Client) DeleteAccessKey(ctx context.Context, accessKeyId string, timeout time.Duration) (*s3management.APIResponse, error) { + apiResponse, err := c.client.AccesskeysApi.AccesskeysDelete(ctx, accessKeyId).Execute() + apiResponse.LogInfo() + + 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 +} + +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/s3management/client.go b/services/s3management/client.go new file mode 100644 index 000000000..5113a7df4 --- /dev/null +++ b/services/s3management/client.go @@ -0,0 +1,40 @@ +package s3management + +import ( + "fmt" + "net/http" + "os" + "runtime" + + "github.com/hashicorp/terraform-plugin-sdk/v2/meta" + s3management "github.com/ionos-cloud/sdk-go-s3-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 *s3management.APIClient +} + +// GetBaseClient returns the base client. +func (c *Client) GetBaseClient() *s3management.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) *Client { + newS3managementConfig := s3management.NewConfiguration(username, password, token, url) + + if os.Getenv(constant.IonosDebug) != "" { + newS3managementConfig.Debug = true + } + newS3managementConfig.MaxRetries = constant.MaxRetries + newS3managementConfig.MaxWaitTime = constant.MaxWaitTime + newS3managementConfig.HTTPClient = &http.Client{Transport: utils.CreateTransport()} + newS3managementConfig.UserAgent = fmt.Sprintf( + "terraform-provider/%s_ionos-cloud-sdk-go-s3-management/%s_hashicorp-terraform/%s_terraform-plugin-sdk/%s_os/%s_arch/%s", + version, s3management.Version, terraformVersion, meta.SDKVersionString(), runtime.GOOS, runtime.GOARCH) //nolint:staticcheck + + return &Client{client: s3management.NewAPIClient(newS3managementConfig)} +} diff --git a/services/s3management/regions.go b/services/s3management/regions.go new file mode 100644 index 000000000..7b981f8f4 --- /dev/null +++ b/services/s3management/regions.go @@ -0,0 +1,19 @@ +package s3management + +import ( + "context" + + s3management "github.com/ionos-cloud/sdk-go-s3-management" +) + +func (c *Client) GetRegion(ctx context.Context, regionId string, depth float32) (s3management.Region, *s3management.APIResponse, error) { + region, apiResponse, err := c.client.RegionsApi.RegionsFindByRegion(ctx, regionId).Execute() + apiResponse.LogInfo() + return region, apiResponse, err +} + +func (c *Client) ListRegions(ctx context.Context) (s3management.RegionList, *s3management.APIResponse, error) { + regions, apiResponse, err := c.client.RegionsApi.RegionsGet(ctx).Execute() + apiResponse.LogInfo() + return regions, apiResponse, err +} From d84c3c29addd9249195d60dbebb96ec5b9f4d97a Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Wed, 18 Sep 2024 18:12:16 +0300 Subject: [PATCH 02/30] fixed some plugin framework compatibilities --- internal/framework/provider/provider.go | 83 ++++++++++++++++++- .../resource_accesskey.go | 28 +++---- ionoscloud/provider.go | 8 +- services/clients.go | 4 + 4 files changed, 103 insertions(+), 20 deletions(-) rename internal/framework/services/{s3-management => s3management}/resource_accesskey.go (89%) diff --git a/internal/framework/provider/provider.go b/internal/framework/provider/provider.go index 4acdf1d17..e39050691 100644 --- a/internal/framework/provider/provider.go +++ b/internal/framework/provider/provider.go @@ -2,7 +2,10 @@ package provider import ( "context" + "fmt" + "net/http" "os" + "runtime" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/path" @@ -10,9 +13,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/s3" - s3service "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/internal/framework/services/s3management" + "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" + s3Service "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3" + s3managementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" + "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. @@ -120,6 +145,8 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu accessKey := os.Getenv("IONOS_S3_ACCESS_KEY") secretKey := os.Getenv("IONOS_S3_SECRET_KEY") region := os.Getenv("IONOS_S3_REGION") + endpoint := os.Getenv("IONOS_API_URL") + terraformVersion := "0.12+compatible" if !clientOpts.Token.IsNull() { token = clientOpts.Token.ValueString() @@ -145,6 +172,10 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu region = clientOpts.S3Region.ValueString() } + if !clientOpts.Endpoint.IsNull() { + endpoint = clientOpts.Endpoint.ValueString() + } + if token == "" && (username == "" || password == "") { resp.Diagnostics.AddError("missing credentials", "either token or username and password must be set") } @@ -153,7 +184,45 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu return } - client := s3service.NewClient(accessKey, secretKey, region) + cleanedEndpoint := cleanURL(endpoint) + version := "v6" + + 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()} + cloudapiClient := ionoscloud.NewAPIClient(newConfig) + + client := &services.SdkBundle{ + CDNClient: cdnService.NewCDNClient(username, password, token, endpoint, version, terraformVersion), + AutoscalingClient: autoscalingService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), + CertManagerClient: cert.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), + CloudApiClient: cloudapiClient, + ContainerClient: crService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), + DataplatformClient: dataplatformService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), + DNSClient: dnsService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), + LoggingClient: loggingService.NewClient(username, password, token, cleanedEndpoint, terraformVersion), + MariaDBClient: mariadb.NewMariaDBClient(username, password, token, cleanedEndpoint, version, terraformVersion), + MongoClient: dbaasService.NewMongoClient(username, password, token, cleanedEndpoint, version, terraformVersion), + NFSClient: nfsService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), + PsqlClient: dbaasService.NewPsqlClient(username, password, token, cleanedEndpoint, version, terraformVersion), + KafkaClient: kafkaService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), + APIGatewayClient: apiGatewayService.NewClient( + username, password, token, cleanedEndpoint, version, terraformVersion, + ), + VPNClient: vpn.NewClient(username, password, token, cleanedEndpoint, terraformVersion), + InMemoryDBClient: inmemorydb.NewInMemoryDBClient(username, password, token, cleanedEndpoint, version, terraformVersion), + S3Client: s3Service.NewClient(accessKey, secretKey, region), + S3ManagementClient: s3managementService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), + } + resp.DataSourceData = client resp.ResourceData = client } @@ -172,6 +241,7 @@ func (p *IonosCloudProvider) Resources(_ context.Context) []func() resource.Reso s3.NewBucketCorsConfigurationResource, s3.NewBucketLifecycleConfigurationResource, s3.NewBucketWebsiteConfigurationResource, + s3management.NewAccesskeyResource, } } @@ -184,3 +254,12 @@ func (p *IonosCloudProvider) DataSources(_ context.Context) []func() datasource. s3.NewObjectsDataSource, } } + +func cleanURL(url string) string { + length := len(url) + if length > 1 && url[length-1] == '/' { + url = url[:length-1] + } + + return url +} diff --git a/internal/framework/services/s3-management/resource_accesskey.go b/internal/framework/services/s3management/resource_accesskey.go similarity index 89% rename from internal/framework/services/s3-management/resource_accesskey.go rename to internal/framework/services/s3management/resource_accesskey.go index 2b1ef2ef1..ebbf0339f 100644 --- a/internal/framework/services/s3-management/resource_accesskey.go +++ b/internal/framework/services/s3management/resource_accesskey.go @@ -1,4 +1,4 @@ -package s3 +package s3management import ( "context" @@ -10,9 +10,9 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" s3management "github.com/ionos-cloud/sdk-go-s3-management" - s3managementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" ) @@ -27,12 +27,12 @@ func NewAccesskeyResource() resource.Resource { } type accesskeyResource struct { - client *s3managementService.Client + client *services.SdkBundle } type accesskeyResourceModel struct { - AccessKey types.String `tfsdk:"accessKey"` - SecretKey types.String `tfsdk:"secretKey"` + 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"` @@ -57,11 +57,11 @@ func (r *accesskeyResource) Schema(ctx context.Context, req resource.SchemaReque Description: "Description of the Access key.", Optional: true, }, - "access_key": schema.StringAttribute{ + "accesskey": schema.StringAttribute{ Description: "Access key metadata is a string of 92 characters.", Computed: true, }, - "secret_key": schema.StringAttribute{ + "secretkey": schema.StringAttribute{ Description: "The secret key of the Access key.", Computed: true, }, @@ -90,7 +90,7 @@ func (r *accesskeyResource) Configure(_ context.Context, req resource.ConfigureR return } - client, ok := req.ProviderData.(*s3managementService.Client) + client, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", @@ -126,7 +126,7 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque Description: data.Description.ValueStringPointer(), }, } - accessKeyResponse, _, err := r.client.CreateAccessKey(ctx, accessKey, createTimeout) + accessKeyResponse, _, err := r.client.S3ManagementClient.CreateAccessKey(ctx, accessKey, createTimeout) if err != nil { resp.Diagnostics.AddError("failed to create accessKey", err.Error()) return @@ -134,7 +134,7 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque data.ID = basetypes.NewStringPointerValue(accessKeyResponse.Id) - accessKeyRead, _, err := r.client.GetAccessKey(ctx, *accessKeyResponse.Id) + accessKeyRead, _, err := r.client.S3ManagementClient.GetAccessKey(ctx, *accessKeyResponse.Id) if err != nil { resp.Diagnostics.AddError("Access Key API error", err.Error()) return @@ -163,7 +163,7 @@ func (r *accesskeyResource) Read(ctx context.Context, req resource.ReadRequest, return } - accessKey, _, err := r.client.GetAccessKey(ctx, data.ID.String()) + accessKey, _, err := r.client.S3ManagementClient.GetAccessKey(ctx, data.ID.String()) if err != nil { resp.Diagnostics.AddError("Access Key API error", err.Error()) return @@ -211,7 +211,7 @@ func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateReque Description: data.Description.ValueStringPointer(), }, } - accessKeyResponse, _, err := r.client.UpdateAccessKey(ctx, data.ID.String(), accessKey, updateTimeout) + accessKeyResponse, _, err := r.client.S3ManagementClient.UpdateAccessKey(ctx, data.ID.String(), accessKey, updateTimeout) if err != nil { resp.Diagnostics.AddError("failed to update accessKey", err.Error()) return @@ -219,7 +219,7 @@ func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateReque data.ID = basetypes.NewStringPointerValue(accessKeyResponse.Id) - accessKeyRead, _, err := r.client.GetAccessKey(ctx, *accessKeyResponse.Id) + accessKeyRead, _, err := r.client.S3ManagementClient.GetAccessKey(ctx, *accessKeyResponse.Id) if err != nil { resp.Diagnostics.AddError("Access Key API error", err.Error()) return @@ -257,7 +257,7 @@ func (r *accesskeyResource) Delete(ctx context.Context, req resource.DeleteReque ctx, cancel := context.WithTimeout(ctx, deleteTimeout) defer cancel() - if _, err := r.client.DeleteAccessKey(ctx, data.ID.String(), deleteTimeout); err != nil { + if _, err := r.client.S3ManagementClient.DeleteAccessKey(ctx, data.ID.String(), deleteTimeout); err != nil { resp.Diagnostics.AddError("failed to delete bucket", err.Error()) return } diff --git a/ionoscloud/provider.go b/ionoscloud/provider.go index 6cb862887..fc6b5d978 100644 --- a/ionoscloud/provider.go +++ b/ionoscloud/provider.go @@ -382,19 +382,19 @@ func NewClientByType(clientOpts ClientOptions, clientType clientType) interface{ case nfsClient: return nfsService.NewClient(clientOpts.Username, clientOpts.Password, clientOpts.Token, clientOpts.Url, clientOpts.Version, clientOpts.TerraformVersion) case psqlClient: - return dbaasService.NewPsqlClient(clientOpts.Username, clientOpts.Password, clientOpts.Token, clientOpts.Url, clientOpts.Version, clientOpts.Username) + return dbaasService.NewPsqlClient(clientOpts.Username, clientOpts.Password, clientOpts.Token, clientOpts.Url, clientOpts.Version, clientOpts.TerraformVersion) case s3Client: return s3.NewAPIClient(s3.NewConfiguration()) case kafkaClient: - return kafkaService.NewClient(clientOpts.Username, clientOpts.Password, clientOpts.Token, clientOpts.Url, clientOpts.Version, clientOpts.Username) + return kafkaService.NewClient(clientOpts.Username, clientOpts.Password, clientOpts.Token, clientOpts.Url, clientOpts.Version, clientOpts.TerraformVersion) case apiGatewayClient: return apiGatewayService.NewClient( clientOpts.Username, clientOpts.Password, clientOpts.Token, clientOpts.Url, clientOpts.Version, clientOpts.TerraformVersion, ) case vpnClient: - return vpn.NewClient(clientOpts.Username, clientOpts.Password, clientOpts.Token, clientOpts.Url, clientOpts.Username) + return vpn.NewClient(clientOpts.Username, clientOpts.Password, clientOpts.Token, clientOpts.Url, clientOpts.TerraformVersion) case inMemoryDBClient: - return inmemorydb.NewInMemoryDBClient(clientOpts.Username, clientOpts.Password, clientOpts.Token, clientOpts.Url, clientOpts.Version, clientOpts.Username) + return inmemorydb.NewInMemoryDBClient(clientOpts.Username, clientOpts.Password, clientOpts.Token, clientOpts.Url, clientOpts.Version, clientOpts.TerraformVersion) default: log.Fatalf("[ERROR] unknown client type %d", clientType) } diff --git a/services/clients.go b/services/clients.go index f84227ef3..d52406b14 100644 --- a/services/clients.go +++ b/services/clients.go @@ -16,6 +16,8 @@ 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/s3" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/vpn" ) @@ -36,4 +38,6 @@ type SdkBundle struct { CDNClient *cdn.Client APIGatewayClient *apigateway.Client VPNClient *vpn.Client + S3Client *s3.Client + S3ManagementClient *s3management.Client } From 456d7ba83889b19cfd82b9a2d553280bcfdd2574 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Fri, 20 Sep 2024 18:19:53 +0300 Subject: [PATCH 03/30] feat: added data sources, some refactoring --- .../s3management/data_source_accesskey.go | 105 ++++++++++++++++++ .../s3management/data_source_region.go | 93 ++++++++++++++++ .../s3management/resource_accesskey.go | 55 +++------ services/s3management/accesskeys.go | 84 +++++++++++--- services/s3management/regions.go | 14 +++ 5 files changed, 293 insertions(+), 58 deletions(-) create mode 100644 internal/framework/services/s3management/data_source_accesskey.go create mode 100644 internal/framework/services/s3management/data_source_region.go diff --git a/internal/framework/services/s3management/data_source_accesskey.go b/internal/framework/services/s3management/data_source_accesskey.go new file mode 100644 index 000000000..6f6c9a9cc --- /dev/null +++ b/internal/framework/services/s3management/data_source_accesskey.go @@ -0,0 +1,105 @@ +package s3management + +import ( + "context" + "fmt" + + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +var _ datasource.DataSourceWithConfigure = (*accessKeyDataSource)(nil) + +// NewBucketDataSource creates a new data source for the accesskey resource. +func NewBucketDataSource() datasource.DataSource { + return &accessKeyDataSource{} +} + +type accessKeyDataSource struct { + client *services.SdkBundle +} + +// 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 + "_s3_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 + } + + client, ok := req.ProviderData.(*services.SdkBundle) + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *s3.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client +} + +// 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.", + }, + "description": schema.StringAttribute{ + Description: "Description of the Access key.", + Optional: true, + }, + "accesskey": schema.StringAttribute{ + 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("s3 api client not configured", "The provider client is not configured") + return + } + + var data *s3management.AccessKeyDataSourceModel + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + if resp.Diagnostics.HasError() { + return + } + + // result, found, err := d.client.GetAccessKeyForDataSource(ctx, data.Name) + // if err != nil { + // resp.Diagnostics.AddError("failed to get accesskey", err.Error()) + // return + // } + + if !found { + resp.Diagnostics.AddError("accesskey not found", "The accesskey was not found") + return + } + + data = result + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} diff --git a/internal/framework/services/s3management/data_source_region.go b/internal/framework/services/s3management/data_source_region.go new file mode 100644 index 000000000..b22e1dee9 --- /dev/null +++ b/internal/framework/services/s3management/data_source_region.go @@ -0,0 +1,93 @@ +package s3management + +import ( + "context" + "fmt" + + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" +) + +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 *services.SdkBundle +} + +// 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 + "_s3_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 + } + + client, ok := req.ProviderData.(*services.SdkBundle) + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *s3.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client +} + +// 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, + }, + "region": schema.StringAttribute{ + Description: "The location or region of the region", + 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("s3 api client not configured", "The provider client is not configured") + return + } + + var data *s3management.RegionDataSourceModel + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + if resp.Diagnostics.HasError() { + return + } + + result, apiResponse, err := d.client.S3ManagementClient.GetRegion(ctx, data.ID.String(), 1) + if err != nil { + resp.Diagnostics.AddError("failed to get region", err.Error()) + return + } + + if apiResponse.HttpNotFound() { + resp.Diagnostics.AddError("region not found", "The region was not found") + return + } + + data = result + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} diff --git a/internal/framework/services/s3management/resource_accesskey.go b/internal/framework/services/s3management/resource_accesskey.go index ebbf0339f..a1a3ade6f 100644 --- a/internal/framework/services/s3management/resource_accesskey.go +++ b/internal/framework/services/s3management/resource_accesskey.go @@ -8,12 +8,13 @@ import ( "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" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" s3management "github.com/ionos-cloud/sdk-go-s3-management" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" + + s3managementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" ) var ( @@ -30,16 +31,6 @@ type accesskeyResource struct { client *services.SdkBundle } -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"` -} - // Metadata returns the metadata for the bucket resource. func (r *accesskeyResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { resp.TypeName = req.ProviderTypeName + "_s3_accesskey" @@ -110,7 +101,7 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque return } - var data *accesskeyResourceModel + var data *s3managementService.AccesskeyResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) if resp.Diagnostics.HasError() { return @@ -132,21 +123,15 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque return } - data.ID = basetypes.NewStringPointerValue(accessKeyResponse.Id) + s3managementService.SetAccessKeyPropertiesToPlan(data, accessKeyResponse) - accessKeyRead, _, err := r.client.S3ManagementClient.GetAccessKey(ctx, *accessKeyResponse.Id) + accessKeyRead, _, err := r.client.S3ManagementClient.GetAccessKey(ctx, data.ID.String()) if err != nil { resp.Diagnostics.AddError("Access Key API error", err.Error()) return } - data.AccessKey = basetypes.NewStringPointerValue(accessKeyRead.Properties.AccessKey) - data.CanonicalUserId = basetypes.NewStringPointerValue(accessKeyRead.Properties.CanonicalUserId) - data.ContractUserId = basetypes.NewStringPointerValue(accessKeyRead.Properties.ContractUserId) - data.Description = basetypes.NewStringPointerValue(accessKeyRead.Properties.Description) - data.SecretKey = basetypes.NewStringPointerValue(accessKeyRead.Properties.SecretKey) - data.ID = basetypes.NewStringPointerValue(accessKeyRead.Id) - + s3managementService.SetAccessKeyPropertiesToPlan(data, accessKeyRead) resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } @@ -157,7 +142,7 @@ func (r *accesskeyResource) Read(ctx context.Context, req resource.ReadRequest, return } - var data accesskeyResourceModel + var data s3managementService.AccesskeyResourceModel resp.Diagnostics.Append(req.State.Get(ctx, &data)...) if resp.Diagnostics.HasError() { return @@ -169,13 +154,7 @@ func (r *accesskeyResource) Read(ctx context.Context, req resource.ReadRequest, return } - data.AccessKey = basetypes.NewStringPointerValue(accessKey.Properties.AccessKey) - data.CanonicalUserId = basetypes.NewStringPointerValue(accessKey.Properties.CanonicalUserId) - data.ContractUserId = basetypes.NewStringPointerValue(accessKey.Properties.ContractUserId) - data.Description = basetypes.NewStringPointerValue(accessKey.Properties.Description) - data.SecretKey = basetypes.NewStringPointerValue(accessKey.Properties.SecretKey) - data.ID = basetypes.NewStringPointerValue(accessKey.Id) - + s3managementService.SetAccessKeyPropertiesToPlan(&data, accessKey) resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } @@ -186,7 +165,7 @@ func (r *accesskeyResource) ImportState(ctx context.Context, req resource.Import // Update updates the bucket. func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var plan, state *accesskeyResourceModel + var plan, state *s3managementService.AccesskeyResourceModel // Read Terraform plan data into the model resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -195,7 +174,7 @@ func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateReque return } - var data *accesskeyResourceModel + var data *s3managementService.AccesskeyResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) if resp.Diagnostics.HasError() { return @@ -211,7 +190,8 @@ func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateReque Description: data.Description.ValueStringPointer(), }, } - accessKeyResponse, _, err := r.client.S3ManagementClient.UpdateAccessKey(ctx, data.ID.String(), accessKey, updateTimeout) + + accessKeyResponse, _, err := r.client.S3ManagementClient.UpdateAccessKey(ctx, state.ID.String(), accessKey, updateTimeout) if err != nil { resp.Diagnostics.AddError("failed to update accessKey", err.Error()) return @@ -225,14 +205,7 @@ func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateReque return } - data.AccessKey = basetypes.NewStringPointerValue(accessKeyRead.Properties.AccessKey) - data.CanonicalUserId = basetypes.NewStringPointerValue(accessKeyRead.Properties.CanonicalUserId) - data.ContractUserId = basetypes.NewStringPointerValue(accessKeyRead.Properties.ContractUserId) - data.Description = basetypes.NewStringPointerValue(accessKeyRead.Properties.Description) - data.SecretKey = basetypes.NewStringPointerValue(accessKeyRead.Properties.SecretKey) - data.ID = basetypes.NewStringPointerValue(accessKeyRead.Id) - - plan.ID = state.ID + s3managementService.SetAccessKeyPropertiesToPlan(plan, accessKeyRead) resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) } @@ -243,7 +216,7 @@ func (r *accesskeyResource) Delete(ctx context.Context, req resource.DeleteReque return } - var data *accesskeyResourceModel + var data *s3managementService.AccesskeyResourceModel resp.Diagnostics.Append(req.State.Get(ctx, &data)...) if resp.Diagnostics.HasError() { return diff --git a/services/s3management/accesskeys.go b/services/s3management/accesskeys.go index eb9f5c452..a3cc2cfd3 100644 --- a/services/s3management/accesskeys.go +++ b/services/s3management/accesskeys.go @@ -6,9 +6,31 @@ import ( "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" s3management "github.com/ionos-cloud/sdk-go-s3-management" ) +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"` +} + func (c *Client) GetAccessKey(ctx context.Context, accessKeyId string) (s3management.AccessKey, *s3management.APIResponse, error) { accessKey, apiResponse, err := c.client.AccesskeysApi.AccesskeysFindById(ctx, accessKeyId).Execute() apiResponse.LogInfo() @@ -24,12 +46,13 @@ func (c *Client) ListAccessKeys(ctx context.Context) (s3management.AccessKeyList func (c *Client) CreateAccessKey(ctx context.Context, accessKey s3management.AccessKeyCreate, timeout time.Duration) (s3management.AccessKey, *s3management.APIResponse, error) { accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPost(ctx).AccessKeyCreate(accessKey).Execute() apiResponse.LogInfo() - - 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) + if err == nil && accessKeyResponse.Id != nil { + 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 @@ -38,12 +61,13 @@ func (c *Client) CreateAccessKey(ctx context.Context, accessKey s3management.Acc func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyId string, accessKey s3management.AccessKeyEnsure, timeout time.Duration) (s3management.AccessKey, *s3management.APIResponse, error) { accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPut(ctx, accessKeyId).AccessKeyEnsure(accessKey).Execute() apiResponse.LogInfo() - - 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) + if err == nil { + 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 @@ -53,16 +77,42 @@ func (c *Client) DeleteAccessKey(ctx context.Context, accessKeyId string, timeou apiResponse, err := c.client.AccesskeysApi.AccesskeysDelete(ctx, accessKeyId).Execute() apiResponse.LogInfo() - 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) + if err == nil { + 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 } +func SetAccessKeyPropertiesToPlan(plan *AccesskeyResourceModel, accessKey s3management.AccessKey) { + + if accessKey.Properties != 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) + } +} + func (c *Client) accessKeyDeletedCheck(ctx context.Context, id string) error { _, apiResponse, err := c.GetAccessKey(ctx, id) if apiResponse.HttpNotFound() { diff --git a/services/s3management/regions.go b/services/s3management/regions.go index 7b981f8f4..f13a6136d 100644 --- a/services/s3management/regions.go +++ b/services/s3management/regions.go @@ -3,9 +3,23 @@ package s3management import ( "context" + "github.com/hashicorp/terraform-plugin-framework/types" s3management "github.com/ionos-cloud/sdk-go-s3-management" ) +// RegionDataSourceModel is used to represent an region for a data source. +type RegionDataSourceModel struct { + Version types.String `tfsdk:"verion"` + Endpoint types.String `tfsdk:"endpoint"` + Website types.String `tfsdk:"website"` + Capability types.String `tfsdk:"capability"` + Storageclasses types.String `tfsdk:"storage_classes"` + Location types.String `tfsdk:"location"` + Country types.String `tfsdk:"country"` + City types.String `tfsdk:"city"` + ID types.String `tfsdk:"id"` +} + func (c *Client) GetRegion(ctx context.Context, regionId string, depth float32) (s3management.Region, *s3management.APIResponse, error) { region, apiResponse, err := c.client.RegionsApi.RegionsFindByRegion(ctx, regionId).Execute() apiResponse.LogInfo() From 80e997cb34dad596bd76e8fb1dad2490c9c3b8d7 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Tue, 24 Sep 2024 17:28:57 +0300 Subject: [PATCH 04/30] fix: working data sources, use valueString and other fixes --- internal/framework/provider/provider.go | 2 + .../s3management/data_source_accesskey.go | 23 ++++---- .../s3management/data_source_region.go | 50 ++++++++++++++--- .../s3management/resource_accesskey.go | 24 +++----- services/s3management/accesskeys.go | 21 +++++++ services/s3management/regions.go | 56 ++++++++++++++++--- 6 files changed, 133 insertions(+), 43 deletions(-) diff --git a/internal/framework/provider/provider.go b/internal/framework/provider/provider.go index e39050691..4f500cd95 100644 --- a/internal/framework/provider/provider.go +++ b/internal/framework/provider/provider.go @@ -252,6 +252,8 @@ func (p *IonosCloudProvider) DataSources(_ context.Context) []func() datasource. s3.NewObjectDataSource, s3.NewBucketPolicyDataSource, s3.NewObjectsDataSource, + s3management.NewRegionDataSource, + s3management.NewAccesskeyDataSource, } } diff --git a/internal/framework/services/s3management/data_source_accesskey.go b/internal/framework/services/s3management/data_source_accesskey.go index 6f6c9a9cc..695bc23e9 100644 --- a/internal/framework/services/s3management/data_source_accesskey.go +++ b/internal/framework/services/s3management/data_source_accesskey.go @@ -6,6 +6,7 @@ import ( "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" + s3managementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -13,8 +14,8 @@ import ( var _ datasource.DataSourceWithConfigure = (*accessKeyDataSource)(nil) -// NewBucketDataSource creates a new data source for the accesskey resource. -func NewBucketDataSource() datasource.DataSource { +// NewAccesskeyDataSource creates a new data source for the accesskey resource. +func NewAccesskeyDataSource() datasource.DataSource { return &accessKeyDataSource{} } @@ -53,7 +54,7 @@ func (d *accessKeyDataSource) Schema(ctx context.Context, req datasource.SchemaR resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ - Optional: true, + Required: true, Description: "The ID (UUID) of the AccessKey.", }, "description": schema.StringAttribute{ @@ -89,17 +90,19 @@ func (d *accessKeyDataSource) Read(ctx context.Context, req datasource.ReadReque return } - // result, found, err := d.client.GetAccessKeyForDataSource(ctx, data.Name) - // if err != nil { - // resp.Diagnostics.AddError("failed to get accesskey", err.Error()) - // return - // } + id := data.ID.String() + + accessKey, apiResponse, err := d.client.S3ManagementClient.GetAccessKey(ctx, id) - if !found { + 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 + } - data = result + s3managementService.SetAccessKeyPropertiesToDataSourcePlan(data, accessKey) resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } diff --git a/internal/framework/services/s3management/data_source_region.go b/internal/framework/services/s3management/data_source_region.go index b22e1dee9..6195d2b30 100644 --- a/internal/framework/services/s3management/data_source_region.go +++ b/internal/framework/services/s3management/data_source_region.go @@ -9,6 +9,7 @@ import ( "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) @@ -56,10 +57,42 @@ func (d *regionDataSource) Schema(ctx context.Context, req datasource.SchemaRequ Description: "The id of the region", Required: true, }, - "region": schema.StringAttribute{ - Description: "The location or region of the region", + "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, + }, + }, + Blocks: map[string]schema.Block{ + "capability": schema.SingleNestedBlock{ + Description: "The capabilities of the region", + 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, + }, + }, + }, }, } } @@ -77,17 +110,16 @@ func (d *regionDataSource) Read(ctx context.Context, req datasource.ReadRequest, return } - result, apiResponse, err := d.client.S3ManagementClient.GetRegion(ctx, data.ID.String(), 1) - if err != nil { - resp.Diagnostics.AddError("failed to get region", err.Error()) - return - } + region, apiResponse, err := d.client.S3ManagementClient.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 + } - data = result - resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + resp.Diagnostics.Append(resp.State.Set(ctx, s3management.BuildRegionModelFromAPIResponse(®ion))...) } diff --git a/internal/framework/services/s3management/resource_accesskey.go b/internal/framework/services/s3management/resource_accesskey.go index a1a3ade6f..9b2738abb 100644 --- a/internal/framework/services/s3management/resource_accesskey.go +++ b/internal/framework/services/s3management/resource_accesskey.go @@ -125,7 +125,7 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque s3managementService.SetAccessKeyPropertiesToPlan(data, accessKeyResponse) - accessKeyRead, _, err := r.client.S3ManagementClient.GetAccessKey(ctx, data.ID.String()) + accessKeyRead, _, err := r.client.S3ManagementClient.GetAccessKey(ctx, data.ID.ValueString()) if err != nil { resp.Diagnostics.AddError("Access Key API error", err.Error()) return @@ -148,7 +148,7 @@ func (r *accesskeyResource) Read(ctx context.Context, req resource.ReadRequest, return } - accessKey, _, err := r.client.S3ManagementClient.GetAccessKey(ctx, data.ID.String()) + accessKey, _, err := r.client.S3ManagementClient.GetAccessKey(ctx, data.ID.ValueString()) if err != nil { resp.Diagnostics.AddError("Access Key API error", err.Error()) return @@ -174,30 +174,24 @@ func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateReque return } - var data *s3managementService.AccesskeyResourceModel - resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) - if resp.Diagnostics.HasError() { - return - } - - updateTimeout, diags := data.Timeouts.Update(ctx, utils.DefaultTimeout) + updateTimeout, diags := plan.Timeouts.Update(ctx, utils.DefaultTimeout) resp.Diagnostics.Append(diags...) ctx, cancel := context.WithTimeout(ctx, updateTimeout) defer cancel() var accessKey = s3management.AccessKeyEnsure{ Properties: &s3management.AccessKeyProperties{ - Description: data.Description.ValueStringPointer(), + Description: plan.Description.ValueStringPointer(), }, } - accessKeyResponse, _, err := r.client.S3ManagementClient.UpdateAccessKey(ctx, state.ID.String(), accessKey, updateTimeout) + accessKeyResponse, _, err := r.client.S3ManagementClient.UpdateAccessKey(ctx, state.ID.ValueString(), accessKey, updateTimeout) if err != nil { resp.Diagnostics.AddError("failed to update accessKey", err.Error()) return } - data.ID = basetypes.NewStringPointerValue(accessKeyResponse.Id) + plan.ID = basetypes.NewStringPointerValue(accessKeyResponse.Id) accessKeyRead, _, err := r.client.S3ManagementClient.GetAccessKey(ctx, *accessKeyResponse.Id) if err != nil { @@ -205,8 +199,8 @@ func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateReque return } - s3managementService.SetAccessKeyPropertiesToPlan(plan, accessKeyRead) - resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) + s3managementService.SetAccessKeyPropertiesToPlan(state, accessKeyRead) + resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) } // Delete deletes the accessKey. @@ -230,7 +224,7 @@ func (r *accesskeyResource) Delete(ctx context.Context, req resource.DeleteReque ctx, cancel := context.WithTimeout(ctx, deleteTimeout) defer cancel() - if _, err := r.client.S3ManagementClient.DeleteAccessKey(ctx, data.ID.String(), deleteTimeout); err != nil { + if _, err := r.client.S3ManagementClient.DeleteAccessKey(ctx, data.ID.ValueString(), deleteTimeout); err != nil { resp.Diagnostics.AddError("failed to delete bucket", err.Error()) return } diff --git a/services/s3management/accesskeys.go b/services/s3management/accesskeys.go index a3cc2cfd3..3555bc995 100644 --- a/services/s3management/accesskeys.go +++ b/services/s3management/accesskeys.go @@ -113,6 +113,27 @@ func SetAccessKeyPropertiesToPlan(plan *AccesskeyResourceModel, accessKey s3mana } } +func SetAccessKeyPropertiesToDataSourcePlan(plan *AccessKeyDataSourceModel, accessKey s3management.AccessKey) { + + if accessKey.Properties != 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() { diff --git a/services/s3management/regions.go b/services/s3management/regions.go index f13a6136d..4a65fb6a4 100644 --- a/services/s3management/regions.go +++ b/services/s3management/regions.go @@ -9,15 +9,18 @@ import ( // RegionDataSourceModel is used to represent an region for a data source. type RegionDataSourceModel struct { - Version types.String `tfsdk:"verion"` - Endpoint types.String `tfsdk:"endpoint"` - Website types.String `tfsdk:"website"` - Capability types.String `tfsdk:"capability"` - Storageclasses types.String `tfsdk:"storage_classes"` - Location types.String `tfsdk:"location"` - Country types.String `tfsdk:"country"` - City types.String `tfsdk:"city"` - ID types.String `tfsdk:"id"` + 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"` } func (c *Client) GetRegion(ctx context.Context, regionId string, depth float32) (s3management.Region, *s3management.APIResponse, error) { @@ -31,3 +34,38 @@ func (c *Client) ListRegions(ctx context.Context) (s3management.RegionList, *s3m apiResponse.LogInfo() return regions, apiResponse, err } + +func BuildRegionModelFromAPIResponse(output *s3management.Region) *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 _, storageClass := range *output.Properties.Storageclasses { + built.Storageclasses = append(built.Storageclasses, types.StringPointerValue(&storageClass)) + } + } + } + + return built +} From 583b17b115b8bd4cdc41fb7d4a297c1692813fd1 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Tue, 24 Sep 2024 17:45:11 +0300 Subject: [PATCH 05/30] fix: getting version and terraform version like in the old provider --- internal/framework/provider/provider.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/framework/provider/provider.go b/internal/framework/provider/provider.go index 4f500cd95..c3abb90b5 100644 --- a/internal/framework/provider/provider.go +++ b/internal/framework/provider/provider.go @@ -146,7 +146,7 @@ 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 := "0.12+compatible" + terraformVersion := req.TerraformVersion if !clientOpts.Token.IsNull() { token = clientOpts.Token.ValueString() @@ -185,7 +185,7 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu } cleanedEndpoint := cleanURL(endpoint) - version := "v6" + version := "DEV" newConfig := ionoscloud.NewConfiguration(username, password, token, endpoint) newConfig.UserAgent = fmt.Sprintf( @@ -200,6 +200,8 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu newConfig.HTTPClient = &http.Client{Transport: utils.CreateTransport()} cloudapiClient := ionoscloud.NewAPIClient(newConfig) + version = ionoscloud.Version + client := &services.SdkBundle{ CDNClient: cdnService.NewCDNClient(username, password, token, endpoint, version, terraformVersion), AutoscalingClient: autoscalingService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), From 2a093e28f346211344927bafa6bb393fe6ee0f85 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Tue, 24 Sep 2024 17:50:21 +0300 Subject: [PATCH 06/30] fix: rename bucket references --- .../services/s3management/resource_accesskey.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/framework/services/s3management/resource_accesskey.go b/internal/framework/services/s3management/resource_accesskey.go index 9b2738abb..a89b3e613 100644 --- a/internal/framework/services/s3management/resource_accesskey.go +++ b/internal/framework/services/s3management/resource_accesskey.go @@ -31,12 +31,12 @@ type accesskeyResource struct { client *services.SdkBundle } -// Metadata returns the metadata for the bucket resource. +// Metadata returns the metadata for the accesskey resource. func (r *accesskeyResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { resp.TypeName = req.ProviderTypeName + "_s3_accesskey" } -// Schema returns the schema for the bucket resource. +// 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{ @@ -75,7 +75,7 @@ func (r *accesskeyResource) Schema(ctx context.Context, req resource.SchemaReque } } -// Configure configures the bucket resource. +// Configure configures the accesskey resource. func (r *accesskeyResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { if req.ProviderData == nil { return @@ -94,7 +94,7 @@ func (r *accesskeyResource) Configure(_ context.Context, req resource.ConfigureR r.client = client } -// Create creates the bucket. +// Create creates the accesskey. func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { if r.client == nil { resp.Diagnostics.AddError("s3 api client not configured", "The provider client is not configured") @@ -135,7 +135,7 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } -// Read reads the bucket. +// Read reads the accesskey. func (r *accesskeyResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { if r.client == nil { resp.Diagnostics.AddError("s3 api client not configured", "The provider client is not configured") @@ -163,7 +163,7 @@ func (r *accesskeyResource) ImportState(ctx context.Context, req resource.Import resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) } -// Update updates the bucket. +// Update updates the accesskey. func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { var plan, state *s3managementService.AccesskeyResourceModel @@ -225,7 +225,7 @@ func (r *accesskeyResource) Delete(ctx context.Context, req resource.DeleteReque defer cancel() if _, err := r.client.S3ManagementClient.DeleteAccessKey(ctx, data.ID.ValueString(), deleteTimeout); err != nil { - resp.Diagnostics.AddError("failed to delete bucket", err.Error()) + resp.Diagnostics.AddError("failed to delete accesskey", err.Error()) return } } From 61003e977e0fb3886a170a47d7f5cfe1409d630f Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Wed, 25 Sep 2024 17:48:45 +0300 Subject: [PATCH 07/30] doc: added docs --- docs/data-sources/s3_accesskey.md | 35 ++++++++++++++++++++++++ docs/data-sources/s3_region.md | 39 +++++++++++++++++++++++++++ docs/resources/s3_accesskey.md | 45 +++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 docs/data-sources/s3_accesskey.md create mode 100644 docs/data-sources/s3_region.md create mode 100644 docs/resources/s3_accesskey.md diff --git a/docs/data-sources/s3_accesskey.md b/docs/data-sources/s3_accesskey.md new file mode 100644 index 000000000..3c2c721c0 --- /dev/null +++ b/docs/data-sources/s3_accesskey.md @@ -0,0 +1,35 @@ +--- +subcategory: "S3 management" +layout: "ionoscloud" +page_title: "IonosCloud : s3_accesskey" +sidebar_current: "docs-datasource-s3_accesskey" +description: |- + Get information on a IonosCloud S3 Accesskeys +--- + +# ionoscloud\_s3\_accesskey + +The **S3 Accesskey data source** can be used to search for and return an existing S3 Accesskeys. + +## Example Usage + +### By ID +```hcl +data "ionoscloud_s3_accesskey" "example" { + id = +} +``` + +## Argument Reference + + * `id` - (Required) Id of an existing S3 accesskey that you want to search for. + +## 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/s3_region.md b/docs/data-sources/s3_region.md new file mode 100644 index 000000000..ee59f44cd --- /dev/null +++ b/docs/data-sources/s3_region.md @@ -0,0 +1,39 @@ +--- +subcategory: "S3 management" +layout: "ionoscloud" +page_title: "IonosCloud : s3_region" +sidebar_current: "docs-datasource-s3_region" +description: |- + Get information on a IonosCloud S3 Region +--- + +# ionoscloud\_s3\_region + +The **S3 region data source** can be used to search for and return an existing S3 Regions. + +## Example Usage + +### By ID +```hcl +data "ionoscloud_s3_region" "example" { + id = +} +``` + +## Argument Reference + + * `id` - (Required) Id of an existing S3 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/s3_accesskey.md b/docs/resources/s3_accesskey.md new file mode 100644 index 000000000..6347216cc --- /dev/null +++ b/docs/resources/s3_accesskey.md @@ -0,0 +1,45 @@ +--- +subcategory: "S3 management" +layout: "ionoscloud" +page_title: "IonosCloud: s3_accesskey" +sidebar_current: "docs-resource-s3_accesskey" +description: |- + Creates and manages IonosCloud S3 Accesskeys. +--- + +# ionoscloud_s3_accesskey + +Manages an **S3 Accesskey** on IonosCloud. + +## Example Usage + +```hcl +resource "ionoscloud_s3_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`. +- `force_destroy` - (Optional)[bool] If true, the bucket and the contents of the bucket will be destroyed. Default is `false`. + +## Import + +An S3 accesskey resource can be imported using its `resource id`, e.g. + +```shell +terraform import ionoscloud_s3_accesskey.demo {s3AccesskeyId} +``` + +This can be helpful when you want to import S3 Accesskeys which you have already created manually or using other means, outside of terraform. From 6376432ea417ba59757c19bd3b3b048114a3cc0d Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Wed, 25 Sep 2024 17:49:58 +0300 Subject: [PATCH 08/30] test: added tests wip, renamed files --- ...cesskey.go => data_source_s3_accesskey.go} | 0 .../data_source_s3_accesskey_test.go | 39 +++++++++++++++ ...rce_region.go => data_source_s3_region.go} | 0 .../data_source_s3_region_test.go | 37 +++++++++++++++ ..._accesskey.go => resource_s3_accesskey.go} | 0 .../resource_s3_accesskey_test.go | 47 +++++++++++++++++++ 6 files changed, 123 insertions(+) rename internal/framework/services/s3management/{data_source_accesskey.go => data_source_s3_accesskey.go} (100%) create mode 100644 internal/framework/services/s3management/data_source_s3_accesskey_test.go rename internal/framework/services/s3management/{data_source_region.go => data_source_s3_region.go} (100%) create mode 100644 internal/framework/services/s3management/data_source_s3_region_test.go rename internal/framework/services/s3management/{resource_accesskey.go => resource_s3_accesskey.go} (100%) create mode 100644 internal/framework/services/s3management/resource_s3_accesskey_test.go diff --git a/internal/framework/services/s3management/data_source_accesskey.go b/internal/framework/services/s3management/data_source_s3_accesskey.go similarity index 100% rename from internal/framework/services/s3management/data_source_accesskey.go rename to internal/framework/services/s3management/data_source_s3_accesskey.go diff --git a/internal/framework/services/s3management/data_source_s3_accesskey_test.go b/internal/framework/services/s3management/data_source_s3_accesskey_test.go new file mode 100644 index 000000000..541a6c5af --- /dev/null +++ b/internal/framework/services/s3management/data_source_s3_accesskey_test.go @@ -0,0 +1,39 @@ +//go:build all || s3management +// +build all s3management + +package s3management_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) { + resource.Test(t, resource.TestCase{ + ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, + PreCheck: func() { + acctest.PreCheck(t) + }, + Steps: []resource.TestStep{ + { + Config: testAccAccesskeyDataSourceConfig_basic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair("data.ionoscloud_s3_accesskey.test", "name", "ionoscloud_s3_accesskey.test", "name"), + resource.TestCheckResourceAttrPair("data.ionoscloud_s3_accesskey.test", "region", "ionoscloud_s3_accesskey.test", "region"), + ), + }, + }, + }) +} + +func testAccAccesskeyDataSourceConfig_basic() string { + return utils.ConfigCompose(testAccAccesskeyConfig_basic(), ` +data "ionoscloud_s3_accesskey" "testres" { + id = ionoscloud_s3_accesskey.test.id +} +`) +} diff --git a/internal/framework/services/s3management/data_source_region.go b/internal/framework/services/s3management/data_source_s3_region.go similarity index 100% rename from internal/framework/services/s3management/data_source_region.go rename to internal/framework/services/s3management/data_source_s3_region.go diff --git a/internal/framework/services/s3management/data_source_s3_region_test.go b/internal/framework/services/s3management/data_source_s3_region_test.go new file mode 100644 index 000000000..39ce354ff --- /dev/null +++ b/internal/framework/services/s3management/data_source_s3_region_test.go @@ -0,0 +1,37 @@ +//go:build all || s3management +// +build all s3management + +package s3management_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) { + resource.Test(t, resource.TestCase{ + ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, + PreCheck: func() { + acctest.PreCheck(t) + }, + Steps: []resource.TestStep{ + { + Config: testAccRegionDataSourceConfig_basic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair("data.ionoscloud_s3_region.testreg", "id", "ionoscloud_s3_region.testreg", "de"), + ), + }, + }, + }) +} + +func testAccRegionDataSourceConfig_basic() string { + return ` +data "ionoscloud_s3_region" "testreg" { + id = "de" +} +` +} diff --git a/internal/framework/services/s3management/resource_accesskey.go b/internal/framework/services/s3management/resource_s3_accesskey.go similarity index 100% rename from internal/framework/services/s3management/resource_accesskey.go rename to internal/framework/services/s3management/resource_s3_accesskey.go diff --git a/internal/framework/services/s3management/resource_s3_accesskey_test.go b/internal/framework/services/s3management/resource_s3_accesskey_test.go new file mode 100644 index 000000000..63b0d4abd --- /dev/null +++ b/internal/framework/services/s3management/resource_s3_accesskey_test.go @@ -0,0 +1,47 @@ +//go:build all || s3management +// +build all s3management + +package s3management_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") + name := "ionoscloud_s3_accesskey.test" + + resource.Test(t, resource.TestCase{ + ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, + PreCheck: func() { + acctest.PreCheck(t) + }, + Steps: []resource.TestStep{ + { + Config: testAccAccesskeyConfig_description(description), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(name, "description", description), + ), + }, + }, + }) +} + +func testAccAccesskeyConfig_basic() string { + return ` +resource "ionoscloud_s3_accesskey" "test" { +} +` +} + +func testAccAccesskeyConfig_description(description string) string { + return fmt.Sprintf(` +resource "ionoscloud_s3_accesskey" "test" { + description = %[1]q +} +`, description) +} From a5f0fea941db45fc85858f9b29ebbb3f03fc59ad Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Thu, 26 Sep 2024 09:38:55 +0300 Subject: [PATCH 09/30] test: fix tests --- .../services/s3management/data_source_s3_accesskey_test.go | 5 ++--- .../services/s3management/data_source_s3_region_test.go | 6 +++++- .../services/s3management/resource_s3_accesskey.go | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/framework/services/s3management/data_source_s3_accesskey_test.go b/internal/framework/services/s3management/data_source_s3_accesskey_test.go index 541a6c5af..685fdcbbd 100644 --- a/internal/framework/services/s3management/data_source_s3_accesskey_test.go +++ b/internal/framework/services/s3management/data_source_s3_accesskey_test.go @@ -22,8 +22,7 @@ func TestAccS3AccesskeyDataSource(t *testing.T) { { Config: testAccAccesskeyDataSourceConfig_basic(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair("data.ionoscloud_s3_accesskey.test", "name", "ionoscloud_s3_accesskey.test", "name"), - resource.TestCheckResourceAttrPair("data.ionoscloud_s3_accesskey.test", "region", "ionoscloud_s3_accesskey.test", "region"), + resource.TestCheckResourceAttr("data.ionoscloud_s3_accesskey.testres", "description", "desc"), ), }, }, @@ -31,7 +30,7 @@ func TestAccS3AccesskeyDataSource(t *testing.T) { } func testAccAccesskeyDataSourceConfig_basic() string { - return utils.ConfigCompose(testAccAccesskeyConfig_basic(), ` + return utils.ConfigCompose(testAccAccesskeyConfig_description("desc"), ` data "ionoscloud_s3_accesskey" "testres" { id = ionoscloud_s3_accesskey.test.id } diff --git a/internal/framework/services/s3management/data_source_s3_region_test.go b/internal/framework/services/s3management/data_source_s3_region_test.go index 39ce354ff..20e0df579 100644 --- a/internal/framework/services/s3management/data_source_s3_region_test.go +++ b/internal/framework/services/s3management/data_source_s3_region_test.go @@ -21,7 +21,11 @@ func TestAccS3RegionDataSource(t *testing.T) { { Config: testAccRegionDataSourceConfig_basic(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair("data.ionoscloud_s3_region.testreg", "id", "ionoscloud_s3_region.testreg", "de"), + resource.TestCheckResourceAttr("data.ionoscloud_s3_region.testreg", "id", "de"), + resource.TestCheckResourceAttr("data.ionoscloud_s3_region.testreg", "endpoint", "s3.eu-central-1.ionoscloud.com"), + resource.TestCheckResourceAttr("data.ionoscloud_s3_region.testreg", "website", "s3-website.de-central.profitbricks.com"), + resource.TestCheckResourceAttr("data.ionoscloud_s3_region.testreg", "storage_classes.0", "standard"), + resource.TestCheckResourceAttr("data.ionoscloud_s3_region.testreg", "capability.iam", "false"), ), }, }, diff --git a/internal/framework/services/s3management/resource_s3_accesskey.go b/internal/framework/services/s3management/resource_s3_accesskey.go index a89b3e613..333552944 100644 --- a/internal/framework/services/s3management/resource_s3_accesskey.go +++ b/internal/framework/services/s3management/resource_s3_accesskey.go @@ -47,6 +47,7 @@ func (r *accesskeyResource) Schema(ctx context.Context, req resource.SchemaReque "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.", From 466c487f1b1ef73b099bc5d03c971821c0f7f414 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Fri, 27 Sep 2024 13:39:46 +0300 Subject: [PATCH 10/30] fix: get specific client from bundle, added some checks to tests --- .../s3management/data_source_s3_accesskey.go | 10 ++++---- .../data_source_s3_accesskey_test.go | 4 ++++ .../s3management/data_source_s3_region.go | 21 ++++++++-------- .../s3management/resource_s3_accesskey.go | 20 ++++++++-------- .../resource_s3_accesskey_test.go | 24 +++++++++++++------ services/s3management/accesskeys.go | 1 + 6 files changed, 47 insertions(+), 33 deletions(-) diff --git a/internal/framework/services/s3management/data_source_s3_accesskey.go b/internal/framework/services/s3management/data_source_s3_accesskey.go index 695bc23e9..844bc7c3f 100644 --- a/internal/framework/services/s3management/data_source_s3_accesskey.go +++ b/internal/framework/services/s3management/data_source_s3_accesskey.go @@ -20,7 +20,7 @@ func NewAccesskeyDataSource() datasource.DataSource { } type accessKeyDataSource struct { - client *services.SdkBundle + client *s3managementService.Client } // Metadata returns the metadata for the data source. @@ -36,17 +36,17 @@ func (d *accessKeyDataSource) Configure(ctx context.Context, req datasource.Conf return } - client, ok := req.ProviderData.(*services.SdkBundle) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + fmt.Sprintf("Expected *services.SdkBundle: %T. Please report this issue to the provider developers.", req.ProviderData), ) return } - d.client = client + d.client = clientBundle.S3ManagementClient } // Schema returns the schema for the data source. @@ -92,7 +92,7 @@ func (d *accessKeyDataSource) Read(ctx context.Context, req datasource.ReadReque id := data.ID.String() - accessKey, apiResponse, err := d.client.S3ManagementClient.GetAccessKey(ctx, id) + accessKey, apiResponse, err := d.client.GetAccessKey(ctx, id) if apiResponse.HttpNotFound() { resp.Diagnostics.AddError("accesskey not found", "The accesskey was not found") diff --git a/internal/framework/services/s3management/data_source_s3_accesskey_test.go b/internal/framework/services/s3management/data_source_s3_accesskey_test.go index 685fdcbbd..64bfc1421 100644 --- a/internal/framework/services/s3management/data_source_s3_accesskey_test.go +++ b/internal/framework/services/s3management/data_source_s3_accesskey_test.go @@ -23,6 +23,10 @@ func TestAccS3AccesskeyDataSource(t *testing.T) { Config: testAccAccesskeyDataSourceConfig_basic(), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("data.ionoscloud_s3_accesskey.testres", "description", "desc"), + resource.TestCheckResourceAttrSet("data.ionoscloud_s3_accesskey.testres", "id"), + resource.TestCheckResourceAttrSet("data.ionoscloud_s3_accesskey.testres", "accesskey"), + resource.TestCheckResourceAttrSet("data.ionoscloud_s3_accesskey.testres", "canonical_user_id"), + resource.TestCheckResourceAttrSet("data.ionoscloud_s3_accesskey.testres", "contract_user_id"), ), }, }, diff --git a/internal/framework/services/s3management/data_source_s3_region.go b/internal/framework/services/s3management/data_source_s3_region.go index 6195d2b30..85d24ea57 100644 --- a/internal/framework/services/s3management/data_source_s3_region.go +++ b/internal/framework/services/s3management/data_source_s3_region.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" - "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" + s3managementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" @@ -20,7 +20,7 @@ func NewRegionDataSource() datasource.DataSource { } type regionDataSource struct { - client *services.SdkBundle + client *s3managementService.Client } // Metadata returns the metadata for the data source. @@ -36,17 +36,17 @@ func (d *regionDataSource) Configure(ctx context.Context, req datasource.Configu return } - client, ok := req.ProviderData.(*services.SdkBundle) + clientbundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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.S3ManagementClient } // Schema returns the schema for the data source. @@ -78,10 +78,9 @@ func (d *regionDataSource) Schema(ctx context.Context, req datasource.SchemaRequ 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, }, - }, - Blocks: map[string]schema.Block{ - "capability": schema.SingleNestedBlock{ + "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", @@ -104,13 +103,13 @@ func (d *regionDataSource) Read(ctx context.Context, req datasource.ReadRequest, return } - var data *s3management.RegionDataSourceModel + var data *s3managementService.RegionDataSourceModel resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) if resp.Diagnostics.HasError() { return } - region, apiResponse, err := d.client.S3ManagementClient.GetRegion(ctx, data.ID.ValueString(), 1) + 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") @@ -121,5 +120,5 @@ func (d *regionDataSource) Read(ctx context.Context, req datasource.ReadRequest, return } - resp.Diagnostics.Append(resp.State.Set(ctx, s3management.BuildRegionModelFromAPIResponse(®ion))...) + resp.Diagnostics.Append(resp.State.Set(ctx, s3managementService.BuildRegionModelFromAPIResponse(®ion))...) } diff --git a/internal/framework/services/s3management/resource_s3_accesskey.go b/internal/framework/services/s3management/resource_s3_accesskey.go index 333552944..4ffc6bc5f 100644 --- a/internal/framework/services/s3management/resource_s3_accesskey.go +++ b/internal/framework/services/s3management/resource_s3_accesskey.go @@ -28,7 +28,7 @@ func NewAccesskeyResource() resource.Resource { } type accesskeyResource struct { - client *services.SdkBundle + client *s3managementService.Client } // Metadata returns the metadata for the accesskey resource. @@ -82,17 +82,17 @@ func (r *accesskeyResource) Configure(_ context.Context, req resource.ConfigureR return } - client, ok := req.ProviderData.(*services.SdkBundle) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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.S3ManagementClient } // Create creates the accesskey. @@ -118,7 +118,7 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque Description: data.Description.ValueStringPointer(), }, } - accessKeyResponse, _, err := r.client.S3ManagementClient.CreateAccessKey(ctx, accessKey, createTimeout) + accessKeyResponse, _, err := r.client.CreateAccessKey(ctx, accessKey, createTimeout) if err != nil { resp.Diagnostics.AddError("failed to create accessKey", err.Error()) return @@ -126,7 +126,7 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque s3managementService.SetAccessKeyPropertiesToPlan(data, accessKeyResponse) - accessKeyRead, _, err := r.client.S3ManagementClient.GetAccessKey(ctx, data.ID.ValueString()) + accessKeyRead, _, err := r.client.GetAccessKey(ctx, data.ID.ValueString()) if err != nil { resp.Diagnostics.AddError("Access Key API error", err.Error()) return @@ -149,7 +149,7 @@ func (r *accesskeyResource) Read(ctx context.Context, req resource.ReadRequest, return } - accessKey, _, err := r.client.S3ManagementClient.GetAccessKey(ctx, data.ID.ValueString()) + accessKey, _, err := r.client.GetAccessKey(ctx, data.ID.ValueString()) if err != nil { resp.Diagnostics.AddError("Access Key API error", err.Error()) return @@ -186,7 +186,7 @@ func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateReque }, } - accessKeyResponse, _, err := r.client.S3ManagementClient.UpdateAccessKey(ctx, state.ID.ValueString(), accessKey, updateTimeout) + accessKeyResponse, _, err := r.client.UpdateAccessKey(ctx, state.ID.ValueString(), accessKey, updateTimeout) if err != nil { resp.Diagnostics.AddError("failed to update accessKey", err.Error()) return @@ -194,7 +194,7 @@ func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateReque plan.ID = basetypes.NewStringPointerValue(accessKeyResponse.Id) - accessKeyRead, _, err := r.client.S3ManagementClient.GetAccessKey(ctx, *accessKeyResponse.Id) + accessKeyRead, _, err := r.client.GetAccessKey(ctx, *accessKeyResponse.Id) if err != nil { resp.Diagnostics.AddError("Access Key API error", err.Error()) return @@ -225,7 +225,7 @@ func (r *accesskeyResource) Delete(ctx context.Context, req resource.DeleteReque ctx, cancel := context.WithTimeout(ctx, deleteTimeout) defer cancel() - if _, err := r.client.S3ManagementClient.DeleteAccessKey(ctx, data.ID.ValueString(), deleteTimeout); err != nil { + 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/s3management/resource_s3_accesskey_test.go b/internal/framework/services/s3management/resource_s3_accesskey_test.go index 63b0d4abd..384bdfaaf 100644 --- a/internal/framework/services/s3management/resource_s3_accesskey_test.go +++ b/internal/framework/services/s3management/resource_s3_accesskey_test.go @@ -13,6 +13,7 @@ import ( func TestAccACcesskeyResource(t *testing.T) { description := acctest.GenerateRandomResourceName("description") + descriptionUpdated := acctest.GenerateRandomResourceName("description") name := "ionoscloud_s3_accesskey.test" resource.Test(t, resource.TestCase{ @@ -25,19 +26,28 @@ func TestAccACcesskeyResource(t *testing.T) { Config: testAccAccesskeyConfig_description(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: testAccAccesskeyConfig_description(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 testAccAccesskeyConfig_basic() string { - return ` -resource "ionoscloud_s3_accesskey" "test" { -} -` -} - func testAccAccesskeyConfig_description(description string) string { return fmt.Sprintf(` resource "ionoscloud_s3_accesskey" "test" { diff --git a/services/s3management/accesskeys.go b/services/s3management/accesskeys.go index 3555bc995..840d8aa89 100644 --- a/services/s3management/accesskeys.go +++ b/services/s3management/accesskeys.go @@ -12,6 +12,7 @@ import ( s3management "github.com/ionos-cloud/sdk-go-s3-management" ) +// AccesskeyResourceModel is used to represent an accesskey type AccesskeyResourceModel struct { AccessKey types.String `tfsdk:"accesskey"` SecretKey types.String `tfsdk:"secretkey"` From 4b51cbf2561ceeaa9d45fe01f81eeedfecb386bd Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Fri, 27 Sep 2024 15:15:57 +0300 Subject: [PATCH 11/30] fix: check for err and return if not nil to reduce complexity --- services/s3management/accesskeys.go | 50 +++++++++++++++++------------ 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/services/s3management/accesskeys.go b/services/s3management/accesskeys.go index 840d8aa89..e876f0fda 100644 --- a/services/s3management/accesskeys.go +++ b/services/s3management/accesskeys.go @@ -47,13 +47,16 @@ func (c *Client) ListAccessKeys(ctx context.Context) (s3management.AccessKeyList func (c *Client) CreateAccessKey(ctx context.Context, accessKey s3management.AccessKeyCreate, timeout time.Duration) (s3management.AccessKey, *s3management.APIResponse, error) { accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPost(ctx).AccessKeyCreate(accessKey).Execute() apiResponse.LogInfo() - if err == nil && accessKeyResponse.Id != nil { - 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) - } + + 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 @@ -62,13 +65,16 @@ func (c *Client) CreateAccessKey(ctx context.Context, accessKey s3management.Acc func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyId string, accessKey s3management.AccessKeyEnsure, timeout time.Duration) (s3management.AccessKey, *s3management.APIResponse, error) { accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPut(ctx, accessKeyId).AccessKeyEnsure(accessKey).Execute() apiResponse.LogInfo() - if err == nil { - 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) - } + + 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 @@ -78,13 +84,15 @@ func (c *Client) DeleteAccessKey(ctx context.Context, accessKeyId string, timeou apiResponse, err := c.client.AccesskeysApi.AccesskeysDelete(ctx, accessKeyId).Execute() apiResponse.LogInfo() - if err == nil { - 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) - } + 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 From 57dd3aaae084e2073e92b120ec128ef7ba82d575 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Fri, 27 Sep 2024 15:19:40 +0300 Subject: [PATCH 12/30] doc: added comments --- .../framework/services/s3management/resource_s3_accesskey.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/framework/services/s3management/resource_s3_accesskey.go b/internal/framework/services/s3management/resource_s3_accesskey.go index 4ffc6bc5f..066067f4a 100644 --- a/internal/framework/services/s3management/resource_s3_accesskey.go +++ b/internal/framework/services/s3management/resource_s3_accesskey.go @@ -123,7 +123,7 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque resp.Diagnostics.AddError("failed to create accessKey", err.Error()) return } - + // we need this because secretkey is only available on create response s3managementService.SetAccessKeyPropertiesToPlan(data, accessKeyResponse) accessKeyRead, _, err := r.client.GetAccessKey(ctx, data.ID.ValueString()) @@ -132,6 +132,7 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque return } + // we need this because canonical_user_id not available on create response s3managementService.SetAccessKeyPropertiesToPlan(data, accessKeyRead) resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } From 554bf1e08090f8528a98627c72122eac5a6e6e29 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Fri, 27 Sep 2024 15:46:40 +0300 Subject: [PATCH 13/30] fix: made s3 work with sdk bundle --- internal/framework/services/s3/data_source_bucket.go | 7 ++++--- .../framework/services/s3/data_source_bucket_policy.go | 7 ++++--- internal/framework/services/s3/data_source_object.go | 7 ++++--- internal/framework/services/s3/data_source_objects.go | 7 ++++--- internal/framework/services/s3/resource_bucket.go | 7 ++++--- .../services/s3/resource_bucket_cors_configuration.go | 7 ++++--- .../services/s3/resource_bucket_lifecycle_configuration.go | 7 ++++--- .../s3/resource_bucket_object_lock_configuration.go | 7 ++++--- internal/framework/services/s3/resource_bucket_policy.go | 7 ++++--- .../services/s3/resource_bucket_public_access_block.go | 7 ++++--- .../services/s3/resource_bucket_sse_configuration.go | 7 ++++--- .../framework/services/s3/resource_bucket_versioning.go | 7 ++++--- .../services/s3/resource_bucket_website_configuration.go | 7 ++++--- internal/framework/services/s3/resource_object.go | 7 ++++--- internal/framework/services/s3/resource_object_copy.go | 7 ++++--- 15 files changed, 60 insertions(+), 45 deletions(-) diff --git a/internal/framework/services/s3/data_source_bucket.go b/internal/framework/services/s3/data_source_bucket.go index 9f88bf0bf..6fd79c5d6 100644 --- a/internal/framework/services/s3/data_source_bucket.go +++ b/internal/framework/services/s3/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/s3" "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.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/data_source_bucket_policy.go b/internal/framework/services/s3/data_source_bucket_policy.go index 0d4cc1437..81db32da0 100644 --- a/internal/framework/services/s3/data_source_bucket_policy.go +++ b/internal/framework/services/s3/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/s3" "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.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/data_source_object.go b/internal/framework/services/s3/data_source_object.go index fce19c23b..996fc52a6 100644 --- a/internal/framework/services/s3/data_source_object.go +++ b/internal/framework/services/s3/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/s3" ) @@ -39,17 +40,17 @@ func (d *objectDataSource) Configure(ctx context.Context, req datasource.Configu return } - client, ok := req.ProviderData.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/data_source_objects.go b/internal/framework/services/s3/data_source_objects.go index b74be4592..0a5e3f76d 100644 --- a/internal/framework/services/s3/data_source_objects.go +++ b/internal/framework/services/s3/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/s3" "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.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/resource_bucket.go b/internal/framework/services/s3/resource_bucket.go index 3316a4e8c..ed216b338 100644 --- a/internal/framework/services/s3/resource_bucket.go +++ b/internal/framework/services/s3/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/s3" @@ -113,17 +114,17 @@ func (r *bucketResource) Configure(_ context.Context, req resource.ConfigureRequ return } - client, ok := req.ProviderData.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/resource_bucket_cors_configuration.go b/internal/framework/services/s3/resource_bucket_cors_configuration.go index 2e204875b..a02c4db84 100644 --- a/internal/framework/services/s3/resource_bucket_cors_configuration.go +++ b/internal/framework/services/s3/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/s3" "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.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/resource_bucket_lifecycle_configuration.go b/internal/framework/services/s3/resource_bucket_lifecycle_configuration.go index 2c222ecc9..bb7dc2b6a 100644 --- a/internal/framework/services/s3/resource_bucket_lifecycle_configuration.go +++ b/internal/framework/services/s3/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/s3" "github.com/hashicorp/terraform-plugin-framework-validators/int64validator" @@ -125,17 +126,17 @@ func (r *bucketLifecycleConfiguration) Configure(_ context.Context, req resource return } - client, ok := req.ProviderData.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/resource_bucket_object_lock_configuration.go b/internal/framework/services/s3/resource_bucket_object_lock_configuration.go index 60be62247..caebed3fc 100644 --- a/internal/framework/services/s3/resource_bucket_object_lock_configuration.go +++ b/internal/framework/services/s3/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/s3" "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.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/resource_bucket_policy.go b/internal/framework/services/s3/resource_bucket_policy.go index 3f1455b43..b3886a4e1 100644 --- a/internal/framework/services/s3/resource_bucket_policy.go +++ b/internal/framework/services/s3/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/s3" ) @@ -59,17 +60,17 @@ func (r *bucketPolicyResource) Configure(_ context.Context, req resource.Configu return } - client, ok := req.ProviderData.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/resource_bucket_public_access_block.go b/internal/framework/services/s3/resource_bucket_public_access_block.go index c96a9943d..e57558426 100644 --- a/internal/framework/services/s3/resource_bucket_public_access_block.go +++ b/internal/framework/services/s3/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/s3" "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.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/resource_bucket_sse_configuration.go b/internal/framework/services/s3/resource_bucket_sse_configuration.go index 2f8c31b6a..4a2590cdd 100644 --- a/internal/framework/services/s3/resource_bucket_sse_configuration.go +++ b/internal/framework/services/s3/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/s3" "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.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/resource_bucket_versioning.go b/internal/framework/services/s3/resource_bucket_versioning.go index c9d5a53d6..982a5ec3a 100644 --- a/internal/framework/services/s3/resource_bucket_versioning.go +++ b/internal/framework/services/s3/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/s3" "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.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/resource_bucket_website_configuration.go b/internal/framework/services/s3/resource_bucket_website_configuration.go index 3d0c8e31a..fc71ed532 100644 --- a/internal/framework/services/s3/resource_bucket_website_configuration.go +++ b/internal/framework/services/s3/resource_bucket_website_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/s3" "github.com/hashicorp/terraform-plugin-framework-validators/resourcevalidator" @@ -151,17 +152,17 @@ func (r *bucketWebsiteConfiguration) Configure(_ context.Context, req resource.C return } - client, ok := req.ProviderData.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/resource_object.go b/internal/framework/services/s3/resource_object.go index c2709cc38..a20f55fcf 100644 --- a/internal/framework/services/s3/resource_object.go +++ b/internal/framework/services/s3/resource_object.go @@ -19,6 +19,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" s3 "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3" ) @@ -188,17 +189,17 @@ func (r *objectResource) Configure(_ context.Context, req resource.ConfigureRequ return } - client, ok := req.ProviderData.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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/s3/resource_object_copy.go b/internal/framework/services/s3/resource_object_copy.go index fde577677..35ed07b9d 100644 --- a/internal/framework/services/s3/resource_object_copy.go +++ b/internal/framework/services/s3/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/s3" ) @@ -215,17 +216,17 @@ func (r *objectCopyResource) Configure(_ context.Context, req resource.Configure return } - client, ok := req.ProviderData.(*s3.Client) + clientBundle, ok := req.ProviderData.(*services.SdkBundle) if !ok { resp.Diagnostics.AddError( "Unexpected Data Source Configure Type", - fmt.Sprintf("Expected *s3.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. From 472425336a35fe66bf4ed2d3d07047f106c6148d Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Fri, 27 Sep 2024 16:20:08 +0300 Subject: [PATCH 14/30] refactor: move cloudapi client initialization in method, sonar fixes --- internal/framework/provider/provider.go | 34 +++++++++---------- .../data_source_s3_accesskey_test.go | 17 +++++----- .../data_source_s3_region_test.go | 1 + .../resource_s3_accesskey_test.go | 6 ++-- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/internal/framework/provider/provider.go b/internal/framework/provider/provider.go index c3abb90b5..c4a9dce0e 100644 --- a/internal/framework/provider/provider.go +++ b/internal/framework/provider/provider.go @@ -147,6 +147,7 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu region := os.Getenv("IONOS_S3_REGION") endpoint := os.Getenv("IONOS_API_URL") terraformVersion := req.TerraformVersion + version := ionoscloud.Version if !clientOpts.Token.IsNull() { token = clientOpts.Token.ValueString() @@ -185,28 +186,12 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu } cleanedEndpoint := cleanURL(endpoint) - version := "DEV" - - 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()} - cloudapiClient := ionoscloud.NewAPIClient(newConfig) - - version = ionoscloud.Version client := &services.SdkBundle{ CDNClient: cdnService.NewCDNClient(username, password, token, endpoint, version, terraformVersion), AutoscalingClient: autoscalingService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), CertManagerClient: cert.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), - CloudApiClient: cloudapiClient, + CloudApiClient: newCloudapiClient(username, password, token, endpoint, "DEV", terraformVersion), ContainerClient: crService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), DataplatformClient: dataplatformService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), DNSClient: dnsService.NewClient(username, password, token, cleanedEndpoint, version, terraformVersion), @@ -229,6 +214,21 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu resp.ResourceData = client } +func newCloudapiClient(username, password, token, endpoint, version, terraformVersion string) *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()} + return ionoscloud.NewAPIClient(newConfig) +} + // Resources returns the resources for the provider. func (p *IonosCloudProvider) Resources(_ context.Context) []func() resource.Resource { return []func() resource.Resource{ diff --git a/internal/framework/services/s3management/data_source_s3_accesskey_test.go b/internal/framework/services/s3management/data_source_s3_accesskey_test.go index 64bfc1421..b6b71b77b 100644 --- a/internal/framework/services/s3management/data_source_s3_accesskey_test.go +++ b/internal/framework/services/s3management/data_source_s3_accesskey_test.go @@ -13,6 +13,7 @@ import ( ) func TestAccS3AccesskeyDataSource(t *testing.T) { + name := "data.ionoscloud_s3_accesskey.testres" resource.Test(t, resource.TestCase{ ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, PreCheck: func() { @@ -20,21 +21,21 @@ func TestAccS3AccesskeyDataSource(t *testing.T) { }, Steps: []resource.TestStep{ { - Config: testAccAccesskeyDataSourceConfig_basic(), + Config: testAccAccesskeyDataSourceConfigBasic(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.ionoscloud_s3_accesskey.testres", "description", "desc"), - resource.TestCheckResourceAttrSet("data.ionoscloud_s3_accesskey.testres", "id"), - resource.TestCheckResourceAttrSet("data.ionoscloud_s3_accesskey.testres", "accesskey"), - resource.TestCheckResourceAttrSet("data.ionoscloud_s3_accesskey.testres", "canonical_user_id"), - resource.TestCheckResourceAttrSet("data.ionoscloud_s3_accesskey.testres", "contract_user_id"), + 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 testAccAccesskeyDataSourceConfig_basic() string { - return utils.ConfigCompose(testAccAccesskeyConfig_description("desc"), ` +func testAccAccesskeyDataSourceConfigBasic() string { + return utils.ConfigCompose(testAccAccesskeyConfigDescription("desc"), ` data "ionoscloud_s3_accesskey" "testres" { id = ionoscloud_s3_accesskey.test.id } diff --git a/internal/framework/services/s3management/data_source_s3_region_test.go b/internal/framework/services/s3management/data_source_s3_region_test.go index 20e0df579..e5f675829 100644 --- a/internal/framework/services/s3management/data_source_s3_region_test.go +++ b/internal/framework/services/s3management/data_source_s3_region_test.go @@ -12,6 +12,7 @@ import ( ) func TestAccS3RegionDataSource(t *testing.T) { + name := "data.ionoscloud_s3_region.testreg" resource.Test(t, resource.TestCase{ ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, PreCheck: func() { diff --git a/internal/framework/services/s3management/resource_s3_accesskey_test.go b/internal/framework/services/s3management/resource_s3_accesskey_test.go index 384bdfaaf..47c8113f4 100644 --- a/internal/framework/services/s3management/resource_s3_accesskey_test.go +++ b/internal/framework/services/s3management/resource_s3_accesskey_test.go @@ -23,7 +23,7 @@ func TestAccACcesskeyResource(t *testing.T) { }, Steps: []resource.TestStep{ { - Config: testAccAccesskeyConfig_description(description), + Config: testAccAccesskeyConfigDescription(description), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(name, "description", description), resource.TestCheckResourceAttrSet(name, "id"), @@ -34,7 +34,7 @@ func TestAccACcesskeyResource(t *testing.T) { ), }, { - Config: testAccAccesskeyConfig_description(descriptionUpdated), + Config: testAccAccesskeyConfigDescription(descriptionUpdated), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr(name, "description", descriptionUpdated), resource.TestCheckResourceAttrSet(name, "id"), @@ -48,7 +48,7 @@ func TestAccACcesskeyResource(t *testing.T) { }) } -func testAccAccesskeyConfig_description(description string) string { +func testAccAccesskeyConfigDescription(description string) string { return fmt.Sprintf(` resource "ionoscloud_s3_accesskey" "test" { description = %[1]q From e28f28151333c40f2c84e72491812f43849e5302 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Fri, 27 Sep 2024 16:23:27 +0300 Subject: [PATCH 15/30] doc: added comments --- services/s3management/accesskeys.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/s3management/accesskeys.go b/services/s3management/accesskeys.go index e876f0fda..ca146dfb9 100644 --- a/services/s3management/accesskeys.go +++ b/services/s3management/accesskeys.go @@ -101,6 +101,7 @@ func (c *Client) DeleteAccessKey(ctx context.Context, accessKeyId string, timeou func SetAccessKeyPropertiesToPlan(plan *AccesskeyResourceModel, accessKey s3management.AccessKey) { 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) } @@ -125,6 +126,7 @@ func SetAccessKeyPropertiesToPlan(plan *AccesskeyResourceModel, accessKey s3mana func SetAccessKeyPropertiesToDataSourcePlan(plan *AccessKeyDataSourceModel, accessKey s3management.AccessKey) { 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) } From 19f2115cc108c993b3f38825169d762bbea43252 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Fri, 27 Sep 2024 17:00:06 +0300 Subject: [PATCH 16/30] sonar fixes --- .../s3management/data_source_s3_region_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/framework/services/s3management/data_source_s3_region_test.go b/internal/framework/services/s3management/data_source_s3_region_test.go index e5f675829..800133cd8 100644 --- a/internal/framework/services/s3management/data_source_s3_region_test.go +++ b/internal/framework/services/s3management/data_source_s3_region_test.go @@ -20,20 +20,20 @@ func TestAccS3RegionDataSource(t *testing.T) { }, Steps: []resource.TestStep{ { - Config: testAccRegionDataSourceConfig_basic(), + Config: testAccRegionDataSourceConfigBasic(), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.ionoscloud_s3_region.testreg", "id", "de"), - resource.TestCheckResourceAttr("data.ionoscloud_s3_region.testreg", "endpoint", "s3.eu-central-1.ionoscloud.com"), - resource.TestCheckResourceAttr("data.ionoscloud_s3_region.testreg", "website", "s3-website.de-central.profitbricks.com"), - resource.TestCheckResourceAttr("data.ionoscloud_s3_region.testreg", "storage_classes.0", "standard"), - resource.TestCheckResourceAttr("data.ionoscloud_s3_region.testreg", "capability.iam", "false"), + 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 testAccRegionDataSourceConfig_basic() string { +func testAccRegionDataSourceConfigBasic() string { return ` data "ionoscloud_s3_region" "testreg" { id = "de" From 51920f0a359bff9fae26cdcdd49c493a14e87fca Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Mon, 30 Sep 2024 15:36:13 +0300 Subject: [PATCH 17/30] added the sdk to run linter --- go.mod | 3 + .../sdk-go-s3-management/.gitignore | 24 + .../sdk-go-s3-management/.travis.yml | 8 + .../sdk-go-s3-management/README.md | 148 ++ .../sdk-go-s3-management/api_accesskeys.go | 1196 +++++++++++++++++ .../sdk-go-s3-management/api_regions.go | 407 ++++++ .../sdk-go-s3-management/client.go | 745 ++++++++++ .../sdk-go-s3-management/configuration.go | 292 ++++ .../sdk-go-s3-management/logger.go | 80 ++ .../sdk-go-s3-management/model_access_key.go | 302 +++++ .../model_access_key_create.go | 167 +++ .../model_access_key_ensure.go | 212 +++ .../model_access_key_list.go | 392 ++++++ .../model_access_key_list_all_of.go | 258 ++++ .../model_access_key_properties.go | 302 +++++ .../sdk-go-s3-management/model_bucket.go | 169 +++ .../model_bucket_create.go | 167 +++ .../model_bucket_ensure.go | 212 +++ .../sdk-go-s3-management/model_bucket_read.go | 302 +++++ .../model_bucket_read_list.go | 392 ++++++ .../model_bucket_read_list_all_of.go | 258 ++++ .../sdk-go-s3-management/model_error.go | 166 +++ .../model_error_messages.go | 166 +++ .../sdk-go-s3-management/model_links.go | 210 +++ .../sdk-go-s3-management/model_metadata.go | 401 ++++++ .../model_metadata_with_status.go | 535 ++++++++ .../model_metadata_with_status_all_of.go | 212 +++ .../model_metadata_with_supported_regions.go | 580 ++++++++ ..._metadata_with_supported_regions_all_of.go | 124 ++ .../sdk-go-s3-management/model_pagination.go | 213 +++ .../sdk-go-s3-management/model_region.go | 302 +++++ .../model_region_create.go | 167 +++ .../model_region_ensure.go | 212 +++ .../sdk-go-s3-management/model_region_list.go | 392 ++++++ .../model_region_list_all_of.go | 258 ++++ .../model_region_properties.go | 347 +++++ .../model_region_properties_capability.go | 166 +++ .../model_storage_class.go | 302 +++++ .../model_storage_class_create.go | 167 +++ .../model_storage_class_ensure.go | 212 +++ .../model_storage_class_list.go | 392 ++++++ .../model_storage_class_list_all_of.go | 258 ++++ .../model_storage_class_properties.go | 214 +++ .../sdk-go-s3-management/response.go | 73 + .../ionos-cloud/sdk-go-s3-management/utils.go | 776 +++++++++++ vendor/modules.txt | 3 + 46 files changed, 12884 insertions(+) create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/.gitignore create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/.travis.yml create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/README.md create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/api_accesskeys.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/api_regions.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/client.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/configuration.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/logger.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_create.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_ensure.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_list.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_list_all_of.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_properties.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_create.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_ensure.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list_all_of.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error_messages.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_links.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status_all_of.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions_all_of.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_pagination.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_create.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_ensure.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_list.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_list_all_of.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties_capability.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_create.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_ensure.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_list.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_list_all_of.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_properties.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/response.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/utils.go diff --git a/go.mod b/go.mod index 8fe81c712..330c751ab 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-s3 v1.1.0 + github.com/ionos-cloud/sdk-go-s3-management v1.0.0 github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.1 github.com/ionos-cloud/sdk-go/v6 v6.2.1 github.com/mitchellh/go-homedir v1.1.0 @@ -38,6 +39,8 @@ require ( gopkg.in/yaml.v3 v3.0.1 ) +replace github.com/ionos-cloud/sdk-go-s3-management v1.0.0 => /home/radu/work/rubygeneration/sdk-go-s3-management + require ( github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/.gitignore b/vendor/github.com/ionos-cloud/sdk-go-s3-management/.gitignore new file mode 100644 index 000000000..daf913b1b --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-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-s3-management/.travis.yml b/vendor/github.com/ionos-cloud/sdk-go-s3-management/.travis.yml new file mode 100644 index 000000000..f5cb2ce9a --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-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-s3-management/README.md b/vendor/github.com/ionos-cloud/sdk-go-s3-management/README.md new file mode 100644 index 000000000..ca914283b --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/README.md @@ -0,0 +1,148 @@ +# Go API client for ionoscloud + +S3 Management API is a RESTful API that manages the S3 +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/net/context +``` + +Put the package under your project folder and add the following in import: + +```golang +import ionoscloud "github.com/ionos-cloud/ionoscloud_s3_management" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```golang +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. + +```golang +ctx := context.WithValue(context.Background(), ionoscloud.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. + +```golang +ctx := context.WithValue(context.Background(), ionoscloud.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +## Documentation for API Endpoints + +All URIs are relative to *https://s3.ionos.com* + +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 + + - [AccessKey](docs/models/AccessKey.md) + - [AccessKeyCreate](docs/models/AccessKeyCreate.md) + - [AccessKeyEnsure](docs/models/AccessKeyEnsure.md) + - [AccessKeyList](docs/models/AccessKeyList.md) + - [AccessKeyListAllOf](docs/models/AccessKeyListAllOf.md) + - [AccessKeyProperties](docs/models/AccessKeyProperties.md) + - [Bucket](docs/models/Bucket.md) + - [BucketCreate](docs/models/BucketCreate.md) + - [BucketEnsure](docs/models/BucketEnsure.md) + - [BucketRead](docs/models/BucketRead.md) + - [BucketReadList](docs/models/BucketReadList.md) + - [BucketReadListAllOf](docs/models/BucketReadListAllOf.md) + - [Error](docs/models/Error.md) + - [ErrorMessages](docs/models/ErrorMessages.md) + - [Links](docs/models/Links.md) + - [Metadata](docs/models/Metadata.md) + - [MetadataWithStatus](docs/models/MetadataWithStatus.md) + - [MetadataWithStatusAllOf](docs/models/MetadataWithStatusAllOf.md) + - [MetadataWithSupportedRegions](docs/models/MetadataWithSupportedRegions.md) + - [MetadataWithSupportedRegionsAllOf](docs/models/MetadataWithSupportedRegionsAllOf.md) + - [Pagination](docs/models/Pagination.md) + - [Region](docs/models/Region.md) + - [RegionCreate](docs/models/RegionCreate.md) + - [RegionEnsure](docs/models/RegionEnsure.md) + - [RegionList](docs/models/RegionList.md) + - [RegionListAllOf](docs/models/RegionListAllOf.md) + - [RegionProperties](docs/models/RegionProperties.md) + - [RegionPropertiesCapability](docs/models/RegionPropertiesCapability.md) + - [StorageClass](docs/models/StorageClass.md) + - [StorageClassCreate](docs/models/StorageClassCreate.md) + - [StorageClassEnsure](docs/models/StorageClassEnsure.md) + - [StorageClassList](docs/models/StorageClassList.md) + - [StorageClassListAllOf](docs/models/StorageClassListAllOf.md) + - [StorageClassProperties](docs/models/StorageClassProperties.md) + + +## Documentation For Authorization + + +Authentication schemes defined for the API: +### tokenAuth + +- **Type**: HTTP Bearer token authentication + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING") +r, err := client.Service.Operation(auth, args) +``` + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + + + diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_accesskeys.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_accesskeys.go new file mode 100644 index 000000000..587fe9ef7 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_accesskeys.go @@ -0,0 +1,1196 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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() (AccessKey, *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 AccessKey + */ +func (a *AccesskeysApiService) AccesskeysFindByIdExecute(r ApiAccesskeysFindByIdRequest) (AccessKey, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccessKey + ) + + 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() (AccessKeyList, *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 AccessKeyList + */ +func (a *AccesskeysApiService) AccesskeysGetExecute(r ApiAccesskeysGetRequest) (AccessKeyList, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccessKeyList + ) + + 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() (AccessKey, *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 AccessKey + */ +func (a *AccesskeysApiService) AccesskeysPostExecute(r ApiAccesskeysPostRequest) (AccessKey, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccessKey + ) + + 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() (AccessKey, *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 AccessKey + */ +func (a *AccesskeysApiService) AccesskeysPutExecute(r ApiAccesskeysPutRequest) (AccessKey, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccessKey + ) + + 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 == 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 == 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 == 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() (AccessKey, *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 AccessKey + */ +func (a *AccesskeysApiService) AccesskeysRenewExecute(r ApiAccesskeysRenewRequest) (AccessKey, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue AccessKey + ) + + 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 == 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 == 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 == 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-s3-management/api_regions.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_regions.go new file mode 100644 index 000000000..6cb010101 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_regions.go @@ -0,0 +1,407 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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() (Region, *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 Region + */ +func (a *RegionsApiService) RegionsFindByRegionExecute(r ApiRegionsFindByRegionRequest) (Region, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue Region + ) + + 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() (RegionList, *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 RegionList + */ +func (a *RegionsApiService) RegionsGetExecute(r ApiRegionsGetRequest) (RegionList, *APIResponse, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue RegionList + ) + + 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-s3-management/client.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/client.go new file mode 100644 index 000000000..3e00a62f9 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/client.go @@ -0,0 +1,745 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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 - S3 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-s3-management/configuration.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/configuration.go new file mode 100644 index 000000000..3fb06dd28 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/configuration.go @@ -0,0 +1,292 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-ionoscloud_s3_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-s3-management/logger.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/logger.go new file mode 100644 index 000000000..8e6f49cac --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/logger.go @@ -0,0 +1,80 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_access_key.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key.go new file mode 100644 index 000000000..afb5eee0a --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key.go @@ -0,0 +1,302 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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 struct for AccessKey +type AccessKey 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 *AccessKeyProperties `json:"properties"` +} + +// 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(id string, type_ string, href string, metadata MetadataWithSupportedRegions, properties AccessKeyProperties) *AccessKey { + this := AccessKey{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Metadata = &metadata + this.Properties = &properties + + 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 +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKey) 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 *AccessKey) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *AccessKey) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *AccessKey) 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 *AccessKey) 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 *AccessKey) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *AccessKey) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *AccessKey) 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 *AccessKey) 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 *AccessKey) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *AccessKey) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *AccessKey) 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 *AccessKey) 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 *AccessKey) GetMetadataOk() (*MetadataWithSupportedRegions, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *AccessKey) SetMetadata(v MetadataWithSupportedRegions) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *AccessKey) 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 AccessKeyProperties will be returned +func (o *AccessKey) GetProperties() *AccessKeyProperties { + 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 *AccessKey) GetPropertiesOk() (*AccessKeyProperties, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *AccessKey) SetProperties(v AccessKeyProperties) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *AccessKey) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o AccessKey) 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 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-s3-management/model_access_key_create.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_create.go new file mode 100644 index 000000000..6224a3284 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_create.go @@ -0,0 +1,167 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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 *AccessKeyProperties `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 AccessKeyProperties) *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 AccessKeyProperties will be returned +func (o *AccessKeyCreate) GetProperties() *AccessKeyProperties { + 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() (*AccessKeyProperties, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *AccessKeyCreate) SetProperties(v AccessKeyProperties) { + + 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-s3-management/model_access_key_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_ensure.go new file mode 100644 index 000000000..2e24bd6c5 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_ensure.go @@ -0,0 +1,212 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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 *AccessKeyProperties `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 AccessKeyProperties) *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 AccessKeyProperties will be returned +func (o *AccessKeyEnsure) GetProperties() *AccessKeyProperties { + 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() (*AccessKeyProperties, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *AccessKeyEnsure) SetProperties(v AccessKeyProperties) { + + 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-s3-management/model_access_key_list.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_list.go new file mode 100644 index 000000000..ef44a9c40 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_list.go @@ -0,0 +1,392 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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" +) + +// AccessKeyList struct for AccessKeyList +type AccessKeyList 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 *[]AccessKey `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"` +} + +// NewAccessKeyList instantiates a new AccessKeyList 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 NewAccessKeyList(id string, type_ string, href string, offset int32, limit int32, links Links) *AccessKeyList { + this := AccessKeyList{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Offset = &offset + this.Limit = &limit + this.Links = &links + + return &this +} + +// NewAccessKeyListWithDefaults instantiates a new AccessKeyList 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 NewAccessKeyListWithDefaults() *AccessKeyList { + this := AccessKeyList{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKeyList) 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 *AccessKeyList) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *AccessKeyList) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *AccessKeyList) 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 *AccessKeyList) 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 *AccessKeyList) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *AccessKeyList) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *AccessKeyList) 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 *AccessKeyList) 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 *AccessKeyList) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *AccessKeyList) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *AccessKeyList) 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 []AccessKey will be returned +func (o *AccessKeyList) GetItems() *[]AccessKey { + 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 *AccessKeyList) GetItemsOk() (*[]AccessKey, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *AccessKeyList) SetItems(v []AccessKey) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *AccessKeyList) 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 *AccessKeyList) 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 *AccessKeyList) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Offset, true +} + +// SetOffset sets field value +func (o *AccessKeyList) SetOffset(v int32) { + + o.Offset = &v + +} + +// HasOffset returns a boolean if a field has been set. +func (o *AccessKeyList) 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 *AccessKeyList) 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 *AccessKeyList) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Limit, true +} + +// SetLimit sets field value +func (o *AccessKeyList) SetLimit(v int32) { + + o.Limit = &v + +} + +// HasLimit returns a boolean if a field has been set. +func (o *AccessKeyList) 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 *AccessKeyList) 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 *AccessKeyList) GetLinksOk() (*Links, bool) { + if o == nil { + return nil, false + } + + return o.Links, true +} + +// SetLinks sets field value +func (o *AccessKeyList) SetLinks(v Links) { + + o.Links = &v + +} + +// HasLinks returns a boolean if a field has been set. +func (o *AccessKeyList) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +func (o AccessKeyList) 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 NullableAccessKeyList struct { + value *AccessKeyList + isSet bool +} + +func (v NullableAccessKeyList) Get() *AccessKeyList { + return v.value +} + +func (v *NullableAccessKeyList) Set(val *AccessKeyList) { + v.value = val + v.isSet = true +} + +func (v NullableAccessKeyList) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessKeyList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessKeyList(val *AccessKeyList) *NullableAccessKeyList { + return &NullableAccessKeyList{value: val, isSet: true} +} + +func (v NullableAccessKeyList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessKeyList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_list_all_of.go new file mode 100644 index 000000000..f67efc9d2 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_list_all_of.go @@ -0,0 +1,258 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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" +) + +// AccessKeyListAllOf struct for AccessKeyListAllOf +type AccessKeyListAllOf 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 *[]AccessKey `json:"items,omitempty"` +} + +// NewAccessKeyListAllOf instantiates a new AccessKeyListAllOf 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 NewAccessKeyListAllOf(id string, type_ string, href string) *AccessKeyListAllOf { + this := AccessKeyListAllOf{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + + return &this +} + +// NewAccessKeyListAllOfWithDefaults instantiates a new AccessKeyListAllOf 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 NewAccessKeyListAllOfWithDefaults() *AccessKeyListAllOf { + this := AccessKeyListAllOf{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKeyListAllOf) 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 *AccessKeyListAllOf) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *AccessKeyListAllOf) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *AccessKeyListAllOf) 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 *AccessKeyListAllOf) 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 *AccessKeyListAllOf) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *AccessKeyListAllOf) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *AccessKeyListAllOf) 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 *AccessKeyListAllOf) 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 *AccessKeyListAllOf) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *AccessKeyListAllOf) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *AccessKeyListAllOf) 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 []AccessKey will be returned +func (o *AccessKeyListAllOf) GetItems() *[]AccessKey { + 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 *AccessKeyListAllOf) GetItemsOk() (*[]AccessKey, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *AccessKeyListAllOf) SetItems(v []AccessKey) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *AccessKeyListAllOf) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +func (o AccessKeyListAllOf) 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 NullableAccessKeyListAllOf struct { + value *AccessKeyListAllOf + isSet bool +} + +func (v NullableAccessKeyListAllOf) Get() *AccessKeyListAllOf { + return v.value +} + +func (v *NullableAccessKeyListAllOf) Set(val *AccessKeyListAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableAccessKeyListAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessKeyListAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessKeyListAllOf(val *AccessKeyListAllOf) *NullableAccessKeyListAllOf { + return &NullableAccessKeyListAllOf{value: val, isSet: true} +} + +func (v NullableAccessKeyListAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessKeyListAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_properties.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_properties.go new file mode 100644 index 000000000..7b0734baa --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_properties.go @@ -0,0 +1,302 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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" +) + +// AccessKeyProperties Per user access key. +type AccessKeyProperties 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"` +} + +// NewAccessKeyProperties instantiates a new AccessKeyProperties 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 NewAccessKeyProperties(description string, accessKey string, secretKey string) *AccessKeyProperties { + this := AccessKeyProperties{} + + this.Description = &description + this.AccessKey = &accessKey + this.SecretKey = &secretKey + + return &this +} + +// NewAccessKeyPropertiesWithDefaults instantiates a new AccessKeyProperties 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 NewAccessKeyPropertiesWithDefaults() *AccessKeyProperties { + this := AccessKeyProperties{} + return &this +} + +// GetDescription returns the Description field value +// If the value is explicit nil, the zero value for string will be returned +func (o *AccessKeyProperties) 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 *AccessKeyProperties) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Description, true +} + +// SetDescription sets field value +func (o *AccessKeyProperties) SetDescription(v string) { + + o.Description = &v + +} + +// HasDescription returns a boolean if a field has been set. +func (o *AccessKeyProperties) 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 *AccessKeyProperties) 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 *AccessKeyProperties) GetAccessKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.AccessKey, true +} + +// SetAccessKey sets field value +func (o *AccessKeyProperties) SetAccessKey(v string) { + + o.AccessKey = &v + +} + +// HasAccessKey returns a boolean if a field has been set. +func (o *AccessKeyProperties) 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 *AccessKeyProperties) 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 *AccessKeyProperties) GetSecretKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.SecretKey, true +} + +// SetSecretKey sets field value +func (o *AccessKeyProperties) SetSecretKey(v string) { + + o.SecretKey = &v + +} + +// HasSecretKey returns a boolean if a field has been set. +func (o *AccessKeyProperties) 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 *AccessKeyProperties) 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 *AccessKeyProperties) GetCanonicalUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.CanonicalUserId, true +} + +// SetCanonicalUserId sets field value +func (o *AccessKeyProperties) SetCanonicalUserId(v string) { + + o.CanonicalUserId = &v + +} + +// HasCanonicalUserId returns a boolean if a field has been set. +func (o *AccessKeyProperties) 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 *AccessKeyProperties) 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 *AccessKeyProperties) GetContractUserIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.ContractUserId, true +} + +// SetContractUserId sets field value +func (o *AccessKeyProperties) SetContractUserId(v string) { + + o.ContractUserId = &v + +} + +// HasContractUserId returns a boolean if a field has been set. +func (o *AccessKeyProperties) HasContractUserId() bool { + if o != nil && o.ContractUserId != nil { + return true + } + + return false +} + +func (o AccessKeyProperties) 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 NullableAccessKeyProperties struct { + value *AccessKeyProperties + isSet bool +} + +func (v NullableAccessKeyProperties) Get() *AccessKeyProperties { + return v.value +} + +func (v *NullableAccessKeyProperties) Set(val *AccessKeyProperties) { + v.value = val + v.isSet = true +} + +func (v NullableAccessKeyProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessKeyProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessKeyProperties(val *AccessKeyProperties) *NullableAccessKeyProperties { + return &NullableAccessKeyProperties{value: val, isSet: true} +} + +func (v NullableAccessKeyProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessKeyProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket.go new file mode 100644 index 000000000..647f2dffe --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket.go @@ -0,0 +1,169 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_bucket_create.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_create.go new file mode 100644 index 000000000..d4781dffc --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_create.go @@ -0,0 +1,167 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_bucket_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_ensure.go new file mode 100644 index 000000000..227872708 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_ensure.go @@ -0,0 +1,212 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_bucket_read.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read.go new file mode 100644 index 000000000..7a33521f7 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read.go @@ -0,0 +1,302 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_bucket_read_list.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list.go new file mode 100644 index 000000000..6e2b7ef28 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list.go @@ -0,0 +1,392 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_bucket_read_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list_all_of.go new file mode 100644 index 000000000..853ce81df --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list_all_of.go @@ -0,0 +1,258 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_error.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error.go new file mode 100644 index 000000000..6f03dd2db --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error.go @@ -0,0 +1,166 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_error_messages.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error_messages.go new file mode 100644 index 000000000..80bd8b4a0 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error_messages.go @@ -0,0 +1,166 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_links.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_links.go new file mode 100644 index 000000000..44d2c2093 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_links.go @@ -0,0 +1,210 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata.go new file mode 100644 index 000000000..dc4f6bcc4 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata.go @@ -0,0 +1,401 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_metadata_with_status.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status.go new file mode 100644 index 000000000..b112fe048 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status.go @@ -0,0 +1,535 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_metadata_with_status_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status_all_of.go new file mode 100644 index 000000000..c3a28a865 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status_all_of.go @@ -0,0 +1,212 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_metadata_with_supported_regions.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions.go new file mode 100644 index 000000000..a8863656c --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions.go @@ -0,0 +1,580 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_metadata_with_supported_regions_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions_all_of.go new file mode 100644 index 000000000..fa3f2b5e0 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions_all_of.go @@ -0,0 +1,124 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_pagination.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_pagination.go new file mode 100644 index 000000000..6d53cc55f --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_pagination.go @@ -0,0 +1,213 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/model_region.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region.go new file mode 100644 index 000000000..75b29cbd5 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region.go @@ -0,0 +1,302 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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 struct for Region +type Region 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 *RegionProperties `json:"properties"` +} + +// 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(id string, type_ string, href string, metadata map[string]interface{}, properties RegionProperties) *Region { + this := Region{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Metadata = &metadata + this.Properties = &properties + + 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 +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *Region) 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 *Region) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *Region) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *Region) 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 *Region) 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 *Region) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *Region) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *Region) 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 *Region) 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 *Region) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *Region) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *Region) 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 *Region) 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 *Region) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *Region) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Region) 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 RegionProperties will be returned +func (o *Region) GetProperties() *RegionProperties { + 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 *Region) GetPropertiesOk() (*RegionProperties, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *Region) SetProperties(v RegionProperties) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *Region) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o Region) 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 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-s3-management/model_region_create.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_create.go new file mode 100644 index 000000000..697a8a36b --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_create.go @@ -0,0 +1,167 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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 *RegionProperties `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 RegionProperties) *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 RegionProperties will be returned +func (o *RegionCreate) GetProperties() *RegionProperties { + 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() (*RegionProperties, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *RegionCreate) SetProperties(v RegionProperties) { + + 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-s3-management/model_region_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_ensure.go new file mode 100644 index 000000000..8ff2e9a0d --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_ensure.go @@ -0,0 +1,212 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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 *RegionProperties `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 RegionProperties) *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 RegionProperties will be returned +func (o *RegionEnsure) GetProperties() *RegionProperties { + 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() (*RegionProperties, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *RegionEnsure) SetProperties(v RegionProperties) { + + 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-s3-management/model_region_list.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_list.go new file mode 100644 index 000000000..bd36fcffd --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_list.go @@ -0,0 +1,392 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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" +) + +// RegionList struct for RegionList +type RegionList 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 *[]Region `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"` +} + +// NewRegionList instantiates a new RegionList 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 NewRegionList(id string, type_ string, href string, offset int32, limit int32, links Links) *RegionList { + this := RegionList{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Offset = &offset + this.Limit = &limit + this.Links = &links + + return &this +} + +// NewRegionListWithDefaults instantiates a new RegionList 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 NewRegionListWithDefaults() *RegionList { + this := RegionList{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RegionList) 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 *RegionList) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *RegionList) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *RegionList) 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 *RegionList) 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 *RegionList) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *RegionList) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *RegionList) 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 *RegionList) 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 *RegionList) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *RegionList) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *RegionList) 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 []Region will be returned +func (o *RegionList) GetItems() *[]Region { + 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 *RegionList) GetItemsOk() (*[]Region, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *RegionList) SetItems(v []Region) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *RegionList) 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 *RegionList) 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 *RegionList) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Offset, true +} + +// SetOffset sets field value +func (o *RegionList) SetOffset(v int32) { + + o.Offset = &v + +} + +// HasOffset returns a boolean if a field has been set. +func (o *RegionList) 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 *RegionList) 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 *RegionList) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Limit, true +} + +// SetLimit sets field value +func (o *RegionList) SetLimit(v int32) { + + o.Limit = &v + +} + +// HasLimit returns a boolean if a field has been set. +func (o *RegionList) 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 *RegionList) 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 *RegionList) GetLinksOk() (*Links, bool) { + if o == nil { + return nil, false + } + + return o.Links, true +} + +// SetLinks sets field value +func (o *RegionList) SetLinks(v Links) { + + o.Links = &v + +} + +// HasLinks returns a boolean if a field has been set. +func (o *RegionList) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +func (o RegionList) 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 NullableRegionList struct { + value *RegionList + isSet bool +} + +func (v NullableRegionList) Get() *RegionList { + return v.value +} + +func (v *NullableRegionList) Set(val *RegionList) { + v.value = val + v.isSet = true +} + +func (v NullableRegionList) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionList(val *RegionList) *NullableRegionList { + return &NullableRegionList{value: val, isSet: true} +} + +func (v NullableRegionList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_list_all_of.go new file mode 100644 index 000000000..01e568265 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_list_all_of.go @@ -0,0 +1,258 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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" +) + +// RegionListAllOf struct for RegionListAllOf +type RegionListAllOf 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 *[]Region `json:"items,omitempty"` +} + +// NewRegionListAllOf instantiates a new RegionListAllOf 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 NewRegionListAllOf(id string, type_ string, href string) *RegionListAllOf { + this := RegionListAllOf{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + + return &this +} + +// NewRegionListAllOfWithDefaults instantiates a new RegionListAllOf 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 NewRegionListAllOfWithDefaults() *RegionListAllOf { + this := RegionListAllOf{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *RegionListAllOf) 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 *RegionListAllOf) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *RegionListAllOf) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *RegionListAllOf) 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 *RegionListAllOf) 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 *RegionListAllOf) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *RegionListAllOf) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *RegionListAllOf) 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 *RegionListAllOf) 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 *RegionListAllOf) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *RegionListAllOf) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *RegionListAllOf) 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 []Region will be returned +func (o *RegionListAllOf) GetItems() *[]Region { + 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 *RegionListAllOf) GetItemsOk() (*[]Region, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *RegionListAllOf) SetItems(v []Region) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *RegionListAllOf) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +func (o RegionListAllOf) 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 NullableRegionListAllOf struct { + value *RegionListAllOf + isSet bool +} + +func (v NullableRegionListAllOf) Get() *RegionListAllOf { + return v.value +} + +func (v *NullableRegionListAllOf) Set(val *RegionListAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableRegionListAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionListAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionListAllOf(val *RegionListAllOf) *NullableRegionListAllOf { + return &NullableRegionListAllOf{value: val, isSet: true} +} + +func (v NullableRegionListAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionListAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties.go new file mode 100644 index 000000000..fc95634b2 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties.go @@ -0,0 +1,347 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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" +) + +// RegionProperties IONOS Cloud S3 regions they define the location of the bucket, can also be used as `LocationConstraint` for bucket creation. +type RegionProperties 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 *RegionPropertiesCapability `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"` +} + +// NewRegionProperties instantiates a new RegionProperties 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 NewRegionProperties(version int32, endpoint string, website string, capability RegionPropertiesCapability, location string) *RegionProperties { + this := RegionProperties{} + + this.Version = &version + this.Endpoint = &endpoint + this.Website = &website + this.Capability = &capability + this.Location = &location + + return &this +} + +// NewRegionPropertiesWithDefaults instantiates a new RegionProperties 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 NewRegionPropertiesWithDefaults() *RegionProperties { + this := RegionProperties{} + return &this +} + +// GetVersion returns the Version field value +// If the value is explicit nil, the zero value for int32 will be returned +func (o *RegionProperties) 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 *RegionProperties) GetVersionOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Version, true +} + +// SetVersion sets field value +func (o *RegionProperties) SetVersion(v int32) { + + o.Version = &v + +} + +// HasVersion returns a boolean if a field has been set. +func (o *RegionProperties) 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 *RegionProperties) 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 *RegionProperties) GetEndpointOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Endpoint, true +} + +// SetEndpoint sets field value +func (o *RegionProperties) SetEndpoint(v string) { + + o.Endpoint = &v + +} + +// HasEndpoint returns a boolean if a field has been set. +func (o *RegionProperties) 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 *RegionProperties) 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 *RegionProperties) GetWebsiteOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Website, true +} + +// SetWebsite sets field value +func (o *RegionProperties) SetWebsite(v string) { + + o.Website = &v + +} + +// HasWebsite returns a boolean if a field has been set. +func (o *RegionProperties) 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 RegionPropertiesCapability will be returned +func (o *RegionProperties) GetCapability() *RegionPropertiesCapability { + 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 *RegionProperties) GetCapabilityOk() (*RegionPropertiesCapability, bool) { + if o == nil { + return nil, false + } + + return o.Capability, true +} + +// SetCapability sets field value +func (o *RegionProperties) SetCapability(v RegionPropertiesCapability) { + + o.Capability = &v + +} + +// HasCapability returns a boolean if a field has been set. +func (o *RegionProperties) 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 *RegionProperties) 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 *RegionProperties) GetStorageclassesOk() (*[]string, bool) { + if o == nil { + return nil, false + } + + return o.Storageclasses, true +} + +// SetStorageclasses sets field value +func (o *RegionProperties) SetStorageclasses(v []string) { + + o.Storageclasses = &v + +} + +// HasStorageclasses returns a boolean if a field has been set. +func (o *RegionProperties) 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 *RegionProperties) 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 *RegionProperties) GetLocationOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Location, true +} + +// SetLocation sets field value +func (o *RegionProperties) SetLocation(v string) { + + o.Location = &v + +} + +// HasLocation returns a boolean if a field has been set. +func (o *RegionProperties) HasLocation() bool { + if o != nil && o.Location != nil { + return true + } + + return false +} + +func (o RegionProperties) 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 NullableRegionProperties struct { + value *RegionProperties + isSet bool +} + +func (v NullableRegionProperties) Get() *RegionProperties { + return v.value +} + +func (v *NullableRegionProperties) Set(val *RegionProperties) { + v.value = val + v.isSet = true +} + +func (v NullableRegionProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionProperties(val *RegionProperties) *NullableRegionProperties { + return &NullableRegionProperties{value: val, isSet: true} +} + +func (v NullableRegionProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties_capability.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties_capability.go new file mode 100644 index 000000000..d257ddde8 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties_capability.go @@ -0,0 +1,166 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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" +) + +// RegionPropertiesCapability The capabilities of the region +type RegionPropertiesCapability 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"` +} + +// NewRegionPropertiesCapability instantiates a new RegionPropertiesCapability 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 NewRegionPropertiesCapability() *RegionPropertiesCapability { + this := RegionPropertiesCapability{} + + return &this +} + +// NewRegionPropertiesCapabilityWithDefaults instantiates a new RegionPropertiesCapability 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 NewRegionPropertiesCapabilityWithDefaults() *RegionPropertiesCapability { + this := RegionPropertiesCapability{} + return &this +} + +// GetIam returns the Iam field value +// If the value is explicit nil, the zero value for bool will be returned +func (o *RegionPropertiesCapability) 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 *RegionPropertiesCapability) GetIamOk() (*bool, bool) { + if o == nil { + return nil, false + } + + return o.Iam, true +} + +// SetIam sets field value +func (o *RegionPropertiesCapability) SetIam(v bool) { + + o.Iam = &v + +} + +// HasIam returns a boolean if a field has been set. +func (o *RegionPropertiesCapability) 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 *RegionPropertiesCapability) 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 *RegionPropertiesCapability) GetS3selectOk() (*bool, bool) { + if o == nil { + return nil, false + } + + return o.S3select, true +} + +// SetS3select sets field value +func (o *RegionPropertiesCapability) SetS3select(v bool) { + + o.S3select = &v + +} + +// HasS3select returns a boolean if a field has been set. +func (o *RegionPropertiesCapability) HasS3select() bool { + if o != nil && o.S3select != nil { + return true + } + + return false +} + +func (o RegionPropertiesCapability) 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 NullableRegionPropertiesCapability struct { + value *RegionPropertiesCapability + isSet bool +} + +func (v NullableRegionPropertiesCapability) Get() *RegionPropertiesCapability { + return v.value +} + +func (v *NullableRegionPropertiesCapability) Set(val *RegionPropertiesCapability) { + v.value = val + v.isSet = true +} + +func (v NullableRegionPropertiesCapability) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionPropertiesCapability) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionPropertiesCapability(val *RegionPropertiesCapability) *NullableRegionPropertiesCapability { + return &NullableRegionPropertiesCapability{value: val, isSet: true} +} + +func (v NullableRegionPropertiesCapability) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionPropertiesCapability) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class.go new file mode 100644 index 000000000..cc06f6a1f --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class.go @@ -0,0 +1,302 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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 struct for StorageClass +type StorageClass 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 *StorageClassProperties `json:"properties"` +} + +// 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(id string, type_ string, href string, metadata map[string]interface{}, properties StorageClassProperties) *StorageClass { + this := StorageClass{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Metadata = &metadata + this.Properties = &properties + + 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 +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClass) 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 *StorageClass) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *StorageClass) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *StorageClass) 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 *StorageClass) 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 *StorageClass) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *StorageClass) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *StorageClass) 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 *StorageClass) 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 *StorageClass) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *StorageClass) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *StorageClass) 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 *StorageClass) 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 *StorageClass) GetMetadataOk() (*map[string]interface{}, bool) { + if o == nil { + return nil, false + } + + return o.Metadata, true +} + +// SetMetadata sets field value +func (o *StorageClass) SetMetadata(v map[string]interface{}) { + + o.Metadata = &v + +} + +// HasMetadata returns a boolean if a field has been set. +func (o *StorageClass) 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 StorageClassProperties will be returned +func (o *StorageClass) GetProperties() *StorageClassProperties { + 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 *StorageClass) GetPropertiesOk() (*StorageClassProperties, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *StorageClass) SetProperties(v StorageClassProperties) { + + o.Properties = &v + +} + +// HasProperties returns a boolean if a field has been set. +func (o *StorageClass) HasProperties() bool { + if o != nil && o.Properties != nil { + return true + } + + return false +} + +func (o StorageClass) 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 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-s3-management/model_storage_class_create.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_create.go new file mode 100644 index 000000000..eb4813d4b --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_create.go @@ -0,0 +1,167 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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 *StorageClassProperties `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 StorageClassProperties) *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 StorageClassProperties will be returned +func (o *StorageClassCreate) GetProperties() *StorageClassProperties { + 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() (*StorageClassProperties, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *StorageClassCreate) SetProperties(v StorageClassProperties) { + + 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-s3-management/model_storage_class_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_ensure.go new file mode 100644 index 000000000..46f0ad2b4 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_ensure.go @@ -0,0 +1,212 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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 *StorageClassProperties `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 StorageClassProperties) *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 StorageClassProperties will be returned +func (o *StorageClassEnsure) GetProperties() *StorageClassProperties { + 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() (*StorageClassProperties, bool) { + if o == nil { + return nil, false + } + + return o.Properties, true +} + +// SetProperties sets field value +func (o *StorageClassEnsure) SetProperties(v StorageClassProperties) { + + 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-s3-management/model_storage_class_list.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_list.go new file mode 100644 index 000000000..d89422b20 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_list.go @@ -0,0 +1,392 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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" +) + +// StorageClassList struct for StorageClassList +type StorageClassList 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 *[]StorageClass `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"` +} + +// NewStorageClassList instantiates a new StorageClassList 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 NewStorageClassList(id string, type_ string, href string, offset int32, limit int32, links Links) *StorageClassList { + this := StorageClassList{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + this.Offset = &offset + this.Limit = &limit + this.Links = &links + + return &this +} + +// NewStorageClassListWithDefaults instantiates a new StorageClassList 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 NewStorageClassListWithDefaults() *StorageClassList { + this := StorageClassList{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClassList) 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 *StorageClassList) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *StorageClassList) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *StorageClassList) 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 *StorageClassList) 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 *StorageClassList) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *StorageClassList) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *StorageClassList) 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 *StorageClassList) 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 *StorageClassList) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *StorageClassList) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *StorageClassList) 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 []StorageClass will be returned +func (o *StorageClassList) GetItems() *[]StorageClass { + 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 *StorageClassList) GetItemsOk() (*[]StorageClass, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *StorageClassList) SetItems(v []StorageClass) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *StorageClassList) 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 *StorageClassList) 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 *StorageClassList) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Offset, true +} + +// SetOffset sets field value +func (o *StorageClassList) SetOffset(v int32) { + + o.Offset = &v + +} + +// HasOffset returns a boolean if a field has been set. +func (o *StorageClassList) 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 *StorageClassList) 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 *StorageClassList) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + + return o.Limit, true +} + +// SetLimit sets field value +func (o *StorageClassList) SetLimit(v int32) { + + o.Limit = &v + +} + +// HasLimit returns a boolean if a field has been set. +func (o *StorageClassList) 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 *StorageClassList) 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 *StorageClassList) GetLinksOk() (*Links, bool) { + if o == nil { + return nil, false + } + + return o.Links, true +} + +// SetLinks sets field value +func (o *StorageClassList) SetLinks(v Links) { + + o.Links = &v + +} + +// HasLinks returns a boolean if a field has been set. +func (o *StorageClassList) HasLinks() bool { + if o != nil && o.Links != nil { + return true + } + + return false +} + +func (o StorageClassList) 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 NullableStorageClassList struct { + value *StorageClassList + isSet bool +} + +func (v NullableStorageClassList) Get() *StorageClassList { + return v.value +} + +func (v *NullableStorageClassList) Set(val *StorageClassList) { + v.value = val + v.isSet = true +} + +func (v NullableStorageClassList) IsSet() bool { + return v.isSet +} + +func (v *NullableStorageClassList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStorageClassList(val *StorageClassList) *NullableStorageClassList { + return &NullableStorageClassList{value: val, isSet: true} +} + +func (v NullableStorageClassList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStorageClassList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_list_all_of.go new file mode 100644 index 000000000..e4e65dab8 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_list_all_of.go @@ -0,0 +1,258 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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" +) + +// StorageClassListAllOf struct for StorageClassListAllOf +type StorageClassListAllOf 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 *[]StorageClass `json:"items,omitempty"` +} + +// NewStorageClassListAllOf instantiates a new StorageClassListAllOf 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 NewStorageClassListAllOf(id string, type_ string, href string) *StorageClassListAllOf { + this := StorageClassListAllOf{} + + this.Id = &id + this.Type = &type_ + this.Href = &href + + return &this +} + +// NewStorageClassListAllOfWithDefaults instantiates a new StorageClassListAllOf 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 NewStorageClassListAllOfWithDefaults() *StorageClassListAllOf { + this := StorageClassListAllOf{} + return &this +} + +// GetId returns the Id field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClassListAllOf) 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 *StorageClassListAllOf) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Id, true +} + +// SetId sets field value +func (o *StorageClassListAllOf) SetId(v string) { + + o.Id = &v + +} + +// HasId returns a boolean if a field has been set. +func (o *StorageClassListAllOf) 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 *StorageClassListAllOf) 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 *StorageClassListAllOf) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Type, true +} + +// SetType sets field value +func (o *StorageClassListAllOf) SetType(v string) { + + o.Type = &v + +} + +// HasType returns a boolean if a field has been set. +func (o *StorageClassListAllOf) 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 *StorageClassListAllOf) 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 *StorageClassListAllOf) GetHrefOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Href, true +} + +// SetHref sets field value +func (o *StorageClassListAllOf) SetHref(v string) { + + o.Href = &v + +} + +// HasHref returns a boolean if a field has been set. +func (o *StorageClassListAllOf) 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 []StorageClass will be returned +func (o *StorageClassListAllOf) GetItems() *[]StorageClass { + 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 *StorageClassListAllOf) GetItemsOk() (*[]StorageClass, bool) { + if o == nil { + return nil, false + } + + return o.Items, true +} + +// SetItems sets field value +func (o *StorageClassListAllOf) SetItems(v []StorageClass) { + + o.Items = &v + +} + +// HasItems returns a boolean if a field has been set. +func (o *StorageClassListAllOf) HasItems() bool { + if o != nil && o.Items != nil { + return true + } + + return false +} + +func (o StorageClassListAllOf) 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 NullableStorageClassListAllOf struct { + value *StorageClassListAllOf + isSet bool +} + +func (v NullableStorageClassListAllOf) Get() *StorageClassListAllOf { + return v.value +} + +func (v *NullableStorageClassListAllOf) Set(val *StorageClassListAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableStorageClassListAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableStorageClassListAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStorageClassListAllOf(val *StorageClassListAllOf) *NullableStorageClassListAllOf { + return &NullableStorageClassListAllOf{value: val, isSet: true} +} + +func (v NullableStorageClassListAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStorageClassListAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_properties.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_properties.go new file mode 100644 index 000000000..da6b4e179 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_properties.go @@ -0,0 +1,214 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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" +) + +// StorageClassProperties Details the cross functional aspects of the given storage class. +type StorageClassProperties 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"` +} + +// NewStorageClassProperties instantiates a new StorageClassProperties 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 NewStorageClassProperties(description string, durability string, availability string) *StorageClassProperties { + this := StorageClassProperties{} + + this.Description = &description + this.Durability = &durability + this.Availability = &availability + + return &this +} + +// NewStorageClassPropertiesWithDefaults instantiates a new StorageClassProperties 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 NewStorageClassPropertiesWithDefaults() *StorageClassProperties { + this := StorageClassProperties{} + return &this +} + +// GetDescription returns the Description field value +// If the value is explicit nil, the zero value for string will be returned +func (o *StorageClassProperties) 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 *StorageClassProperties) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Description, true +} + +// SetDescription sets field value +func (o *StorageClassProperties) SetDescription(v string) { + + o.Description = &v + +} + +// HasDescription returns a boolean if a field has been set. +func (o *StorageClassProperties) 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 *StorageClassProperties) 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 *StorageClassProperties) GetDurabilityOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Durability, true +} + +// SetDurability sets field value +func (o *StorageClassProperties) SetDurability(v string) { + + o.Durability = &v + +} + +// HasDurability returns a boolean if a field has been set. +func (o *StorageClassProperties) 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 *StorageClassProperties) 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 *StorageClassProperties) GetAvailabilityOk() (*string, bool) { + if o == nil { + return nil, false + } + + return o.Availability, true +} + +// SetAvailability sets field value +func (o *StorageClassProperties) SetAvailability(v string) { + + o.Availability = &v + +} + +// HasAvailability returns a boolean if a field has been set. +func (o *StorageClassProperties) HasAvailability() bool { + if o != nil && o.Availability != nil { + return true + } + + return false +} + +func (o StorageClassProperties) 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 NullableStorageClassProperties struct { + value *StorageClassProperties + isSet bool +} + +func (v NullableStorageClassProperties) Get() *StorageClassProperties { + return v.value +} + +func (v *NullableStorageClassProperties) Set(val *StorageClassProperties) { + v.value = val + v.isSet = true +} + +func (v NullableStorageClassProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableStorageClassProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStorageClassProperties(val *StorageClassProperties) *NullableStorageClassProperties { + return &NullableStorageClassProperties{value: val, isSet: true} +} + +func (v NullableStorageClassProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStorageClassProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/response.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/response.go new file mode 100644 index 000000000..ca6204502 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/response.go @@ -0,0 +1,73 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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-s3-management/utils.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/utils.go new file mode 100644 index 000000000..cbc1119db --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/utils.go @@ -0,0 +1,776 @@ +/* + * IONOS Cloud - S3 Management API + * + * S3 Management API is a RESTful API that manages the S3 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 3af9a5281..ecbc0fabc 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-s3 v1.1.0 ## explicit; go 1.18 github.com/ionos-cloud/sdk-go-s3 +# github.com/ionos-cloud/sdk-go-s3-management v1.0.0 => /home/radu/work/rubygeneration/sdk-go-s3-management +## explicit; go 1.18 +github.com/ionos-cloud/sdk-go-s3-management # github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.1 ## explicit; go 1.18 github.com/ionos-cloud/sdk-go-vm-autoscaling From 361e1524a9a43fde6e5df5a022a2f1d3ca40762d Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Mon, 30 Sep 2024 16:58:49 +0300 Subject: [PATCH 18/30] fix: linter issues --- services/s3management/accesskeys.go | 23 +++++++++++++++-------- services/s3management/regions.go | 7 +++++-- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/services/s3management/accesskeys.go b/services/s3management/accesskeys.go index ca146dfb9..c054a274e 100644 --- a/services/s3management/accesskeys.go +++ b/services/s3management/accesskeys.go @@ -16,8 +16,8 @@ import ( 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"` + 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"` @@ -26,24 +26,27 @@ type AccesskeyResourceModel struct { // 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"` + 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) (s3management.AccessKey, *s3management.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) (s3management.AccessKeyList, *s3management.APIResponse, error) { accessKeys, apiResponse, err := c.client.AccesskeysApi.AccesskeysGet(ctx).Execute() apiResponse.LogInfo() return accessKeys, apiResponse, err } +// CreateAccessKey creates an accesskey func (c *Client) CreateAccessKey(ctx context.Context, accessKey s3management.AccessKeyCreate, timeout time.Duration) (s3management.AccessKey, *s3management.APIResponse, error) { accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPost(ctx).AccessKeyCreate(accessKey).Execute() apiResponse.LogInfo() @@ -62,6 +65,7 @@ func (c *Client) CreateAccessKey(ctx context.Context, accessKey s3management.Acc return accessKeyResponse, apiResponse, err } +// UpdateAccessKey updates an accesskey func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyId string, accessKey s3management.AccessKeyEnsure, timeout time.Duration) (s3management.AccessKey, *s3management.APIResponse, error) { accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPut(ctx, accessKeyId).AccessKeyEnsure(accessKey).Execute() apiResponse.LogInfo() @@ -80,6 +84,7 @@ func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyId string, access return accessKeyResponse, apiResponse, err } +// DeleteAccessKey deletes an accesskey func (c *Client) DeleteAccessKey(ctx context.Context, accessKeyId string, timeout time.Duration) (*s3management.APIResponse, error) { apiResponse, err := c.client.AccesskeysApi.AccesskeysDelete(ctx, accessKeyId).Execute() apiResponse.LogInfo() @@ -98,6 +103,7 @@ func (c *Client) DeleteAccessKey(ctx context.Context, accessKeyId string, timeou return apiResponse, err } +// SetAccessKeyPropertiesToPlan sets accesskey properties from an SDK object to a AccesskeyResourceModel func SetAccessKeyPropertiesToPlan(plan *AccesskeyResourceModel, accessKey s3management.AccessKey) { if accessKey.Properties != nil { @@ -106,10 +112,10 @@ func SetAccessKeyPropertiesToPlan(plan *AccesskeyResourceModel, accessKey s3mana plan.AccessKey = basetypes.NewStringPointerValue(accessKey.Properties.AccessKey) } if accessKey.Properties.CanonicalUserId != nil { - plan.CanonicalUserId = basetypes.NewStringPointerValue(accessKey.Properties.CanonicalUserId) + plan.CanonicalUserID = basetypes.NewStringPointerValue(accessKey.Properties.CanonicalUserId) } if accessKey.Properties.ContractUserId != nil { - plan.ContractUserId = basetypes.NewStringPointerValue(accessKey.Properties.ContractUserId) + plan.ContractUserID = basetypes.NewStringPointerValue(accessKey.Properties.ContractUserId) } if accessKey.Properties.Description != nil { plan.Description = basetypes.NewStringPointerValue(accessKey.Properties.Description) @@ -123,6 +129,7 @@ func SetAccessKeyPropertiesToPlan(plan *AccesskeyResourceModel, accessKey s3mana } } +// SetAccessKeyPropertiesToDataSourcePlan sets accesskey properties from an SDK object to a AccessKeyDataSourceModel func SetAccessKeyPropertiesToDataSourcePlan(plan *AccessKeyDataSourceModel, accessKey s3management.AccessKey) { if accessKey.Properties != nil { @@ -131,10 +138,10 @@ func SetAccessKeyPropertiesToDataSourcePlan(plan *AccessKeyDataSourceModel, acce plan.AccessKey = basetypes.NewStringPointerValue(accessKey.Properties.AccessKey) } if accessKey.Properties.CanonicalUserId != nil { - plan.CanonicalUserId = basetypes.NewStringPointerValue(accessKey.Properties.CanonicalUserId) + plan.CanonicalUserID = basetypes.NewStringPointerValue(accessKey.Properties.CanonicalUserId) } if accessKey.Properties.ContractUserId != nil { - plan.ContractUserId = basetypes.NewStringPointerValue(accessKey.Properties.ContractUserId) + plan.ContractUserID = basetypes.NewStringPointerValue(accessKey.Properties.ContractUserId) } if accessKey.Properties.Description != nil { plan.Description = basetypes.NewStringPointerValue(accessKey.Properties.Description) diff --git a/services/s3management/regions.go b/services/s3management/regions.go index 4a65fb6a4..2459f4592 100644 --- a/services/s3management/regions.go +++ b/services/s3management/regions.go @@ -23,18 +23,21 @@ type capability struct { S3select types.Bool `tfsdk:"s3select"` } +// GetRegion retrieves a region func (c *Client) GetRegion(ctx context.Context, regionId string, depth float32) (s3management.Region, *s3management.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) (s3management.RegionList, *s3management.APIResponse, error) { regions, apiResponse, err := c.client.RegionsApi.RegionsGet(ctx).Execute() apiResponse.LogInfo() return regions, apiResponse, err } +// SetAccessKeyPropertiesToDataSourcePlan builds an RegionDataSourceModel from a region SDK object func BuildRegionModelFromAPIResponse(output *s3management.Region) *RegionDataSourceModel { built := &RegionDataSourceModel{} @@ -61,8 +64,8 @@ func BuildRegionModelFromAPIResponse(output *s3management.Region) *RegionDataSou if output.Properties.Storageclasses != nil { built.Storageclasses = make([]types.String, 0, len(*output.Properties.Storageclasses)) - for _, storageClass := range *output.Properties.Storageclasses { - built.Storageclasses = append(built.Storageclasses, types.StringPointerValue(&storageClass)) + for i := range *output.Properties.Storageclasses { + built.Storageclasses = append(built.Storageclasses, types.StringPointerValue(&(*output.Properties.Storageclasses)[i])) } } } From ec42e7650339b566896eacbb8009b362a98e401a Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Mon, 30 Sep 2024 17:08:25 +0300 Subject: [PATCH 19/30] fix: linter issues 2 --- services/s3management/accesskeys.go | 16 ++++++++-------- services/s3management/regions.go | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/services/s3management/accesskeys.go b/services/s3management/accesskeys.go index c054a274e..dcb1f1779 100644 --- a/services/s3management/accesskeys.go +++ b/services/s3management/accesskeys.go @@ -33,8 +33,8 @@ type AccessKeyDataSourceModel struct { } // GetAccessKey retrieves an accesskey -func (c *Client) GetAccessKey(ctx context.Context, accessKeyId string) (s3management.AccessKey, *s3management.APIResponse, error) { - accessKey, apiResponse, err := c.client.AccesskeysApi.AccesskeysFindById(ctx, accessKeyId).Execute() +func (c *Client) GetAccessKey(ctx context.Context, accessKeyID string) (s3management.AccessKey, *s3management.APIResponse, error) { + accessKey, apiResponse, err := c.client.AccesskeysApi.AccesskeysFindById(ctx, accessKeyID).Execute() apiResponse.LogInfo() return accessKey, apiResponse, err } @@ -66,8 +66,8 @@ func (c *Client) CreateAccessKey(ctx context.Context, accessKey s3management.Acc } // UpdateAccessKey updates an accesskey -func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyId string, accessKey s3management.AccessKeyEnsure, timeout time.Duration) (s3management.AccessKey, *s3management.APIResponse, error) { - accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPut(ctx, accessKeyId).AccessKeyEnsure(accessKey).Execute() +func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyID string, accessKey s3management.AccessKeyEnsure, timeout time.Duration) (s3management.AccessKey, *s3management.APIResponse, error) { + accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPut(ctx, accessKeyID).AccessKeyEnsure(accessKey).Execute() apiResponse.LogInfo() if err != nil || accessKeyResponse.Id == nil { @@ -75,7 +75,7 @@ func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyId string, access } err = backoff.Retry(func() error { - return c.accessKeyAvailableCheck(ctx, accessKeyId) + 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) @@ -85,8 +85,8 @@ func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyId string, access } // DeleteAccessKey deletes an accesskey -func (c *Client) DeleteAccessKey(ctx context.Context, accessKeyId string, timeout time.Duration) (*s3management.APIResponse, error) { - apiResponse, err := c.client.AccesskeysApi.AccesskeysDelete(ctx, accessKeyId).Execute() +func (c *Client) DeleteAccessKey(ctx context.Context, accessKeyID string, timeout time.Duration) (*s3management.APIResponse, error) { + apiResponse, err := c.client.AccesskeysApi.AccesskeysDelete(ctx, accessKeyID).Execute() apiResponse.LogInfo() if err != nil { @@ -94,7 +94,7 @@ func (c *Client) DeleteAccessKey(ctx context.Context, accessKeyId string, timeou } err = backoff.Retry(func() error { - return c.accessKeyDeletedCheck(ctx, accessKeyId) + 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) diff --git a/services/s3management/regions.go b/services/s3management/regions.go index 2459f4592..a115ce12b 100644 --- a/services/s3management/regions.go +++ b/services/s3management/regions.go @@ -24,8 +24,8 @@ type capability struct { } // GetRegion retrieves a region -func (c *Client) GetRegion(ctx context.Context, regionId string, depth float32) (s3management.Region, *s3management.APIResponse, error) { - region, apiResponse, err := c.client.RegionsApi.RegionsFindByRegion(ctx, regionId).Execute() +func (c *Client) GetRegion(ctx context.Context, regionID string, depth float32) (s3management.Region, *s3management.APIResponse, error) { + region, apiResponse, err := c.client.RegionsApi.RegionsFindByRegion(ctx, regionID).Execute() apiResponse.LogInfo() return region, apiResponse, err } @@ -37,7 +37,7 @@ func (c *Client) ListRegions(ctx context.Context) (s3management.RegionList, *s3m return regions, apiResponse, err } -// SetAccessKeyPropertiesToDataSourcePlan builds an RegionDataSourceModel from a region SDK object +// BuildRegionModelFromAPIResponse builds an RegionDataSourceModel from a region SDK object func BuildRegionModelFromAPIResponse(output *s3management.Region) *RegionDataSourceModel { built := &RegionDataSourceModel{} From 57473b1d1650f9298ff3d8808460f20b3cb300c9 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Mon, 30 Sep 2024 17:20:42 +0300 Subject: [PATCH 20/30] fix: try fix imports --- .../framework/services/s3management/resource_s3_accesskey.go | 1 + services/s3management/client.go | 1 + 2 files changed, 2 insertions(+) diff --git a/internal/framework/services/s3management/resource_s3_accesskey.go b/internal/framework/services/s3management/resource_s3_accesskey.go index 066067f4a..bf15d13cf 100644 --- a/internal/framework/services/s3management/resource_s3_accesskey.go +++ b/internal/framework/services/s3management/resource_s3_accesskey.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" s3management "github.com/ionos-cloud/sdk-go-s3-management" diff --git a/services/s3management/client.go b/services/s3management/client.go index 5113a7df4..ce41ce307 100644 --- a/services/s3management/client.go +++ b/services/s3management/client.go @@ -7,6 +7,7 @@ import ( "runtime" "github.com/hashicorp/terraform-plugin-sdk/v2/meta" + s3management "github.com/ionos-cloud/sdk-go-s3-management" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" From f98abc7ddea44067228b104f05ea460a71aaede4 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Mon, 30 Sep 2024 17:29:21 +0300 Subject: [PATCH 21/30] fix: try fix imports 2 --- .../framework/services/s3management/resource_s3_accesskey.go | 5 ++--- services/s3management/client.go | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/framework/services/s3management/resource_s3_accesskey.go b/internal/framework/services/s3management/resource_s3_accesskey.go index bf15d13cf..55e82e8e6 100644 --- a/internal/framework/services/s3management/resource_s3_accesskey.go +++ b/internal/framework/services/s3management/resource_s3_accesskey.go @@ -10,12 +10,11 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" - "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" - s3management "github.com/ionos-cloud/sdk-go-s3-management" - "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" s3managementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" ) var ( diff --git a/services/s3management/client.go b/services/s3management/client.go index ce41ce307..1ee354519 100644 --- a/services/s3management/client.go +++ b/services/s3management/client.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/meta" s3management "github.com/ionos-cloud/sdk-go-s3-management" + "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" ) From ce3b8accd70c756b7c4f66a7a5ec0fc9d0c9a194 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Tue, 19 Nov 2024 13:58:09 +0200 Subject: [PATCH 22/30] chore: added sdk from repo, some renaming changes --- docs/resources/s3_accesskey.md | 1 - go.mod | 2 +- .../s3management/resource_s3_accesskey.go | 4 +- services/s3management/accesskeys.go | 12 +- services/s3management/regions.go | 14 +- .../ionos-cloud/sdk-go-s3-management/LICENSE | 201 ++++++++++ .../sdk-go-s3-management/README.md | 181 +++++---- .../sdk-go-s3-management/api_accesskeys.go | 52 +-- .../sdk-go-s3-management/api_regions.go | 20 +- .../sdk-go-s3-management/client.go | 6 +- .../sdk-go-s3-management/configuration.go | 6 +- .../sdk-go-s3-management/logger.go | 4 +- .../sdk-go-s3-management/model_access_key.go | 178 ++++----- .../model_access_key_create.go | 16 +- .../model_access_key_ensure.go | 16 +- .../model_access_key_properties.go | 302 --------------- .../model_access_key_read.go | 302 +++++++++++++++ ..._list.go => model_access_key_read_list.go} | 102 ++--- ...o => model_access_key_read_list_all_of.go} | 78 ++-- .../sdk-go-s3-management/model_bucket.go | 4 +- .../model_bucket_create.go | 4 +- .../model_bucket_ensure.go | 4 +- .../sdk-go-s3-management/model_bucket_read.go | 4 +- .../model_bucket_read_list.go | 4 +- .../model_bucket_read_list_all_of.go | 4 +- .../sdk-go-s3-management/model_error.go | 4 +- .../model_error_messages.go | 4 +- .../sdk-go-s3-management/model_links.go | 4 +- .../sdk-go-s3-management/model_metadata.go | 4 +- .../model_metadata_with_status.go | 4 +- .../model_metadata_with_status_all_of.go | 4 +- .../model_metadata_with_supported_regions.go | 4 +- ..._metadata_with_supported_regions_all_of.go | 4 +- .../sdk-go-s3-management/model_pagination.go | 4 +- .../sdk-go-s3-management/model_region.go | 225 +++++++----- ...pability.go => model_region_capability.go} | 58 +-- .../model_region_create.go | 16 +- .../model_region_ensure.go | 16 +- .../model_region_properties.go | 347 ------------------ .../sdk-go-s3-management/model_region_read.go | 302 +++++++++++++++ ...gion_list.go => model_region_read_list.go} | 102 ++--- ...of.go => model_region_read_list_all_of.go} | 78 ++-- .../model_storage_class.go | 198 +++------- .../model_storage_class_create.go | 16 +- .../model_storage_class_ensure.go | 16 +- .../model_storage_class_properties.go | 214 ----------- .../model_storage_class_read.go | 302 +++++++++++++++ ...st.go => model_storage_class_read_list.go} | 102 ++--- ...> model_storage_class_read_list_all_of.go} | 78 ++-- .../sdk-go-s3-management/response.go | 4 +- .../ionos-cloud/sdk-go-s3-management/utils.go | 4 +- vendor/modules.txt | 2 +- 52 files changed, 1910 insertions(+), 1727 deletions(-) create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/LICENSE delete mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_properties.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read.go rename vendor/github.com/ionos-cloud/sdk-go-s3-management/{model_access_key_list.go => model_access_key_read_list.go} (67%) rename vendor/github.com/ionos-cloud/sdk-go-s3-management/{model_access_key_list_all_of.go => model_access_key_read_list_all_of.go} (60%) rename vendor/github.com/ionos-cloud/sdk-go-s3-management/{model_region_properties_capability.go => model_region_capability.go} (55%) delete mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read.go rename vendor/github.com/ionos-cloud/sdk-go-s3-management/{model_region_list.go => model_region_read_list.go} (69%) rename vendor/github.com/ionos-cloud/sdk-go-s3-management/{model_region_list_all_of.go => model_region_read_list_all_of.go} (61%) delete mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_properties.go create mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read.go rename vendor/github.com/ionos-cloud/sdk-go-s3-management/{model_storage_class_list.go => model_storage_class_read_list.go} (66%) rename vendor/github.com/ionos-cloud/sdk-go-s3-management/{model_storage_class_list_all_of.go => model_storage_class_read_list_all_of.go} (59%) diff --git a/docs/resources/s3_accesskey.md b/docs/resources/s3_accesskey.md index 6347216cc..dab2ccbf7 100644 --- a/docs/resources/s3_accesskey.md +++ b/docs/resources/s3_accesskey.md @@ -32,7 +32,6 @@ The following arguments are supported: - `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`. -- `force_destroy` - (Optional)[bool] If true, the bucket and the contents of the bucket will be destroyed. Default is `false`. ## Import diff --git a/go.mod b/go.mod index 330c751ab..3c992aabb 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 ) -replace github.com/ionos-cloud/sdk-go-s3-management v1.0.0 => /home/radu/work/rubygeneration/sdk-go-s3-management +replace github.com/ionos-cloud/sdk-go-s3-management v1.0.0 => /home/radu/work/sdk-go-s3-management require ( github.com/hashicorp/go-retryablehttp v0.7.7 // indirect diff --git a/internal/framework/services/s3management/resource_s3_accesskey.go b/internal/framework/services/s3management/resource_s3_accesskey.go index 55e82e8e6..68102fe79 100644 --- a/internal/framework/services/s3management/resource_s3_accesskey.go +++ b/internal/framework/services/s3management/resource_s3_accesskey.go @@ -114,7 +114,7 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque defer cancel() var accessKey = s3management.AccessKeyCreate{ - Properties: &s3management.AccessKeyProperties{ + Properties: &s3management.AccessKey{ Description: data.Description.ValueStringPointer(), }, } @@ -182,7 +182,7 @@ func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateReque defer cancel() var accessKey = s3management.AccessKeyEnsure{ - Properties: &s3management.AccessKeyProperties{ + Properties: &s3management.AccessKey{ Description: plan.Description.ValueStringPointer(), }, } diff --git a/services/s3management/accesskeys.go b/services/s3management/accesskeys.go index dcb1f1779..0ab30dd7a 100644 --- a/services/s3management/accesskeys.go +++ b/services/s3management/accesskeys.go @@ -33,21 +33,21 @@ type AccessKeyDataSourceModel struct { } // GetAccessKey retrieves an accesskey -func (c *Client) GetAccessKey(ctx context.Context, accessKeyID string) (s3management.AccessKey, *s3management.APIResponse, error) { +func (c *Client) GetAccessKey(ctx context.Context, accessKeyID string) (s3management.AccessKeyRead, *s3management.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) (s3management.AccessKeyList, *s3management.APIResponse, error) { +func (c *Client) ListAccessKeys(ctx context.Context) (s3management.AccessKeyReadList, *s3management.APIResponse, error) { accessKeys, apiResponse, err := c.client.AccesskeysApi.AccesskeysGet(ctx).Execute() apiResponse.LogInfo() return accessKeys, apiResponse, err } // CreateAccessKey creates an accesskey -func (c *Client) CreateAccessKey(ctx context.Context, accessKey s3management.AccessKeyCreate, timeout time.Duration) (s3management.AccessKey, *s3management.APIResponse, error) { +func (c *Client) CreateAccessKey(ctx context.Context, accessKey s3management.AccessKeyCreate, timeout time.Duration) (s3management.AccessKeyRead, *s3management.APIResponse, error) { accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPost(ctx).AccessKeyCreate(accessKey).Execute() apiResponse.LogInfo() @@ -66,7 +66,7 @@ func (c *Client) CreateAccessKey(ctx context.Context, accessKey s3management.Acc } // UpdateAccessKey updates an accesskey -func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyID string, accessKey s3management.AccessKeyEnsure, timeout time.Duration) (s3management.AccessKey, *s3management.APIResponse, error) { +func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyID string, accessKey s3management.AccessKeyEnsure, timeout time.Duration) (s3management.AccessKeyRead, *s3management.APIResponse, error) { accessKeyResponse, apiResponse, err := c.client.AccesskeysApi.AccesskeysPut(ctx, accessKeyID).AccessKeyEnsure(accessKey).Execute() apiResponse.LogInfo() @@ -104,7 +104,7 @@ func (c *Client) DeleteAccessKey(ctx context.Context, accessKeyID string, timeou } // SetAccessKeyPropertiesToPlan sets accesskey properties from an SDK object to a AccesskeyResourceModel -func SetAccessKeyPropertiesToPlan(plan *AccesskeyResourceModel, accessKey s3management.AccessKey) { +func SetAccessKeyPropertiesToPlan(plan *AccesskeyResourceModel, accessKey s3management.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 @@ -130,7 +130,7 @@ func SetAccessKeyPropertiesToPlan(plan *AccesskeyResourceModel, accessKey s3mana } // SetAccessKeyPropertiesToDataSourcePlan sets accesskey properties from an SDK object to a AccessKeyDataSourceModel -func SetAccessKeyPropertiesToDataSourcePlan(plan *AccessKeyDataSourceModel, accessKey s3management.AccessKey) { +func SetAccessKeyPropertiesToDataSourcePlan(plan *AccessKeyDataSourceModel, accessKey s3management.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 diff --git a/services/s3management/regions.go b/services/s3management/regions.go index a115ce12b..1116be58a 100644 --- a/services/s3management/regions.go +++ b/services/s3management/regions.go @@ -24,21 +24,21 @@ type capability struct { } // GetRegion retrieves a region -func (c *Client) GetRegion(ctx context.Context, regionID string, depth float32) (s3management.Region, *s3management.APIResponse, error) { +func (c *Client) GetRegion(ctx context.Context, regionID string, depth float32) (s3management.RegionRead, *s3management.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) (s3management.RegionList, *s3management.APIResponse, error) { +func (c *Client) ListRegions(ctx context.Context) (s3management.RegionReadList, *s3management.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 *s3management.Region) *RegionDataSourceModel { +func BuildRegionModelFromAPIResponse(output *s3management.RegionRead) *RegionDataSourceModel { built := &RegionDataSourceModel{} if output.Id != nil { @@ -62,10 +62,10 @@ func BuildRegionModelFromAPIResponse(output *s3management.Region) *RegionDataSou } } - 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])) + 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])) } } } diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/LICENSE b/vendor/github.com/ionos-cloud/sdk-go-s3-management/LICENSE new file mode 100644 index 000000000..261eeb9e9 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-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-s3-management/README.md b/vendor/github.com/ionos-cloud/sdk-go-s3-management/README.md index ca914283b..7b203c186 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/README.md +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/README.md @@ -1,6 +1,8 @@ +[![Gitter](https://img.shields.io/gitter/room/ionos-cloud/sdk-general)](https://gitter.im/ionos-cloud/sdk-general) + # Go API client for ionoscloud -S3 Management API is a RESTful API that manages the S3 +Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. @@ -17,132 +19,113 @@ 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 "github.com/ionos-cloud/ionoscloud_s3_management" +import "./ionoscloud" ``` -To use a proxy, set the environment variable `HTTP_PROXY`: +## Authentication -```golang -os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") -``` +All available server URLs are: -## Configuration of Server URL +- *https://s3.ionos.com* - Production -Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. +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. -### Select Server Configuration - -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. +The username and password or the authentication token can be manually specified when initializing +the sdk client: ```golang -ctx := context.WithValue(context.Background(), ionoscloud.ContextServerIndex, 1) -``` -### Templated Server URL +client := ionoscloud.NewAPIClient(ionoscloud.NewConfiguration(username, password, token, hostUrl)) -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. - -```golang -ctx := context.WithValue(context.Background(), ionoscloud.ContextServerVariables, map[string]string{ - "basePath": "v2", -}) ``` -Note, enum values are always validated and all unused variables are silently ignored. +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 -## Documentation for API Endpoints - -All URIs are relative to *https://s3.ionos.com* +In this case, the client configuration needs to be initialized using `NewConfigurationFromEnv()`. -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 +```golang - - [AccessKey](docs/models/AccessKey.md) - - [AccessKeyCreate](docs/models/AccessKeyCreate.md) - - [AccessKeyEnsure](docs/models/AccessKeyEnsure.md) - - [AccessKeyList](docs/models/AccessKeyList.md) - - [AccessKeyListAllOf](docs/models/AccessKeyListAllOf.md) - - [AccessKeyProperties](docs/models/AccessKeyProperties.md) - - [Bucket](docs/models/Bucket.md) - - [BucketCreate](docs/models/BucketCreate.md) - - [BucketEnsure](docs/models/BucketEnsure.md) - - [BucketRead](docs/models/BucketRead.md) - - [BucketReadList](docs/models/BucketReadList.md) - - [BucketReadListAllOf](docs/models/BucketReadListAllOf.md) - - [Error](docs/models/Error.md) - - [ErrorMessages](docs/models/ErrorMessages.md) - - [Links](docs/models/Links.md) - - [Metadata](docs/models/Metadata.md) - - [MetadataWithStatus](docs/models/MetadataWithStatus.md) - - [MetadataWithStatusAllOf](docs/models/MetadataWithStatusAllOf.md) - - [MetadataWithSupportedRegions](docs/models/MetadataWithSupportedRegions.md) - - [MetadataWithSupportedRegionsAllOf](docs/models/MetadataWithSupportedRegionsAllOf.md) - - [Pagination](docs/models/Pagination.md) - - [Region](docs/models/Region.md) - - [RegionCreate](docs/models/RegionCreate.md) - - [RegionEnsure](docs/models/RegionEnsure.md) - - [RegionList](docs/models/RegionList.md) - - [RegionListAllOf](docs/models/RegionListAllOf.md) - - [RegionProperties](docs/models/RegionProperties.md) - - [RegionPropertiesCapability](docs/models/RegionPropertiesCapability.md) - - [StorageClass](docs/models/StorageClass.md) - - [StorageClassCreate](docs/models/StorageClassCreate.md) - - [StorageClassEnsure](docs/models/StorageClassEnsure.md) - - [StorageClassList](docs/models/StorageClassList.md) - - [StorageClassListAllOf](docs/models/StorageClassListAllOf.md) - - [StorageClassProperties](docs/models/StorageClassProperties.md) - - -## Documentation For Authorization - - -Authentication schemes defined for the API: -### tokenAuth - -- **Type**: HTTP Bearer token authentication - -Example +client := ionoscloud.NewAPIClient(ionoscloud.NewConfigurationFromEnv()) -```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING") -r, err := client.Service.Operation(auth, args) ``` -## Documentation for Utility Methods +## Documentation for API Endpoints -Due to the fact that model structure members are all pointers, this package contains -a number of utility functions to easily obtain pointers to values of basic types. -Each of these functions takes a value of the given basic type and returns a pointer to it: +All URIs are relative to *https://s3.ionos.com* +
+ API Endpoints table -* `PtrBool` -* `PtrInt` -* `PtrInt32` -* `PtrInt64` -* `PtrFloat` -* `PtrFloat32` -* `PtrFloat64` -* `PtrString` -* `PtrTime` -## Author +| 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-s3-management/api_accesskeys.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_accesskeys.go index 587fe9ef7..854c58855 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_accesskeys.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_accesskeys.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -207,7 +207,7 @@ type ApiAccesskeysFindByIdRequest struct { accesskeyId string } -func (r ApiAccesskeysFindByIdRequest) Execute() (AccessKey, *APIResponse, error) { +func (r ApiAccesskeysFindByIdRequest) Execute() (AccessKeyRead, *APIResponse, error) { return r.ApiService.AccesskeysFindByIdExecute(r) } @@ -228,16 +228,16 @@ func (a *AccesskeysApiService) AccesskeysFindById(ctx _context.Context, accesske /* * Execute executes the request - * @return AccessKey + * @return AccessKeyRead */ -func (a *AccesskeysApiService) AccesskeysFindByIdExecute(r ApiAccesskeysFindByIdRequest) (AccessKey, *APIResponse, error) { +func (a *AccesskeysApiService) AccesskeysFindByIdExecute(r ApiAccesskeysFindByIdRequest) (AccessKeyRead, *APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue AccessKey + localVarReturnValue AccessKeyRead ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AccesskeysApiService.AccesskeysFindById") @@ -408,7 +408,7 @@ func (r ApiAccesskeysGetRequest) FilterAccesskeyId(filterAccesskeyId string) Api return r } -func (r ApiAccesskeysGetRequest) Execute() (AccessKeyList, *APIResponse, error) { +func (r ApiAccesskeysGetRequest) Execute() (AccessKeyReadList, *APIResponse, error) { return r.ApiService.AccesskeysGetExecute(r) } @@ -430,16 +430,16 @@ func (a *AccesskeysApiService) AccesskeysGet(ctx _context.Context) ApiAccesskeys /* * Execute executes the request - * @return AccessKeyList + * @return AccessKeyReadList */ -func (a *AccesskeysApiService) AccesskeysGetExecute(r ApiAccesskeysGetRequest) (AccessKeyList, *APIResponse, error) { +func (a *AccesskeysApiService) AccesskeysGetExecute(r ApiAccesskeysGetRequest) (AccessKeyReadList, *APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue AccessKeyList + localVarReturnValue AccessKeyReadList ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AccesskeysApiService.AccesskeysGet") @@ -599,7 +599,7 @@ func (r ApiAccesskeysPostRequest) AccessKeyCreate(accessKeyCreate AccessKeyCreat return r } -func (r ApiAccesskeysPostRequest) Execute() (AccessKey, *APIResponse, error) { +func (r ApiAccesskeysPostRequest) Execute() (AccessKeyRead, *APIResponse, error) { return r.ApiService.AccesskeysPostExecute(r) } @@ -622,16 +622,16 @@ func (a *AccesskeysApiService) AccesskeysPost(ctx _context.Context) ApiAccesskey /* * Execute executes the request - * @return AccessKey + * @return AccessKeyRead */ -func (a *AccesskeysApiService) AccesskeysPostExecute(r ApiAccesskeysPostRequest) (AccessKey, *APIResponse, error) { +func (a *AccesskeysApiService) AccesskeysPostExecute(r ApiAccesskeysPostRequest) (AccessKeyRead, *APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue AccessKey + localVarReturnValue AccessKeyRead ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AccesskeysApiService.AccesskeysPost") @@ -806,7 +806,7 @@ func (r ApiAccesskeysPutRequest) AccessKeyEnsure(accessKeyEnsure AccessKeyEnsure return r } -func (r ApiAccesskeysPutRequest) Execute() (AccessKey, *APIResponse, error) { +func (r ApiAccesskeysPutRequest) Execute() (AccessKeyRead, *APIResponse, error) { return r.ApiService.AccesskeysPutExecute(r) } @@ -833,16 +833,16 @@ func (a *AccesskeysApiService) AccesskeysPut(ctx _context.Context, accesskeyId s /* * Execute executes the request - * @return AccessKey + * @return AccessKeyRead */ -func (a *AccesskeysApiService) AccesskeysPutExecute(r ApiAccesskeysPutRequest) (AccessKey, *APIResponse, error) { +func (a *AccesskeysApiService) AccesskeysPutExecute(r ApiAccesskeysPutRequest) (AccessKeyRead, *APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue AccessKey + localVarReturnValue AccessKeyRead ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AccesskeysApiService.AccesskeysPut") @@ -938,7 +938,7 @@ func (a *AccesskeysApiService) AccesskeysPutExecute(r ApiAccesskeysPutRequest) ( } newErr.model = v } - if localVarHTTPResponse.StatusCode == 409 { + if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -947,7 +947,7 @@ func (a *AccesskeysApiService) AccesskeysPutExecute(r ApiAccesskeysPutRequest) ( } newErr.model = v } - if localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1030,7 +1030,7 @@ type ApiAccesskeysRenewRequest struct { accesskeyId string } -func (r ApiAccesskeysRenewRequest) Execute() (AccessKey, *APIResponse, error) { +func (r ApiAccesskeysRenewRequest) Execute() (AccessKeyRead, *APIResponse, error) { return r.ApiService.AccesskeysRenewExecute(r) } @@ -1052,16 +1052,16 @@ func (a *AccesskeysApiService) AccesskeysRenew(ctx _context.Context, accesskeyId /* * Execute executes the request - * @return AccessKey + * @return AccessKeyRead */ -func (a *AccesskeysApiService) AccesskeysRenewExecute(r ApiAccesskeysRenewRequest) (AccessKey, *APIResponse, error) { +func (a *AccesskeysApiService) AccesskeysRenewExecute(r ApiAccesskeysRenewRequest) (AccessKeyRead, *APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue AccessKey + localVarReturnValue AccessKeyRead ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AccesskeysApiService.AccesskeysRenew") @@ -1152,7 +1152,7 @@ func (a *AccesskeysApiService) AccesskeysRenewExecute(r ApiAccesskeysRenewReques } newErr.model = v } - if localVarHTTPResponse.StatusCode == 409 { + if localVarHTTPResponse.StatusCode == 404 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { @@ -1161,7 +1161,7 @@ func (a *AccesskeysApiService) AccesskeysRenewExecute(r ApiAccesskeysRenewReques } newErr.model = v } - if localVarHTTPResponse.StatusCode == 404 { + if localVarHTTPResponse.StatusCode == 409 { var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_regions.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_regions.go index 6cb010101..52e2a5d30 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_regions.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_regions.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -33,7 +33,7 @@ type ApiRegionsFindByRegionRequest struct { region string } -func (r ApiRegionsFindByRegionRequest) Execute() (Region, *APIResponse, error) { +func (r ApiRegionsFindByRegionRequest) Execute() (RegionRead, *APIResponse, error) { return r.ApiService.RegionsFindByRegionExecute(r) } @@ -54,16 +54,16 @@ func (a *RegionsApiService) RegionsFindByRegion(ctx _context.Context, region str /* * Execute executes the request - * @return Region + * @return RegionRead */ -func (a *RegionsApiService) RegionsFindByRegionExecute(r ApiRegionsFindByRegionRequest) (Region, *APIResponse, error) { +func (a *RegionsApiService) RegionsFindByRegionExecute(r ApiRegionsFindByRegionRequest) (RegionRead, *APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue Region + localVarReturnValue RegionRead ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RegionsApiService.RegionsFindByRegion") @@ -229,7 +229,7 @@ func (r ApiRegionsGetRequest) Limit(limit int32) ApiRegionsGetRequest { return r } -func (r ApiRegionsGetRequest) Execute() (RegionList, *APIResponse, error) { +func (r ApiRegionsGetRequest) Execute() (RegionReadList, *APIResponse, error) { return r.ApiService.RegionsGetExecute(r) } @@ -251,16 +251,16 @@ func (a *RegionsApiService) RegionsGet(ctx _context.Context) ApiRegionsGetReques /* * Execute executes the request - * @return RegionList + * @return RegionReadList */ -func (a *RegionsApiService) RegionsGetExecute(r ApiRegionsGetRequest) (RegionList, *APIResponse, error) { +func (a *RegionsApiService) RegionsGetExecute(r ApiRegionsGetRequest) (RegionReadList, *APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue RegionList + localVarReturnValue RegionReadList ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RegionsApiService.RegionsGet") diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/client.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/client.go index 3e00a62f9..a29104836 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/client.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/client.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -53,7 +53,7 @@ const ( Version = "1.0.0" ) -// APIClient manages communication with the IONOS Cloud - S3 Management API API v0.1.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 diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/configuration.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/configuration.go index 3fb06dd28..4165416e7 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/configuration.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/configuration.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -134,7 +134,7 @@ func NewConfiguration(username, password, token, hostUrl string) *Configuration cfg := &Configuration{ DefaultHeader: make(map[string]string), DefaultQueryParams: url.Values{}, - UserAgent: "ionos-cloud-ionoscloud_s3_management/v1.0.0", + UserAgent: "ionos-cloud-sdk-go-s3-management/v1.0.0", Debug: false, Username: username, Password: password, diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/logger.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/logger.go index 8e6f49cac..a6fb5483e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/logger.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/logger.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key.go index afb5eee0a..5abc7fb36 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -14,30 +14,30 @@ import ( "encoding/json" ) -// AccessKey struct for AccessKey +// AccessKey Per user access key. type AccessKey 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 *AccessKeyProperties `json:"properties"` + // 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(id string, type_ string, href string, metadata MetadataWithSupportedRegions, properties AccessKeyProperties) *AccessKey { +func NewAccessKey(description string, accessKey string, secretKey string) *AccessKey { this := AccessKey{} - this.Id = &id - this.Type = &type_ - this.Href = &href - this.Metadata = &metadata - this.Properties = &properties + this.Description = &description + this.AccessKey = &accessKey + this.SecretKey = &secretKey return &this } @@ -50,190 +50,190 @@ func NewAccessKeyWithDefaults() *AccessKey { return &this } -// GetId returns the Id field value +// GetDescription returns the Description field value // If the value is explicit nil, the zero value for string will be returned -func (o *AccessKey) GetId() *string { +func (o *AccessKey) GetDescription() *string { if o == nil { return nil } - return o.Id + return o.Description } -// GetIdOk returns a tuple with the Id field value +// 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) GetIdOk() (*string, bool) { +func (o *AccessKey) GetDescriptionOk() (*string, bool) { if o == nil { return nil, false } - return o.Id, true + return o.Description, true } -// SetId sets field value -func (o *AccessKey) SetId(v string) { +// SetDescription sets field value +func (o *AccessKey) SetDescription(v string) { - o.Id = &v + o.Description = &v } -// HasId returns a boolean if a field has been set. -func (o *AccessKey) HasId() bool { - if o != nil && o.Id != nil { +// 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 } -// GetType returns the Type field value +// GetAccessKey returns the AccessKey field value // If the value is explicit nil, the zero value for string will be returned -func (o *AccessKey) GetType() *string { +func (o *AccessKey) GetAccessKey() *string { if o == nil { return nil } - return o.Type + return o.AccessKey } -// GetTypeOk returns a tuple with the Type field value +// 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) GetTypeOk() (*string, bool) { +func (o *AccessKey) GetAccessKeyOk() (*string, bool) { if o == nil { return nil, false } - return o.Type, true + return o.AccessKey, true } -// SetType sets field value -func (o *AccessKey) SetType(v string) { +// SetAccessKey sets field value +func (o *AccessKey) SetAccessKey(v string) { - o.Type = &v + o.AccessKey = &v } -// HasType returns a boolean if a field has been set. -func (o *AccessKey) HasType() bool { - if o != nil && o.Type != nil { +// 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 } -// GetHref returns the Href field value +// GetSecretKey returns the SecretKey field value // If the value is explicit nil, the zero value for string will be returned -func (o *AccessKey) GetHref() *string { +func (o *AccessKey) GetSecretKey() *string { if o == nil { return nil } - return o.Href + return o.SecretKey } -// GetHrefOk returns a tuple with the Href field value +// 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) GetHrefOk() (*string, bool) { +func (o *AccessKey) GetSecretKeyOk() (*string, bool) { if o == nil { return nil, false } - return o.Href, true + return o.SecretKey, true } -// SetHref sets field value -func (o *AccessKey) SetHref(v string) { +// SetSecretKey sets field value +func (o *AccessKey) SetSecretKey(v string) { - o.Href = &v + o.SecretKey = &v } -// HasHref returns a boolean if a field has been set. -func (o *AccessKey) HasHref() bool { - if o != nil && o.Href != nil { +// 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 } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, the zero value for MetadataWithSupportedRegions will be returned -func (o *AccessKey) GetMetadata() *MetadataWithSupportedRegions { +// 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.Metadata + return o.CanonicalUserId } -// GetMetadataOk returns a tuple with the Metadata field value +// 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) GetMetadataOk() (*MetadataWithSupportedRegions, bool) { +func (o *AccessKey) GetCanonicalUserIdOk() (*string, bool) { if o == nil { return nil, false } - return o.Metadata, true + return o.CanonicalUserId, true } -// SetMetadata sets field value -func (o *AccessKey) SetMetadata(v MetadataWithSupportedRegions) { +// SetCanonicalUserId sets field value +func (o *AccessKey) SetCanonicalUserId(v string) { - o.Metadata = &v + o.CanonicalUserId = &v } -// HasMetadata returns a boolean if a field has been set. -func (o *AccessKey) HasMetadata() bool { - if o != nil && o.Metadata != nil { +// 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 } -// GetProperties returns the Properties field value -// If the value is explicit nil, the zero value for AccessKeyProperties will be returned -func (o *AccessKey) GetProperties() *AccessKeyProperties { +// 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.Properties + return o.ContractUserId } -// GetPropertiesOk returns a tuple with the Properties field value +// 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) GetPropertiesOk() (*AccessKeyProperties, bool) { +func (o *AccessKey) GetContractUserIdOk() (*string, bool) { if o == nil { return nil, false } - return o.Properties, true + return o.ContractUserId, true } -// SetProperties sets field value -func (o *AccessKey) SetProperties(v AccessKeyProperties) { +// SetContractUserId sets field value +func (o *AccessKey) SetContractUserId(v string) { - o.Properties = &v + o.ContractUserId = &v } -// HasProperties returns a boolean if a field has been set. -func (o *AccessKey) HasProperties() bool { - if o != nil && o.Properties != nil { +// HasContractUserId returns a boolean if a field has been set. +func (o *AccessKey) HasContractUserId() bool { + if o != nil && o.ContractUserId != nil { return true } @@ -242,24 +242,24 @@ func (o *AccessKey) HasProperties() bool { func (o AccessKey) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { - toSerialize["id"] = o.Id + if o.Description != nil { + toSerialize["description"] = o.Description } - if o.Type != nil { - toSerialize["type"] = o.Type + if o.AccessKey != nil { + toSerialize["accessKey"] = o.AccessKey } - if o.Href != nil { - toSerialize["href"] = o.Href + if o.SecretKey != nil { + toSerialize["secretKey"] = o.SecretKey } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata + if o.CanonicalUserId != nil { + toSerialize["canonicalUserId"] = o.CanonicalUserId } - if o.Properties != nil { - toSerialize["properties"] = o.Properties + if o.ContractUserId != nil { + toSerialize["contractUserId"] = o.ContractUserId } return json.Marshal(toSerialize) diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_create.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_create.go index 6224a3284..edcb5b2ce 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_create.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_create.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -18,14 +18,14 @@ import ( type AccessKeyCreate struct { // Metadata Metadata *map[string]interface{} `json:"metadata,omitempty"` - Properties *AccessKeyProperties `json:"properties"` + 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 AccessKeyProperties) *AccessKeyCreate { +func NewAccessKeyCreate(properties AccessKey) *AccessKeyCreate { this := AccessKeyCreate{} this.Properties = &properties @@ -80,8 +80,8 @@ func (o *AccessKeyCreate) HasMetadata() bool { } // GetProperties returns the Properties field value -// If the value is explicit nil, the zero value for AccessKeyProperties will be returned -func (o *AccessKeyCreate) GetProperties() *AccessKeyProperties { +// If the value is explicit nil, the zero value for AccessKey will be returned +func (o *AccessKeyCreate) GetProperties() *AccessKey { if o == nil { return nil } @@ -93,7 +93,7 @@ func (o *AccessKeyCreate) GetProperties() *AccessKeyProperties { // 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() (*AccessKeyProperties, bool) { +func (o *AccessKeyCreate) GetPropertiesOk() (*AccessKey, bool) { if o == nil { return nil, false } @@ -102,7 +102,7 @@ func (o *AccessKeyCreate) GetPropertiesOk() (*AccessKeyProperties, bool) { } // SetProperties sets field value -func (o *AccessKeyCreate) SetProperties(v AccessKeyProperties) { +func (o *AccessKeyCreate) SetProperties(v AccessKey) { o.Properties = &v diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_ensure.go index 2e24bd6c5..559603b1a 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_ensure.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_ensure.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -20,14 +20,14 @@ type AccessKeyEnsure struct { Id *string `json:"id"` // Metadata Metadata *map[string]interface{} `json:"metadata,omitempty"` - Properties *AccessKeyProperties `json:"properties"` + 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 AccessKeyProperties) *AccessKeyEnsure { +func NewAccessKeyEnsure(id string, properties AccessKey) *AccessKeyEnsure { this := AccessKeyEnsure{} this.Id = &id @@ -121,8 +121,8 @@ func (o *AccessKeyEnsure) HasMetadata() bool { } // GetProperties returns the Properties field value -// If the value is explicit nil, the zero value for AccessKeyProperties will be returned -func (o *AccessKeyEnsure) GetProperties() *AccessKeyProperties { +// If the value is explicit nil, the zero value for AccessKey will be returned +func (o *AccessKeyEnsure) GetProperties() *AccessKey { if o == nil { return nil } @@ -134,7 +134,7 @@ func (o *AccessKeyEnsure) GetProperties() *AccessKeyProperties { // 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() (*AccessKeyProperties, bool) { +func (o *AccessKeyEnsure) GetPropertiesOk() (*AccessKey, bool) { if o == nil { return nil, false } @@ -143,7 +143,7 @@ func (o *AccessKeyEnsure) GetPropertiesOk() (*AccessKeyProperties, bool) { } // SetProperties sets field value -func (o *AccessKeyEnsure) SetProperties(v AccessKeyProperties) { +func (o *AccessKeyEnsure) SetProperties(v AccessKey) { o.Properties = &v diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_properties.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_properties.go deleted file mode 100644 index 7b0734baa..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_properties.go +++ /dev/null @@ -1,302 +0,0 @@ -/* - * IONOS Cloud - S3 Management API - * - * S3 Management API is a RESTful API that manages the S3 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" -) - -// AccessKeyProperties Per user access key. -type AccessKeyProperties 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"` -} - -// NewAccessKeyProperties instantiates a new AccessKeyProperties 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 NewAccessKeyProperties(description string, accessKey string, secretKey string) *AccessKeyProperties { - this := AccessKeyProperties{} - - this.Description = &description - this.AccessKey = &accessKey - this.SecretKey = &secretKey - - return &this -} - -// NewAccessKeyPropertiesWithDefaults instantiates a new AccessKeyProperties 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 NewAccessKeyPropertiesWithDefaults() *AccessKeyProperties { - this := AccessKeyProperties{} - return &this -} - -// GetDescription returns the Description field value -// If the value is explicit nil, the zero value for string will be returned -func (o *AccessKeyProperties) 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 *AccessKeyProperties) GetDescriptionOk() (*string, bool) { - if o == nil { - return nil, false - } - - return o.Description, true -} - -// SetDescription sets field value -func (o *AccessKeyProperties) SetDescription(v string) { - - o.Description = &v - -} - -// HasDescription returns a boolean if a field has been set. -func (o *AccessKeyProperties) 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 *AccessKeyProperties) 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 *AccessKeyProperties) GetAccessKeyOk() (*string, bool) { - if o == nil { - return nil, false - } - - return o.AccessKey, true -} - -// SetAccessKey sets field value -func (o *AccessKeyProperties) SetAccessKey(v string) { - - o.AccessKey = &v - -} - -// HasAccessKey returns a boolean if a field has been set. -func (o *AccessKeyProperties) 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 *AccessKeyProperties) 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 *AccessKeyProperties) GetSecretKeyOk() (*string, bool) { - if o == nil { - return nil, false - } - - return o.SecretKey, true -} - -// SetSecretKey sets field value -func (o *AccessKeyProperties) SetSecretKey(v string) { - - o.SecretKey = &v - -} - -// HasSecretKey returns a boolean if a field has been set. -func (o *AccessKeyProperties) 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 *AccessKeyProperties) 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 *AccessKeyProperties) GetCanonicalUserIdOk() (*string, bool) { - if o == nil { - return nil, false - } - - return o.CanonicalUserId, true -} - -// SetCanonicalUserId sets field value -func (o *AccessKeyProperties) SetCanonicalUserId(v string) { - - o.CanonicalUserId = &v - -} - -// HasCanonicalUserId returns a boolean if a field has been set. -func (o *AccessKeyProperties) 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 *AccessKeyProperties) 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 *AccessKeyProperties) GetContractUserIdOk() (*string, bool) { - if o == nil { - return nil, false - } - - return o.ContractUserId, true -} - -// SetContractUserId sets field value -func (o *AccessKeyProperties) SetContractUserId(v string) { - - o.ContractUserId = &v - -} - -// HasContractUserId returns a boolean if a field has been set. -func (o *AccessKeyProperties) HasContractUserId() bool { - if o != nil && o.ContractUserId != nil { - return true - } - - return false -} - -func (o AccessKeyProperties) 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 NullableAccessKeyProperties struct { - value *AccessKeyProperties - isSet bool -} - -func (v NullableAccessKeyProperties) Get() *AccessKeyProperties { - return v.value -} - -func (v *NullableAccessKeyProperties) Set(val *AccessKeyProperties) { - v.value = val - v.isSet = true -} - -func (v NullableAccessKeyProperties) IsSet() bool { - return v.isSet -} - -func (v *NullableAccessKeyProperties) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableAccessKeyProperties(val *AccessKeyProperties) *NullableAccessKeyProperties { - return &NullableAccessKeyProperties{value: val, isSet: true} -} - -func (v NullableAccessKeyProperties) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableAccessKeyProperties) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read.go new file mode 100644 index 000000000..2550ede3c --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-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-s3-management/model_access_key_list.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read_list.go similarity index 67% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_list.go rename to vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read_list.go index ef44a9c40..3e942b7b2 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_list.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read_list.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -14,8 +14,8 @@ import ( "encoding/json" ) -// AccessKeyList struct for AccessKeyList -type AccessKeyList struct { +// AccessKeyReadList struct for AccessKeyReadList +type AccessKeyReadList struct { // ID of the list of AccessKey resources. Id *string `json:"id"` // The type of the resource. @@ -23,7 +23,7 @@ type AccessKeyList struct { // The URL of the list of AccessKey resources. Href *string `json:"href"` // The list of AccessKey resources. - Items *[]AccessKey `json:"items,omitempty"` + 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). @@ -31,12 +31,12 @@ type AccessKeyList struct { Links *Links `json:"_links"` } -// NewAccessKeyList instantiates a new AccessKeyList object +// 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 NewAccessKeyList(id string, type_ string, href string, offset int32, limit int32, links Links) *AccessKeyList { - this := AccessKeyList{} +func NewAccessKeyReadList(id string, type_ string, href string, offset int32, limit int32, links Links) *AccessKeyReadList { + this := AccessKeyReadList{} this.Id = &id this.Type = &type_ @@ -48,17 +48,17 @@ func NewAccessKeyList(id string, type_ string, href string, offset int32, limit return &this } -// NewAccessKeyListWithDefaults instantiates a new AccessKeyList object +// 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 NewAccessKeyListWithDefaults() *AccessKeyList { - this := AccessKeyList{} +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 *AccessKeyList) GetId() *string { +func (o *AccessKeyReadList) GetId() *string { if o == nil { return nil } @@ -70,7 +70,7 @@ func (o *AccessKeyList) GetId() *string { // 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 *AccessKeyList) GetIdOk() (*string, bool) { +func (o *AccessKeyReadList) GetIdOk() (*string, bool) { if o == nil { return nil, false } @@ -79,14 +79,14 @@ func (o *AccessKeyList) GetIdOk() (*string, bool) { } // SetId sets field value -func (o *AccessKeyList) SetId(v string) { +func (o *AccessKeyReadList) SetId(v string) { o.Id = &v } // HasId returns a boolean if a field has been set. -func (o *AccessKeyList) HasId() bool { +func (o *AccessKeyReadList) HasId() bool { if o != nil && o.Id != nil { return true } @@ -96,7 +96,7 @@ func (o *AccessKeyList) HasId() bool { // GetType returns the Type field value // If the value is explicit nil, the zero value for string will be returned -func (o *AccessKeyList) GetType() *string { +func (o *AccessKeyReadList) GetType() *string { if o == nil { return nil } @@ -108,7 +108,7 @@ func (o *AccessKeyList) GetType() *string { // 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 *AccessKeyList) GetTypeOk() (*string, bool) { +func (o *AccessKeyReadList) GetTypeOk() (*string, bool) { if o == nil { return nil, false } @@ -117,14 +117,14 @@ func (o *AccessKeyList) GetTypeOk() (*string, bool) { } // SetType sets field value -func (o *AccessKeyList) SetType(v string) { +func (o *AccessKeyReadList) SetType(v string) { o.Type = &v } // HasType returns a boolean if a field has been set. -func (o *AccessKeyList) HasType() bool { +func (o *AccessKeyReadList) HasType() bool { if o != nil && o.Type != nil { return true } @@ -134,7 +134,7 @@ func (o *AccessKeyList) HasType() bool { // GetHref returns the Href field value // If the value is explicit nil, the zero value for string will be returned -func (o *AccessKeyList) GetHref() *string { +func (o *AccessKeyReadList) GetHref() *string { if o == nil { return nil } @@ -146,7 +146,7 @@ func (o *AccessKeyList) GetHref() *string { // 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 *AccessKeyList) GetHrefOk() (*string, bool) { +func (o *AccessKeyReadList) GetHrefOk() (*string, bool) { if o == nil { return nil, false } @@ -155,14 +155,14 @@ func (o *AccessKeyList) GetHrefOk() (*string, bool) { } // SetHref sets field value -func (o *AccessKeyList) SetHref(v string) { +func (o *AccessKeyReadList) SetHref(v string) { o.Href = &v } // HasHref returns a boolean if a field has been set. -func (o *AccessKeyList) HasHref() bool { +func (o *AccessKeyReadList) HasHref() bool { if o != nil && o.Href != nil { return true } @@ -171,8 +171,8 @@ func (o *AccessKeyList) HasHref() bool { } // GetItems returns the Items field value -// If the value is explicit nil, the zero value for []AccessKey will be returned -func (o *AccessKeyList) GetItems() *[]AccessKey { +// If the value is explicit nil, the zero value for []AccessKeyRead will be returned +func (o *AccessKeyReadList) GetItems() *[]AccessKeyRead { if o == nil { return nil } @@ -184,7 +184,7 @@ func (o *AccessKeyList) GetItems() *[]AccessKey { // 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 *AccessKeyList) GetItemsOk() (*[]AccessKey, bool) { +func (o *AccessKeyReadList) GetItemsOk() (*[]AccessKeyRead, bool) { if o == nil { return nil, false } @@ -193,14 +193,14 @@ func (o *AccessKeyList) GetItemsOk() (*[]AccessKey, bool) { } // SetItems sets field value -func (o *AccessKeyList) SetItems(v []AccessKey) { +func (o *AccessKeyReadList) SetItems(v []AccessKeyRead) { o.Items = &v } // HasItems returns a boolean if a field has been set. -func (o *AccessKeyList) HasItems() bool { +func (o *AccessKeyReadList) HasItems() bool { if o != nil && o.Items != nil { return true } @@ -210,7 +210,7 @@ func (o *AccessKeyList) HasItems() bool { // GetOffset returns the Offset field value // If the value is explicit nil, the zero value for int32 will be returned -func (o *AccessKeyList) GetOffset() *int32 { +func (o *AccessKeyReadList) GetOffset() *int32 { if o == nil { return nil } @@ -222,7 +222,7 @@ func (o *AccessKeyList) GetOffset() *int32 { // 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 *AccessKeyList) GetOffsetOk() (*int32, bool) { +func (o *AccessKeyReadList) GetOffsetOk() (*int32, bool) { if o == nil { return nil, false } @@ -231,14 +231,14 @@ func (o *AccessKeyList) GetOffsetOk() (*int32, bool) { } // SetOffset sets field value -func (o *AccessKeyList) SetOffset(v int32) { +func (o *AccessKeyReadList) SetOffset(v int32) { o.Offset = &v } // HasOffset returns a boolean if a field has been set. -func (o *AccessKeyList) HasOffset() bool { +func (o *AccessKeyReadList) HasOffset() bool { if o != nil && o.Offset != nil { return true } @@ -248,7 +248,7 @@ func (o *AccessKeyList) HasOffset() bool { // GetLimit returns the Limit field value // If the value is explicit nil, the zero value for int32 will be returned -func (o *AccessKeyList) GetLimit() *int32 { +func (o *AccessKeyReadList) GetLimit() *int32 { if o == nil { return nil } @@ -260,7 +260,7 @@ func (o *AccessKeyList) GetLimit() *int32 { // 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 *AccessKeyList) GetLimitOk() (*int32, bool) { +func (o *AccessKeyReadList) GetLimitOk() (*int32, bool) { if o == nil { return nil, false } @@ -269,14 +269,14 @@ func (o *AccessKeyList) GetLimitOk() (*int32, bool) { } // SetLimit sets field value -func (o *AccessKeyList) SetLimit(v int32) { +func (o *AccessKeyReadList) SetLimit(v int32) { o.Limit = &v } // HasLimit returns a boolean if a field has been set. -func (o *AccessKeyList) HasLimit() bool { +func (o *AccessKeyReadList) HasLimit() bool { if o != nil && o.Limit != nil { return true } @@ -286,7 +286,7 @@ func (o *AccessKeyList) HasLimit() bool { // GetLinks returns the Links field value // If the value is explicit nil, the zero value for Links will be returned -func (o *AccessKeyList) GetLinks() *Links { +func (o *AccessKeyReadList) GetLinks() *Links { if o == nil { return nil } @@ -298,7 +298,7 @@ func (o *AccessKeyList) GetLinks() *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 *AccessKeyList) GetLinksOk() (*Links, bool) { +func (o *AccessKeyReadList) GetLinksOk() (*Links, bool) { if o == nil { return nil, false } @@ -307,14 +307,14 @@ func (o *AccessKeyList) GetLinksOk() (*Links, bool) { } // SetLinks sets field value -func (o *AccessKeyList) SetLinks(v Links) { +func (o *AccessKeyReadList) SetLinks(v Links) { o.Links = &v } // HasLinks returns a boolean if a field has been set. -func (o *AccessKeyList) HasLinks() bool { +func (o *AccessKeyReadList) HasLinks() bool { if o != nil && o.Links != nil { return true } @@ -322,7 +322,7 @@ func (o *AccessKeyList) HasLinks() bool { return false } -func (o AccessKeyList) MarshalJSON() ([]byte, error) { +func (o AccessKeyReadList) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Id != nil { toSerialize["id"] = o.Id @@ -355,38 +355,38 @@ func (o AccessKeyList) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullableAccessKeyList struct { - value *AccessKeyList +type NullableAccessKeyReadList struct { + value *AccessKeyReadList isSet bool } -func (v NullableAccessKeyList) Get() *AccessKeyList { +func (v NullableAccessKeyReadList) Get() *AccessKeyReadList { return v.value } -func (v *NullableAccessKeyList) Set(val *AccessKeyList) { +func (v *NullableAccessKeyReadList) Set(val *AccessKeyReadList) { v.value = val v.isSet = true } -func (v NullableAccessKeyList) IsSet() bool { +func (v NullableAccessKeyReadList) IsSet() bool { return v.isSet } -func (v *NullableAccessKeyList) Unset() { +func (v *NullableAccessKeyReadList) Unset() { v.value = nil v.isSet = false } -func NewNullableAccessKeyList(val *AccessKeyList) *NullableAccessKeyList { - return &NullableAccessKeyList{value: val, isSet: true} +func NewNullableAccessKeyReadList(val *AccessKeyReadList) *NullableAccessKeyReadList { + return &NullableAccessKeyReadList{value: val, isSet: true} } -func (v NullableAccessKeyList) MarshalJSON() ([]byte, error) { +func (v NullableAccessKeyReadList) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableAccessKeyList) UnmarshalJSON(src []byte) error { +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-s3-management/model_access_key_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read_list_all_of.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_list_all_of.go rename to vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read_list_all_of.go index f67efc9d2..abf9c88c7 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_list_all_of.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read_list_all_of.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -14,8 +14,8 @@ import ( "encoding/json" ) -// AccessKeyListAllOf struct for AccessKeyListAllOf -type AccessKeyListAllOf struct { +// AccessKeyReadListAllOf struct for AccessKeyReadListAllOf +type AccessKeyReadListAllOf struct { // ID of the list of AccessKey resources. Id *string `json:"id"` // The type of the resource. @@ -23,15 +23,15 @@ type AccessKeyListAllOf struct { // The URL of the list of AccessKey resources. Href *string `json:"href"` // The list of AccessKey resources. - Items *[]AccessKey `json:"items,omitempty"` + Items *[]AccessKeyRead `json:"items,omitempty"` } -// NewAccessKeyListAllOf instantiates a new AccessKeyListAllOf object +// 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 NewAccessKeyListAllOf(id string, type_ string, href string) *AccessKeyListAllOf { - this := AccessKeyListAllOf{} +func NewAccessKeyReadListAllOf(id string, type_ string, href string) *AccessKeyReadListAllOf { + this := AccessKeyReadListAllOf{} this.Id = &id this.Type = &type_ @@ -40,17 +40,17 @@ func NewAccessKeyListAllOf(id string, type_ string, href string) *AccessKeyListA return &this } -// NewAccessKeyListAllOfWithDefaults instantiates a new AccessKeyListAllOf object +// 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 NewAccessKeyListAllOfWithDefaults() *AccessKeyListAllOf { - this := AccessKeyListAllOf{} +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 *AccessKeyListAllOf) GetId() *string { +func (o *AccessKeyReadListAllOf) GetId() *string { if o == nil { return nil } @@ -62,7 +62,7 @@ func (o *AccessKeyListAllOf) GetId() *string { // 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 *AccessKeyListAllOf) GetIdOk() (*string, bool) { +func (o *AccessKeyReadListAllOf) GetIdOk() (*string, bool) { if o == nil { return nil, false } @@ -71,14 +71,14 @@ func (o *AccessKeyListAllOf) GetIdOk() (*string, bool) { } // SetId sets field value -func (o *AccessKeyListAllOf) SetId(v string) { +func (o *AccessKeyReadListAllOf) SetId(v string) { o.Id = &v } // HasId returns a boolean if a field has been set. -func (o *AccessKeyListAllOf) HasId() bool { +func (o *AccessKeyReadListAllOf) HasId() bool { if o != nil && o.Id != nil { return true } @@ -88,7 +88,7 @@ func (o *AccessKeyListAllOf) HasId() bool { // GetType returns the Type field value // If the value is explicit nil, the zero value for string will be returned -func (o *AccessKeyListAllOf) GetType() *string { +func (o *AccessKeyReadListAllOf) GetType() *string { if o == nil { return nil } @@ -100,7 +100,7 @@ func (o *AccessKeyListAllOf) GetType() *string { // 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 *AccessKeyListAllOf) GetTypeOk() (*string, bool) { +func (o *AccessKeyReadListAllOf) GetTypeOk() (*string, bool) { if o == nil { return nil, false } @@ -109,14 +109,14 @@ func (o *AccessKeyListAllOf) GetTypeOk() (*string, bool) { } // SetType sets field value -func (o *AccessKeyListAllOf) SetType(v string) { +func (o *AccessKeyReadListAllOf) SetType(v string) { o.Type = &v } // HasType returns a boolean if a field has been set. -func (o *AccessKeyListAllOf) HasType() bool { +func (o *AccessKeyReadListAllOf) HasType() bool { if o != nil && o.Type != nil { return true } @@ -126,7 +126,7 @@ func (o *AccessKeyListAllOf) HasType() bool { // GetHref returns the Href field value // If the value is explicit nil, the zero value for string will be returned -func (o *AccessKeyListAllOf) GetHref() *string { +func (o *AccessKeyReadListAllOf) GetHref() *string { if o == nil { return nil } @@ -138,7 +138,7 @@ func (o *AccessKeyListAllOf) GetHref() *string { // 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 *AccessKeyListAllOf) GetHrefOk() (*string, bool) { +func (o *AccessKeyReadListAllOf) GetHrefOk() (*string, bool) { if o == nil { return nil, false } @@ -147,14 +147,14 @@ func (o *AccessKeyListAllOf) GetHrefOk() (*string, bool) { } // SetHref sets field value -func (o *AccessKeyListAllOf) SetHref(v string) { +func (o *AccessKeyReadListAllOf) SetHref(v string) { o.Href = &v } // HasHref returns a boolean if a field has been set. -func (o *AccessKeyListAllOf) HasHref() bool { +func (o *AccessKeyReadListAllOf) HasHref() bool { if o != nil && o.Href != nil { return true } @@ -163,8 +163,8 @@ func (o *AccessKeyListAllOf) HasHref() bool { } // GetItems returns the Items field value -// If the value is explicit nil, the zero value for []AccessKey will be returned -func (o *AccessKeyListAllOf) GetItems() *[]AccessKey { +// If the value is explicit nil, the zero value for []AccessKeyRead will be returned +func (o *AccessKeyReadListAllOf) GetItems() *[]AccessKeyRead { if o == nil { return nil } @@ -176,7 +176,7 @@ func (o *AccessKeyListAllOf) GetItems() *[]AccessKey { // 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 *AccessKeyListAllOf) GetItemsOk() (*[]AccessKey, bool) { +func (o *AccessKeyReadListAllOf) GetItemsOk() (*[]AccessKeyRead, bool) { if o == nil { return nil, false } @@ -185,14 +185,14 @@ func (o *AccessKeyListAllOf) GetItemsOk() (*[]AccessKey, bool) { } // SetItems sets field value -func (o *AccessKeyListAllOf) SetItems(v []AccessKey) { +func (o *AccessKeyReadListAllOf) SetItems(v []AccessKeyRead) { o.Items = &v } // HasItems returns a boolean if a field has been set. -func (o *AccessKeyListAllOf) HasItems() bool { +func (o *AccessKeyReadListAllOf) HasItems() bool { if o != nil && o.Items != nil { return true } @@ -200,7 +200,7 @@ func (o *AccessKeyListAllOf) HasItems() bool { return false } -func (o AccessKeyListAllOf) MarshalJSON() ([]byte, error) { +func (o AccessKeyReadListAllOf) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Id != nil { toSerialize["id"] = o.Id @@ -221,38 +221,38 @@ func (o AccessKeyListAllOf) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullableAccessKeyListAllOf struct { - value *AccessKeyListAllOf +type NullableAccessKeyReadListAllOf struct { + value *AccessKeyReadListAllOf isSet bool } -func (v NullableAccessKeyListAllOf) Get() *AccessKeyListAllOf { +func (v NullableAccessKeyReadListAllOf) Get() *AccessKeyReadListAllOf { return v.value } -func (v *NullableAccessKeyListAllOf) Set(val *AccessKeyListAllOf) { +func (v *NullableAccessKeyReadListAllOf) Set(val *AccessKeyReadListAllOf) { v.value = val v.isSet = true } -func (v NullableAccessKeyListAllOf) IsSet() bool { +func (v NullableAccessKeyReadListAllOf) IsSet() bool { return v.isSet } -func (v *NullableAccessKeyListAllOf) Unset() { +func (v *NullableAccessKeyReadListAllOf) Unset() { v.value = nil v.isSet = false } -func NewNullableAccessKeyListAllOf(val *AccessKeyListAllOf) *NullableAccessKeyListAllOf { - return &NullableAccessKeyListAllOf{value: val, isSet: true} +func NewNullableAccessKeyReadListAllOf(val *AccessKeyReadListAllOf) *NullableAccessKeyReadListAllOf { + return &NullableAccessKeyReadListAllOf{value: val, isSet: true} } -func (v NullableAccessKeyListAllOf) MarshalJSON() ([]byte, error) { +func (v NullableAccessKeyReadListAllOf) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableAccessKeyListAllOf) UnmarshalJSON(src []byte) error { +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-s3-management/model_bucket.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket.go index 647f2dffe..c4697bec3 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_create.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_create.go index d4781dffc..4754e7bbd 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_create.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_create.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_ensure.go index 227872708..17d8dae73 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_ensure.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_ensure.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read.go index 7a33521f7..3ea51afe3 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list.go index 6e2b7ef28..b77ed701e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list_all_of.go index 853ce81df..3b234e8d9 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list_all_of.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list_all_of.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error.go index 6f03dd2db..1fcd7252e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error_messages.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error_messages.go index 80bd8b4a0..92ee45788 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error_messages.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error_messages.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_links.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_links.go index 44d2c2093..74a607c16 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_links.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_links.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata.go index dc4f6bcc4..7e130f9c6 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status.go index b112fe048..4ac633629 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status_all_of.go index c3a28a865..11bffc82e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status_all_of.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status_all_of.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions.go index a8863656c..e4705448d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions_all_of.go index fa3f2b5e0..4577dd2d5 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions_all_of.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions_all_of.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_pagination.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_pagination.go index 6d53cc55f..12780cb7e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_pagination.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_pagination.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region.go index 75b29cbd5..33919d4c0 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -14,30 +14,33 @@ import ( "encoding/json" ) -// Region struct for Region +// 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 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 *RegionProperties `json:"properties"` + // 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(id string, type_ string, href string, metadata map[string]interface{}, properties RegionProperties) *Region { +func NewRegion(version int32, endpoint string, website string, capability RegionCapability, location string) *Region { this := Region{} - this.Id = &id - this.Type = &type_ - this.Href = &href - this.Metadata = &metadata - this.Properties = &properties + this.Version = &version + this.Endpoint = &endpoint + this.Website = &website + this.Capability = &capability + this.Location = &location return &this } @@ -50,190 +53,228 @@ func NewRegionWithDefaults() *Region { return &this } -// GetId returns the Id field value -// If the value is explicit nil, the zero value for string will be returned -func (o *Region) GetId() *string { +// 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.Id + return o.Version } -// GetIdOk returns a tuple with the Id field value +// 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) GetIdOk() (*string, bool) { +func (o *Region) GetVersionOk() (*int32, bool) { if o == nil { return nil, false } - return o.Id, true + return o.Version, true } -// SetId sets field value -func (o *Region) SetId(v string) { +// SetVersion sets field value +func (o *Region) SetVersion(v int32) { - o.Id = &v + o.Version = &v } -// HasId returns a boolean if a field has been set. -func (o *Region) HasId() bool { - if o != nil && o.Id != nil { +// 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 } -// GetType returns the Type field value +// GetEndpoint returns the Endpoint field value // If the value is explicit nil, the zero value for string will be returned -func (o *Region) GetType() *string { +func (o *Region) GetEndpoint() *string { if o == nil { return nil } - return o.Type + return o.Endpoint } -// GetTypeOk returns a tuple with the Type field value +// 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) GetTypeOk() (*string, bool) { +func (o *Region) GetEndpointOk() (*string, bool) { if o == nil { return nil, false } - return o.Type, true + return o.Endpoint, true } -// SetType sets field value -func (o *Region) SetType(v string) { +// SetEndpoint sets field value +func (o *Region) SetEndpoint(v string) { - o.Type = &v + o.Endpoint = &v } -// HasType returns a boolean if a field has been set. -func (o *Region) HasType() bool { - if o != nil && o.Type != nil { +// 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 } -// GetHref returns the Href field value +// GetWebsite returns the Website field value // If the value is explicit nil, the zero value for string will be returned -func (o *Region) GetHref() *string { +func (o *Region) GetWebsite() *string { if o == nil { return nil } - return o.Href + return o.Website } -// GetHrefOk returns a tuple with the Href field value +// 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) GetHrefOk() (*string, bool) { +func (o *Region) GetWebsiteOk() (*string, bool) { if o == nil { return nil, false } - return o.Href, true + return o.Website, true } -// SetHref sets field value -func (o *Region) SetHref(v string) { +// SetWebsite sets field value +func (o *Region) SetWebsite(v string) { - o.Href = &v + o.Website = &v } -// HasHref returns a boolean if a field has been set. -func (o *Region) HasHref() bool { - if o != nil && o.Href != nil { +// 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 } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, the zero value for map[string]interface{} will be returned -func (o *Region) GetMetadata() *map[string]interface{} { +// 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.Metadata + return o.Capability } -// GetMetadataOk returns a tuple with the Metadata field value +// 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) GetMetadataOk() (*map[string]interface{}, bool) { +func (o *Region) GetCapabilityOk() (*RegionCapability, bool) { if o == nil { return nil, false } - return o.Metadata, true + return o.Capability, true } -// SetMetadata sets field value -func (o *Region) SetMetadata(v map[string]interface{}) { +// SetCapability sets field value +func (o *Region) SetCapability(v RegionCapability) { - o.Metadata = &v + o.Capability = &v } -// HasMetadata returns a boolean if a field has been set. -func (o *Region) HasMetadata() bool { - if o != nil && o.Metadata != nil { +// 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 } -// GetProperties returns the Properties field value -// If the value is explicit nil, the zero value for RegionProperties will be returned -func (o *Region) GetProperties() *RegionProperties { +// 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.Properties + return o.StorageClasses } -// GetPropertiesOk returns a tuple with the Properties field value +// 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) GetPropertiesOk() (*RegionProperties, bool) { +func (o *Region) GetStorageClassesOk() (*[]string, bool) { if o == nil { return nil, false } - return o.Properties, true + return o.StorageClasses, true } -// SetProperties sets field value -func (o *Region) SetProperties(v RegionProperties) { +// SetStorageClasses sets field value +func (o *Region) SetStorageClasses(v []string) { - o.Properties = &v + o.StorageClasses = &v } -// HasProperties returns a boolean if a field has been set. -func (o *Region) HasProperties() bool { - if o != nil && o.Properties != nil { +// 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 } @@ -242,24 +283,28 @@ func (o *Region) HasProperties() bool { func (o Region) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { - toSerialize["id"] = o.Id + if o.Version != nil { + toSerialize["version"] = o.Version + } + + if o.Endpoint != nil { + toSerialize["endpoint"] = o.Endpoint } - if o.Type != nil { - toSerialize["type"] = o.Type + if o.Website != nil { + toSerialize["website"] = o.Website } - if o.Href != nil { - toSerialize["href"] = o.Href + if o.Capability != nil { + toSerialize["capability"] = o.Capability } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata + if o.StorageClasses != nil { + toSerialize["storageClasses"] = o.StorageClasses } - if o.Properties != nil { - toSerialize["properties"] = o.Properties + if o.Location != nil { + toSerialize["location"] = o.Location } return json.Marshal(toSerialize) diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties_capability.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_capability.go similarity index 55% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties_capability.go rename to vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_capability.go index d257ddde8..fbe6f17c3 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties_capability.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_capability.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -14,35 +14,35 @@ import ( "encoding/json" ) -// RegionPropertiesCapability The capabilities of the region -type RegionPropertiesCapability struct { +// 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"` } -// NewRegionPropertiesCapability instantiates a new RegionPropertiesCapability object +// 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 NewRegionPropertiesCapability() *RegionPropertiesCapability { - this := RegionPropertiesCapability{} +func NewRegionCapability() *RegionCapability { + this := RegionCapability{} return &this } -// NewRegionPropertiesCapabilityWithDefaults instantiates a new RegionPropertiesCapability object +// 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 NewRegionPropertiesCapabilityWithDefaults() *RegionPropertiesCapability { - this := RegionPropertiesCapability{} +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 *RegionPropertiesCapability) GetIam() *bool { +func (o *RegionCapability) GetIam() *bool { if o == nil { return nil } @@ -54,7 +54,7 @@ func (o *RegionPropertiesCapability) GetIam() *bool { // 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 *RegionPropertiesCapability) GetIamOk() (*bool, bool) { +func (o *RegionCapability) GetIamOk() (*bool, bool) { if o == nil { return nil, false } @@ -63,14 +63,14 @@ func (o *RegionPropertiesCapability) GetIamOk() (*bool, bool) { } // SetIam sets field value -func (o *RegionPropertiesCapability) SetIam(v bool) { +func (o *RegionCapability) SetIam(v bool) { o.Iam = &v } // HasIam returns a boolean if a field has been set. -func (o *RegionPropertiesCapability) HasIam() bool { +func (o *RegionCapability) HasIam() bool { if o != nil && o.Iam != nil { return true } @@ -80,7 +80,7 @@ func (o *RegionPropertiesCapability) HasIam() bool { // GetS3select returns the S3select field value // If the value is explicit nil, the zero value for bool will be returned -func (o *RegionPropertiesCapability) GetS3select() *bool { +func (o *RegionCapability) GetS3select() *bool { if o == nil { return nil } @@ -92,7 +92,7 @@ func (o *RegionPropertiesCapability) GetS3select() *bool { // 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 *RegionPropertiesCapability) GetS3selectOk() (*bool, bool) { +func (o *RegionCapability) GetS3selectOk() (*bool, bool) { if o == nil { return nil, false } @@ -101,14 +101,14 @@ func (o *RegionPropertiesCapability) GetS3selectOk() (*bool, bool) { } // SetS3select sets field value -func (o *RegionPropertiesCapability) SetS3select(v bool) { +func (o *RegionCapability) SetS3select(v bool) { o.S3select = &v } // HasS3select returns a boolean if a field has been set. -func (o *RegionPropertiesCapability) HasS3select() bool { +func (o *RegionCapability) HasS3select() bool { if o != nil && o.S3select != nil { return true } @@ -116,7 +116,7 @@ func (o *RegionPropertiesCapability) HasS3select() bool { return false } -func (o RegionPropertiesCapability) MarshalJSON() ([]byte, error) { +func (o RegionCapability) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Iam != nil { toSerialize["iam"] = o.Iam @@ -129,38 +129,38 @@ func (o RegionPropertiesCapability) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullableRegionPropertiesCapability struct { - value *RegionPropertiesCapability +type NullableRegionCapability struct { + value *RegionCapability isSet bool } -func (v NullableRegionPropertiesCapability) Get() *RegionPropertiesCapability { +func (v NullableRegionCapability) Get() *RegionCapability { return v.value } -func (v *NullableRegionPropertiesCapability) Set(val *RegionPropertiesCapability) { +func (v *NullableRegionCapability) Set(val *RegionCapability) { v.value = val v.isSet = true } -func (v NullableRegionPropertiesCapability) IsSet() bool { +func (v NullableRegionCapability) IsSet() bool { return v.isSet } -func (v *NullableRegionPropertiesCapability) Unset() { +func (v *NullableRegionCapability) Unset() { v.value = nil v.isSet = false } -func NewNullableRegionPropertiesCapability(val *RegionPropertiesCapability) *NullableRegionPropertiesCapability { - return &NullableRegionPropertiesCapability{value: val, isSet: true} +func NewNullableRegionCapability(val *RegionCapability) *NullableRegionCapability { + return &NullableRegionCapability{value: val, isSet: true} } -func (v NullableRegionPropertiesCapability) MarshalJSON() ([]byte, error) { +func (v NullableRegionCapability) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableRegionPropertiesCapability) UnmarshalJSON(src []byte) error { +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-s3-management/model_region_create.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_create.go index 697a8a36b..8949b590d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_create.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_create.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -18,14 +18,14 @@ import ( type RegionCreate struct { // Metadata Metadata *map[string]interface{} `json:"metadata,omitempty"` - Properties *RegionProperties `json:"properties"` + 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 RegionProperties) *RegionCreate { +func NewRegionCreate(properties Region) *RegionCreate { this := RegionCreate{} this.Properties = &properties @@ -80,8 +80,8 @@ func (o *RegionCreate) HasMetadata() bool { } // GetProperties returns the Properties field value -// If the value is explicit nil, the zero value for RegionProperties will be returned -func (o *RegionCreate) GetProperties() *RegionProperties { +// If the value is explicit nil, the zero value for Region will be returned +func (o *RegionCreate) GetProperties() *Region { if o == nil { return nil } @@ -93,7 +93,7 @@ func (o *RegionCreate) GetProperties() *RegionProperties { // 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() (*RegionProperties, bool) { +func (o *RegionCreate) GetPropertiesOk() (*Region, bool) { if o == nil { return nil, false } @@ -102,7 +102,7 @@ func (o *RegionCreate) GetPropertiesOk() (*RegionProperties, bool) { } // SetProperties sets field value -func (o *RegionCreate) SetProperties(v RegionProperties) { +func (o *RegionCreate) SetProperties(v Region) { o.Properties = &v diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_ensure.go index 8ff2e9a0d..e83934556 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_ensure.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_ensure.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -20,14 +20,14 @@ type RegionEnsure struct { Id *string `json:"id"` // Metadata Metadata *map[string]interface{} `json:"metadata,omitempty"` - Properties *RegionProperties `json:"properties"` + 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 RegionProperties) *RegionEnsure { +func NewRegionEnsure(id string, properties Region) *RegionEnsure { this := RegionEnsure{} this.Id = &id @@ -121,8 +121,8 @@ func (o *RegionEnsure) HasMetadata() bool { } // GetProperties returns the Properties field value -// If the value is explicit nil, the zero value for RegionProperties will be returned -func (o *RegionEnsure) GetProperties() *RegionProperties { +// If the value is explicit nil, the zero value for Region will be returned +func (o *RegionEnsure) GetProperties() *Region { if o == nil { return nil } @@ -134,7 +134,7 @@ func (o *RegionEnsure) GetProperties() *RegionProperties { // 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() (*RegionProperties, bool) { +func (o *RegionEnsure) GetPropertiesOk() (*Region, bool) { if o == nil { return nil, false } @@ -143,7 +143,7 @@ func (o *RegionEnsure) GetPropertiesOk() (*RegionProperties, bool) { } // SetProperties sets field value -func (o *RegionEnsure) SetProperties(v RegionProperties) { +func (o *RegionEnsure) SetProperties(v Region) { o.Properties = &v diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties.go deleted file mode 100644 index fc95634b2..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_properties.go +++ /dev/null @@ -1,347 +0,0 @@ -/* - * IONOS Cloud - S3 Management API - * - * S3 Management API is a RESTful API that manages the S3 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" -) - -// RegionProperties IONOS Cloud S3 regions they define the location of the bucket, can also be used as `LocationConstraint` for bucket creation. -type RegionProperties 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 *RegionPropertiesCapability `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"` -} - -// NewRegionProperties instantiates a new RegionProperties 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 NewRegionProperties(version int32, endpoint string, website string, capability RegionPropertiesCapability, location string) *RegionProperties { - this := RegionProperties{} - - this.Version = &version - this.Endpoint = &endpoint - this.Website = &website - this.Capability = &capability - this.Location = &location - - return &this -} - -// NewRegionPropertiesWithDefaults instantiates a new RegionProperties 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 NewRegionPropertiesWithDefaults() *RegionProperties { - this := RegionProperties{} - return &this -} - -// GetVersion returns the Version field value -// If the value is explicit nil, the zero value for int32 will be returned -func (o *RegionProperties) 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 *RegionProperties) GetVersionOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.Version, true -} - -// SetVersion sets field value -func (o *RegionProperties) SetVersion(v int32) { - - o.Version = &v - -} - -// HasVersion returns a boolean if a field has been set. -func (o *RegionProperties) 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 *RegionProperties) 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 *RegionProperties) GetEndpointOk() (*string, bool) { - if o == nil { - return nil, false - } - - return o.Endpoint, true -} - -// SetEndpoint sets field value -func (o *RegionProperties) SetEndpoint(v string) { - - o.Endpoint = &v - -} - -// HasEndpoint returns a boolean if a field has been set. -func (o *RegionProperties) 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 *RegionProperties) 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 *RegionProperties) GetWebsiteOk() (*string, bool) { - if o == nil { - return nil, false - } - - return o.Website, true -} - -// SetWebsite sets field value -func (o *RegionProperties) SetWebsite(v string) { - - o.Website = &v - -} - -// HasWebsite returns a boolean if a field has been set. -func (o *RegionProperties) 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 RegionPropertiesCapability will be returned -func (o *RegionProperties) GetCapability() *RegionPropertiesCapability { - 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 *RegionProperties) GetCapabilityOk() (*RegionPropertiesCapability, bool) { - if o == nil { - return nil, false - } - - return o.Capability, true -} - -// SetCapability sets field value -func (o *RegionProperties) SetCapability(v RegionPropertiesCapability) { - - o.Capability = &v - -} - -// HasCapability returns a boolean if a field has been set. -func (o *RegionProperties) 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 *RegionProperties) 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 *RegionProperties) GetStorageclassesOk() (*[]string, bool) { - if o == nil { - return nil, false - } - - return o.Storageclasses, true -} - -// SetStorageclasses sets field value -func (o *RegionProperties) SetStorageclasses(v []string) { - - o.Storageclasses = &v - -} - -// HasStorageclasses returns a boolean if a field has been set. -func (o *RegionProperties) 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 *RegionProperties) 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 *RegionProperties) GetLocationOk() (*string, bool) { - if o == nil { - return nil, false - } - - return o.Location, true -} - -// SetLocation sets field value -func (o *RegionProperties) SetLocation(v string) { - - o.Location = &v - -} - -// HasLocation returns a boolean if a field has been set. -func (o *RegionProperties) HasLocation() bool { - if o != nil && o.Location != nil { - return true - } - - return false -} - -func (o RegionProperties) 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 NullableRegionProperties struct { - value *RegionProperties - isSet bool -} - -func (v NullableRegionProperties) Get() *RegionProperties { - return v.value -} - -func (v *NullableRegionProperties) Set(val *RegionProperties) { - v.value = val - v.isSet = true -} - -func (v NullableRegionProperties) IsSet() bool { - return v.isSet -} - -func (v *NullableRegionProperties) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableRegionProperties(val *RegionProperties) *NullableRegionProperties { - return &NullableRegionProperties{value: val, isSet: true} -} - -func (v NullableRegionProperties) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableRegionProperties) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read.go new file mode 100644 index 000000000..92f389dbc --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-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-s3-management/model_region_list.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read_list.go similarity index 69% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_list.go rename to vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read_list.go index bd36fcffd..7e78cf2ee 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_list.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read_list.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -14,8 +14,8 @@ import ( "encoding/json" ) -// RegionList struct for RegionList -type RegionList struct { +// RegionReadList struct for RegionReadList +type RegionReadList struct { // ID of the list of Region resources. Id *string `json:"id"` // The type of the resource. @@ -23,7 +23,7 @@ type RegionList struct { // The URL of the list of Region resources. Href *string `json:"href"` // The list of Region resources. - Items *[]Region `json:"items,omitempty"` + 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). @@ -31,12 +31,12 @@ type RegionList struct { Links *Links `json:"_links"` } -// NewRegionList instantiates a new RegionList object +// 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 NewRegionList(id string, type_ string, href string, offset int32, limit int32, links Links) *RegionList { - this := RegionList{} +func NewRegionReadList(id string, type_ string, href string, offset int32, limit int32, links Links) *RegionReadList { + this := RegionReadList{} this.Id = &id this.Type = &type_ @@ -48,17 +48,17 @@ func NewRegionList(id string, type_ string, href string, offset int32, limit int return &this } -// NewRegionListWithDefaults instantiates a new RegionList object +// 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 NewRegionListWithDefaults() *RegionList { - this := RegionList{} +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 *RegionList) GetId() *string { +func (o *RegionReadList) GetId() *string { if o == nil { return nil } @@ -70,7 +70,7 @@ func (o *RegionList) GetId() *string { // 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 *RegionList) GetIdOk() (*string, bool) { +func (o *RegionReadList) GetIdOk() (*string, bool) { if o == nil { return nil, false } @@ -79,14 +79,14 @@ func (o *RegionList) GetIdOk() (*string, bool) { } // SetId sets field value -func (o *RegionList) SetId(v string) { +func (o *RegionReadList) SetId(v string) { o.Id = &v } // HasId returns a boolean if a field has been set. -func (o *RegionList) HasId() bool { +func (o *RegionReadList) HasId() bool { if o != nil && o.Id != nil { return true } @@ -96,7 +96,7 @@ func (o *RegionList) HasId() bool { // GetType returns the Type field value // If the value is explicit nil, the zero value for string will be returned -func (o *RegionList) GetType() *string { +func (o *RegionReadList) GetType() *string { if o == nil { return nil } @@ -108,7 +108,7 @@ func (o *RegionList) GetType() *string { // 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 *RegionList) GetTypeOk() (*string, bool) { +func (o *RegionReadList) GetTypeOk() (*string, bool) { if o == nil { return nil, false } @@ -117,14 +117,14 @@ func (o *RegionList) GetTypeOk() (*string, bool) { } // SetType sets field value -func (o *RegionList) SetType(v string) { +func (o *RegionReadList) SetType(v string) { o.Type = &v } // HasType returns a boolean if a field has been set. -func (o *RegionList) HasType() bool { +func (o *RegionReadList) HasType() bool { if o != nil && o.Type != nil { return true } @@ -134,7 +134,7 @@ func (o *RegionList) HasType() bool { // GetHref returns the Href field value // If the value is explicit nil, the zero value for string will be returned -func (o *RegionList) GetHref() *string { +func (o *RegionReadList) GetHref() *string { if o == nil { return nil } @@ -146,7 +146,7 @@ func (o *RegionList) GetHref() *string { // 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 *RegionList) GetHrefOk() (*string, bool) { +func (o *RegionReadList) GetHrefOk() (*string, bool) { if o == nil { return nil, false } @@ -155,14 +155,14 @@ func (o *RegionList) GetHrefOk() (*string, bool) { } // SetHref sets field value -func (o *RegionList) SetHref(v string) { +func (o *RegionReadList) SetHref(v string) { o.Href = &v } // HasHref returns a boolean if a field has been set. -func (o *RegionList) HasHref() bool { +func (o *RegionReadList) HasHref() bool { if o != nil && o.Href != nil { return true } @@ -171,8 +171,8 @@ func (o *RegionList) HasHref() bool { } // GetItems returns the Items field value -// If the value is explicit nil, the zero value for []Region will be returned -func (o *RegionList) GetItems() *[]Region { +// If the value is explicit nil, the zero value for []RegionRead will be returned +func (o *RegionReadList) GetItems() *[]RegionRead { if o == nil { return nil } @@ -184,7 +184,7 @@ func (o *RegionList) GetItems() *[]Region { // 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 *RegionList) GetItemsOk() (*[]Region, bool) { +func (o *RegionReadList) GetItemsOk() (*[]RegionRead, bool) { if o == nil { return nil, false } @@ -193,14 +193,14 @@ func (o *RegionList) GetItemsOk() (*[]Region, bool) { } // SetItems sets field value -func (o *RegionList) SetItems(v []Region) { +func (o *RegionReadList) SetItems(v []RegionRead) { o.Items = &v } // HasItems returns a boolean if a field has been set. -func (o *RegionList) HasItems() bool { +func (o *RegionReadList) HasItems() bool { if o != nil && o.Items != nil { return true } @@ -210,7 +210,7 @@ func (o *RegionList) HasItems() bool { // GetOffset returns the Offset field value // If the value is explicit nil, the zero value for int32 will be returned -func (o *RegionList) GetOffset() *int32 { +func (o *RegionReadList) GetOffset() *int32 { if o == nil { return nil } @@ -222,7 +222,7 @@ func (o *RegionList) GetOffset() *int32 { // 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 *RegionList) GetOffsetOk() (*int32, bool) { +func (o *RegionReadList) GetOffsetOk() (*int32, bool) { if o == nil { return nil, false } @@ -231,14 +231,14 @@ func (o *RegionList) GetOffsetOk() (*int32, bool) { } // SetOffset sets field value -func (o *RegionList) SetOffset(v int32) { +func (o *RegionReadList) SetOffset(v int32) { o.Offset = &v } // HasOffset returns a boolean if a field has been set. -func (o *RegionList) HasOffset() bool { +func (o *RegionReadList) HasOffset() bool { if o != nil && o.Offset != nil { return true } @@ -248,7 +248,7 @@ func (o *RegionList) HasOffset() bool { // GetLimit returns the Limit field value // If the value is explicit nil, the zero value for int32 will be returned -func (o *RegionList) GetLimit() *int32 { +func (o *RegionReadList) GetLimit() *int32 { if o == nil { return nil } @@ -260,7 +260,7 @@ func (o *RegionList) GetLimit() *int32 { // 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 *RegionList) GetLimitOk() (*int32, bool) { +func (o *RegionReadList) GetLimitOk() (*int32, bool) { if o == nil { return nil, false } @@ -269,14 +269,14 @@ func (o *RegionList) GetLimitOk() (*int32, bool) { } // SetLimit sets field value -func (o *RegionList) SetLimit(v int32) { +func (o *RegionReadList) SetLimit(v int32) { o.Limit = &v } // HasLimit returns a boolean if a field has been set. -func (o *RegionList) HasLimit() bool { +func (o *RegionReadList) HasLimit() bool { if o != nil && o.Limit != nil { return true } @@ -286,7 +286,7 @@ func (o *RegionList) HasLimit() bool { // GetLinks returns the Links field value // If the value is explicit nil, the zero value for Links will be returned -func (o *RegionList) GetLinks() *Links { +func (o *RegionReadList) GetLinks() *Links { if o == nil { return nil } @@ -298,7 +298,7 @@ func (o *RegionList) GetLinks() *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 *RegionList) GetLinksOk() (*Links, bool) { +func (o *RegionReadList) GetLinksOk() (*Links, bool) { if o == nil { return nil, false } @@ -307,14 +307,14 @@ func (o *RegionList) GetLinksOk() (*Links, bool) { } // SetLinks sets field value -func (o *RegionList) SetLinks(v Links) { +func (o *RegionReadList) SetLinks(v Links) { o.Links = &v } // HasLinks returns a boolean if a field has been set. -func (o *RegionList) HasLinks() bool { +func (o *RegionReadList) HasLinks() bool { if o != nil && o.Links != nil { return true } @@ -322,7 +322,7 @@ func (o *RegionList) HasLinks() bool { return false } -func (o RegionList) MarshalJSON() ([]byte, error) { +func (o RegionReadList) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Id != nil { toSerialize["id"] = o.Id @@ -355,38 +355,38 @@ func (o RegionList) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullableRegionList struct { - value *RegionList +type NullableRegionReadList struct { + value *RegionReadList isSet bool } -func (v NullableRegionList) Get() *RegionList { +func (v NullableRegionReadList) Get() *RegionReadList { return v.value } -func (v *NullableRegionList) Set(val *RegionList) { +func (v *NullableRegionReadList) Set(val *RegionReadList) { v.value = val v.isSet = true } -func (v NullableRegionList) IsSet() bool { +func (v NullableRegionReadList) IsSet() bool { return v.isSet } -func (v *NullableRegionList) Unset() { +func (v *NullableRegionReadList) Unset() { v.value = nil v.isSet = false } -func NewNullableRegionList(val *RegionList) *NullableRegionList { - return &NullableRegionList{value: val, isSet: true} +func NewNullableRegionReadList(val *RegionReadList) *NullableRegionReadList { + return &NullableRegionReadList{value: val, isSet: true} } -func (v NullableRegionList) MarshalJSON() ([]byte, error) { +func (v NullableRegionReadList) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableRegionList) UnmarshalJSON(src []byte) error { +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-s3-management/model_region_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read_list_all_of.go similarity index 61% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_list_all_of.go rename to vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read_list_all_of.go index 01e568265..7d632de6e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_list_all_of.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read_list_all_of.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -14,8 +14,8 @@ import ( "encoding/json" ) -// RegionListAllOf struct for RegionListAllOf -type RegionListAllOf struct { +// RegionReadListAllOf struct for RegionReadListAllOf +type RegionReadListAllOf struct { // ID of the list of Region resources. Id *string `json:"id"` // The type of the resource. @@ -23,15 +23,15 @@ type RegionListAllOf struct { // The URL of the list of Region resources. Href *string `json:"href"` // The list of Region resources. - Items *[]Region `json:"items,omitempty"` + Items *[]RegionRead `json:"items,omitempty"` } -// NewRegionListAllOf instantiates a new RegionListAllOf object +// 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 NewRegionListAllOf(id string, type_ string, href string) *RegionListAllOf { - this := RegionListAllOf{} +func NewRegionReadListAllOf(id string, type_ string, href string) *RegionReadListAllOf { + this := RegionReadListAllOf{} this.Id = &id this.Type = &type_ @@ -40,17 +40,17 @@ func NewRegionListAllOf(id string, type_ string, href string) *RegionListAllOf { return &this } -// NewRegionListAllOfWithDefaults instantiates a new RegionListAllOf object +// 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 NewRegionListAllOfWithDefaults() *RegionListAllOf { - this := RegionListAllOf{} +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 *RegionListAllOf) GetId() *string { +func (o *RegionReadListAllOf) GetId() *string { if o == nil { return nil } @@ -62,7 +62,7 @@ func (o *RegionListAllOf) GetId() *string { // 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 *RegionListAllOf) GetIdOk() (*string, bool) { +func (o *RegionReadListAllOf) GetIdOk() (*string, bool) { if o == nil { return nil, false } @@ -71,14 +71,14 @@ func (o *RegionListAllOf) GetIdOk() (*string, bool) { } // SetId sets field value -func (o *RegionListAllOf) SetId(v string) { +func (o *RegionReadListAllOf) SetId(v string) { o.Id = &v } // HasId returns a boolean if a field has been set. -func (o *RegionListAllOf) HasId() bool { +func (o *RegionReadListAllOf) HasId() bool { if o != nil && o.Id != nil { return true } @@ -88,7 +88,7 @@ func (o *RegionListAllOf) HasId() bool { // GetType returns the Type field value // If the value is explicit nil, the zero value for string will be returned -func (o *RegionListAllOf) GetType() *string { +func (o *RegionReadListAllOf) GetType() *string { if o == nil { return nil } @@ -100,7 +100,7 @@ func (o *RegionListAllOf) GetType() *string { // 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 *RegionListAllOf) GetTypeOk() (*string, bool) { +func (o *RegionReadListAllOf) GetTypeOk() (*string, bool) { if o == nil { return nil, false } @@ -109,14 +109,14 @@ func (o *RegionListAllOf) GetTypeOk() (*string, bool) { } // SetType sets field value -func (o *RegionListAllOf) SetType(v string) { +func (o *RegionReadListAllOf) SetType(v string) { o.Type = &v } // HasType returns a boolean if a field has been set. -func (o *RegionListAllOf) HasType() bool { +func (o *RegionReadListAllOf) HasType() bool { if o != nil && o.Type != nil { return true } @@ -126,7 +126,7 @@ func (o *RegionListAllOf) HasType() bool { // GetHref returns the Href field value // If the value is explicit nil, the zero value for string will be returned -func (o *RegionListAllOf) GetHref() *string { +func (o *RegionReadListAllOf) GetHref() *string { if o == nil { return nil } @@ -138,7 +138,7 @@ func (o *RegionListAllOf) GetHref() *string { // 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 *RegionListAllOf) GetHrefOk() (*string, bool) { +func (o *RegionReadListAllOf) GetHrefOk() (*string, bool) { if o == nil { return nil, false } @@ -147,14 +147,14 @@ func (o *RegionListAllOf) GetHrefOk() (*string, bool) { } // SetHref sets field value -func (o *RegionListAllOf) SetHref(v string) { +func (o *RegionReadListAllOf) SetHref(v string) { o.Href = &v } // HasHref returns a boolean if a field has been set. -func (o *RegionListAllOf) HasHref() bool { +func (o *RegionReadListAllOf) HasHref() bool { if o != nil && o.Href != nil { return true } @@ -163,8 +163,8 @@ func (o *RegionListAllOf) HasHref() bool { } // GetItems returns the Items field value -// If the value is explicit nil, the zero value for []Region will be returned -func (o *RegionListAllOf) GetItems() *[]Region { +// If the value is explicit nil, the zero value for []RegionRead will be returned +func (o *RegionReadListAllOf) GetItems() *[]RegionRead { if o == nil { return nil } @@ -176,7 +176,7 @@ func (o *RegionListAllOf) GetItems() *[]Region { // 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 *RegionListAllOf) GetItemsOk() (*[]Region, bool) { +func (o *RegionReadListAllOf) GetItemsOk() (*[]RegionRead, bool) { if o == nil { return nil, false } @@ -185,14 +185,14 @@ func (o *RegionListAllOf) GetItemsOk() (*[]Region, bool) { } // SetItems sets field value -func (o *RegionListAllOf) SetItems(v []Region) { +func (o *RegionReadListAllOf) SetItems(v []RegionRead) { o.Items = &v } // HasItems returns a boolean if a field has been set. -func (o *RegionListAllOf) HasItems() bool { +func (o *RegionReadListAllOf) HasItems() bool { if o != nil && o.Items != nil { return true } @@ -200,7 +200,7 @@ func (o *RegionListAllOf) HasItems() bool { return false } -func (o RegionListAllOf) MarshalJSON() ([]byte, error) { +func (o RegionReadListAllOf) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Id != nil { toSerialize["id"] = o.Id @@ -221,38 +221,38 @@ func (o RegionListAllOf) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullableRegionListAllOf struct { - value *RegionListAllOf +type NullableRegionReadListAllOf struct { + value *RegionReadListAllOf isSet bool } -func (v NullableRegionListAllOf) Get() *RegionListAllOf { +func (v NullableRegionReadListAllOf) Get() *RegionReadListAllOf { return v.value } -func (v *NullableRegionListAllOf) Set(val *RegionListAllOf) { +func (v *NullableRegionReadListAllOf) Set(val *RegionReadListAllOf) { v.value = val v.isSet = true } -func (v NullableRegionListAllOf) IsSet() bool { +func (v NullableRegionReadListAllOf) IsSet() bool { return v.isSet } -func (v *NullableRegionListAllOf) Unset() { +func (v *NullableRegionReadListAllOf) Unset() { v.value = nil v.isSet = false } -func NewNullableRegionListAllOf(val *RegionListAllOf) *NullableRegionListAllOf { - return &NullableRegionListAllOf{value: val, isSet: true} +func NewNullableRegionReadListAllOf(val *RegionReadListAllOf) *NullableRegionReadListAllOf { + return &NullableRegionReadListAllOf{value: val, isSet: true} } -func (v NullableRegionListAllOf) MarshalJSON() ([]byte, error) { +func (v NullableRegionReadListAllOf) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableRegionListAllOf) UnmarshalJSON(src []byte) error { +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-s3-management/model_storage_class.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class.go index cc06f6a1f..f4426a652 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -14,30 +14,26 @@ import ( "encoding/json" ) -// StorageClass struct for StorageClass +// StorageClass Details the cross functional aspects of the given storage class. type StorageClass 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 *StorageClassProperties `json:"properties"` + // 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(id string, type_ string, href string, metadata map[string]interface{}, properties StorageClassProperties) *StorageClass { +func NewStorageClass(description string, durability string, availability string) *StorageClass { this := StorageClass{} - this.Id = &id - this.Type = &type_ - this.Href = &href - this.Metadata = &metadata - this.Properties = &properties + this.Description = &description + this.Durability = &durability + this.Availability = &availability return &this } @@ -50,190 +46,114 @@ func NewStorageClassWithDefaults() *StorageClass { return &this } -// GetId returns the Id field value +// GetDescription returns the Description field value // If the value is explicit nil, the zero value for string will be returned -func (o *StorageClass) GetId() *string { +func (o *StorageClass) GetDescription() *string { if o == nil { return nil } - return o.Id + return o.Description } -// GetIdOk returns a tuple with the Id field value +// 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) GetIdOk() (*string, bool) { +func (o *StorageClass) GetDescriptionOk() (*string, bool) { if o == nil { return nil, false } - return o.Id, true + return o.Description, true } -// SetId sets field value -func (o *StorageClass) SetId(v string) { +// SetDescription sets field value +func (o *StorageClass) SetDescription(v string) { - o.Id = &v + o.Description = &v } -// HasId returns a boolean if a field has been set. -func (o *StorageClass) HasId() bool { - if o != nil && o.Id != nil { +// 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 } -// GetType returns the Type field value +// GetDurability returns the Durability field value // If the value is explicit nil, the zero value for string will be returned -func (o *StorageClass) GetType() *string { +func (o *StorageClass) GetDurability() *string { if o == nil { return nil } - return o.Type + return o.Durability } -// GetTypeOk returns a tuple with the Type field value +// 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) GetTypeOk() (*string, bool) { +func (o *StorageClass) GetDurabilityOk() (*string, bool) { if o == nil { return nil, false } - return o.Type, true + return o.Durability, true } -// SetType sets field value -func (o *StorageClass) SetType(v string) { +// SetDurability sets field value +func (o *StorageClass) SetDurability(v string) { - o.Type = &v + o.Durability = &v } -// HasType returns a boolean if a field has been set. -func (o *StorageClass) HasType() bool { - if o != nil && o.Type != nil { +// 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 } -// GetHref returns the Href field value +// GetAvailability returns the Availability field value // If the value is explicit nil, the zero value for string will be returned -func (o *StorageClass) GetHref() *string { +func (o *StorageClass) GetAvailability() *string { if o == nil { return nil } - return o.Href + return o.Availability } -// GetHrefOk returns a tuple with the Href field value +// 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) GetHrefOk() (*string, bool) { +func (o *StorageClass) GetAvailabilityOk() (*string, bool) { if o == nil { return nil, false } - return o.Href, true + return o.Availability, true } -// SetHref sets field value -func (o *StorageClass) SetHref(v string) { +// SetAvailability sets field value +func (o *StorageClass) SetAvailability(v string) { - o.Href = &v + o.Availability = &v } -// HasHref returns a boolean if a field has been set. -func (o *StorageClass) 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 *StorageClass) 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 *StorageClass) GetMetadataOk() (*map[string]interface{}, bool) { - if o == nil { - return nil, false - } - - return o.Metadata, true -} - -// SetMetadata sets field value -func (o *StorageClass) SetMetadata(v map[string]interface{}) { - - o.Metadata = &v - -} - -// HasMetadata returns a boolean if a field has been set. -func (o *StorageClass) 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 StorageClassProperties will be returned -func (o *StorageClass) GetProperties() *StorageClassProperties { - 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 *StorageClass) GetPropertiesOk() (*StorageClassProperties, bool) { - if o == nil { - return nil, false - } - - return o.Properties, true -} - -// SetProperties sets field value -func (o *StorageClass) SetProperties(v StorageClassProperties) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *StorageClass) HasProperties() bool { - if o != nil && o.Properties != nil { +// HasAvailability returns a boolean if a field has been set. +func (o *StorageClass) HasAvailability() bool { + if o != nil && o.Availability != nil { return true } @@ -242,24 +162,16 @@ func (o *StorageClass) HasProperties() bool { func (o StorageClass) 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.Description != nil { + toSerialize["description"] = o.Description } - if o.Metadata != nil { - toSerialize["metadata"] = o.Metadata + if o.Durability != nil { + toSerialize["durability"] = o.Durability } - if o.Properties != nil { - toSerialize["properties"] = o.Properties + if o.Availability != nil { + toSerialize["availability"] = o.Availability } return json.Marshal(toSerialize) diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_create.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_create.go index eb4813d4b..99d2add7f 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_create.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_create.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -18,14 +18,14 @@ import ( type StorageClassCreate struct { // Metadata Metadata *map[string]interface{} `json:"metadata,omitempty"` - Properties *StorageClassProperties `json:"properties"` + 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 StorageClassProperties) *StorageClassCreate { +func NewStorageClassCreate(properties StorageClass) *StorageClassCreate { this := StorageClassCreate{} this.Properties = &properties @@ -80,8 +80,8 @@ func (o *StorageClassCreate) HasMetadata() bool { } // GetProperties returns the Properties field value -// If the value is explicit nil, the zero value for StorageClassProperties will be returned -func (o *StorageClassCreate) GetProperties() *StorageClassProperties { +// If the value is explicit nil, the zero value for StorageClass will be returned +func (o *StorageClassCreate) GetProperties() *StorageClass { if o == nil { return nil } @@ -93,7 +93,7 @@ func (o *StorageClassCreate) GetProperties() *StorageClassProperties { // 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() (*StorageClassProperties, bool) { +func (o *StorageClassCreate) GetPropertiesOk() (*StorageClass, bool) { if o == nil { return nil, false } @@ -102,7 +102,7 @@ func (o *StorageClassCreate) GetPropertiesOk() (*StorageClassProperties, bool) { } // SetProperties sets field value -func (o *StorageClassCreate) SetProperties(v StorageClassProperties) { +func (o *StorageClassCreate) SetProperties(v StorageClass) { o.Properties = &v diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_ensure.go index 46f0ad2b4..682b882db 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_ensure.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_ensure.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -20,14 +20,14 @@ type StorageClassEnsure struct { Id *string `json:"id"` // Metadata Metadata *map[string]interface{} `json:"metadata,omitempty"` - Properties *StorageClassProperties `json:"properties"` + 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 StorageClassProperties) *StorageClassEnsure { +func NewStorageClassEnsure(id string, properties StorageClass) *StorageClassEnsure { this := StorageClassEnsure{} this.Id = &id @@ -121,8 +121,8 @@ func (o *StorageClassEnsure) HasMetadata() bool { } // GetProperties returns the Properties field value -// If the value is explicit nil, the zero value for StorageClassProperties will be returned -func (o *StorageClassEnsure) GetProperties() *StorageClassProperties { +// If the value is explicit nil, the zero value for StorageClass will be returned +func (o *StorageClassEnsure) GetProperties() *StorageClass { if o == nil { return nil } @@ -134,7 +134,7 @@ func (o *StorageClassEnsure) GetProperties() *StorageClassProperties { // 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() (*StorageClassProperties, bool) { +func (o *StorageClassEnsure) GetPropertiesOk() (*StorageClass, bool) { if o == nil { return nil, false } @@ -143,7 +143,7 @@ func (o *StorageClassEnsure) GetPropertiesOk() (*StorageClassProperties, bool) { } // SetProperties sets field value -func (o *StorageClassEnsure) SetProperties(v StorageClassProperties) { +func (o *StorageClassEnsure) SetProperties(v StorageClass) { o.Properties = &v diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_properties.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_properties.go deleted file mode 100644 index da6b4e179..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_properties.go +++ /dev/null @@ -1,214 +0,0 @@ -/* - * IONOS Cloud - S3 Management API - * - * S3 Management API is a RESTful API that manages the S3 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" -) - -// StorageClassProperties Details the cross functional aspects of the given storage class. -type StorageClassProperties 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"` -} - -// NewStorageClassProperties instantiates a new StorageClassProperties 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 NewStorageClassProperties(description string, durability string, availability string) *StorageClassProperties { - this := StorageClassProperties{} - - this.Description = &description - this.Durability = &durability - this.Availability = &availability - - return &this -} - -// NewStorageClassPropertiesWithDefaults instantiates a new StorageClassProperties 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 NewStorageClassPropertiesWithDefaults() *StorageClassProperties { - this := StorageClassProperties{} - return &this -} - -// GetDescription returns the Description field value -// If the value is explicit nil, the zero value for string will be returned -func (o *StorageClassProperties) 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 *StorageClassProperties) GetDescriptionOk() (*string, bool) { - if o == nil { - return nil, false - } - - return o.Description, true -} - -// SetDescription sets field value -func (o *StorageClassProperties) SetDescription(v string) { - - o.Description = &v - -} - -// HasDescription returns a boolean if a field has been set. -func (o *StorageClassProperties) 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 *StorageClassProperties) 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 *StorageClassProperties) GetDurabilityOk() (*string, bool) { - if o == nil { - return nil, false - } - - return o.Durability, true -} - -// SetDurability sets field value -func (o *StorageClassProperties) SetDurability(v string) { - - o.Durability = &v - -} - -// HasDurability returns a boolean if a field has been set. -func (o *StorageClassProperties) 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 *StorageClassProperties) 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 *StorageClassProperties) GetAvailabilityOk() (*string, bool) { - if o == nil { - return nil, false - } - - return o.Availability, true -} - -// SetAvailability sets field value -func (o *StorageClassProperties) SetAvailability(v string) { - - o.Availability = &v - -} - -// HasAvailability returns a boolean if a field has been set. -func (o *StorageClassProperties) HasAvailability() bool { - if o != nil && o.Availability != nil { - return true - } - - return false -} - -func (o StorageClassProperties) 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 NullableStorageClassProperties struct { - value *StorageClassProperties - isSet bool -} - -func (v NullableStorageClassProperties) Get() *StorageClassProperties { - return v.value -} - -func (v *NullableStorageClassProperties) Set(val *StorageClassProperties) { - v.value = val - v.isSet = true -} - -func (v NullableStorageClassProperties) IsSet() bool { - return v.isSet -} - -func (v *NullableStorageClassProperties) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableStorageClassProperties(val *StorageClassProperties) *NullableStorageClassProperties { - return &NullableStorageClassProperties{value: val, isSet: true} -} - -func (v NullableStorageClassProperties) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableStorageClassProperties) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read.go new file mode 100644 index 000000000..38497bb79 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-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-s3-management/model_storage_class_list.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read_list.go similarity index 66% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_list.go rename to vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read_list.go index d89422b20..9a655f16c 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_list.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read_list.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -14,8 +14,8 @@ import ( "encoding/json" ) -// StorageClassList struct for StorageClassList -type StorageClassList struct { +// StorageClassReadList struct for StorageClassReadList +type StorageClassReadList struct { // ID of the list of StorageClass resources. Id *string `json:"id"` // The type of the resource. @@ -23,7 +23,7 @@ type StorageClassList struct { // The URL of the list of StorageClass resources. Href *string `json:"href"` // The list of StorageClass resources. - Items *[]StorageClass `json:"items,omitempty"` + 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). @@ -31,12 +31,12 @@ type StorageClassList struct { Links *Links `json:"_links"` } -// NewStorageClassList instantiates a new StorageClassList object +// 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 NewStorageClassList(id string, type_ string, href string, offset int32, limit int32, links Links) *StorageClassList { - this := StorageClassList{} +func NewStorageClassReadList(id string, type_ string, href string, offset int32, limit int32, links Links) *StorageClassReadList { + this := StorageClassReadList{} this.Id = &id this.Type = &type_ @@ -48,17 +48,17 @@ func NewStorageClassList(id string, type_ string, href string, offset int32, lim return &this } -// NewStorageClassListWithDefaults instantiates a new StorageClassList object +// 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 NewStorageClassListWithDefaults() *StorageClassList { - this := StorageClassList{} +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 *StorageClassList) GetId() *string { +func (o *StorageClassReadList) GetId() *string { if o == nil { return nil } @@ -70,7 +70,7 @@ func (o *StorageClassList) GetId() *string { // 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 *StorageClassList) GetIdOk() (*string, bool) { +func (o *StorageClassReadList) GetIdOk() (*string, bool) { if o == nil { return nil, false } @@ -79,14 +79,14 @@ func (o *StorageClassList) GetIdOk() (*string, bool) { } // SetId sets field value -func (o *StorageClassList) SetId(v string) { +func (o *StorageClassReadList) SetId(v string) { o.Id = &v } // HasId returns a boolean if a field has been set. -func (o *StorageClassList) HasId() bool { +func (o *StorageClassReadList) HasId() bool { if o != nil && o.Id != nil { return true } @@ -96,7 +96,7 @@ func (o *StorageClassList) HasId() bool { // GetType returns the Type field value // If the value is explicit nil, the zero value for string will be returned -func (o *StorageClassList) GetType() *string { +func (o *StorageClassReadList) GetType() *string { if o == nil { return nil } @@ -108,7 +108,7 @@ func (o *StorageClassList) GetType() *string { // 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 *StorageClassList) GetTypeOk() (*string, bool) { +func (o *StorageClassReadList) GetTypeOk() (*string, bool) { if o == nil { return nil, false } @@ -117,14 +117,14 @@ func (o *StorageClassList) GetTypeOk() (*string, bool) { } // SetType sets field value -func (o *StorageClassList) SetType(v string) { +func (o *StorageClassReadList) SetType(v string) { o.Type = &v } // HasType returns a boolean if a field has been set. -func (o *StorageClassList) HasType() bool { +func (o *StorageClassReadList) HasType() bool { if o != nil && o.Type != nil { return true } @@ -134,7 +134,7 @@ func (o *StorageClassList) HasType() bool { // GetHref returns the Href field value // If the value is explicit nil, the zero value for string will be returned -func (o *StorageClassList) GetHref() *string { +func (o *StorageClassReadList) GetHref() *string { if o == nil { return nil } @@ -146,7 +146,7 @@ func (o *StorageClassList) GetHref() *string { // 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 *StorageClassList) GetHrefOk() (*string, bool) { +func (o *StorageClassReadList) GetHrefOk() (*string, bool) { if o == nil { return nil, false } @@ -155,14 +155,14 @@ func (o *StorageClassList) GetHrefOk() (*string, bool) { } // SetHref sets field value -func (o *StorageClassList) SetHref(v string) { +func (o *StorageClassReadList) SetHref(v string) { o.Href = &v } // HasHref returns a boolean if a field has been set. -func (o *StorageClassList) HasHref() bool { +func (o *StorageClassReadList) HasHref() bool { if o != nil && o.Href != nil { return true } @@ -171,8 +171,8 @@ func (o *StorageClassList) HasHref() bool { } // GetItems returns the Items field value -// If the value is explicit nil, the zero value for []StorageClass will be returned -func (o *StorageClassList) GetItems() *[]StorageClass { +// If the value is explicit nil, the zero value for []StorageClassRead will be returned +func (o *StorageClassReadList) GetItems() *[]StorageClassRead { if o == nil { return nil } @@ -184,7 +184,7 @@ func (o *StorageClassList) GetItems() *[]StorageClass { // 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 *StorageClassList) GetItemsOk() (*[]StorageClass, bool) { +func (o *StorageClassReadList) GetItemsOk() (*[]StorageClassRead, bool) { if o == nil { return nil, false } @@ -193,14 +193,14 @@ func (o *StorageClassList) GetItemsOk() (*[]StorageClass, bool) { } // SetItems sets field value -func (o *StorageClassList) SetItems(v []StorageClass) { +func (o *StorageClassReadList) SetItems(v []StorageClassRead) { o.Items = &v } // HasItems returns a boolean if a field has been set. -func (o *StorageClassList) HasItems() bool { +func (o *StorageClassReadList) HasItems() bool { if o != nil && o.Items != nil { return true } @@ -210,7 +210,7 @@ func (o *StorageClassList) HasItems() bool { // GetOffset returns the Offset field value // If the value is explicit nil, the zero value for int32 will be returned -func (o *StorageClassList) GetOffset() *int32 { +func (o *StorageClassReadList) GetOffset() *int32 { if o == nil { return nil } @@ -222,7 +222,7 @@ func (o *StorageClassList) GetOffset() *int32 { // 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 *StorageClassList) GetOffsetOk() (*int32, bool) { +func (o *StorageClassReadList) GetOffsetOk() (*int32, bool) { if o == nil { return nil, false } @@ -231,14 +231,14 @@ func (o *StorageClassList) GetOffsetOk() (*int32, bool) { } // SetOffset sets field value -func (o *StorageClassList) SetOffset(v int32) { +func (o *StorageClassReadList) SetOffset(v int32) { o.Offset = &v } // HasOffset returns a boolean if a field has been set. -func (o *StorageClassList) HasOffset() bool { +func (o *StorageClassReadList) HasOffset() bool { if o != nil && o.Offset != nil { return true } @@ -248,7 +248,7 @@ func (o *StorageClassList) HasOffset() bool { // GetLimit returns the Limit field value // If the value is explicit nil, the zero value for int32 will be returned -func (o *StorageClassList) GetLimit() *int32 { +func (o *StorageClassReadList) GetLimit() *int32 { if o == nil { return nil } @@ -260,7 +260,7 @@ func (o *StorageClassList) GetLimit() *int32 { // 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 *StorageClassList) GetLimitOk() (*int32, bool) { +func (o *StorageClassReadList) GetLimitOk() (*int32, bool) { if o == nil { return nil, false } @@ -269,14 +269,14 @@ func (o *StorageClassList) GetLimitOk() (*int32, bool) { } // SetLimit sets field value -func (o *StorageClassList) SetLimit(v int32) { +func (o *StorageClassReadList) SetLimit(v int32) { o.Limit = &v } // HasLimit returns a boolean if a field has been set. -func (o *StorageClassList) HasLimit() bool { +func (o *StorageClassReadList) HasLimit() bool { if o != nil && o.Limit != nil { return true } @@ -286,7 +286,7 @@ func (o *StorageClassList) HasLimit() bool { // GetLinks returns the Links field value // If the value is explicit nil, the zero value for Links will be returned -func (o *StorageClassList) GetLinks() *Links { +func (o *StorageClassReadList) GetLinks() *Links { if o == nil { return nil } @@ -298,7 +298,7 @@ func (o *StorageClassList) GetLinks() *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 *StorageClassList) GetLinksOk() (*Links, bool) { +func (o *StorageClassReadList) GetLinksOk() (*Links, bool) { if o == nil { return nil, false } @@ -307,14 +307,14 @@ func (o *StorageClassList) GetLinksOk() (*Links, bool) { } // SetLinks sets field value -func (o *StorageClassList) SetLinks(v Links) { +func (o *StorageClassReadList) SetLinks(v Links) { o.Links = &v } // HasLinks returns a boolean if a field has been set. -func (o *StorageClassList) HasLinks() bool { +func (o *StorageClassReadList) HasLinks() bool { if o != nil && o.Links != nil { return true } @@ -322,7 +322,7 @@ func (o *StorageClassList) HasLinks() bool { return false } -func (o StorageClassList) MarshalJSON() ([]byte, error) { +func (o StorageClassReadList) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Id != nil { toSerialize["id"] = o.Id @@ -355,38 +355,38 @@ func (o StorageClassList) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullableStorageClassList struct { - value *StorageClassList +type NullableStorageClassReadList struct { + value *StorageClassReadList isSet bool } -func (v NullableStorageClassList) Get() *StorageClassList { +func (v NullableStorageClassReadList) Get() *StorageClassReadList { return v.value } -func (v *NullableStorageClassList) Set(val *StorageClassList) { +func (v *NullableStorageClassReadList) Set(val *StorageClassReadList) { v.value = val v.isSet = true } -func (v NullableStorageClassList) IsSet() bool { +func (v NullableStorageClassReadList) IsSet() bool { return v.isSet } -func (v *NullableStorageClassList) Unset() { +func (v *NullableStorageClassReadList) Unset() { v.value = nil v.isSet = false } -func NewNullableStorageClassList(val *StorageClassList) *NullableStorageClassList { - return &NullableStorageClassList{value: val, isSet: true} +func NewNullableStorageClassReadList(val *StorageClassReadList) *NullableStorageClassReadList { + return &NullableStorageClassReadList{value: val, isSet: true} } -func (v NullableStorageClassList) MarshalJSON() ([]byte, error) { +func (v NullableStorageClassReadList) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableStorageClassList) UnmarshalJSON(src []byte) error { +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-s3-management/model_storage_class_list_all_of.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read_list_all_of.go similarity index 59% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_list_all_of.go rename to vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read_list_all_of.go index e4e65dab8..b5699ad49 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_list_all_of.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read_list_all_of.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ @@ -14,8 +14,8 @@ import ( "encoding/json" ) -// StorageClassListAllOf struct for StorageClassListAllOf -type StorageClassListAllOf struct { +// StorageClassReadListAllOf struct for StorageClassReadListAllOf +type StorageClassReadListAllOf struct { // ID of the list of StorageClass resources. Id *string `json:"id"` // The type of the resource. @@ -23,15 +23,15 @@ type StorageClassListAllOf struct { // The URL of the list of StorageClass resources. Href *string `json:"href"` // The list of StorageClass resources. - Items *[]StorageClass `json:"items,omitempty"` + Items *[]StorageClassRead `json:"items,omitempty"` } -// NewStorageClassListAllOf instantiates a new StorageClassListAllOf object +// 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 NewStorageClassListAllOf(id string, type_ string, href string) *StorageClassListAllOf { - this := StorageClassListAllOf{} +func NewStorageClassReadListAllOf(id string, type_ string, href string) *StorageClassReadListAllOf { + this := StorageClassReadListAllOf{} this.Id = &id this.Type = &type_ @@ -40,17 +40,17 @@ func NewStorageClassListAllOf(id string, type_ string, href string) *StorageClas return &this } -// NewStorageClassListAllOfWithDefaults instantiates a new StorageClassListAllOf object +// 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 NewStorageClassListAllOfWithDefaults() *StorageClassListAllOf { - this := StorageClassListAllOf{} +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 *StorageClassListAllOf) GetId() *string { +func (o *StorageClassReadListAllOf) GetId() *string { if o == nil { return nil } @@ -62,7 +62,7 @@ func (o *StorageClassListAllOf) GetId() *string { // 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 *StorageClassListAllOf) GetIdOk() (*string, bool) { +func (o *StorageClassReadListAllOf) GetIdOk() (*string, bool) { if o == nil { return nil, false } @@ -71,14 +71,14 @@ func (o *StorageClassListAllOf) GetIdOk() (*string, bool) { } // SetId sets field value -func (o *StorageClassListAllOf) SetId(v string) { +func (o *StorageClassReadListAllOf) SetId(v string) { o.Id = &v } // HasId returns a boolean if a field has been set. -func (o *StorageClassListAllOf) HasId() bool { +func (o *StorageClassReadListAllOf) HasId() bool { if o != nil && o.Id != nil { return true } @@ -88,7 +88,7 @@ func (o *StorageClassListAllOf) HasId() bool { // GetType returns the Type field value // If the value is explicit nil, the zero value for string will be returned -func (o *StorageClassListAllOf) GetType() *string { +func (o *StorageClassReadListAllOf) GetType() *string { if o == nil { return nil } @@ -100,7 +100,7 @@ func (o *StorageClassListAllOf) GetType() *string { // 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 *StorageClassListAllOf) GetTypeOk() (*string, bool) { +func (o *StorageClassReadListAllOf) GetTypeOk() (*string, bool) { if o == nil { return nil, false } @@ -109,14 +109,14 @@ func (o *StorageClassListAllOf) GetTypeOk() (*string, bool) { } // SetType sets field value -func (o *StorageClassListAllOf) SetType(v string) { +func (o *StorageClassReadListAllOf) SetType(v string) { o.Type = &v } // HasType returns a boolean if a field has been set. -func (o *StorageClassListAllOf) HasType() bool { +func (o *StorageClassReadListAllOf) HasType() bool { if o != nil && o.Type != nil { return true } @@ -126,7 +126,7 @@ func (o *StorageClassListAllOf) HasType() bool { // GetHref returns the Href field value // If the value is explicit nil, the zero value for string will be returned -func (o *StorageClassListAllOf) GetHref() *string { +func (o *StorageClassReadListAllOf) GetHref() *string { if o == nil { return nil } @@ -138,7 +138,7 @@ func (o *StorageClassListAllOf) GetHref() *string { // 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 *StorageClassListAllOf) GetHrefOk() (*string, bool) { +func (o *StorageClassReadListAllOf) GetHrefOk() (*string, bool) { if o == nil { return nil, false } @@ -147,14 +147,14 @@ func (o *StorageClassListAllOf) GetHrefOk() (*string, bool) { } // SetHref sets field value -func (o *StorageClassListAllOf) SetHref(v string) { +func (o *StorageClassReadListAllOf) SetHref(v string) { o.Href = &v } // HasHref returns a boolean if a field has been set. -func (o *StorageClassListAllOf) HasHref() bool { +func (o *StorageClassReadListAllOf) HasHref() bool { if o != nil && o.Href != nil { return true } @@ -163,8 +163,8 @@ func (o *StorageClassListAllOf) HasHref() bool { } // GetItems returns the Items field value -// If the value is explicit nil, the zero value for []StorageClass will be returned -func (o *StorageClassListAllOf) GetItems() *[]StorageClass { +// If the value is explicit nil, the zero value for []StorageClassRead will be returned +func (o *StorageClassReadListAllOf) GetItems() *[]StorageClassRead { if o == nil { return nil } @@ -176,7 +176,7 @@ func (o *StorageClassListAllOf) GetItems() *[]StorageClass { // 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 *StorageClassListAllOf) GetItemsOk() (*[]StorageClass, bool) { +func (o *StorageClassReadListAllOf) GetItemsOk() (*[]StorageClassRead, bool) { if o == nil { return nil, false } @@ -185,14 +185,14 @@ func (o *StorageClassListAllOf) GetItemsOk() (*[]StorageClass, bool) { } // SetItems sets field value -func (o *StorageClassListAllOf) SetItems(v []StorageClass) { +func (o *StorageClassReadListAllOf) SetItems(v []StorageClassRead) { o.Items = &v } // HasItems returns a boolean if a field has been set. -func (o *StorageClassListAllOf) HasItems() bool { +func (o *StorageClassReadListAllOf) HasItems() bool { if o != nil && o.Items != nil { return true } @@ -200,7 +200,7 @@ func (o *StorageClassListAllOf) HasItems() bool { return false } -func (o StorageClassListAllOf) MarshalJSON() ([]byte, error) { +func (o StorageClassReadListAllOf) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Id != nil { toSerialize["id"] = o.Id @@ -221,38 +221,38 @@ func (o StorageClassListAllOf) MarshalJSON() ([]byte, error) { return json.Marshal(toSerialize) } -type NullableStorageClassListAllOf struct { - value *StorageClassListAllOf +type NullableStorageClassReadListAllOf struct { + value *StorageClassReadListAllOf isSet bool } -func (v NullableStorageClassListAllOf) Get() *StorageClassListAllOf { +func (v NullableStorageClassReadListAllOf) Get() *StorageClassReadListAllOf { return v.value } -func (v *NullableStorageClassListAllOf) Set(val *StorageClassListAllOf) { +func (v *NullableStorageClassReadListAllOf) Set(val *StorageClassReadListAllOf) { v.value = val v.isSet = true } -func (v NullableStorageClassListAllOf) IsSet() bool { +func (v NullableStorageClassReadListAllOf) IsSet() bool { return v.isSet } -func (v *NullableStorageClassListAllOf) Unset() { +func (v *NullableStorageClassReadListAllOf) Unset() { v.value = nil v.isSet = false } -func NewNullableStorageClassListAllOf(val *StorageClassListAllOf) *NullableStorageClassListAllOf { - return &NullableStorageClassListAllOf{value: val, isSet: true} +func NewNullableStorageClassReadListAllOf(val *StorageClassReadListAllOf) *NullableStorageClassReadListAllOf { + return &NullableStorageClassReadListAllOf{value: val, isSet: true} } -func (v NullableStorageClassListAllOf) MarshalJSON() ([]byte, error) { +func (v NullableStorageClassReadListAllOf) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } -func (v *NullableStorageClassListAllOf) UnmarshalJSON(src []byte) error { +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-s3-management/response.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/response.go index ca6204502..715454726 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/response.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/response.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/utils.go b/vendor/github.com/ionos-cloud/sdk-go-s3-management/utils.go index cbc1119db..1e090d8a0 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/utils.go +++ b/vendor/github.com/ionos-cloud/sdk-go-s3-management/utils.go @@ -1,7 +1,7 @@ /* - * IONOS Cloud - S3 Management API + * IONOS Cloud - Object Storage Management API * - * S3 Management API is a RESTful API that manages the S3 service configuration for IONOS Cloud. + * Object Storage Management API is a RESTful API that manages the object storage service configuration for IONOS Cloud. * * API version: 0.1.0 */ diff --git a/vendor/modules.txt b/vendor/modules.txt index ecbc0fabc..adf8d59e4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -355,7 +355,7 @@ github.com/ionos-cloud/sdk-go-nfs # github.com/ionos-cloud/sdk-go-s3 v1.1.0 ## explicit; go 1.18 github.com/ionos-cloud/sdk-go-s3 -# github.com/ionos-cloud/sdk-go-s3-management v1.0.0 => /home/radu/work/rubygeneration/sdk-go-s3-management +# github.com/ionos-cloud/sdk-go-s3-management v1.0.0 => /home/radu/work/sdk-go-s3-management ## explicit; go 1.18 github.com/ionos-cloud/sdk-go-s3-management # github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.1 From ba7653deee93e0bbf30fdb27d2f084f642d4f512 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Thu, 21 Nov 2024 17:04:31 +0200 Subject: [PATCH 23/30] chore: rename to object-storage-management --- ...cesskey.md => object_storage_accesskey.md} | 16 +- ...{s3_region.md => object_storage_region.md} | 16 +- ...cesskey.md => object_storage_accesskey.md} | 20 +- go.mod | 4 +- internal/framework/provider/provider.go | 18 +- .../data_source_object_storage_accesskey.go} | 18 +- ...a_source_object_storage_accesskey_test.go} | 12 +- .../data_source_object_storage_region.go} | 16 +- ...data_source_object_storage_region_test.go} | 10 +- .../resource_object_storage_accesskey.go} | 42 ++-- ...resource_object_storage_accesskey_test.go} | 10 +- services/clients.go | 38 ++-- .../accesskeys.go | 18 +- services/objectstoragemanagement/client.go | 42 ++++ .../regions.go | 10 +- services/s3management/client.go | 42 ---- .../.gitignore | 0 .../.travis.yml | 0 .../README.md | 0 .../api_accesskeys.go | 0 .../api_regions.go | 0 .../client.go | 0 .../configuration.go | 2 +- .../logger.go | 0 .../model_access_key.go | 0 .../model_access_key_create.go | 0 .../model_access_key_ensure.go | 0 .../model_access_key_read.go | 0 .../model_access_key_read_list.go | 0 .../model_access_key_read_list_all_of.go | 0 .../model_bucket.go | 0 .../model_bucket_create.go | 0 .../model_bucket_ensure.go | 0 .../model_bucket_read.go | 0 .../model_bucket_read_list.go | 0 .../model_bucket_read_list_all_of.go | 0 .../model_error.go | 0 .../model_error_messages.go | 0 .../model_links.go | 0 .../model_metadata.go | 0 .../model_metadata_with_status.go | 0 .../model_metadata_with_status_all_of.go | 0 .../model_metadata_with_supported_regions.go | 0 ..._metadata_with_supported_regions_all_of.go | 0 .../model_pagination.go | 0 .../model_region.go | 0 .../model_region_capability.go | 0 .../model_region_create.go | 0 .../model_region_ensure.go | 0 .../model_region_read.go | 0 .../model_region_read_list.go | 0 .../model_region_read_list_all_of.go | 0 .../model_storage_class.go | 0 .../model_storage_class_create.go | 0 .../model_storage_class_ensure.go | 0 .../model_storage_class_read.go | 0 .../model_storage_class_read_list.go | 0 .../model_storage_class_read_list_all_of.go | 0 .../response.go | 0 .../utils.go | 0 .../ionos-cloud/sdk-go-s3-management/LICENSE | 201 ------------------ vendor/modules.txt | 4 +- 62 files changed, 169 insertions(+), 370 deletions(-) rename docs/data-sources/{s3_accesskey.md => object_storage_accesskey.md} (51%) rename docs/data-sources/{s3_region.md => object_storage_region.md} (62%) rename docs/resources/{s3_accesskey.md => object_storage_accesskey.md} (56%) rename internal/framework/services/{s3management/data_source_s3_accesskey.go => objectstoragemanagement/data_source_object_storage_accesskey.go} (82%) rename internal/framework/services/{s3management/data_source_s3_accesskey_test.go => objectstoragemanagement/data_source_object_storage_accesskey_test.go} (78%) rename internal/framework/services/{s3management/data_source_s3_region.go => objectstoragemanagement/data_source_object_storage_region.go} (85%) rename internal/framework/services/{s3management/data_source_s3_region_test.go => objectstoragemanagement/data_source_object_storage_region_test.go} (81%) rename internal/framework/services/{s3management/resource_s3_accesskey.go => objectstoragemanagement/resource_object_storage_accesskey.go} (80%) rename internal/framework/services/{s3management/resource_s3_accesskey_test.go => objectstoragemanagement/resource_object_storage_accesskey_test.go} (88%) rename services/{s3management => objectstoragemanagement}/accesskeys.go (88%) create mode 100644 services/objectstoragemanagement/client.go rename services/{s3management => objectstoragemanagement}/regions.go (82%) delete mode 100644 services/s3management/client.go rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/.gitignore (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/.travis.yml (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/README.md (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/api_accesskeys.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/api_regions.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/client.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/configuration.go (99%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/logger.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_access_key.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_access_key_create.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_access_key_ensure.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_access_key_read.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_access_key_read_list.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_access_key_read_list_all_of.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_bucket.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_bucket_create.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_bucket_ensure.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_bucket_read.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_bucket_read_list.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_bucket_read_list_all_of.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_error.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_error_messages.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_links.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_metadata.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_metadata_with_status.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_metadata_with_status_all_of.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_metadata_with_supported_regions.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_metadata_with_supported_regions_all_of.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_pagination.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_region.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_region_capability.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_region_create.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_region_ensure.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_region_read.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_region_read_list.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_region_read_list_all_of.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_storage_class.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_storage_class_create.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_storage_class_ensure.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_storage_class_read.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_storage_class_read_list.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/model_storage_class_read_list_all_of.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/response.go (100%) rename vendor/github.com/ionos-cloud/{sdk-go-s3-management => sdk-go-object-storage-management}/utils.go (100%) delete mode 100644 vendor/github.com/ionos-cloud/sdk-go-s3-management/LICENSE diff --git a/docs/data-sources/s3_accesskey.md b/docs/data-sources/object_storage_accesskey.md similarity index 51% rename from docs/data-sources/s3_accesskey.md rename to docs/data-sources/object_storage_accesskey.md index 3c2c721c0..784228dc2 100644 --- a/docs/data-sources/s3_accesskey.md +++ b/docs/data-sources/object_storage_accesskey.md @@ -1,28 +1,28 @@ --- -subcategory: "S3 management" +subcategory: "Object storage management" layout: "ionoscloud" -page_title: "IonosCloud : s3_accesskey" -sidebar_current: "docs-datasource-s3_accesskey" +page_title: "IonosCloud : object_storage_accesskey" +sidebar_current: "docs-datasource-object_storage_accesskey" description: |- - Get information on a IonosCloud S3 Accesskeys + Get information on a IonosCloud Object storage Accesskey --- -# ionoscloud\_s3\_accesskey +# ionoscloud_object_storage_accesskey -The **S3 Accesskey data source** can be used to search for and return an existing S3 Accesskeys. +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_s3_accesskey" "example" { +data "ionoscloud_object_storage_accesskey" "example" { id = } ``` ## Argument Reference - * `id` - (Required) Id of an existing S3 accesskey that you want to search for. + * `id` - (Required) Id of an existing object storage accesskey that you want to search for. ## Attributes Reference diff --git a/docs/data-sources/s3_region.md b/docs/data-sources/object_storage_region.md similarity index 62% rename from docs/data-sources/s3_region.md rename to docs/data-sources/object_storage_region.md index ee59f44cd..87dce09fd 100644 --- a/docs/data-sources/s3_region.md +++ b/docs/data-sources/object_storage_region.md @@ -1,28 +1,28 @@ --- -subcategory: "S3 management" +subcategory: "Object storage management" layout: "ionoscloud" -page_title: "IonosCloud : s3_region" -sidebar_current: "docs-datasource-s3_region" +page_title: "IonosCloud : object_storage_region" +sidebar_current: "docs-datasource-object_storage_region" description: |- - Get information on a IonosCloud S3 Region + Get information on a IonosCloud Object Storage Region --- -# ionoscloud\_s3\_region +# ionoscloud_object_storage_region -The **S3 region data source** can be used to search for and return an existing S3 Regions. +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_s3_region" "example" { +data "ionoscloud_object_storage_region" "example" { id = } ``` ## Argument Reference - * `id` - (Required) Id of an existing S3 Region that you want to search for. + * `id` - (Required) Id of an existing object storage Region that you want to search for. ## Attributes Reference diff --git a/docs/resources/s3_accesskey.md b/docs/resources/object_storage_accesskey.md similarity index 56% rename from docs/resources/s3_accesskey.md rename to docs/resources/object_storage_accesskey.md index dab2ccbf7..a7ac39bf5 100644 --- a/docs/resources/s3_accesskey.md +++ b/docs/resources/object_storage_accesskey.md @@ -1,20 +1,20 @@ --- -subcategory: "S3 management" +subcategory: "Object storage management" layout: "ionoscloud" -page_title: "IonosCloud: s3_accesskey" -sidebar_current: "docs-resource-s3_accesskey" +page_title: "IonosCloud: object_storage_accesskey" +sidebar_current: "docs-resource-object_storage_accesskey" description: |- - Creates and manages IonosCloud S3 Accesskeys. + Creates and manages IonosCloud Object Storage Accesskeys. --- -# ionoscloud_s3_accesskey +# ionoscloud_object_storage_accesskey -Manages an **S3 Accesskey** on IonosCloud. +Manages an **Object Storage Accesskey** on IonosCloud. ## Example Usage ```hcl -resource "ionoscloud_s3_accesskey" "example" { +resource "ionoscloud_object_storage_accesskey" "example" { description = "my description" } ``` @@ -35,10 +35,10 @@ The following arguments are supported: ## Import -An S3 accesskey resource can be imported using its `resource id`, e.g. +An object storage accesskey resource can be imported using its `resource id`, e.g. ```shell -terraform import ionoscloud_s3_accesskey.demo {s3AccesskeyId} +terraform import ionoscloud_object_storage_accesskey.demo {objectStorageAccesskeyId} ``` -This can be helpful when you want to import S3 Accesskeys which you have already created manually or using other means, outside of terraform. +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/go.mod b/go.mod index ec6252753..81b94dc6d 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +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-s3-management v1.0.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 @@ -39,7 +39,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 ) -replace github.com/ionos-cloud/sdk-go-s3-management v1.0.0 => /home/radu/work/sdk-go-s3-management +replace github.com/ionos-cloud/sdk-go-object-storage-management v1.0.0 => /home/radu/work/rubygeneration/sdk-go-object-storage-management require ( github.com/hashicorp/go-retryablehttp v0.7.7 // indirect diff --git a/internal/framework/provider/provider.go b/internal/framework/provider/provider.go index 720c1cce7..266f9c865 100644 --- a/internal/framework/provider/provider.go +++ b/internal/framework/provider/provider.go @@ -20,7 +20,7 @@ import ( ionoscloud "github.com/ionos-cloud/sdk-go/v6" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/internal/framework/services/objectstorage" - "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/internal/framework/services/s3management" + "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" @@ -36,7 +36,7 @@ import ( 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" - s3managementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" + 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" @@ -227,10 +227,10 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu 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), - S3ManagementClient: s3managementService.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 @@ -267,7 +267,7 @@ func (p *IonosCloudProvider) Resources(_ context.Context) []func() resource.Reso objectstorage.NewBucketCorsConfigurationResource, objectstorage.NewBucketLifecycleConfigurationResource, objectstorage.NewBucketWebsiteConfigurationResource, - s3management.NewAccesskeyResource, + objectstoragemanagement.NewAccesskeyResource, } } @@ -278,8 +278,8 @@ func (p *IonosCloudProvider) DataSources(_ context.Context) []func() datasource. objectstorage.NewObjectDataSource, objectstorage.NewBucketPolicyDataSource, objectstorage.NewObjectsDataSource, - s3management.NewRegionDataSource, - s3management.NewAccesskeyDataSource, + objectstoragemanagement.NewRegionDataSource, + objectstoragemanagement.NewAccesskeyDataSource, } } diff --git a/internal/framework/services/s3management/data_source_s3_accesskey.go b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go similarity index 82% rename from internal/framework/services/s3management/data_source_s3_accesskey.go rename to internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go index 844bc7c3f..d883d6c77 100644 --- a/internal/framework/services/s3management/data_source_s3_accesskey.go +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go @@ -1,12 +1,12 @@ -package s3management +package objectstoragemanagement import ( "context" "fmt" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" - "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" - s3managementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" + "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" @@ -20,12 +20,12 @@ func NewAccesskeyDataSource() datasource.DataSource { } type accessKeyDataSource struct { - client *s3managementService.Client + 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 + "_s3_accesskey" + resp.TypeName = req.ProviderTypeName + "_object_storage_accesskey" } // Configure configures the data source. @@ -46,7 +46,7 @@ func (d *accessKeyDataSource) Configure(ctx context.Context, req datasource.Conf return } - d.client = clientBundle.S3ManagementClient + d.client = clientBundle.ObjectStorageManagementClient } // Schema returns the schema for the data source. @@ -80,11 +80,11 @@ func (d *accessKeyDataSource) Schema(ctx context.Context, req datasource.SchemaR // 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("s3 api client not configured", "The provider client is not configured") + resp.Diagnostics.AddError("object storage management api client not configured", "The provider client is not configured") return } - var data *s3management.AccessKeyDataSourceModel + var data *objectstoragemanagement.AccessKeyDataSourceModel resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) if resp.Diagnostics.HasError() { return @@ -103,6 +103,6 @@ func (d *accessKeyDataSource) Read(ctx context.Context, req datasource.ReadReque return } - s3managementService.SetAccessKeyPropertiesToDataSourcePlan(data, accessKey) + objectStorageManagementService.SetAccessKeyPropertiesToDataSourcePlan(data, accessKey) resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } diff --git a/internal/framework/services/s3management/data_source_s3_accesskey_test.go b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey_test.go similarity index 78% rename from internal/framework/services/s3management/data_source_s3_accesskey_test.go rename to internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey_test.go index b6b71b77b..59f932699 100644 --- a/internal/framework/services/s3management/data_source_s3_accesskey_test.go +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey_test.go @@ -1,7 +1,7 @@ -//go:build all || s3management -// +build all s3management +//go:build all || objectstoragemanagement +// +build all objectstoragemanagement -package s3management_test +package objectstoragemanagement_test import ( "testing" @@ -13,7 +13,7 @@ import ( ) func TestAccS3AccesskeyDataSource(t *testing.T) { - name := "data.ionoscloud_s3_accesskey.testres" + name := "data.ionoscloud_object_storage_accesskey.testres" resource.Test(t, resource.TestCase{ ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, PreCheck: func() { @@ -36,8 +36,8 @@ func TestAccS3AccesskeyDataSource(t *testing.T) { func testAccAccesskeyDataSourceConfigBasic() string { return utils.ConfigCompose(testAccAccesskeyConfigDescription("desc"), ` -data "ionoscloud_s3_accesskey" "testres" { - id = ionoscloud_s3_accesskey.test.id +data "ionoscloud_object_storage_accesskey" "testres" { + id = ionoscloud_object_storage_accesskey.test.id } `) } diff --git a/internal/framework/services/s3management/data_source_s3_region.go b/internal/framework/services/objectstoragemanagement/data_source_object_storage_region.go similarity index 85% rename from internal/framework/services/s3management/data_source_s3_region.go rename to internal/framework/services/objectstoragemanagement/data_source_object_storage_region.go index 85d24ea57..f3d2886bc 100644 --- a/internal/framework/services/s3management/data_source_s3_region.go +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_region.go @@ -1,11 +1,11 @@ -package s3management +package objectstoragemanagement import ( "context" "fmt" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" - s3managementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" + 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" @@ -20,12 +20,12 @@ func NewRegionDataSource() datasource.DataSource { } type regionDataSource struct { - client *s3managementService.Client + 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 + "_s3_region" + resp.TypeName = req.ProviderTypeName + "_object_storage_region" } // Configure configures the data source. @@ -46,7 +46,7 @@ func (d *regionDataSource) Configure(ctx context.Context, req datasource.Configu return } - d.client = clientbundle.S3ManagementClient + d.client = clientbundle.ObjectStorageManagementClient } // Schema returns the schema for the data source. @@ -99,11 +99,11 @@ func (d *regionDataSource) Schema(ctx context.Context, req datasource.SchemaRequ // 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("s3 api client not configured", "The provider client is not configured") + resp.Diagnostics.AddError("api client not configured", "The provider client is not configured") return } - var data *s3managementService.RegionDataSourceModel + var data *objectStorageManagementService.RegionDataSourceModel resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) if resp.Diagnostics.HasError() { return @@ -120,5 +120,5 @@ func (d *regionDataSource) Read(ctx context.Context, req datasource.ReadRequest, return } - resp.Diagnostics.Append(resp.State.Set(ctx, s3managementService.BuildRegionModelFromAPIResponse(®ion))...) + resp.Diagnostics.Append(resp.State.Set(ctx, objectStorageManagementService.BuildRegionModelFromAPIResponse(®ion))...) } diff --git a/internal/framework/services/s3management/data_source_s3_region_test.go b/internal/framework/services/objectstoragemanagement/data_source_object_storage_region_test.go similarity index 81% rename from internal/framework/services/s3management/data_source_s3_region_test.go rename to internal/framework/services/objectstoragemanagement/data_source_object_storage_region_test.go index 800133cd8..b93a60765 100644 --- a/internal/framework/services/s3management/data_source_s3_region_test.go +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_region_test.go @@ -1,7 +1,7 @@ -//go:build all || s3management -// +build all s3management +//go:build all || objectstoragemanagement +// +build all objectstoragemanagement -package s3management_test +package objectstoragemanagement_test import ( "testing" @@ -12,7 +12,7 @@ import ( ) func TestAccS3RegionDataSource(t *testing.T) { - name := "data.ionoscloud_s3_region.testreg" + name := "data.ionoscloud_object_storage_region.testreg" resource.Test(t, resource.TestCase{ ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, PreCheck: func() { @@ -35,7 +35,7 @@ func TestAccS3RegionDataSource(t *testing.T) { func testAccRegionDataSourceConfigBasic() string { return ` -data "ionoscloud_s3_region" "testreg" { +data "ionoscloud_object_storage_region" "testreg" { id = "de" } ` diff --git a/internal/framework/services/s3management/resource_s3_accesskey.go b/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey.go similarity index 80% rename from internal/framework/services/s3management/resource_s3_accesskey.go rename to internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey.go index 68102fe79..e399fe8dd 100644 --- a/internal/framework/services/s3management/resource_s3_accesskey.go +++ b/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey.go @@ -1,4 +1,4 @@ -package s3management +package objectstoragemanagement import ( "context" @@ -10,10 +10,10 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" - s3management "github.com/ionos-cloud/sdk-go-s3-management" + objectStorageManagement "github.com/ionos-cloud/sdk-go-object-storage-management" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" - s3managementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/s3management" + objectStorageManagementService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/objectstoragemanagement" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" ) @@ -28,12 +28,12 @@ func NewAccesskeyResource() resource.Resource { } type accesskeyResource struct { - client *s3managementService.Client + 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 + "_s3_accesskey" + resp.TypeName = req.ProviderTypeName + "_object_storage_accesskey" } // Schema returns the schema for the accesskey resource. @@ -92,17 +92,17 @@ func (r *accesskeyResource) Configure(_ context.Context, req resource.ConfigureR return } - r.client = clientBundle.S3ManagementClient + 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("s3 api client not configured", "The provider client is not configured") + resp.Diagnostics.AddError("object storage management api client not configured", "The provider client is not configured") return } - var data *s3managementService.AccesskeyResourceModel + var data *objectStorageManagementService.AccesskeyResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) if resp.Diagnostics.HasError() { return @@ -113,8 +113,8 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque ctx, cancel := context.WithTimeout(ctx, createTimeout) defer cancel() - var accessKey = s3management.AccessKeyCreate{ - Properties: &s3management.AccessKey{ + var accessKey = objectStorageManagement.AccessKeyCreate{ + Properties: &objectStorageManagement.AccessKey{ Description: data.Description.ValueStringPointer(), }, } @@ -124,7 +124,7 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque return } // we need this because secretkey is only available on create response - s3managementService.SetAccessKeyPropertiesToPlan(data, accessKeyResponse) + objectStorageManagementService.SetAccessKeyPropertiesToPlan(data, accessKeyResponse) accessKeyRead, _, err := r.client.GetAccessKey(ctx, data.ID.ValueString()) if err != nil { @@ -133,18 +133,18 @@ func (r *accesskeyResource) Create(ctx context.Context, req resource.CreateReque } // we need this because canonical_user_id not available on create response - s3managementService.SetAccessKeyPropertiesToPlan(data, accessKeyRead) + 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("s3 api client not configured", "The provider client is not configured") + resp.Diagnostics.AddError("object storage management api client not configured", "The provider client is not configured") return } - var data s3managementService.AccesskeyResourceModel + var data objectStorageManagementService.AccesskeyResourceModel resp.Diagnostics.Append(req.State.Get(ctx, &data)...) if resp.Diagnostics.HasError() { return @@ -156,7 +156,7 @@ func (r *accesskeyResource) Read(ctx context.Context, req resource.ReadRequest, return } - s3managementService.SetAccessKeyPropertiesToPlan(&data, accessKey) + objectStorageManagementService.SetAccessKeyPropertiesToPlan(&data, accessKey) resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } @@ -167,7 +167,7 @@ func (r *accesskeyResource) ImportState(ctx context.Context, req resource.Import // Update updates the accesskey. func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var plan, state *s3managementService.AccesskeyResourceModel + var plan, state *objectStorageManagementService.AccesskeyResourceModel // Read Terraform plan data into the model resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) @@ -181,8 +181,8 @@ func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateReque ctx, cancel := context.WithTimeout(ctx, updateTimeout) defer cancel() - var accessKey = s3management.AccessKeyEnsure{ - Properties: &s3management.AccessKey{ + var accessKey = objectStorageManagement.AccessKeyEnsure{ + Properties: &objectStorageManagement.AccessKey{ Description: plan.Description.ValueStringPointer(), }, } @@ -201,18 +201,18 @@ func (r *accesskeyResource) Update(ctx context.Context, req resource.UpdateReque return } - s3managementService.SetAccessKeyPropertiesToPlan(state, accessKeyRead) + 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("s3 api client not configured", "The provider client is not configured") + resp.Diagnostics.AddError("object storage management api client not configured", "The provider client is not configured") return } - var data *s3managementService.AccesskeyResourceModel + var data *objectStorageManagementService.AccesskeyResourceModel resp.Diagnostics.Append(req.State.Get(ctx, &data)...) if resp.Diagnostics.HasError() { return diff --git a/internal/framework/services/s3management/resource_s3_accesskey_test.go b/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey_test.go similarity index 88% rename from internal/framework/services/s3management/resource_s3_accesskey_test.go rename to internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey_test.go index 47c8113f4..a8ac5f820 100644 --- a/internal/framework/services/s3management/resource_s3_accesskey_test.go +++ b/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey_test.go @@ -1,7 +1,7 @@ -//go:build all || s3management -// +build all s3management +//go:build all || objectstoragemanagement +// +build all objectstoragemanagement -package s3management_test +package objectstoragemanagement_test import ( "fmt" @@ -14,7 +14,7 @@ import ( func TestAccACcesskeyResource(t *testing.T) { description := acctest.GenerateRandomResourceName("description") descriptionUpdated := acctest.GenerateRandomResourceName("description") - name := "ionoscloud_s3_accesskey.test" + name := "ionoscloud_object_storage_accesskey.test" resource.Test(t, resource.TestCase{ ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, @@ -50,7 +50,7 @@ func TestAccACcesskeyResource(t *testing.T) { func testAccAccesskeyConfigDescription(description string) string { return fmt.Sprintf(` -resource "ionoscloud_s3_accesskey" "test" { +resource "ionoscloud_object_storage_accesskey" "test" { description = %[1]q } `, description) diff --git a/services/clients.go b/services/clients.go index b31a2f18c..cf0db1e7a 100644 --- a/services/clients.go +++ b/services/clients.go @@ -17,27 +17,27 @@ import ( "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/s3management" + "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 - S3Client *objectstorage.Client - S3ManagementClient *s3management.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/s3management/accesskeys.go b/services/objectstoragemanagement/accesskeys.go similarity index 88% rename from services/s3management/accesskeys.go rename to services/objectstoragemanagement/accesskeys.go index 0ab30dd7a..839564fe2 100644 --- a/services/s3management/accesskeys.go +++ b/services/objectstoragemanagement/accesskeys.go @@ -1,4 +1,4 @@ -package s3management +package objectstoragemanagement import ( "context" @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts" "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-framework/types/basetypes" - s3management "github.com/ionos-cloud/sdk-go-s3-management" + objectstoragemanagement "github.com/ionos-cloud/sdk-go-object-storage-management" ) // AccesskeyResourceModel is used to represent an accesskey @@ -33,21 +33,21 @@ type AccessKeyDataSourceModel struct { } // GetAccessKey retrieves an accesskey -func (c *Client) GetAccessKey(ctx context.Context, accessKeyID string) (s3management.AccessKeyRead, *s3management.APIResponse, error) { +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) (s3management.AccessKeyReadList, *s3management.APIResponse, error) { +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 } // CreateAccessKey creates an accesskey -func (c *Client) CreateAccessKey(ctx context.Context, accessKey s3management.AccessKeyCreate, timeout time.Duration) (s3management.AccessKeyRead, *s3management.APIResponse, error) { +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() @@ -66,7 +66,7 @@ func (c *Client) CreateAccessKey(ctx context.Context, accessKey s3management.Acc } // UpdateAccessKey updates an accesskey -func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyID string, accessKey s3management.AccessKeyEnsure, timeout time.Duration) (s3management.AccessKeyRead, *s3management.APIResponse, error) { +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() @@ -85,7 +85,7 @@ func (c *Client) UpdateAccessKey(ctx context.Context, accessKeyID string, access } // DeleteAccessKey deletes an accesskey -func (c *Client) DeleteAccessKey(ctx context.Context, accessKeyID string, timeout time.Duration) (*s3management.APIResponse, error) { +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() @@ -104,7 +104,7 @@ func (c *Client) DeleteAccessKey(ctx context.Context, accessKeyID string, timeou } // SetAccessKeyPropertiesToPlan sets accesskey properties from an SDK object to a AccesskeyResourceModel -func SetAccessKeyPropertiesToPlan(plan *AccesskeyResourceModel, accessKey s3management.AccessKeyRead) { +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 @@ -130,7 +130,7 @@ func SetAccessKeyPropertiesToPlan(plan *AccesskeyResourceModel, accessKey s3mana } // SetAccessKeyPropertiesToDataSourcePlan sets accesskey properties from an SDK object to a AccessKeyDataSourceModel -func SetAccessKeyPropertiesToDataSourcePlan(plan *AccessKeyDataSourceModel, accessKey s3management.AccessKeyRead) { +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 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/s3management/regions.go b/services/objectstoragemanagement/regions.go similarity index 82% rename from services/s3management/regions.go rename to services/objectstoragemanagement/regions.go index 1116be58a..4f74dee4d 100644 --- a/services/s3management/regions.go +++ b/services/objectstoragemanagement/regions.go @@ -1,10 +1,10 @@ -package s3management +package objectstoragemanagement import ( "context" "github.com/hashicorp/terraform-plugin-framework/types" - s3management "github.com/ionos-cloud/sdk-go-s3-management" + objectstoragemanagement "github.com/ionos-cloud/sdk-go-object-storage-management" ) // RegionDataSourceModel is used to represent an region for a data source. @@ -24,21 +24,21 @@ type capability struct { } // GetRegion retrieves a region -func (c *Client) GetRegion(ctx context.Context, regionID string, depth float32) (s3management.RegionRead, *s3management.APIResponse, error) { +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) (s3management.RegionReadList, *s3management.APIResponse, error) { +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 *s3management.RegionRead) *RegionDataSourceModel { +func BuildRegionModelFromAPIResponse(output *objectstoragemanagement.RegionRead) *RegionDataSourceModel { built := &RegionDataSourceModel{} if output.Id != nil { diff --git a/services/s3management/client.go b/services/s3management/client.go deleted file mode 100644 index b3920fc93..000000000 --- a/services/s3management/client.go +++ /dev/null @@ -1,42 +0,0 @@ -package s3management - -import ( - "fmt" - "net/http" - "os" - "runtime" - - "github.com/hashicorp/terraform-plugin-sdk/v2/meta" - - s3management "github.com/ionos-cloud/sdk-go-s3-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 *s3management.APIClient -} - -// GetBaseClient returns the base client. -func (c *Client) GetBaseClient() *s3management.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 { - newS3managementConfig := s3management.NewConfiguration(username, password, token, url) - - if os.Getenv(constant.IonosDebug) != "" { - newS3managementConfig.Debug = true - } - newS3managementConfig.MaxRetries = constant.MaxRetries - newS3managementConfig.MaxWaitTime = constant.MaxWaitTime - newS3managementConfig.HTTPClient = &http.Client{Transport: utils.CreateTransport(insecure)} - newS3managementConfig.UserAgent = fmt.Sprintf( - "terraform-provider/%s_ionos-cloud-sdk-go-s3-management/%s_hashicorp-terraform/%s_terraform-plugin-sdk/%s_os/%s_arch/%s", - version, s3management.Version, terraformVersion, meta.SDKVersionString(), runtime.GOOS, runtime.GOARCH) //nolint:staticcheck - - return &Client{client: s3management.NewAPIClient(newS3managementConfig)} -} diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/.gitignore b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/.gitignore similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/.gitignore rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/.gitignore diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/.travis.yml b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/.travis.yml similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/.travis.yml rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/.travis.yml diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/README.md b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/README.md similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/README.md rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/README.md diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_accesskeys.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/api_accesskeys.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/api_accesskeys.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/api_accesskeys.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/api_regions.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/api_regions.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/api_regions.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/api_regions.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/client.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/client.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/client.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/client.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/configuration.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/configuration.go similarity index 99% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/configuration.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/configuration.go index 4165416e7..8e4305b26 100644 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/configuration.go +++ b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/configuration.go @@ -134,7 +134,7 @@ func NewConfiguration(username, password, token, hostUrl string) *Configuration cfg := &Configuration{ DefaultHeader: make(map[string]string), DefaultQueryParams: url.Values{}, - UserAgent: "ionos-cloud-sdk-go-s3-management/v1.0.0", + UserAgent: "ionos-cloud-ionoscloud_object_storage_management/v1.0.0", Debug: false, Username: username, Password: password, diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/logger.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/logger.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/logger.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/logger.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_create.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_create.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_create.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_create.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_ensure.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_ensure.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_ensure.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read_list.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read_list.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read_list.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read_list.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-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 similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_access_key_read_list_all_of.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_access_key_read_list_all_of.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_create.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_create.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_create.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_create.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_ensure.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_ensure.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_ensure.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read_list.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read_list.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-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 similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_bucket_read_list_all_of.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_bucket_read_list_all_of.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_error.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_error.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error_messages.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_error_messages.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_error_messages.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_error_messages.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_links.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_links.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_links.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_links.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_status.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_status.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-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 similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_status_all_of.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_status_all_of.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_supported_regions.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_supported_regions.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-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 similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_metadata_with_supported_regions_all_of.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_metadata_with_supported_regions_all_of.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_pagination.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_pagination.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_pagination.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_pagination.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_capability.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_capability.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_capability.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_capability.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_create.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_create.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_create.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_create.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_ensure.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_ensure.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_ensure.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read_list.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read_list.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read_list.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read_list.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-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 similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_region_read_list_all_of.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_region_read_list_all_of.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_create.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_create.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_create.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_create.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_ensure.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_ensure.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_ensure.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_ensure.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read_list.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read_list.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read_list.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read_list.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-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 similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/model_storage_class_read_list_all_of.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/model_storage_class_read_list_all_of.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/response.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/response.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/response.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/response.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/utils.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/utils.go similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go-s3-management/utils.go rename to vendor/github.com/ionos-cloud/sdk-go-object-storage-management/utils.go diff --git a/vendor/github.com/ionos-cloud/sdk-go-s3-management/LICENSE b/vendor/github.com/ionos-cloud/sdk-go-s3-management/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go-s3-management/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - 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/modules.txt b/vendor/modules.txt index 752931d33..1de847ddb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -355,9 +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-s3-management v1.0.0 => /home/radu/work/sdk-go-s3-management +# github.com/ionos-cloud/sdk-go-object-storage-management v1.0.0 => /home/radu/work/rubygeneration/sdk-go-object-storage-management ## explicit; go 1.18 -github.com/ionos-cloud/sdk-go-s3-management +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 From 1997c644b52e1140db02fdf4627a7ee3354e61f2 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Thu, 21 Nov 2024 17:12:33 +0200 Subject: [PATCH 24/30] chore: pr review changes and linter --- docs/data-sources/object_storage_accesskey.md | 2 +- docs/data-sources/object_storage_region.md | 2 +- internal/framework/provider/provider.go | 13 ++----------- ionoscloud/data_source_application_loadbalancer.go | 2 +- ...urce_application_loadbalancer_forwardingrule.go | 2 +- ionoscloud/data_source_backup_unit.go | 2 +- ionoscloud/data_source_cube_server.go | 3 ++- ionoscloud/data_source_datacenter.go | 2 +- ionoscloud/data_source_firewall.go | 2 +- ionoscloud/data_source_group.go | 2 +- ionoscloud/data_source_image.go | 2 +- ionoscloud/data_source_ipblock.go | 2 +- ionoscloud/data_source_ipfailover.go | 2 +- ionoscloud/data_source_k8s_cluster.go | 2 +- ionoscloud/data_source_k8s_clusters.go | 2 +- ionoscloud/data_source_k8s_node_pool.go | 2 +- ionoscloud/data_source_k8s_node_pool_nodes.go | 2 +- ionoscloud/data_source_lan.go | 2 +- ionoscloud/data_source_location.go | 2 +- ionoscloud/data_source_natgateway.go | 2 +- ionoscloud/data_source_natgateway_rule.go | 2 +- ionoscloud/data_source_networkloadbalancer.go | 2 +- ...ta_source_networkloadbalancer_forwardingrule.go | 2 +- ionoscloud/data_source_nic.go | 2 +- ionoscloud/data_source_nsg.go | 2 +- ionoscloud/data_source_private_crossconnect.go | 2 +- ionoscloud/data_source_resource.go | 2 +- ionoscloud/data_source_server.go | 3 ++- ionoscloud/data_source_servers.go | 2 +- ionoscloud/data_source_servers_test.go | 2 +- ionoscloud/data_source_snapshot.go | 2 +- ionoscloud/data_source_target_group.go | 2 +- ionoscloud/data_source_template.go | 2 +- ionoscloud/data_source_user.go | 2 +- ionoscloud/data_source_volume.go | 2 +- ionoscloud/provider.go | 2 +- ionoscloud/resource_application_loadbalancer.go | 10 +++++----- ...urce_application_loadbalancer_forwardingrule.go | 10 +++++----- ...application_loadbalancer_forwardingrule_test.go | 4 ++-- .../resource_application_loadbalancer_test.go | 4 ++-- ionoscloud/resource_backup_unit.go | 10 +++++----- ionoscloud/resource_backup_unit_test.go | 4 ++-- ionoscloud/resource_cube_server.go | 12 ++++++------ ionoscloud/resource_cube_server_test.go | 4 ++-- ionoscloud/resource_datacenter.go | 10 +++++----- ionoscloud/resource_datacenter_nsg_selection.go | 8 ++++---- ionoscloud/resource_datacenter_test.go | 4 ++-- ionoscloud/resource_firewall.go | 10 +++++----- ionoscloud/resource_firewall_test.go | 4 ++-- ionoscloud/resource_group.go | 14 +++++++------- ionoscloud/resource_group_test.go | 4 ++-- ionoscloud/resource_ipblock.go | 10 +++++----- ionoscloud/resource_ipblock_test.go | 4 ++-- ionoscloud/resource_ipfailover.go | 10 +++++----- ionoscloud/resource_ipfailover_test.go | 4 ++-- ionoscloud/resource_k8s_cluster.go | 10 +++++----- ionoscloud/resource_k8s_cluster_test.go | 4 ++-- ionoscloud/resource_k8s_node_pool.go | 10 +++++----- ionoscloud/resource_k8s_node_pool_test.go | 4 ++-- ionoscloud/resource_lan.go | 10 +++++----- ionoscloud/resource_lan_test.go | 4 ++-- ionoscloud/resource_loadbalancer.go | 10 +++++----- ionoscloud/resource_loadbalancer_test.go | 4 ++-- ionoscloud/resource_natgateway.go | 10 +++++----- ionoscloud/resource_natgateway_rule.go | 10 +++++----- ionoscloud/resource_natgateway_rule_test.go | 4 ++-- ionoscloud/resource_natgateway_test.go | 4 ++-- ionoscloud/resource_networkloadbalancer.go | 10 +++++----- .../resource_networkloadbalancer_forwardingrule.go | 10 +++++----- ...urce_networkloadbalancer_forwardingrule_test.go | 4 ++-- ionoscloud/resource_networkloadbalancer_test.go | 4 ++-- ionoscloud/resource_nic.go | 10 +++++----- ionoscloud/resource_nic_test.go | 4 ++-- ionoscloud/resource_nsg.go | 10 +++++----- ionoscloud/resource_nsg_firewallrule.go | 10 +++++----- ionoscloud/resource_nsg_test.go | 8 ++++---- ionoscloud/resource_private_crossconnect.go | 10 +++++----- ionoscloud/resource_private_crossconnect_test.go | 4 ++-- ionoscloud/resource_s3_key.go | 10 +++++----- ionoscloud/resource_s3_key_test.go | 4 ++-- ionoscloud/resource_server.go | 12 ++++++------ .../resource_server_boot_device_selection.go | 4 ++-- ionoscloud/resource_server_test.go | 6 +++--- ionoscloud/resource_share.go | 10 +++++----- ionoscloud/resource_share_test.go | 4 ++-- ionoscloud/resource_snapshot.go | 10 +++++----- ionoscloud/resource_snapshot_test.go | 4 ++-- ionoscloud/resource_target_group.go | 10 +++++----- ionoscloud/resource_target_group_test.go | 4 ++-- ionoscloud/resource_user.go | 10 +++++----- ionoscloud/resource_user_test.go | 6 +++--- ionoscloud/resource_vcpu_server_test.go | 6 +++--- ionoscloud/resource_volume.go | 10 +++++----- ionoscloud/resource_volume_test.go | 4 ++-- ionoscloud/testUtil.go | 2 +- services/clients.go | 2 +- services/cloudapi/cloudapiserver/server.go | 2 +- services/cloudapi/state.go | 2 +- 98 files changed, 254 insertions(+), 261 deletions(-) diff --git a/docs/data-sources/object_storage_accesskey.md b/docs/data-sources/object_storage_accesskey.md index 784228dc2..d70439ee5 100644 --- a/docs/data-sources/object_storage_accesskey.md +++ b/docs/data-sources/object_storage_accesskey.md @@ -16,7 +16,7 @@ The **Object Storage Accesskey data source** can be used to search for and retur ### By ID ```hcl data "ionoscloud_object_storage_accesskey" "example" { - id = + id = "accesskey_id" } ``` diff --git a/docs/data-sources/object_storage_region.md b/docs/data-sources/object_storage_region.md index 87dce09fd..986f06a1b 100644 --- a/docs/data-sources/object_storage_region.md +++ b/docs/data-sources/object_storage_region.md @@ -16,7 +16,7 @@ The **Object storage region data source** can be used to search for and return a ### By ID ```hcl data "ionoscloud_object_storage_region" "example" { - id = + id = "region_id" } ``` diff --git a/internal/framework/provider/provider.go b/internal/framework/provider/provider.go index 266f9c865..ac8a42576 100644 --- a/internal/framework/provider/provider.go +++ b/internal/framework/provider/provider.go @@ -204,7 +204,7 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu return } - cleanedEndpoint := cleanURL(endpoint) + cleanedEndpoint := utils.CleanURL(endpoint) if insecureBool == true { resp.Diagnostics.AddWarning("insecure mode enabled", "This is not recommended for production environments.") @@ -214,7 +214,7 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu 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), + 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), @@ -282,12 +282,3 @@ func (p *IonosCloudProvider) DataSources(_ context.Context) []func() datasource. objectstoragemanagement.NewAccesskeyDataSource, } } - -func cleanURL(url string) string { - length := len(url) - if length > 1 && url[length-1] == '/' { - url = url[:length-1] - } - - return url -} diff --git a/ionoscloud/data_source_application_loadbalancer.go b/ionoscloud/data_source_application_loadbalancer.go index c32d184b6..01d1b1af3 100644 --- a/ionoscloud/data_source_application_loadbalancer.go +++ b/ionoscloud/data_source_application_loadbalancer.go @@ -89,7 +89,7 @@ and log the extent to which your instances are being accessed.`, } func dataSourceApplicationLoadBalancerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterId := d.Get("datacenter_id").(string) diff --git a/ionoscloud/data_source_application_loadbalancer_forwardingrule.go b/ionoscloud/data_source_application_loadbalancer_forwardingrule.go index 83a401131..ab7c2cf17 100644 --- a/ionoscloud/data_source_application_loadbalancer_forwardingrule.go +++ b/ionoscloud/data_source_application_loadbalancer_forwardingrule.go @@ -161,7 +161,7 @@ func dataSourceApplicationLoadBalancerForwardingRule() *schema.Resource { } func dataSourceApplicationLoadBalancerForwardingRuleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterId := d.Get("datacenter_id").(string) albId := d.Get("application_loadbalancer_id").(string) diff --git a/ionoscloud/data_source_backup_unit.go b/ionoscloud/data_source_backup_unit.go index c2fd73f12..1ae68340e 100644 --- a/ionoscloud/data_source_backup_unit.go +++ b/ionoscloud/data_source_backup_unit.go @@ -42,7 +42,7 @@ func dataSourceBackupUnit() *schema.Resource { } func dataSourceBackupUnitRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient id, idOk := d.GetOk("id") name, nameOk := d.GetOk("name") diff --git a/ionoscloud/data_source_cube_server.go b/ionoscloud/data_source_cube_server.go index bf47a8f4a..9ef359281 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" @@ -358,7 +359,7 @@ func setCubeServerData(d *schema.ResourceData, server *ionoscloud.Server, token } func dataSourceCubeServerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_datacenter.go b/ionoscloud/data_source_datacenter.go index 6a1776f42..64b631bbc 100644 --- a/ionoscloud/data_source_datacenter.go +++ b/ionoscloud/data_source_datacenter.go @@ -82,7 +82,7 @@ func dataSourceDataCenter() *schema.Resource { } func dataSourceDataCenterRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient var name, location string id, idOk := d.GetOk("id") diff --git a/ionoscloud/data_source_firewall.go b/ionoscloud/data_source_firewall.go index 2d9a051dd..3a1927b5f 100644 --- a/ionoscloud/data_source_firewall.go +++ b/ionoscloud/data_source_firewall.go @@ -81,7 +81,7 @@ func dataSourceFirewall() *schema.Resource { } func dataSourceFirewallRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterId := d.Get("datacenter_id").(string) serverId := d.Get("server_id").(string) diff --git a/ionoscloud/data_source_group.go b/ionoscloud/data_source_group.go index 7f020b306..27c2e07a3 100644 --- a/ionoscloud/data_source_group.go +++ b/ionoscloud/data_source_group.go @@ -119,7 +119,7 @@ func dataSourceGroup() *schema.Resource { } func dataSourceGroupRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient id, idOk := d.GetOk("id") name, nameOk := d.GetOk("name") diff --git a/ionoscloud/data_source_image.go b/ionoscloud/data_source_image.go index c4a6e69b5..43dfef230 100644 --- a/ionoscloud/data_source_image.go +++ b/ionoscloud/data_source_image.go @@ -111,7 +111,7 @@ func dataSourceImage() *schema.Resource { } func dataSourceImageRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient images, apiResponse, err := client.ImagesApi.ImagesGet(ctx).Depth(1).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/data_source_ipblock.go b/ionoscloud/data_source_ipblock.go index 4adb42c0c..8a8e87405 100644 --- a/ionoscloud/data_source_ipblock.go +++ b/ionoscloud/data_source_ipblock.go @@ -109,7 +109,7 @@ func datasourceIpBlockRead(ctx context.Context, data *schema.ResourceData, meta } var ipBlock ionoscloud.IpBlock var err error - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient var apiResponse *ionoscloud.APIResponse if !idOk && !nameOk && !locationOk { diff --git a/ionoscloud/data_source_ipfailover.go b/ionoscloud/data_source_ipfailover.go index 2eb1ff5e3..4aa890419 100644 --- a/ionoscloud/data_source_ipfailover.go +++ b/ionoscloud/data_source_ipfailover.go @@ -47,7 +47,7 @@ func dataSourceIpFailover() *schema.Resource { } func dataSourceIpFailoverRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) lanId := d.Get("lan_id").(string) ip := d.Get("ip").(string) diff --git a/ionoscloud/data_source_k8s_cluster.go b/ionoscloud/data_source_k8s_cluster.go index 5902284e0..e7fe563bc 100644 --- a/ionoscloud/data_source_k8s_cluster.go +++ b/ionoscloud/data_source_k8s_cluster.go @@ -266,7 +266,7 @@ func dataSourceK8sCluster() *schema.Resource { } func dataSourceK8sReadCluster(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient id, idOk := d.GetOk("id") name, nameOk := d.GetOk("name") diff --git a/ionoscloud/data_source_k8s_clusters.go b/ionoscloud/data_source_k8s_clusters.go index 9a222bfe0..bfc938336 100644 --- a/ionoscloud/data_source_k8s_clusters.go +++ b/ionoscloud/data_source_k8s_clusters.go @@ -43,7 +43,7 @@ func dataSourceK8sReadClusters(ctx context.Context, d *schema.ResourceData, meta "k8s_version": "k8sVersion", } - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient req := client.KubernetesApi.K8sGet(ctx).Depth(1) filters, filtersOk := d.GetOk("filter") diff --git a/ionoscloud/data_source_k8s_node_pool.go b/ionoscloud/data_source_k8s_node_pool.go index 6f787afdd..f5640248e 100644 --- a/ionoscloud/data_source_k8s_node_pool.go +++ b/ionoscloud/data_source_k8s_node_pool.go @@ -193,7 +193,7 @@ func dataSourceK8sNodePool() *schema.Resource { } func dataSourceK8sReadNodePool(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient clusterId := d.Get("k8s_cluster_id") id, idOk := d.GetOk("id") diff --git a/ionoscloud/data_source_k8s_node_pool_nodes.go b/ionoscloud/data_source_k8s_node_pool_nodes.go index a860e5563..6d8af2ecd 100644 --- a/ionoscloud/data_source_k8s_node_pool_nodes.go +++ b/ionoscloud/data_source_k8s_node_pool_nodes.go @@ -68,7 +68,7 @@ func dataSourceK8sNodePoolNodes() *schema.Resource { } func dataSourceK8sReadNodePoolNodes(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient clusterId := d.Get("k8s_cluster_id") nodePoolId := d.Get("node_pool_id") nodePoolIdStr := nodePoolId.(string) diff --git a/ionoscloud/data_source_lan.go b/ionoscloud/data_source_lan.go index 95ef8cafc..1c4603404 100644 --- a/ionoscloud/data_source_lan.go +++ b/ionoscloud/data_source_lan.go @@ -82,7 +82,7 @@ func convertIpFailoverList(ips *[]ionoscloud.IPFailover) []interface{} { } func dataSourceLanRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_location.go b/ionoscloud/data_source_location.go index 6ec2c06b5..40a4d25e9 100644 --- a/ionoscloud/data_source_location.go +++ b/ionoscloud/data_source_location.go @@ -61,7 +61,7 @@ func dataSourceLocation() *schema.Resource { } func dataSourceLocationRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient name, nameOk := d.GetOk("name") feature, featureOk := d.GetOk("feature") diff --git a/ionoscloud/data_source_natgateway.go b/ionoscloud/data_source_natgateway.go index e377eebf0..7cfecb533 100644 --- a/ionoscloud/data_source_natgateway.go +++ b/ionoscloud/data_source_natgateway.go @@ -69,7 +69,7 @@ func dataSourceNatGateway() *schema.Resource { } func dataSourceNatGatewayRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_natgateway_rule.go b/ionoscloud/data_source_natgateway_rule.go index 8c1fe5d1c..b137f24a3 100644 --- a/ionoscloud/data_source_natgateway_rule.go +++ b/ionoscloud/data_source_natgateway_rule.go @@ -93,7 +93,7 @@ func dataSourceNatGatewayRule() *schema.Resource { } func dataSourceNatGatewayRuleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_networkloadbalancer.go b/ionoscloud/data_source_networkloadbalancer.go index 41f45a637..28dc362ad 100644 --- a/ionoscloud/data_source_networkloadbalancer.go +++ b/ionoscloud/data_source_networkloadbalancer.go @@ -86,7 +86,7 @@ and log the extent to which your instances are being accessed.`, } func dataSourceNetworkLoadBalancerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_networkloadbalancer_forwardingrule.go b/ionoscloud/data_source_networkloadbalancer_forwardingrule.go index dc8e0cb1e..e95986fee 100644 --- a/ionoscloud/data_source_networkloadbalancer_forwardingrule.go +++ b/ionoscloud/data_source_networkloadbalancer_forwardingrule.go @@ -152,7 +152,7 @@ func dataSourceNetworkLoadBalancerForwardingRule() *schema.Resource { } func dataSourceNetworkLoadBalancerForwardingRuleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_nic.go b/ionoscloud/data_source_nic.go index 44465c31e..8844f8123 100644 --- a/ionoscloud/data_source_nic.go +++ b/ionoscloud/data_source_nic.go @@ -179,7 +179,7 @@ func getNicDataSourceSchema() map[string]*schema.Schema { } } func dataSourceNicRead(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient t, dIdOk := data.GetOk("datacenter_id") st, sIdOk := data.GetOk("server_id") diff --git a/ionoscloud/data_source_nsg.go b/ionoscloud/data_source_nsg.go index d3099a002..5fcbc4712 100644 --- a/ionoscloud/data_source_nsg.go +++ b/ionoscloud/data_source_nsg.go @@ -102,7 +102,7 @@ func dataSourceNSG() *schema.Resource { } func dataSourceNSGRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterID := d.Get("datacenter_id").(string) id, idOk := d.GetOk("id") diff --git a/ionoscloud/data_source_private_crossconnect.go b/ionoscloud/data_source_private_crossconnect.go index 8a046e476..6684d4482 100644 --- a/ionoscloud/data_source_private_crossconnect.go +++ b/ionoscloud/data_source_private_crossconnect.go @@ -158,7 +158,7 @@ func setPccDataSource(d *schema.ResourceData, pcc *ionoscloud.PrivateCrossConnec } func dataSourcePccRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient id, idOk := d.GetOk("id") name, nameOk := d.GetOk("name") diff --git a/ionoscloud/data_source_resource.go b/ionoscloud/data_source_resource.go index 0800b0275..7e0e338f7 100644 --- a/ionoscloud/data_source_resource.go +++ b/ionoscloud/data_source_resource.go @@ -29,7 +29,7 @@ func dataSourceResource() *schema.Resource { } func dataSourceResourceRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient var results []ionoscloud.Resource diff --git a/ionoscloud/data_source_server.go b/ionoscloud/data_source_server.go index de5f2b588..06ef22824 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" @@ -454,7 +455,7 @@ func setServerData(d *schema.ResourceData, server *ionoscloud.Server, token *ion } func dataSourceServerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_servers.go b/ionoscloud/data_source_servers.go index fa96b4776..6b3d49275 100644 --- a/ionoscloud/data_source_servers.go +++ b/ionoscloud/data_source_servers.go @@ -231,7 +231,7 @@ func dataSourceFiltersSchema() *schema.Schema { } func dataSourceServersRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_servers_test.go b/ionoscloud/data_source_servers_test.go index 1cccacbc9..9ce5b83f7 100644 --- a/ionoscloud/data_source_servers_test.go +++ b/ionoscloud/data_source_servers_test.go @@ -105,7 +105,7 @@ func TestAccDataSourceServersBasic(t *testing.T) { } func testAccCheckServersDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) diff --git a/ionoscloud/data_source_snapshot.go b/ionoscloud/data_source_snapshot.go index 9b5328ce4..11304395d 100644 --- a/ionoscloud/data_source_snapshot.go +++ b/ionoscloud/data_source_snapshot.go @@ -99,7 +99,7 @@ func dataSourceSnapshot() *schema.Resource { } func dataSourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient id, idOk := d.GetOk("id") name, nameOk := d.GetOk("name") diff --git a/ionoscloud/data_source_target_group.go b/ionoscloud/data_source_target_group.go index e166d8817..6effda64c 100644 --- a/ionoscloud/data_source_target_group.go +++ b/ionoscloud/data_source_target_group.go @@ -154,7 +154,7 @@ func dataSourceTargetGroup() *schema.Resource { } func dataSourceTargetGroupRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient idValue, idOk := d.GetOk("id") nameValue, nameOk := d.GetOk("name") diff --git a/ionoscloud/data_source_template.go b/ionoscloud/data_source_template.go index f49ed54d2..3de9cefd9 100644 --- a/ionoscloud/data_source_template.go +++ b/ionoscloud/data_source_template.go @@ -46,7 +46,7 @@ func dataSourceTemplate() *schema.Resource { } func dataSourceTemplateRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient templates, apiResponse, err := client.TemplatesApi.TemplatesGet(ctx).Depth(1).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/data_source_user.go b/ionoscloud/data_source_user.go index 893558048..7492fcc36 100644 --- a/ionoscloud/data_source_user.go +++ b/ionoscloud/data_source_user.go @@ -77,7 +77,7 @@ func dataSourceUser() *schema.Resource { } func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient idValue, idOk := d.GetOk("id") emailValue, emailOk := d.GetOk("email") diff --git a/ionoscloud/data_source_volume.go b/ionoscloud/data_source_volume.go index beb72a077..28c48952f 100644 --- a/ionoscloud/data_source_volume.go +++ b/ionoscloud/data_source_volume.go @@ -107,7 +107,7 @@ func dataSourceVolume() *schema.Resource { } func dataSourceVolumeRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/provider.go b/ionoscloud/provider.go index 0c9394315..53898a027 100644 --- a/ionoscloud/provider.go +++ b/ionoscloud/provider.go @@ -325,7 +325,7 @@ func NewSDKBundleClient(clientOpts ClientOptions) interface{} { CDNClient: NewClientByType(clientOpts, cdnClient).(*cdnService.Client), AutoscalingClient: NewClientByType(clientOpts, autoscalingClient).(*autoscalingService.Client), CertManagerClient: NewClientByType(clientOpts, certManagerClient).(*cert.Client), - CloudApiClient: NewClientByType(clientOpts, ionosClient).(*ionoscloud.APIClient), + CloudAPIClient: NewClientByType(clientOpts, ionosClient).(*ionoscloud.APIClient), ContainerClient: NewClientByType(clientOpts, containerRegistryClient).(*crService.Client), DataplatformClient: NewClientByType(clientOpts, dataplatformClient).(*dataplatformService.Client), DNSClient: NewClientByType(clientOpts, dnsClient).(*dnsService.Client), diff --git a/ionoscloud/resource_application_loadbalancer.go b/ionoscloud/resource_application_loadbalancer.go index ea8cdd185..3454ee53f 100644 --- a/ionoscloud/resource_application_loadbalancer.go +++ b/ionoscloud/resource_application_loadbalancer.go @@ -92,7 +92,7 @@ and log the extent to which your instances are being accessed.`, } func resourceApplicationLoadBalancerCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient applicationLoadBalancer := ionoscloud.ApplicationLoadBalancer{ Properties: &ionoscloud.ApplicationLoadBalancerProperties{}, @@ -207,7 +207,7 @@ func resourceApplicationLoadBalancerCreate(ctx context.Context, d *schema.Resour } func resourceApplicationLoadBalancerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) @@ -240,7 +240,7 @@ func resourceApplicationLoadBalancerRead(ctx context.Context, d *schema.Resource } func resourceApplicationLoadBalancerUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.ApplicationLoadBalancer{ Properties: &ionoscloud.ApplicationLoadBalancerProperties{}, @@ -347,7 +347,7 @@ func resourceApplicationLoadBalancerUpdate(ctx context.Context, d *schema.Resour } func resourceApplicationLoadBalancerDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) @@ -369,7 +369,7 @@ func resourceApplicationLoadBalancerDelete(ctx context.Context, d *schema.Resour } func resourceApplicationLoadBalancerImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient parts := strings.Split(d.Id(), "/") diff --git a/ionoscloud/resource_application_loadbalancer_forwardingrule.go b/ionoscloud/resource_application_loadbalancer_forwardingrule.go index cba20a2fb..79d60c9fe 100644 --- a/ionoscloud/resource_application_loadbalancer_forwardingrule.go +++ b/ionoscloud/resource_application_loadbalancer_forwardingrule.go @@ -177,7 +177,7 @@ func resourceApplicationLoadBalancerForwardingRule() *schema.Resource { } func resourceApplicationLoadBalancerForwardingRuleCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient applicationLoadBalancerForwardingRule := ionoscloud.ApplicationLoadBalancerForwardingRule{ Properties: &ionoscloud.ApplicationLoadBalancerForwardingRuleProperties{}, @@ -255,7 +255,7 @@ func resourceApplicationLoadBalancerForwardingRuleCreate(ctx context.Context, d func resourceApplicationLoadBalancerForwardingRuleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) @@ -280,7 +280,7 @@ func resourceApplicationLoadBalancerForwardingRuleRead(ctx context.Context, d *s } func resourceApplicationLoadBalancerForwardingRuleUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.ApplicationLoadBalancerForwardingRule{ Properties: &ionoscloud.ApplicationLoadBalancerForwardingRuleProperties{}, @@ -356,7 +356,7 @@ func resourceApplicationLoadBalancerForwardingRuleUpdate(ctx context.Context, d } func resourceApplicationLoadBalancerForwardingRuleDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) albID := d.Get("application_loadbalancer_id").(string) @@ -379,7 +379,7 @@ func resourceApplicationLoadBalancerForwardingRuleDelete(ctx context.Context, d } func resourceApplicationLoadBalancerForwardingRuleImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient parts := strings.Split(d.Id(), "/") diff --git a/ionoscloud/resource_application_loadbalancer_forwardingrule_test.go b/ionoscloud/resource_application_loadbalancer_forwardingrule_test.go index 38d1f6c3b..ab1e76f1f 100644 --- a/ionoscloud/resource_application_loadbalancer_forwardingrule_test.go +++ b/ionoscloud/resource_application_loadbalancer_forwardingrule_test.go @@ -171,7 +171,7 @@ func TestAccApplicationLoadBalancerForwardingRuleBasic(t *testing.T) { } func testAccCheckApplicationLoadBalancerForwardingRuleDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -204,7 +204,7 @@ func testAccCheckApplicationLoadBalancerForwardingRuleDestroyCheck(s *terraform. func testAccCheckApplicationLoadBalancerForwardingRuleExists(n string, alb *ionoscloud.ApplicationLoadBalancerForwardingRule) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_application_loadbalancer_test.go b/ionoscloud/resource_application_loadbalancer_test.go index 0a4060397..cc6ee62d8 100644 --- a/ionoscloud/resource_application_loadbalancer_test.go +++ b/ionoscloud/resource_application_loadbalancer_test.go @@ -115,7 +115,7 @@ func TestAccApplicationLoadBalancerBasic(t *testing.T) { } func testAccCheckApplicationLoadBalancerDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -147,7 +147,7 @@ func testAccCheckApplicationLoadBalancerDestroyCheck(s *terraform.State) error { func testAccCheckApplicationLoadBalancerExists(n string, alb *ionoscloud.ApplicationLoadBalancer) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_backup_unit.go b/ionoscloud/resource_backup_unit.go index a2c663694..ff300947f 100644 --- a/ionoscloud/resource_backup_unit.go +++ b/ionoscloud/resource_backup_unit.go @@ -61,7 +61,7 @@ func resourceBackupUnit() *schema.Resource { } func resourceBackupUnitCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient backupUnitName := d.Get("name").(string) backupUnitPassword := d.Get("password").(string) @@ -96,7 +96,7 @@ func resourceBackupUnitCreate(ctx context.Context, d *schema.ResourceData, meta func resourceBackupUnitRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient backupUnit, apiResponse, err := BackupUnitFindByID(ctx, d.Id(), client) logApiRequestTime(apiResponse) @@ -130,7 +130,7 @@ func resourceBackupUnitRead(ctx context.Context, d *schema.ResourceData, meta in } func resourceBackupUnitUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.BackupUnit{} request.Properties = &ionoscloud.BackupUnitProperties{} @@ -206,7 +206,7 @@ func waitForUnitToBeReady(ctx context.Context, d *schema.ResourceData, client *i } func resourceBackupUnitDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient apiResponse, err := client.BackupUnitsApi.BackupunitsDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -249,7 +249,7 @@ func resourceBackupUnitDelete(ctx context.Context, d *schema.ResourceData, meta } func resourceBackupUnitImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient buId := d.Id() diff --git a/ionoscloud/resource_backup_unit_test.go b/ionoscloud/resource_backup_unit_test.go index 6c7759866..227a2d613 100644 --- a/ionoscloud/resource_backup_unit_test.go +++ b/ionoscloud/resource_backup_unit_test.go @@ -79,7 +79,7 @@ func TestAccBackupUnitBasic(t *testing.T) { } func testAccCheckBackupUnitDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -111,7 +111,7 @@ func testAccCheckBackupUnitDestroyCheck(s *terraform.State) error { func testAccCheckBackupUnitExists(n string, backupUnit *ionoscloud.BackupUnit) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_cube_server.go b/ionoscloud/resource_cube_server.go index 611beaa3c..2aca75421 100644 --- a/ionoscloud/resource_cube_server.go +++ b/ionoscloud/resource_cube_server.go @@ -381,7 +381,7 @@ func resourceCubeServer() *schema.Resource { } func resourceCubeServerCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient server := ionoscloud.Server{ Properties: &ionoscloud.ServerProperties{}, @@ -631,7 +631,7 @@ func resourceCubeServerCreate(ctx context.Context, d *schema.ResourceData, meta } func resourceCubeServerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) serverId := d.Id() @@ -791,7 +791,7 @@ func resourceCubeServerRead(ctx context.Context, d *schema.ResourceData, meta in } func resourceCubeServerUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient ss := cloudapiserver.Service{Client: client, Meta: meta, D: d} dcId := d.Get("datacenter_id").(string) @@ -838,7 +838,7 @@ func resourceCubeServerUpdate(ctx context.Context, d *schema.ResourceData, meta bootCdrom := n.(string) if utils.IsValidUUID(bootCdrom) { - ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} + ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} ss.UpdateBootDevice(ctx, dcId, d.Id(), bootCdrom) } } @@ -1094,7 +1094,7 @@ func SetCubeVolumeProperties(volume ionoscloud.Volume) map[string]interface{} { } func resourceCubeServerDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) apiResponse, err := client.ServersApi.DatacentersServersDelete(ctx, dcId, d.Id()).Execute() @@ -1123,7 +1123,7 @@ func resourceCubeServerImport(ctx context.Context, d *schema.ResourceData, meta datacenterId := parts[0] serverId := parts[1] - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient server, apiResponse, err := client.ServersApi.DatacentersServersFindById(ctx, datacenterId, serverId).Depth(3).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_cube_server_test.go b/ionoscloud/resource_cube_server_test.go index f9c334848..5dbef5808 100644 --- a/ionoscloud/resource_cube_server_test.go +++ b/ionoscloud/resource_cube_server_test.go @@ -338,7 +338,7 @@ func TestAccCubeServerWithICMP(t *testing.T) { } func testAccCheckCubeServerDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -371,7 +371,7 @@ func testAccCheckCubeServerDestroyCheck(s *terraform.State) error { func testAccCheckCubeServerExists(n string, server *ionoscloud.Server) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_datacenter.go b/ionoscloud/resource_datacenter.go index d451b2b30..f311d832d 100644 --- a/ionoscloud/resource_datacenter.go +++ b/ionoscloud/resource_datacenter.go @@ -94,7 +94,7 @@ func resourceDatacenter() *schema.Resource { func resourceDatacenterCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterName := d.Get("name").(string) datacenterLocation := d.Get("location").(string) @@ -137,7 +137,7 @@ func resourceDatacenterCreate(ctx context.Context, d *schema.ResourceData, meta func resourceDatacenterRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenter, apiResponse, err := client.DataCentersApi.DatacentersFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -160,7 +160,7 @@ func resourceDatacenterRead(ctx context.Context, d *schema.ResourceData, meta in func resourceDatacenterUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient obj := ionoscloud.DatacenterPropertiesPut{} if d.HasChange("name") { @@ -204,7 +204,7 @@ func resourceDatacenterUpdate(ctx context.Context, d *schema.ResourceData, meta func resourceDatacenterDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient apiResponse, err := client.DataCentersApi.DatacentersDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -223,7 +223,7 @@ func resourceDatacenterDelete(ctx context.Context, d *schema.ResourceData, meta } func resourceDatacenterImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Id() diff --git a/ionoscloud/resource_datacenter_nsg_selection.go b/ionoscloud/resource_datacenter_nsg_selection.go index bbaf1697b..2abab798c 100644 --- a/ionoscloud/resource_datacenter_nsg_selection.go +++ b/ionoscloud/resource_datacenter_nsg_selection.go @@ -45,7 +45,7 @@ func resourceDatacenterNSGSelectionCreate(ctx context.Context, d *schema.Resourc dcID := d.Get("datacenter_id").(string) nsgID := d.Get("nsg_id").(string) - ns := nsg.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} + ns := nsg.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} if diags := ns.SetDefaultDatacenterNSG(ctx, dcID, nsgID); diags.HasError() { return diags } @@ -55,7 +55,7 @@ func resourceDatacenterNSGSelectionCreate(ctx context.Context, d *schema.Resourc } func resourceDatacenterNSGSelectionRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcID := d.Get("datacenter_id").(string) nsgID := d.Get("nsg_id").(string) @@ -80,7 +80,7 @@ func resourceDatacenterNSGSelectionUpdate(ctx context.Context, d *schema.Resourc if d.HasChange("nsg_id") { _, newID := d.GetChange("nsg_id") - ns := nsg.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} + ns := nsg.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} if diags := ns.SetDefaultDatacenterNSG(ctx, dcID, newID.(string)); diags.HasError() { return diags } @@ -92,7 +92,7 @@ func resourceDatacenterNSGSelectionUpdate(ctx context.Context, d *schema.Resourc func resourceDatacenterNSGSelectionDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { dcID := d.Get("datacenter_id").(string) - ns := nsg.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} + ns := nsg.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} if diags := ns.SetDefaultDatacenterNSG(ctx, dcID, ""); diags.HasError() { return diags } diff --git a/ionoscloud/resource_datacenter_test.go b/ionoscloud/resource_datacenter_test.go index 4c8625ced..fe7942093 100644 --- a/ionoscloud/resource_datacenter_test.go +++ b/ionoscloud/resource_datacenter_test.go @@ -104,7 +104,7 @@ func TestAccDataCenterBasic(t *testing.T) { } func testAccCheckDatacenterDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -134,7 +134,7 @@ func testAccCheckDatacenterDestroyCheck(s *terraform.State) error { func testAccCheckDatacenterExists(n string, datacenter *ionoscloud.Datacenter) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_firewall.go b/ionoscloud/resource_firewall.go index 55f690ce1..2daca4439 100644 --- a/ionoscloud/resource_firewall.go +++ b/ionoscloud/resource_firewall.go @@ -101,7 +101,7 @@ func resourceFirewall() *schema.Resource { } func resourceFirewallCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient firewall, diags := getFirewallData(d, "", false) if diags != nil { @@ -130,7 +130,7 @@ func resourceFirewallCreate(ctx context.Context, d *schema.ResourceData, meta in } func resourceFirewallRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient fw, apiResponse, err := client.FirewallRulesApi.DatacentersServersNicsFirewallrulesFindById(ctx, d.Get("datacenter_id").(string), d.Get("server_id").(string), d.Get("nic_id").(string), d.Id()).Execute() @@ -155,7 +155,7 @@ func resourceFirewallRead(ctx context.Context, d *schema.ResourceData, meta inte } func resourceFirewallUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient firewall, diags := getFirewallData(d, "", true) if diags != nil { @@ -177,7 +177,7 @@ func resourceFirewallUpdate(ctx context.Context, d *schema.ResourceData, meta in } func resourceFirewallDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient apiResponse, err := client.FirewallRulesApi. DatacentersServersNicsFirewallrulesDelete( @@ -201,7 +201,7 @@ func resourceFirewallDelete(ctx context.Context, d *schema.ResourceData, meta in func resourceFirewallImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient parts := strings.Split(d.Id(), "/") if len(parts) != 4 || parts[0] == "" || parts[1] == "" || parts[2] == "" || parts[3] == "" { diff --git a/ionoscloud/resource_firewall_test.go b/ionoscloud/resource_firewall_test.go index e0adfd6b2..adc5b5204 100644 --- a/ionoscloud/resource_firewall_test.go +++ b/ionoscloud/resource_firewall_test.go @@ -144,7 +144,7 @@ func TestAccFirewallUDP(t *testing.T) { } func testAccCheckFirewallDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -175,7 +175,7 @@ func testAccCheckFirewallDestroyCheck(s *terraform.State) error { func testAccCheckFirewallExists(n string, firewall *ionoscloud.FirewallRule) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_group.go b/ionoscloud/resource_group.go index c49aca6be..b6bbe7c61 100644 --- a/ionoscloud/resource_group.go +++ b/ionoscloud/resource_group.go @@ -181,7 +181,7 @@ func resourceGroup() *schema.Resource { //} func resourceGroupCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.Group{ Properties: &ionoscloud.GroupProperties{}, @@ -262,7 +262,7 @@ func resourceGroupCreate(ctx context.Context, d *schema.ResourceData, meta inter } func resourceGroupRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient group, apiResponse, err := client.UserManagementApi.UmGroupsFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -284,7 +284,7 @@ func resourceGroupRead(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient tempCreateDataCenter := d.Get("create_datacenter").(bool) tempCreateSnapshot := d.Get("create_snapshot").(bool) @@ -386,7 +386,7 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter } func resourceGroupDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient apiResponse, err := client.UserManagementApi.UmGroupsDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -404,7 +404,7 @@ func resourceGroupDelete(ctx context.Context, d *schema.ResourceData, meta inter } func resourceGroupImporter(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient grpId := d.Id() @@ -586,7 +586,7 @@ func setGroupData(ctx context.Context, client *ionoscloud.APIClient, d *schema.R } func addUserToGroup(userId, groupId string, ctx context.Context, d *schema.ResourceData, meta interface{}) error { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient userToAdd := ionoscloud.UserGroupPost{ Id: &userId, } @@ -608,7 +608,7 @@ func addUserToGroup(userId, groupId string, ctx context.Context, d *schema.Resou } func deleteUserFromGroup(userId, groupId string, ctx context.Context, d *schema.ResourceData, meta interface{}) error { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient apiResponse, err := client.UserManagementApi.UmGroupsUsersDelete(ctx, groupId, userId).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_group_test.go b/ionoscloud/resource_group_test.go index 0fc520a13..9f4e5b154 100644 --- a/ionoscloud/resource_group_test.go +++ b/ionoscloud/resource_group_test.go @@ -162,7 +162,7 @@ func TestAccGroupBasic(t *testing.T) { } func testAccCheckGroupDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) if cancel != nil { @@ -191,7 +191,7 @@ func testAccCheckGroupDestroyCheck(s *terraform.State) error { func testAccCheckGroupExists(n string, group *ionoscloud.Group) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_ipblock.go b/ionoscloud/resource_ipblock.go index 62d8cf1bb..c507461d9 100644 --- a/ionoscloud/resource_ipblock.go +++ b/ionoscloud/resource_ipblock.go @@ -98,7 +98,7 @@ func resourceIPBlock() *schema.Resource { } func resourceIPBlockCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient size := d.Get("size").(int) sizeConverted := int32(size) @@ -132,7 +132,7 @@ func resourceIPBlockCreate(ctx context.Context, d *schema.ResourceData, meta int } func resourceIPBlockRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient ipBlock, apiResponse, err := client.IPBlocksApi.IpblocksFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -155,7 +155,7 @@ func resourceIPBlockRead(ctx context.Context, d *schema.ResourceData, meta inter return nil } func resourceIPBlockUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.IpBlockProperties{} @@ -178,7 +178,7 @@ func resourceIPBlockUpdate(ctx context.Context, d *schema.ResourceData, meta int } func resourceIPBlockDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient apiResponse, err := client.IPBlocksApi.IpblocksDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -196,7 +196,7 @@ func resourceIPBlockDelete(ctx context.Context, d *schema.ResourceData, meta int } func resourceIpBlockImporter(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient ipBlockId := d.Id() diff --git a/ionoscloud/resource_ipblock_test.go b/ionoscloud/resource_ipblock_test.go index 782eeb647..78f77bd26 100644 --- a/ionoscloud/resource_ipblock_test.go +++ b/ionoscloud/resource_ipblock_test.go @@ -106,7 +106,7 @@ func TestAccIPBlockBasic(t *testing.T) { } func testAccCheckIPBlockDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -148,7 +148,7 @@ func testAccCheckIPBlockAttributes(n string, location string) resource.TestCheck func testAccCheckIPBlockExists(n string, ipblock *ionoscloud.IpBlock) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_ipfailover.go b/ionoscloud/resource_ipfailover.go index ba1bd4eee..6ea682024 100644 --- a/ionoscloud/resource_ipfailover.go +++ b/ionoscloud/resource_ipfailover.go @@ -63,7 +63,7 @@ func resourceLanIPFailover() *schema.Resource { } func resourceLanIPFailoverCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) lanId := d.Get("lan_id").(string) ip := d.Get("ip").(string) @@ -104,7 +104,7 @@ func resourceLanIPFailoverCreate(ctx context.Context, d *schema.ResourceData, me } func resourceLanIPFailoverRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) lanId := d.Get("lan_id").(string) ip := d.Get("ip").(string) @@ -149,7 +149,7 @@ func resourceLanIPFailoverRead(ctx context.Context, d *schema.ResourceData, meta } func resourceLanIPFailoverUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) lanId := d.Get("lan_id").(string) ip := d.Get("ip").(string) @@ -198,7 +198,7 @@ func resourceLanIPFailoverUpdate(ctx context.Context, d *schema.ResourceData, me } func resourceLanIPFailoverDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) lanId := d.Get("lan_id").(string) ip := d.Get("ip").(string) @@ -246,7 +246,7 @@ func resourceIpFailoverImporter(ctx context.Context, d *schema.ResourceData, met lanId := parts[1] ip := parts[2] - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient lan, apiResponse, err := client.LANsApi.DatacentersLansFindById(ctx, dcId, lanId).Execute() apiResponse.LogInfo() diff --git a/ionoscloud/resource_ipfailover_test.go b/ionoscloud/resource_ipfailover_test.go index 40bc24816..57412dbe5 100644 --- a/ionoscloud/resource_ipfailover_test.go +++ b/ionoscloud/resource_ipfailover_test.go @@ -76,7 +76,7 @@ func TestAccLanIPFailoverBasic(t *testing.T) { func testAccCheckLanIPFailoverGroupExists(n string) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] if !ok { @@ -112,7 +112,7 @@ func testAccCheckLanIPFailoverGroupExists(n string) resource.TestCheckFunc { } func testAccCheckLanIPFailoverDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) defer cancel() diff --git a/ionoscloud/resource_k8s_cluster.go b/ionoscloud/resource_k8s_cluster.go index 43e790159..5c831661e 100644 --- a/ionoscloud/resource_k8s_cluster.go +++ b/ionoscloud/resource_k8s_cluster.go @@ -160,7 +160,7 @@ func checkClusterImmutableFields(_ context.Context, diff *schema.ResourceDiff, _ } func resourcek8sClusterCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient clusterName := d.Get("name").(string) cluster := ionoscloud.KubernetesClusterForPost{ @@ -291,7 +291,7 @@ func resourcek8sClusterCreate(ctx context.Context, d *schema.ResourceData, meta } func resourcek8sClusterRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient cluster, apiResponse, err := client.KubernetesApi.K8sFindByClusterId(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -316,7 +316,7 @@ func resourcek8sClusterRead(ctx context.Context, d *schema.ResourceData, meta in func resourcek8sClusterUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.KubernetesClusterForPut{} @@ -460,7 +460,7 @@ func resourcek8sClusterUpdate(ctx context.Context, d *schema.ResourceData, meta func resourcek8sClusterDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient apiResponse, err := client.KubernetesApi.K8sDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -504,7 +504,7 @@ func resourcek8sClusterDelete(ctx context.Context, d *schema.ResourceData, meta } func resourceK8sClusterImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient clusterId := d.Id() diff --git a/ionoscloud/resource_k8s_cluster_test.go b/ionoscloud/resource_k8s_cluster_test.go index 550e08932..e16fa5dd1 100644 --- a/ionoscloud/resource_k8s_cluster_test.go +++ b/ionoscloud/resource_k8s_cluster_test.go @@ -204,7 +204,7 @@ func TestAccK8sClusters(t *testing.T) { } func testAccCheckK8sClusterDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -235,7 +235,7 @@ func testAccCheckK8sClusterDestroyCheck(s *terraform.State) error { func testAccCheckK8sClusterExists(n string, k8sCluster *ionoscloud.KubernetesCluster) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_k8s_node_pool.go b/ionoscloud/resource_k8s_node_pool.go index 33c056420..840fdd4f9 100644 --- a/ionoscloud/resource_k8s_node_pool.go +++ b/ionoscloud/resource_k8s_node_pool.go @@ -405,7 +405,7 @@ func getAutoscalingData(d *schema.ResourceData) (*ionoscloud.KubernetesAutoScali return &autoscaling, nil } func resourcek8sNodePoolCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient name := d.Get("name").(string) datacenterId := d.Get("datacenter_id").(string) @@ -549,7 +549,7 @@ func resourcek8sNodePoolCreate(ctx context.Context, d *schema.ResourceData, meta } func resourcek8sNodePoolRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient k8sNodepool, apiResponse, err := client.KubernetesApi.K8sNodepoolsFindById(ctx, d.Get("k8s_cluster_id").(string), d.Id()).Execute() logApiRequestTime(apiResponse) @@ -574,7 +574,7 @@ func resourcek8sNodePoolRead(ctx context.Context, d *schema.ResourceData, meta i } func resourcek8sNodePoolUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.KubernetesNodePoolForPut{} @@ -766,7 +766,7 @@ func resourcek8sNodePoolUpdate(ctx context.Context, d *schema.ResourceData, meta } func resourcek8sNodePoolDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient apiResponse, err := client.KubernetesApi.K8sNodepoolsDelete(ctx, d.Get("k8s_cluster_id").(string), d.Id()).Execute() logApiRequestTime(apiResponse) @@ -818,7 +818,7 @@ func resourceK8sNodepoolImport(ctx context.Context, d *schema.ResourceData, meta clusterId := parts[0] npId := parts[1] - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient k8sNodepool, apiResponse, err := client.KubernetesApi.K8sNodepoolsFindById(ctx, clusterId, npId).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_k8s_node_pool_test.go b/ionoscloud/resource_k8s_node_pool_test.go index 8b0689a17..c336a166e 100644 --- a/ionoscloud/resource_k8s_node_pool_test.go +++ b/ionoscloud/resource_k8s_node_pool_test.go @@ -249,7 +249,7 @@ func TestAccK8sNodePoolNoOptionalAndNodesDataSource(t *testing.T) { } func testAccCheckK8sNodePoolDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -280,7 +280,7 @@ func testAccCheckK8sNodePoolDestroyCheck(s *terraform.State) error { func testAccCheckK8sNodePoolExists(n string, k8sNodepool *ionoscloud.KubernetesNodePool) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_lan.go b/ionoscloud/resource_lan.go index 0e2ee1980..ecbad9731 100644 --- a/ionoscloud/resource_lan.go +++ b/ionoscloud/resource_lan.go @@ -84,7 +84,7 @@ func resourceLan() *schema.Resource { } func resourceLanCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient public := d.Get("public").(bool) request := ionoscloud.Lan{ Properties: &ionoscloud.LanProperties{ @@ -164,7 +164,7 @@ func resourceLanCreate(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceLanRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcid := d.Get("datacenter_id").(string) @@ -192,7 +192,7 @@ func resourceLanRead(ctx context.Context, d *schema.ResourceData, meta interface } func resourceLanUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient properties := &ionoscloud.LanProperties{} newValue := d.Get("public") public := newValue.(bool) @@ -243,7 +243,7 @@ func resourceLanUpdate(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceLanDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) if err := waitForLanNicsDeletion(ctx, client, d); err != nil { @@ -268,7 +268,7 @@ func resourceLanDelete(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceLanImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient parts := strings.Split(d.Id(), "/") diff --git a/ionoscloud/resource_lan_test.go b/ionoscloud/resource_lan_test.go index 5c77d2944..5b1880cd8 100644 --- a/ionoscloud/resource_lan_test.go +++ b/ionoscloud/resource_lan_test.go @@ -78,7 +78,7 @@ func TestAccLanBasic(t *testing.T) { } func testAccCheckLanDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -108,7 +108,7 @@ func testAccCheckLanDestroyCheck(s *terraform.State) error { func testAccCheckLanExists(n string, lan *ionoscloud.Lan) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_loadbalancer.go b/ionoscloud/resource_loadbalancer.go index 9ffadf7db..072783e58 100644 --- a/ionoscloud/resource_loadbalancer.go +++ b/ionoscloud/resource_loadbalancer.go @@ -60,7 +60,7 @@ func resourceLoadbalancer() *schema.Resource { } func resourceLoadbalancerCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient rawIds := d.Get("nic_ids").([]interface{}) var nicIds []ionoscloud.Nic @@ -105,7 +105,7 @@ func resourceLoadbalancerCreate(ctx context.Context, d *schema.ResourceData, met } func resourceLoadbalancerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient lb, apiResponse, err := client.LoadBalancersApi.DatacentersLoadbalancersFindById(ctx, d.Get("datacenter_id").(string), d.Id()).Execute() logApiRequestTime(apiResponse) @@ -143,7 +143,7 @@ func resourceLoadbalancerRead(ctx context.Context, d *schema.ResourceData, meta } func resourceLoadbalancerUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient properties := &ionoscloud.LoadbalancerProperties{} @@ -223,7 +223,7 @@ func resourceLoadbalancerUpdate(ctx context.Context, d *schema.ResourceData, met } func resourceLoadbalancerDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcid := d.Get("datacenter_id").(string) apiResponse, err := client.LoadBalancersApi.DatacentersLoadbalancersDelete(ctx, dcid, d.Id()).Execute() @@ -251,7 +251,7 @@ func resourceLoadbalancerImporter(ctx context.Context, d *schema.ResourceData, m dcId := parts[0] lbId := parts[1] - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient loadbalancer, apiResponse, err := client.LoadBalancersApi.DatacentersLoadbalancersFindById(ctx, dcId, lbId).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_loadbalancer_test.go b/ionoscloud/resource_loadbalancer_test.go index 0d0b5e167..43a1d0ea7 100644 --- a/ionoscloud/resource_loadbalancer_test.go +++ b/ionoscloud/resource_loadbalancer_test.go @@ -49,7 +49,7 @@ func TestAccLoadbalancerBasic(t *testing.T) { } func testAccCheckLoadbalancerDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -95,7 +95,7 @@ func testAccCheckLoadbalancerAttributes(n string, name string) resource.TestChec func testAccCheckLoadbalancerExists(n string, loadbalancer *ionoscloud.Loadbalancer) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_natgateway.go b/ionoscloud/resource_natgateway.go index 7994f7dd1..6fbefbb6b 100644 --- a/ionoscloud/resource_natgateway.go +++ b/ionoscloud/resource_natgateway.go @@ -76,7 +76,7 @@ func resourceNatGateway() *schema.Resource { } func resourceNatGatewayCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient name := d.Get("name").(string) @@ -167,7 +167,7 @@ func resourceNatGatewayCreate(ctx context.Context, d *schema.ResourceData, meta } func resourceNatGatewayRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) @@ -193,7 +193,7 @@ func resourceNatGatewayRead(ctx context.Context, d *schema.ResourceData, meta in } func resourceNatGatewayUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.NatGateway{ Properties: &ionoscloud.NatGatewayProperties{}, } @@ -275,7 +275,7 @@ func resourceNatGatewayUpdate(ctx context.Context, d *schema.ResourceData, meta } func resourceNatGatewayDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) @@ -297,7 +297,7 @@ func resourceNatGatewayDelete(ctx context.Context, d *schema.ResourceData, meta } func resourceNatGatewayImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient parts := strings.Split(d.Id(), "/") if len(parts) != 2 || parts[0] == "" || parts[1] == "" { diff --git a/ionoscloud/resource_natgateway_rule.go b/ionoscloud/resource_natgateway_rule.go index 59f1d2c94..620e22c94 100644 --- a/ionoscloud/resource_natgateway_rule.go +++ b/ionoscloud/resource_natgateway_rule.go @@ -111,7 +111,7 @@ func resourceNatGatewayRule() *schema.Resource { func resourceNatGatewayRuleCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient natGatewayRule := ionoscloud.NatGatewayRule{ Properties: &ionoscloud.NatGatewayRuleProperties{}, @@ -209,7 +209,7 @@ func resourceNatGatewayRuleCreate(ctx context.Context, d *schema.ResourceData, m } func resourceNatGatewayRuleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) ngId := d.Get("natgateway_id").(string) @@ -234,7 +234,7 @@ func resourceNatGatewayRuleRead(ctx context.Context, d *schema.ResourceData, met return nil } func resourceNatGatewayRuleUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.NatGatewayRule{ Properties: &ionoscloud.NatGatewayRuleProperties{}, } @@ -331,7 +331,7 @@ func resourceNatGatewayRuleUpdate(ctx context.Context, d *schema.ResourceData, m } func resourceNatGatewayRuleDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) ngId := d.Get("natgateway_id").(string) @@ -354,7 +354,7 @@ func resourceNatGatewayRuleDelete(ctx context.Context, d *schema.ResourceData, m } func resourceNatGatewayRuleImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient parts := strings.Split(d.Id(), "/") if len(parts) != 3 || parts[0] == "" || parts[1] == "" || parts[2] == "" { diff --git a/ionoscloud/resource_natgateway_rule_test.go b/ionoscloud/resource_natgateway_rule_test.go index 4f19776f0..965792a1f 100644 --- a/ionoscloud/resource_natgateway_rule_test.go +++ b/ionoscloud/resource_natgateway_rule_test.go @@ -92,7 +92,7 @@ func TestAccNatGatewayRuleBasic(t *testing.T) { } func testAccCheckNatGatewayRuleDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) @@ -122,7 +122,7 @@ func testAccCheckNatGatewayRuleDestroyCheck(s *terraform.State) error { func testAccCheckNatGatewayRuleExists(n string, natGateway *ionoscloud.NatGatewayRule) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_natgateway_test.go b/ionoscloud/resource_natgateway_test.go index ece3c7591..739c33390 100644 --- a/ionoscloud/resource_natgateway_test.go +++ b/ionoscloud/resource_natgateway_test.go @@ -78,7 +78,7 @@ func TestAccNatGatewayBasic(t *testing.T) { } func testAccCheckNatGatewayDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -107,7 +107,7 @@ func testAccCheckNatGatewayDestroyCheck(s *terraform.State) error { func testAccCheckNatGatewayExists(n string, natGateway *ionoscloud.NatGateway) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_networkloadbalancer.go b/ionoscloud/resource_networkloadbalancer.go index e2b1d00e9..3c16ae3f3 100644 --- a/ionoscloud/resource_networkloadbalancer.go +++ b/ionoscloud/resource_networkloadbalancer.go @@ -100,7 +100,7 @@ and log the extent to which your instances are being accessed.`, } func resourceNetworkLoadBalancerCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient networkLoadBalancer := ionoscloud.NetworkLoadBalancer{ Properties: &ionoscloud.NetworkLoadBalancerProperties{}, @@ -200,7 +200,7 @@ func resourceNetworkLoadBalancerCreate(ctx context.Context, d *schema.ResourceDa } func resourceNetworkLoadBalancerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) @@ -225,7 +225,7 @@ func resourceNetworkLoadBalancerRead(ctx context.Context, d *schema.ResourceData } func resourceNetworkLoadBalancerUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.NetworkLoadBalancer{ Properties: &ionoscloud.NetworkLoadBalancerProperties{}, } @@ -342,7 +342,7 @@ func resourceNetworkLoadBalancerUpdate(ctx context.Context, d *schema.ResourceDa } func resourceNetworkLoadBalancerDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) @@ -364,7 +364,7 @@ func resourceNetworkLoadBalancerDelete(ctx context.Context, d *schema.ResourceDa } func resourceNetworkLoadBalancerImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient parts := strings.Split(d.Id(), "/") if len(parts) != 2 || parts[0] == "" || parts[1] == "" { diff --git a/ionoscloud/resource_networkloadbalancer_forwardingrule.go b/ionoscloud/resource_networkloadbalancer_forwardingrule.go index acb579648..87ba32ac5 100644 --- a/ionoscloud/resource_networkloadbalancer_forwardingrule.go +++ b/ionoscloud/resource_networkloadbalancer_forwardingrule.go @@ -171,7 +171,7 @@ func resourceNetworkLoadBalancerForwardingRule() *schema.Resource { } func resourceNetworkLoadBalancerForwardingRuleCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient networkLoadBalancerForwardingRule := ionoscloud.NetworkLoadBalancerForwardingRule{ Properties: &ionoscloud.NetworkLoadBalancerForwardingRuleProperties{}, @@ -347,7 +347,7 @@ func getTargetsData(targets interface{}) ([]ionoscloud.NetworkLoadBalancerForwar func resourceNetworkLoadBalancerForwardingRuleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) @@ -374,7 +374,7 @@ func resourceNetworkLoadBalancerForwardingRuleRead(ctx context.Context, d *schem } func resourceNetworkLoadBalancerForwardingRuleUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.NetworkLoadBalancerForwardingRule{ Properties: &ionoscloud.NetworkLoadBalancerForwardingRuleProperties{}, @@ -481,7 +481,7 @@ func resourceNetworkLoadBalancerForwardingRuleUpdate(ctx context.Context, d *sch } func resourceNetworkLoadBalancerForwardingRuleDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) nlbID := d.Get("networkloadbalancer_id").(string) @@ -504,7 +504,7 @@ func resourceNetworkLoadBalancerForwardingRuleDelete(ctx context.Context, d *sch } func resourceNetworLoadBalancerForwardingRuleImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient parts := strings.Split(d.Id(), "/") if len(parts) != 3 || parts[0] == "" || parts[1] == "" || parts[2] == "" { diff --git a/ionoscloud/resource_networkloadbalancer_forwardingrule_test.go b/ionoscloud/resource_networkloadbalancer_forwardingrule_test.go index 67585e3ce..1753ed49a 100644 --- a/ionoscloud/resource_networkloadbalancer_forwardingrule_test.go +++ b/ionoscloud/resource_networkloadbalancer_forwardingrule_test.go @@ -143,7 +143,7 @@ func TestAccNetworkLoadBalancerForwardingRuleBasic(t *testing.T) { } func testAccCheckNetworkLoadBalancerForwardingRuleDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) @@ -173,7 +173,7 @@ func testAccCheckNetworkLoadBalancerForwardingRuleDestroyCheck(s *terraform.Stat func testAccCheckNetworkLoadBalancerForwardingRuleExists(n string, networkLoadBalancerForwardingRule *ionoscloud.NetworkLoadBalancerForwardingRule) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_networkloadbalancer_test.go b/ionoscloud/resource_networkloadbalancer_test.go index e2ac91ef9..0cfba0823 100644 --- a/ionoscloud/resource_networkloadbalancer_test.go +++ b/ionoscloud/resource_networkloadbalancer_test.go @@ -117,7 +117,7 @@ func TestAccNetworkLoadBalancerBasic(t *testing.T) { } func testAccCheckNetworkLoadBalancerDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) @@ -147,7 +147,7 @@ func testAccCheckNetworkLoadBalancerDestroyCheck(s *terraform.State) error { func testAccCheckNetworkLoadBalancerExists(n string, networkLoadBalancer *ionoscloud.NetworkLoadBalancer) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_nic.go b/ionoscloud/resource_nic.go index d0f7feb8a..d3c66d03d 100644 --- a/ionoscloud/resource_nic.go +++ b/ionoscloud/resource_nic.go @@ -176,7 +176,7 @@ func ForceNewForFlowlogChanges(_ context.Context, d *schema.ResourceDiff, _ inte return nil } func resourceNicCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient ns := cloudapinic.Service{Client: client, Meta: meta, D: d} nic, err := cloudapinic.GetNicFromSchema(d, "") @@ -237,7 +237,7 @@ func resourceNicCreate(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceNicRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient ns := cloudapinic.Service{Client: client, Meta: meta, D: d} dcid := d.Get("datacenter_id").(string) srvid := d.Get("server_id").(string) @@ -261,7 +261,7 @@ func resourceNicRead(ctx context.Context, d *schema.ResourceData, meta interface } func resourceNicUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient ns := cloudapinic.Service{Client: client, Meta: meta, D: d} dcID := d.Get("datacenter_id").(string) srvID := d.Get("server_id").(string) @@ -321,7 +321,7 @@ func resourceNicUpdate(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceNicDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient ns := cloudapinic.Service{Client: client, Meta: meta, D: d} dcid := d.Get("datacenter_id").(string) srvid := d.Get("server_id").(string) @@ -344,7 +344,7 @@ func resourceNicImport(ctx context.Context, d *schema.ResourceData, meta interfa sId := parts[1] nicId := parts[2] - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient nic, apiResponse, err := client.NetworkInterfacesApi.DatacentersServersNicsFindById(ctx, dcId, sId, nicId).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_nic_test.go b/ionoscloud/resource_nic_test.go index f9d29b312..99cab9185 100644 --- a/ionoscloud/resource_nic_test.go +++ b/ionoscloud/resource_nic_test.go @@ -132,7 +132,7 @@ func TestAccNicBasic(t *testing.T) { } func testAccCheckNicDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -165,7 +165,7 @@ func testAccCheckNicDestroyCheck(s *terraform.State) error { func testAccCheckNICExists(n string, nic *ionoscloud.Nic) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_nsg.go b/ionoscloud/resource_nsg.go index 357104acd..bd5051ad4 100644 --- a/ionoscloud/resource_nsg.go +++ b/ionoscloud/resource_nsg.go @@ -51,7 +51,7 @@ func resourceNSG() *schema.Resource { } func resourceNSGCreate(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterID := d.Get("datacenter_id").(string) sgName := d.Get("name").(string) @@ -78,7 +78,7 @@ func resourceNSGCreate(ctx context.Context, d *schema.ResourceData, meta any) di } func resourceNSGRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterID := d.Get("datacenter_id").(string) securityGroup, apiResponse, err := client.SecurityGroupsApi.DatacentersSecuritygroupsFindById(ctx, datacenterID, d.Id()).Depth(2).Execute() @@ -94,7 +94,7 @@ func resourceNSGRead(ctx context.Context, d *schema.ResourceData, meta interface } func resourceNSGUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterID := d.Get("datacenter_id").(string) sgName := d.Get("name").(string) @@ -122,7 +122,7 @@ func resourceNSGUpdate(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceNSGDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterID := d.Get("datacenter_id").(string) @@ -141,7 +141,7 @@ func resourceNSGDelete(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceNSGImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient parts := strings.Split(d.Id(), "/") diff --git a/ionoscloud/resource_nsg_firewallrule.go b/ionoscloud/resource_nsg_firewallrule.go index 7d73cd71b..b9e51def7 100644 --- a/ionoscloud/resource_nsg_firewallrule.go +++ b/ionoscloud/resource_nsg_firewallrule.go @@ -89,7 +89,7 @@ func resourceNSGFirewallRule() *schema.Resource { } func resourceNSGFirewallCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient firewall, diags := getFirewallData(d, "", false) if diags != nil { @@ -115,7 +115,7 @@ func resourceNSGFirewallCreate(ctx context.Context, d *schema.ResourceData, meta } func resourceNSGFirewallRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient fw, apiResponse, err := client.SecurityGroupsApi.DatacentersSecuritygroupsRulesFindById(ctx, d.Get("datacenter_id").(string), d.Get("nsg_id").(string), d.Id()).Execute() @@ -140,7 +140,7 @@ func resourceNSGFirewallRead(ctx context.Context, d *schema.ResourceData, meta i } func resourceNSGFirewallUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient firewall, diags := getFirewallData(d, "", true) if diags != nil { @@ -164,7 +164,7 @@ func resourceNSGFirewallUpdate(ctx context.Context, d *schema.ResourceData, meta } func resourceNSGFirewallDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcID := d.Get("datacenter_id").(string) nsgID := d.Get("nsg_id").(string) apiResponse, err := client.SecurityGroupsApi. @@ -189,7 +189,7 @@ func resourceNSGFirewallDelete(ctx context.Context, d *schema.ResourceData, meta func resourceNSGFirewallImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient parts := strings.Split(d.Id(), "/") if len(parts) != 3 || parts[0] == "" || parts[1] == "" || parts[2] == "" { diff --git a/ionoscloud/resource_nsg_test.go b/ionoscloud/resource_nsg_test.go index f3a676f4a..cdfade2cb 100644 --- a/ionoscloud/resource_nsg_test.go +++ b/ionoscloud/resource_nsg_test.go @@ -226,7 +226,7 @@ func TestAccNSGFirewallRules(t *testing.T) { } func testAccCheckNSGDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -255,7 +255,7 @@ func testAccCheckNSGDestroyCheck(s *terraform.State) error { func testAccCheckNSGExists(n string, nsg *ionoscloud.SecurityGroup) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] @@ -287,7 +287,7 @@ func testAccCheckNSGExists(n string, nsg *ionoscloud.SecurityGroup) resource.Tes } func testAccCheckNSGRuleDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -316,7 +316,7 @@ func testAccCheckNSGRuleDestroyCheck(s *terraform.State) error { func testAccCheckNSGFirewallRuleExists(n string, rule *ionoscloud.FirewallRule) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_private_crossconnect.go b/ionoscloud/resource_private_crossconnect.go index 307ae2da8..8c3053008 100644 --- a/ionoscloud/resource_private_crossconnect.go +++ b/ionoscloud/resource_private_crossconnect.go @@ -103,7 +103,7 @@ func resourcePrivateCrossConnect() *schema.Resource { } func resourcePrivateCrossConnectCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient name := d.Get("name").(string) pcc := ionoscloud.PrivateCrossConnect{ @@ -137,7 +137,7 @@ func resourcePrivateCrossConnectCreate(ctx context.Context, d *schema.ResourceDa } func resourcePrivateCrossConnectRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient pcc, apiResponse, err := client.PrivateCrossConnectsApi.PccsFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -160,7 +160,7 @@ func resourcePrivateCrossConnectRead(ctx context.Context, d *schema.ResourceData } func resourcePrivateCrossConnectUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.PrivateCrossConnect{} name := d.Get("name").(string) @@ -205,7 +205,7 @@ func resourcePrivateCrossConnectUpdate(ctx context.Context, d *schema.ResourceDa } func resourcePrivateCrossConnectDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient apiResponse, err := client.PrivateCrossConnectsApi.PccsDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -248,7 +248,7 @@ func resourcePrivateCrossConnectDelete(ctx context.Context, d *schema.ResourceDa } func resourcePrivateCrossConnectImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient pccId := d.Id() diff --git a/ionoscloud/resource_private_crossconnect_test.go b/ionoscloud/resource_private_crossconnect_test.go index 9cf6c7158..2de2b789d 100644 --- a/ionoscloud/resource_private_crossconnect_test.go +++ b/ionoscloud/resource_private_crossconnect_test.go @@ -73,7 +73,7 @@ func TestAccPrivateCrossConnectBasic(t *testing.T) { } func testAccCheckPrivateCrossConnectDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -102,7 +102,7 @@ func testAccCheckPrivateCrossConnectDestroyCheck(s *terraform.State) error { func testAccCheckPrivateCrossConnectExists(n string, privateCrossConnect *ionoscloud.PrivateCrossConnect) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) diff --git a/ionoscloud/resource_s3_key.go b/ionoscloud/resource_s3_key.go index 3e5455646..ac978d92a 100644 --- a/ionoscloud/resource_s3_key.go +++ b/ionoscloud/resource_s3_key.go @@ -50,7 +50,7 @@ func resourceS3Key() *schema.Resource { } func resourceS3KeyCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient userId := d.Get("user_id").(string) rsp, apiResponse, err := client.UserS3KeysApi.UmUsersS3keysPost(ctx, userId).Execute() @@ -94,7 +94,7 @@ func resourceS3KeyCreate(ctx context.Context, d *schema.ResourceData, meta inter } func resourceS3KeyRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient userId := d.Get("user_id").(string) @@ -124,7 +124,7 @@ func resourceS3KeyRead(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceS3KeyUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.S3Key{} request.Properties = &ionoscloud.S3KeyProperties{} @@ -157,7 +157,7 @@ func resourceS3KeyUpdate(ctx context.Context, d *schema.ResourceData, meta inter } func resourceS3KeyDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient userId := d.Get("user_id").(string) apiResponse, err := client.UserS3KeysApi.UmUsersS3keysDelete(ctx, userId, d.Id()).Execute() @@ -236,7 +236,7 @@ func resourceS3KeyImport(ctx context.Context, d *schema.ResourceData, meta inter userId := parts[0] keyId := parts[1] - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient s3Key, apiResponse, err := client.UserS3KeysApi.UmUsersS3keysFindByKeyId(ctx, userId, keyId).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_s3_key_test.go b/ionoscloud/resource_s3_key_test.go index d8d110c2b..55e5a5f30 100644 --- a/ionoscloud/resource_s3_key_test.go +++ b/ionoscloud/resource_s3_key_test.go @@ -58,7 +58,7 @@ func TestAccKeyBasic(t *testing.T) { func testAccChecksKeyDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient for _, rs := range s.RootModule().Resources { if rs.Type != constant.S3KeyResource { @@ -84,7 +84,7 @@ func testAccChecksKeyDestroyCheck(s *terraform.State) error { func testAccCheckKeyExists(n string, s3Key *ionoscloud.S3Key) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_server.go b/ionoscloud/resource_server.go index b01c529e0..499583023 100644 --- a/ionoscloud/resource_server.go +++ b/ionoscloud/resource_server.go @@ -535,7 +535,7 @@ func checkServerImmutableFields(_ context.Context, diff *schema.ResourceDiff, _ } func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient datacenterId := d.Get("datacenter_id").(string) serverReq, err := initializeCreateRequests(d) @@ -794,7 +794,7 @@ func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta inte } func resourceServerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) serverId := d.Id() @@ -852,7 +852,7 @@ func SetVolumeProperties(volume ionoscloud.Volume) map[string]interface{} { } func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient ss := cloudapiserver.Service{Client: client, Meta: meta, D: d} dcId := d.Get("datacenter_id").(string) @@ -919,7 +919,7 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte bootCdrom := n.(string) if utils.IsValidUUID(bootCdrom) { - ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} + ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} ss.UpdateBootDevice(ctx, dcId, d.Id(), bootCdrom) } } @@ -1213,7 +1213,7 @@ func deleteInlineVolumes(ctx context.Context, d *schema.ResourceData, meta inter } func resourceServerDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) // A bigger depth is required since we need all volumes items. server, apiResponse, err := client.ServersApi.DatacentersServersFindById(ctx, dcId, d.Id()).Depth(2).Execute() @@ -1258,7 +1258,7 @@ func resourceServerImport(ctx context.Context, d *schema.ResourceData, meta inte datacenterId := parts[0] serverId := parts[1] - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient server, apiResponse, err := client.ServersApi.DatacentersServersFindById(ctx, datacenterId, serverId).Depth(3).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_server_boot_device_selection.go b/ionoscloud/resource_server_boot_device_selection.go index 1f7fb0aab..e82f17e96 100644 --- a/ionoscloud/resource_server_boot_device_selection.go +++ b/ionoscloud/resource_server_boot_device_selection.go @@ -89,7 +89,7 @@ func resourceServerBootDeviceSelectionCreate(ctx context.Context, d *schema.Reso } func resourceServerBootDeviceSelectionRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} + ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} dcId := d.Get("datacenter_id").(string) serverId := d.Get("server_id").(string) @@ -133,7 +133,7 @@ func resourceServerBootDeviceSelectionUpdate(ctx context.Context, d *schema.Reso } func resourceServerBootDeviceSelectionDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} + ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} dcId := d.Get("datacenter_id").(string) serverId := d.Get("server_id").(string) diff --git a/ionoscloud/resource_server_test.go b/ionoscloud/resource_server_test.go index 0d6dba453..9d668306a 100644 --- a/ionoscloud/resource_server_test.go +++ b/ionoscloud/resource_server_test.go @@ -870,7 +870,7 @@ func TestAccServerBootDeviceSelection(t *testing.T) { } func testAccCheckServerDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -903,7 +903,7 @@ func testAccCheckServerDestroyCheck(s *terraform.State) error { func testAccCheckServerAndVolumesDestroyed(dcName string) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) defer cancel() @@ -946,7 +946,7 @@ func testAccCheckServerAndVolumesDestroyed(dcName string) resource.TestCheckFunc func testAccCheckServerExists(serverName string, server *ionoscloud.Server) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[serverName] diff --git a/ionoscloud/resource_share.go b/ionoscloud/resource_share.go index 78e7b7198..57a2d5397 100644 --- a/ionoscloud/resource_share.go +++ b/ionoscloud/resource_share.go @@ -51,7 +51,7 @@ func resourceShare() *schema.Resource { } func resourceShareCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.GroupShare{ Properties: &ionoscloud.GroupShareProperties{}, @@ -82,7 +82,7 @@ func resourceShareCreate(ctx context.Context, d *schema.ResourceData, meta inter } func resourceShareRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient rsp, apiResponse, err := client.UserManagementApi.UmGroupsSharesFindByResourceId(ctx, d.Get("group_id").(string), d.Get("resource_id").(string)).Execute() logApiRequestTime(apiResponse) @@ -107,7 +107,7 @@ func resourceShareRead(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceShareUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient tempSharePrivilege := d.Get("share_privilege").(bool) tempEditPrivilege := d.Get("edit_privilege").(bool) @@ -135,7 +135,7 @@ func resourceShareUpdate(ctx context.Context, d *schema.ResourceData, meta inter } func resourceShareDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient groupId := d.Get("group_id").(string) resourceId := d.Get("resource_id").(string) @@ -177,7 +177,7 @@ func resourceShareImporter(ctx context.Context, d *schema.ResourceData, meta int grpId := parts[0] rscId := parts[1] - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient share, apiResponse, err := client.UserManagementApi.UmGroupsSharesFindByResourceId(ctx, grpId, rscId).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_share_test.go b/ionoscloud/resource_share_test.go index d38866f22..1603bda11 100644 --- a/ionoscloud/resource_share_test.go +++ b/ionoscloud/resource_share_test.go @@ -57,7 +57,7 @@ func TestAccShareBasic(t *testing.T) { } func testAccCheckShareDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) @@ -91,7 +91,7 @@ func testAccCheckShareDestroyCheck(s *terraform.State) error { func testAccCheckShareExists(n string, share *ionoscloud.GroupShare) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_snapshot.go b/ionoscloud/resource_snapshot.go index 425082f68..024dfa84e 100644 --- a/ionoscloud/resource_snapshot.go +++ b/ionoscloud/resource_snapshot.go @@ -122,7 +122,7 @@ func resourceSnapshot() *schema.Resource { } func resourceSnapshotCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) volumeId := d.Get("volume_id").(string) @@ -159,7 +159,7 @@ func resourceSnapshotCreate(ctx context.Context, d *schema.ResourceData, meta in } func resourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient snapshot, apiResponse, err := client.SnapshotsApi.SnapshotsFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -181,7 +181,7 @@ func resourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta inte } func resourceSnapshotUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient name := d.Get("name").(string) input := ionoscloud.NewSnapshotProperties() @@ -229,7 +229,7 @@ func resourceSnapshotUpdate(ctx context.Context, d *schema.ResourceData, meta in } func resourceSnapshotDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient apiResponse, err := client.SnapshotsApi.SnapshotsDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -247,7 +247,7 @@ func resourceSnapshotDelete(ctx context.Context, d *schema.ResourceData, meta in } func resourceSnapshotImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient snapshotId := d.Id() snapshot, apiResponse, err := client.SnapshotsApi.SnapshotsFindById(ctx, d.Id()).Execute() diff --git a/ionoscloud/resource_snapshot_test.go b/ionoscloud/resource_snapshot_test.go index 9f1661c7a..399185ccd 100644 --- a/ionoscloud/resource_snapshot_test.go +++ b/ionoscloud/resource_snapshot_test.go @@ -131,7 +131,7 @@ func TestAccSnapshotBasic(t *testing.T) { } func testAccCheckSnapshotDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -160,7 +160,7 @@ func testAccCheckSnapshotDestroyCheck(s *terraform.State) error { func testAccCheckSnapshotExists(n string, snapshot *ionoscloud.Snapshot) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_target_group.go b/ionoscloud/resource_target_group.go index 35e18f6e6..35043cba5 100644 --- a/ionoscloud/resource_target_group.go +++ b/ionoscloud/resource_target_group.go @@ -171,7 +171,7 @@ func resourceTargetGroup() *schema.Resource { } func resourceTargetGroupCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient targetGroup := ionoscloud.TargetGroup{ Properties: &ionoscloud.TargetGroupProperties{}, @@ -227,7 +227,7 @@ func resourceTargetGroupCreate(ctx context.Context, d *schema.ResourceData, meta } func resourceTargetGroupRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient rsp, apiResponse, err := client.TargetGroupsApi.TargetgroupsFindByTargetGroupId(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -249,7 +249,7 @@ func resourceTargetGroupRead(ctx context.Context, d *schema.ResourceData, meta i } func resourceTargetGroupUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient targetGroup := ionoscloud.TargetGroupPut{ Properties: &ionoscloud.TargetGroupProperties{}, @@ -303,7 +303,7 @@ func resourceTargetGroupUpdate(ctx context.Context, d *schema.ResourceData, meta } func resourceTargetGroupDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient apiResponse, err := client.TargetGroupsApi.TargetGroupsDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -323,7 +323,7 @@ func resourceTargetGroupDelete(ctx context.Context, d *schema.ResourceData, meta } func resourceTargetGroupImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient groupIp := d.Id() diff --git a/ionoscloud/resource_target_group_test.go b/ionoscloud/resource_target_group_test.go index f6fcaeea0..a70423495 100644 --- a/ionoscloud/resource_target_group_test.go +++ b/ionoscloud/resource_target_group_test.go @@ -195,7 +195,7 @@ func TestAccTargetGroupBasic(t *testing.T) { } func testAccCheckTargetGroupDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) @@ -225,7 +225,7 @@ func testAccCheckTargetGroupDestroyCheck(s *terraform.State) error { func testAccCheckTargetGroupExists(n string, targetGroup *ionoscloud.TargetGroup) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_user.go b/ionoscloud/resource_user.go index ae6b648b6..7c0cd9b69 100644 --- a/ionoscloud/resource_user.go +++ b/ionoscloud/resource_user.go @@ -88,7 +88,7 @@ func resourceUser() *schema.Resource { } func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient request := ionoscloud.UserPost{ Properties: &ionoscloud.UserPropertiesPost{}, } @@ -161,7 +161,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf } func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient user, apiResponse, err := client.UserManagementApi.UmUsersFindById(ctx, d.Id()).Depth(1).Execute() logApiRequestTime(apiResponse) @@ -187,7 +187,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac } func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient foundUser, apiResponse, err := client.UserManagementApi.UmUsersFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -288,7 +288,7 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf } func resourceUserDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient apiResponse, err := client.UserManagementApi.UmUsersDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -307,7 +307,7 @@ func resourceUserDelete(ctx context.Context, d *schema.ResourceData, meta interf } func resourceUserImporter(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient userId := d.Id() diff --git a/ionoscloud/resource_user_test.go b/ionoscloud/resource_user_test.go index b7cf1f8c5..5cb599eb0 100644 --- a/ionoscloud/resource_user_test.go +++ b/ionoscloud/resource_user_test.go @@ -136,7 +136,7 @@ func TestAccUserBasic(t *testing.T) { } func testAccCheckUserDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -164,7 +164,7 @@ func testAccCheckUserDestroyCheck(s *terraform.State) error { func testAccCheckUserExists(n string, user *ionoscloud.User) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] if !ok { @@ -199,7 +199,7 @@ func testAccCheckUserExists(n string, user *ionoscloud.User) resource.TestCheckF func testAccRemoveUserFromGroup(group, user string) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient gr, ok := s.RootModule().Resources[group] if !ok { return fmt.Errorf("testAccRemoveUserFromGroup: group not found: %s", group) diff --git a/ionoscloud/resource_vcpu_server_test.go b/ionoscloud/resource_vcpu_server_test.go index 2121836b6..11d03ad52 100644 --- a/ionoscloud/resource_vcpu_server_test.go +++ b/ionoscloud/resource_vcpu_server_test.go @@ -758,7 +758,7 @@ func TestAccServerVCPUWithLabels(t *testing.T) { } func testAccCheckServerVCPUDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -791,7 +791,7 @@ func testAccCheckServerVCPUDestroyCheck(s *terraform.State) error { func testAccCheckServerVCPUAndVolumesDestroyed(dcName string) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) defer cancel() @@ -834,7 +834,7 @@ func testAccCheckServerVCPUAndVolumesDestroyed(dcName string) resource.TestCheck func testAccCheckServerVCPUExists(serverName string, server *ionoscloud.Server) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[serverName] diff --git a/ionoscloud/resource_volume.go b/ionoscloud/resource_volume.go index 7beea5088..94a2f5577 100644 --- a/ionoscloud/resource_volume.go +++ b/ionoscloud/resource_volume.go @@ -196,7 +196,7 @@ func checkVolumeImmutableFields(_ context.Context, diff *schema.ResourceDiff, _ func resourceVolumeCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient var image, imageAlias string @@ -300,7 +300,7 @@ func resourceVolumeCreate(ctx context.Context, d *schema.ResourceData, meta inte } func resourceVolumeRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) serverID := d.Get("server_id").(string) @@ -335,7 +335,7 @@ func resourceVolumeRead(ctx context.Context, d *schema.ResourceData, meta interf } func resourceVolumeUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient properties := ionoscloud.VolumeProperties{} dcId := d.Get("datacenter_id").(string) @@ -397,7 +397,7 @@ func resourceVolumeUpdate(ctx context.Context, d *schema.ResourceData, meta inte } func resourceVolumeDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := d.Get("datacenter_id").(string) @@ -423,7 +423,7 @@ func resourceVolumeImporter(ctx context.Context, d *schema.ResourceData, meta in return nil, fmt.Errorf("invalid import id %q. Expecting {datacenter}/{server}/{volume}", d.Id()) } - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient dcId := parts[0] srvId := parts[1] diff --git a/ionoscloud/resource_volume_test.go b/ionoscloud/resource_volume_test.go index 4efc42e04..8d95dd07b 100644 --- a/ionoscloud/resource_volume_test.go +++ b/ionoscloud/resource_volume_test.go @@ -167,7 +167,7 @@ func TestAccVolumeResolveImageName(t *testing.T) { } func testAccCheckVolumeDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) @@ -197,7 +197,7 @@ func testAccCheckVolumeDestroyCheck(s *terraform.State) error { func testAccCheckVolumeExists(n string, volume *ionoscloud.Volume) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient + client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/testUtil.go b/ionoscloud/testUtil.go index f82958c85..6ab1ecfa0 100644 --- a/ionoscloud/testUtil.go +++ b/ionoscloud/testUtil.go @@ -35,7 +35,7 @@ func getMockedClient(jsonResponse string) interface{} { cfg.HTTPClient = ts.Client() return services.SdkBundle{ - CloudApiClient: ionoscloud.NewAPIClient(cfg), + CloudAPIClient: ionoscloud.NewAPIClient(cfg), } } diff --git a/services/clients.go b/services/clients.go index cf0db1e7a..a2075ceab 100644 --- a/services/clients.go +++ b/services/clients.go @@ -22,7 +22,7 @@ import ( ) type SdkBundle struct { - CloudApiClient *ionoscloud.APIClient + CloudAPIClient *ionoscloud.APIClient InMemoryDBClient *inmemorydb.InMemoryDBClient PsqlClient *dbaas.PsqlClient MongoClient *dbaas.MongoClient diff --git a/services/cloudapi/cloudapiserver/server.go b/services/cloudapi/cloudapiserver/server.go index ffcd4442d..3729c2a3f 100644 --- a/services/cloudapi/cloudapiserver/server.go +++ b/services/cloudapi/cloudapiserver/server.go @@ -50,7 +50,7 @@ type Service struct { // The concrete Service is created with a dummy ResourceData reference which has the ID of the Server this service will interact with // This ensure state tracking functions such as WaitForResourceToBeReady use the correct ID func NewUnboundService(serverID string, meta any) UnboundService { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient d := &schema.ResourceData{} d.SetId(serverID) return &Service{client, meta, d} diff --git a/services/cloudapi/state.go b/services/cloudapi/state.go index 1d704a492..cbb6242d6 100644 --- a/services/cloudapi/state.go +++ b/services/cloudapi/state.go @@ -34,7 +34,7 @@ func GetStateChangeConf(meta interface{}, d *schema.ResourceData, location strin // resourceStateRefreshFunc tracks progress of a request func resourceStateRefreshFunc(meta interface{}, path string) retry.StateRefreshFunc { return func() (interface{}, string, error) { - client := meta.(services.SdkBundle).CloudApiClient + client := meta.(services.SdkBundle).CloudAPIClient log.Printf("[INFO] Checking PATH %s\n", path) if path == "" { From 7a384ecf57de9bbb24d7225329a00f57ed2a92b0 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Thu, 21 Nov 2024 17:20:15 +0200 Subject: [PATCH 25/30] chore: linter error --- ionoscloud/resource_server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ionoscloud/resource_server.go b/ionoscloud/resource_server.go index 499583023..b026f737b 100644 --- a/ionoscloud/resource_server.go +++ b/ionoscloud/resource_server.go @@ -1196,11 +1196,11 @@ func deleteInlineVolumes(ctx context.Context, d *schema.ResourceData, meta inter dcId := d.Get("datacenter_id").(string) volumeIds := d.Get("inline_volume_ids").([]interface{}) - for _, volumeId := range volumeIds { - apiResponse, err := client.VolumesApi.DatacentersVolumesDelete(ctx, dcId, volumeId.(string)).Execute() + for _, volumeID := range volumeIds { + apiResponse, err := client.VolumesApi.DatacentersVolumesDelete(ctx, dcId, volumeID.(string)).Execute() logApiRequestTime(apiResponse) if err != nil { - diags := diag.FromErr(fmt.Errorf("error occurred while deleting volume with ID: %s of server ID %s %w", volumeId.(string), d.Id(), err)) + diags := diag.FromErr(fmt.Errorf("error occurred while deleting volume with ID: %s of server ID %s %w", volumeID.(string), d.Id(), err)) return diags } From 2e2badecb30acca0100851c5c897c029663ba56f Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Thu, 21 Nov 2024 17:25:35 +0200 Subject: [PATCH 26/30] chore: undo linter changes --- internal/framework/provider/provider.go | 2 +- .../data_source_application_loadbalancer.go | 2 +- ..._application_loadbalancer_forwardingrule.go | 2 +- ionoscloud/data_source_backup_unit.go | 2 +- ionoscloud/data_source_cube_server.go | 2 +- ionoscloud/data_source_datacenter.go | 2 +- ionoscloud/data_source_firewall.go | 2 +- ionoscloud/data_source_group.go | 2 +- ionoscloud/data_source_image.go | 2 +- ionoscloud/data_source_ipblock.go | 2 +- ionoscloud/data_source_ipfailover.go | 2 +- ionoscloud/data_source_k8s_cluster.go | 2 +- ionoscloud/data_source_k8s_clusters.go | 2 +- ionoscloud/data_source_k8s_node_pool.go | 2 +- ionoscloud/data_source_k8s_node_pool_nodes.go | 2 +- ionoscloud/data_source_lan.go | 2 +- ionoscloud/data_source_location.go | 2 +- ionoscloud/data_source_natgateway.go | 2 +- ionoscloud/data_source_natgateway_rule.go | 2 +- ionoscloud/data_source_networkloadbalancer.go | 2 +- ...ource_networkloadbalancer_forwardingrule.go | 2 +- ionoscloud/data_source_nic.go | 2 +- ionoscloud/data_source_nsg.go | 2 +- ionoscloud/data_source_private_crossconnect.go | 2 +- ionoscloud/data_source_resource.go | 2 +- ionoscloud/data_source_server.go | 2 +- ionoscloud/data_source_servers.go | 2 +- ionoscloud/data_source_servers_test.go | 2 +- ionoscloud/data_source_snapshot.go | 2 +- ionoscloud/data_source_target_group.go | 2 +- ionoscloud/data_source_template.go | 2 +- ionoscloud/data_source_user.go | 2 +- ionoscloud/data_source_volume.go | 2 +- ionoscloud/provider.go | 2 +- .../resource_application_loadbalancer.go | 10 +++++----- ..._application_loadbalancer_forwardingrule.go | 10 +++++----- ...ication_loadbalancer_forwardingrule_test.go | 4 ++-- .../resource_application_loadbalancer_test.go | 4 ++-- ionoscloud/resource_backup_unit.go | 10 +++++----- ionoscloud/resource_backup_unit_test.go | 4 ++-- ionoscloud/resource_cube_server.go | 12 ++++++------ ionoscloud/resource_cube_server_test.go | 4 ++-- ionoscloud/resource_datacenter.go | 10 +++++----- .../resource_datacenter_nsg_selection.go | 8 ++++---- ionoscloud/resource_datacenter_test.go | 4 ++-- ionoscloud/resource_firewall.go | 10 +++++----- ionoscloud/resource_firewall_test.go | 4 ++-- ionoscloud/resource_group.go | 14 +++++++------- ionoscloud/resource_group_test.go | 4 ++-- ionoscloud/resource_ipblock.go | 10 +++++----- ionoscloud/resource_ipblock_test.go | 4 ++-- ionoscloud/resource_ipfailover.go | 10 +++++----- ionoscloud/resource_ipfailover_test.go | 4 ++-- ionoscloud/resource_k8s_cluster.go | 10 +++++----- ionoscloud/resource_k8s_cluster_test.go | 4 ++-- ionoscloud/resource_k8s_node_pool.go | 10 +++++----- ionoscloud/resource_k8s_node_pool_test.go | 4 ++-- ionoscloud/resource_lan.go | 10 +++++----- ionoscloud/resource_lan_test.go | 4 ++-- ionoscloud/resource_loadbalancer.go | 10 +++++----- ionoscloud/resource_loadbalancer_test.go | 4 ++-- ionoscloud/resource_natgateway.go | 10 +++++----- ionoscloud/resource_natgateway_rule.go | 10 +++++----- ionoscloud/resource_natgateway_rule_test.go | 4 ++-- ionoscloud/resource_natgateway_test.go | 4 ++-- ionoscloud/resource_networkloadbalancer.go | 10 +++++----- ...ource_networkloadbalancer_forwardingrule.go | 10 +++++----- ..._networkloadbalancer_forwardingrule_test.go | 4 ++-- .../resource_networkloadbalancer_test.go | 4 ++-- ionoscloud/resource_nic.go | 10 +++++----- ionoscloud/resource_nic_test.go | 4 ++-- ionoscloud/resource_nsg.go | 10 +++++----- ionoscloud/resource_nsg_firewallrule.go | 10 +++++----- ionoscloud/resource_nsg_test.go | 8 ++++---- ionoscloud/resource_private_crossconnect.go | 10 +++++----- .../resource_private_crossconnect_test.go | 4 ++-- ionoscloud/resource_s3_key.go | 10 +++++----- ionoscloud/resource_s3_key_test.go | 4 ++-- ionoscloud/resource_server.go | 18 +++++++++--------- .../resource_server_boot_device_selection.go | 4 ++-- ionoscloud/resource_server_test.go | 6 +++--- ionoscloud/resource_share.go | 10 +++++----- ionoscloud/resource_share_test.go | 4 ++-- ionoscloud/resource_snapshot.go | 10 +++++----- ionoscloud/resource_snapshot_test.go | 4 ++-- ionoscloud/resource_target_group.go | 10 +++++----- ionoscloud/resource_target_group_test.go | 4 ++-- ionoscloud/resource_user.go | 10 +++++----- ionoscloud/resource_user_test.go | 6 +++--- ionoscloud/resource_vcpu_server_test.go | 6 +++--- ionoscloud/resource_volume.go | 10 +++++----- ionoscloud/resource_volume_test.go | 4 ++-- ionoscloud/testUtil.go | 2 +- services/clients.go | 2 +- services/cloudapi/cloudapiserver/server.go | 2 +- services/cloudapi/state.go | 2 +- 96 files changed, 252 insertions(+), 252 deletions(-) diff --git a/internal/framework/provider/provider.go b/internal/framework/provider/provider.go index ac8a42576..d058b8a3d 100644 --- a/internal/framework/provider/provider.go +++ b/internal/framework/provider/provider.go @@ -214,7 +214,7 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu 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), + 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), diff --git a/ionoscloud/data_source_application_loadbalancer.go b/ionoscloud/data_source_application_loadbalancer.go index 01d1b1af3..c32d184b6 100644 --- a/ionoscloud/data_source_application_loadbalancer.go +++ b/ionoscloud/data_source_application_loadbalancer.go @@ -89,7 +89,7 @@ and log the extent to which your instances are being accessed.`, } func dataSourceApplicationLoadBalancerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterId := d.Get("datacenter_id").(string) diff --git a/ionoscloud/data_source_application_loadbalancer_forwardingrule.go b/ionoscloud/data_source_application_loadbalancer_forwardingrule.go index ab7c2cf17..83a401131 100644 --- a/ionoscloud/data_source_application_loadbalancer_forwardingrule.go +++ b/ionoscloud/data_source_application_loadbalancer_forwardingrule.go @@ -161,7 +161,7 @@ func dataSourceApplicationLoadBalancerForwardingRule() *schema.Resource { } func dataSourceApplicationLoadBalancerForwardingRuleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterId := d.Get("datacenter_id").(string) albId := d.Get("application_loadbalancer_id").(string) diff --git a/ionoscloud/data_source_backup_unit.go b/ionoscloud/data_source_backup_unit.go index 1ae68340e..c2fd73f12 100644 --- a/ionoscloud/data_source_backup_unit.go +++ b/ionoscloud/data_source_backup_unit.go @@ -42,7 +42,7 @@ func dataSourceBackupUnit() *schema.Resource { } func dataSourceBackupUnitRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient id, idOk := d.GetOk("id") name, nameOk := d.GetOk("name") diff --git a/ionoscloud/data_source_cube_server.go b/ionoscloud/data_source_cube_server.go index 9ef359281..cbe4e0a8f 100644 --- a/ionoscloud/data_source_cube_server.go +++ b/ionoscloud/data_source_cube_server.go @@ -359,7 +359,7 @@ func setCubeServerData(d *schema.ResourceData, server *ionoscloud.Server, token } func dataSourceCubeServerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_datacenter.go b/ionoscloud/data_source_datacenter.go index 64b631bbc..6a1776f42 100644 --- a/ionoscloud/data_source_datacenter.go +++ b/ionoscloud/data_source_datacenter.go @@ -82,7 +82,7 @@ func dataSourceDataCenter() *schema.Resource { } func dataSourceDataCenterRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient var name, location string id, idOk := d.GetOk("id") diff --git a/ionoscloud/data_source_firewall.go b/ionoscloud/data_source_firewall.go index 3a1927b5f..2d9a051dd 100644 --- a/ionoscloud/data_source_firewall.go +++ b/ionoscloud/data_source_firewall.go @@ -81,7 +81,7 @@ func dataSourceFirewall() *schema.Resource { } func dataSourceFirewallRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterId := d.Get("datacenter_id").(string) serverId := d.Get("server_id").(string) diff --git a/ionoscloud/data_source_group.go b/ionoscloud/data_source_group.go index 27c2e07a3..7f020b306 100644 --- a/ionoscloud/data_source_group.go +++ b/ionoscloud/data_source_group.go @@ -119,7 +119,7 @@ func dataSourceGroup() *schema.Resource { } func dataSourceGroupRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient id, idOk := d.GetOk("id") name, nameOk := d.GetOk("name") diff --git a/ionoscloud/data_source_image.go b/ionoscloud/data_source_image.go index 43dfef230..c4a6e69b5 100644 --- a/ionoscloud/data_source_image.go +++ b/ionoscloud/data_source_image.go @@ -111,7 +111,7 @@ func dataSourceImage() *schema.Resource { } func dataSourceImageRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient images, apiResponse, err := client.ImagesApi.ImagesGet(ctx).Depth(1).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/data_source_ipblock.go b/ionoscloud/data_source_ipblock.go index 8a8e87405..4adb42c0c 100644 --- a/ionoscloud/data_source_ipblock.go +++ b/ionoscloud/data_source_ipblock.go @@ -109,7 +109,7 @@ func datasourceIpBlockRead(ctx context.Context, data *schema.ResourceData, meta } var ipBlock ionoscloud.IpBlock var err error - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient var apiResponse *ionoscloud.APIResponse if !idOk && !nameOk && !locationOk { diff --git a/ionoscloud/data_source_ipfailover.go b/ionoscloud/data_source_ipfailover.go index 4aa890419..2eb1ff5e3 100644 --- a/ionoscloud/data_source_ipfailover.go +++ b/ionoscloud/data_source_ipfailover.go @@ -47,7 +47,7 @@ func dataSourceIpFailover() *schema.Resource { } func dataSourceIpFailoverRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) lanId := d.Get("lan_id").(string) ip := d.Get("ip").(string) diff --git a/ionoscloud/data_source_k8s_cluster.go b/ionoscloud/data_source_k8s_cluster.go index e7fe563bc..5902284e0 100644 --- a/ionoscloud/data_source_k8s_cluster.go +++ b/ionoscloud/data_source_k8s_cluster.go @@ -266,7 +266,7 @@ func dataSourceK8sCluster() *schema.Resource { } func dataSourceK8sReadCluster(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient id, idOk := d.GetOk("id") name, nameOk := d.GetOk("name") diff --git a/ionoscloud/data_source_k8s_clusters.go b/ionoscloud/data_source_k8s_clusters.go index bfc938336..9a222bfe0 100644 --- a/ionoscloud/data_source_k8s_clusters.go +++ b/ionoscloud/data_source_k8s_clusters.go @@ -43,7 +43,7 @@ func dataSourceK8sReadClusters(ctx context.Context, d *schema.ResourceData, meta "k8s_version": "k8sVersion", } - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient req := client.KubernetesApi.K8sGet(ctx).Depth(1) filters, filtersOk := d.GetOk("filter") diff --git a/ionoscloud/data_source_k8s_node_pool.go b/ionoscloud/data_source_k8s_node_pool.go index f5640248e..6f787afdd 100644 --- a/ionoscloud/data_source_k8s_node_pool.go +++ b/ionoscloud/data_source_k8s_node_pool.go @@ -193,7 +193,7 @@ func dataSourceK8sNodePool() *schema.Resource { } func dataSourceK8sReadNodePool(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient clusterId := d.Get("k8s_cluster_id") id, idOk := d.GetOk("id") diff --git a/ionoscloud/data_source_k8s_node_pool_nodes.go b/ionoscloud/data_source_k8s_node_pool_nodes.go index 6d8af2ecd..a860e5563 100644 --- a/ionoscloud/data_source_k8s_node_pool_nodes.go +++ b/ionoscloud/data_source_k8s_node_pool_nodes.go @@ -68,7 +68,7 @@ func dataSourceK8sNodePoolNodes() *schema.Resource { } func dataSourceK8sReadNodePoolNodes(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient clusterId := d.Get("k8s_cluster_id") nodePoolId := d.Get("node_pool_id") nodePoolIdStr := nodePoolId.(string) diff --git a/ionoscloud/data_source_lan.go b/ionoscloud/data_source_lan.go index 1c4603404..95ef8cafc 100644 --- a/ionoscloud/data_source_lan.go +++ b/ionoscloud/data_source_lan.go @@ -82,7 +82,7 @@ func convertIpFailoverList(ips *[]ionoscloud.IPFailover) []interface{} { } func dataSourceLanRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_location.go b/ionoscloud/data_source_location.go index 40a4d25e9..6ec2c06b5 100644 --- a/ionoscloud/data_source_location.go +++ b/ionoscloud/data_source_location.go @@ -61,7 +61,7 @@ func dataSourceLocation() *schema.Resource { } func dataSourceLocationRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient name, nameOk := d.GetOk("name") feature, featureOk := d.GetOk("feature") diff --git a/ionoscloud/data_source_natgateway.go b/ionoscloud/data_source_natgateway.go index 7cfecb533..e377eebf0 100644 --- a/ionoscloud/data_source_natgateway.go +++ b/ionoscloud/data_source_natgateway.go @@ -69,7 +69,7 @@ func dataSourceNatGateway() *schema.Resource { } func dataSourceNatGatewayRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_natgateway_rule.go b/ionoscloud/data_source_natgateway_rule.go index b137f24a3..8c1fe5d1c 100644 --- a/ionoscloud/data_source_natgateway_rule.go +++ b/ionoscloud/data_source_natgateway_rule.go @@ -93,7 +93,7 @@ func dataSourceNatGatewayRule() *schema.Resource { } func dataSourceNatGatewayRuleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_networkloadbalancer.go b/ionoscloud/data_source_networkloadbalancer.go index 28dc362ad..41f45a637 100644 --- a/ionoscloud/data_source_networkloadbalancer.go +++ b/ionoscloud/data_source_networkloadbalancer.go @@ -86,7 +86,7 @@ and log the extent to which your instances are being accessed.`, } func dataSourceNetworkLoadBalancerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_networkloadbalancer_forwardingrule.go b/ionoscloud/data_source_networkloadbalancer_forwardingrule.go index e95986fee..dc8e0cb1e 100644 --- a/ionoscloud/data_source_networkloadbalancer_forwardingrule.go +++ b/ionoscloud/data_source_networkloadbalancer_forwardingrule.go @@ -152,7 +152,7 @@ func dataSourceNetworkLoadBalancerForwardingRule() *schema.Resource { } func dataSourceNetworkLoadBalancerForwardingRuleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_nic.go b/ionoscloud/data_source_nic.go index 8844f8123..44465c31e 100644 --- a/ionoscloud/data_source_nic.go +++ b/ionoscloud/data_source_nic.go @@ -179,7 +179,7 @@ func getNicDataSourceSchema() map[string]*schema.Schema { } } func dataSourceNicRead(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient t, dIdOk := data.GetOk("datacenter_id") st, sIdOk := data.GetOk("server_id") diff --git a/ionoscloud/data_source_nsg.go b/ionoscloud/data_source_nsg.go index 5fcbc4712..d3099a002 100644 --- a/ionoscloud/data_source_nsg.go +++ b/ionoscloud/data_source_nsg.go @@ -102,7 +102,7 @@ func dataSourceNSG() *schema.Resource { } func dataSourceNSGRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterID := d.Get("datacenter_id").(string) id, idOk := d.GetOk("id") diff --git a/ionoscloud/data_source_private_crossconnect.go b/ionoscloud/data_source_private_crossconnect.go index 6684d4482..8a046e476 100644 --- a/ionoscloud/data_source_private_crossconnect.go +++ b/ionoscloud/data_source_private_crossconnect.go @@ -158,7 +158,7 @@ func setPccDataSource(d *schema.ResourceData, pcc *ionoscloud.PrivateCrossConnec } func dataSourcePccRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient id, idOk := d.GetOk("id") name, nameOk := d.GetOk("name") diff --git a/ionoscloud/data_source_resource.go b/ionoscloud/data_source_resource.go index 7e0e338f7..0800b0275 100644 --- a/ionoscloud/data_source_resource.go +++ b/ionoscloud/data_source_resource.go @@ -29,7 +29,7 @@ func dataSourceResource() *schema.Resource { } func dataSourceResourceRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient var results []ionoscloud.Resource diff --git a/ionoscloud/data_source_server.go b/ionoscloud/data_source_server.go index 06ef22824..8b9f0b90a 100644 --- a/ionoscloud/data_source_server.go +++ b/ionoscloud/data_source_server.go @@ -455,7 +455,7 @@ func setServerData(d *schema.ResourceData, server *ionoscloud.Server, token *ion } func dataSourceServerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_servers.go b/ionoscloud/data_source_servers.go index 6b3d49275..fa96b4776 100644 --- a/ionoscloud/data_source_servers.go +++ b/ionoscloud/data_source_servers.go @@ -231,7 +231,7 @@ func dataSourceFiltersSchema() *schema.Schema { } func dataSourceServersRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/data_source_servers_test.go b/ionoscloud/data_source_servers_test.go index 9ce5b83f7..1cccacbc9 100644 --- a/ionoscloud/data_source_servers_test.go +++ b/ionoscloud/data_source_servers_test.go @@ -105,7 +105,7 @@ func TestAccDataSourceServersBasic(t *testing.T) { } func testAccCheckServersDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) diff --git a/ionoscloud/data_source_snapshot.go b/ionoscloud/data_source_snapshot.go index 11304395d..9b5328ce4 100644 --- a/ionoscloud/data_source_snapshot.go +++ b/ionoscloud/data_source_snapshot.go @@ -99,7 +99,7 @@ func dataSourceSnapshot() *schema.Resource { } func dataSourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient id, idOk := d.GetOk("id") name, nameOk := d.GetOk("name") diff --git a/ionoscloud/data_source_target_group.go b/ionoscloud/data_source_target_group.go index 6effda64c..e166d8817 100644 --- a/ionoscloud/data_source_target_group.go +++ b/ionoscloud/data_source_target_group.go @@ -154,7 +154,7 @@ func dataSourceTargetGroup() *schema.Resource { } func dataSourceTargetGroupRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient idValue, idOk := d.GetOk("id") nameValue, nameOk := d.GetOk("name") diff --git a/ionoscloud/data_source_template.go b/ionoscloud/data_source_template.go index 3de9cefd9..f49ed54d2 100644 --- a/ionoscloud/data_source_template.go +++ b/ionoscloud/data_source_template.go @@ -46,7 +46,7 @@ func dataSourceTemplate() *schema.Resource { } func dataSourceTemplateRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient templates, apiResponse, err := client.TemplatesApi.TemplatesGet(ctx).Depth(1).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/data_source_user.go b/ionoscloud/data_source_user.go index 7492fcc36..893558048 100644 --- a/ionoscloud/data_source_user.go +++ b/ionoscloud/data_source_user.go @@ -77,7 +77,7 @@ func dataSourceUser() *schema.Resource { } func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient idValue, idOk := d.GetOk("id") emailValue, emailOk := d.GetOk("email") diff --git a/ionoscloud/data_source_volume.go b/ionoscloud/data_source_volume.go index 28c48952f..beb72a077 100644 --- a/ionoscloud/data_source_volume.go +++ b/ionoscloud/data_source_volume.go @@ -107,7 +107,7 @@ func dataSourceVolume() *schema.Resource { } func dataSourceVolumeRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterId, dcIdOk := d.GetOk("datacenter_id") if !dcIdOk { diff --git a/ionoscloud/provider.go b/ionoscloud/provider.go index 53898a027..0c9394315 100644 --- a/ionoscloud/provider.go +++ b/ionoscloud/provider.go @@ -325,7 +325,7 @@ func NewSDKBundleClient(clientOpts ClientOptions) interface{} { CDNClient: NewClientByType(clientOpts, cdnClient).(*cdnService.Client), AutoscalingClient: NewClientByType(clientOpts, autoscalingClient).(*autoscalingService.Client), CertManagerClient: NewClientByType(clientOpts, certManagerClient).(*cert.Client), - CloudAPIClient: NewClientByType(clientOpts, ionosClient).(*ionoscloud.APIClient), + CloudApiClient: NewClientByType(clientOpts, ionosClient).(*ionoscloud.APIClient), ContainerClient: NewClientByType(clientOpts, containerRegistryClient).(*crService.Client), DataplatformClient: NewClientByType(clientOpts, dataplatformClient).(*dataplatformService.Client), DNSClient: NewClientByType(clientOpts, dnsClient).(*dnsService.Client), diff --git a/ionoscloud/resource_application_loadbalancer.go b/ionoscloud/resource_application_loadbalancer.go index 3454ee53f..ea8cdd185 100644 --- a/ionoscloud/resource_application_loadbalancer.go +++ b/ionoscloud/resource_application_loadbalancer.go @@ -92,7 +92,7 @@ and log the extent to which your instances are being accessed.`, } func resourceApplicationLoadBalancerCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient applicationLoadBalancer := ionoscloud.ApplicationLoadBalancer{ Properties: &ionoscloud.ApplicationLoadBalancerProperties{}, @@ -207,7 +207,7 @@ func resourceApplicationLoadBalancerCreate(ctx context.Context, d *schema.Resour } func resourceApplicationLoadBalancerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) @@ -240,7 +240,7 @@ func resourceApplicationLoadBalancerRead(ctx context.Context, d *schema.Resource } func resourceApplicationLoadBalancerUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.ApplicationLoadBalancer{ Properties: &ionoscloud.ApplicationLoadBalancerProperties{}, @@ -347,7 +347,7 @@ func resourceApplicationLoadBalancerUpdate(ctx context.Context, d *schema.Resour } func resourceApplicationLoadBalancerDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) @@ -369,7 +369,7 @@ func resourceApplicationLoadBalancerDelete(ctx context.Context, d *schema.Resour } func resourceApplicationLoadBalancerImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient parts := strings.Split(d.Id(), "/") diff --git a/ionoscloud/resource_application_loadbalancer_forwardingrule.go b/ionoscloud/resource_application_loadbalancer_forwardingrule.go index 79d60c9fe..cba20a2fb 100644 --- a/ionoscloud/resource_application_loadbalancer_forwardingrule.go +++ b/ionoscloud/resource_application_loadbalancer_forwardingrule.go @@ -177,7 +177,7 @@ func resourceApplicationLoadBalancerForwardingRule() *schema.Resource { } func resourceApplicationLoadBalancerForwardingRuleCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient applicationLoadBalancerForwardingRule := ionoscloud.ApplicationLoadBalancerForwardingRule{ Properties: &ionoscloud.ApplicationLoadBalancerForwardingRuleProperties{}, @@ -255,7 +255,7 @@ func resourceApplicationLoadBalancerForwardingRuleCreate(ctx context.Context, d func resourceApplicationLoadBalancerForwardingRuleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) @@ -280,7 +280,7 @@ func resourceApplicationLoadBalancerForwardingRuleRead(ctx context.Context, d *s } func resourceApplicationLoadBalancerForwardingRuleUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.ApplicationLoadBalancerForwardingRule{ Properties: &ionoscloud.ApplicationLoadBalancerForwardingRuleProperties{}, @@ -356,7 +356,7 @@ func resourceApplicationLoadBalancerForwardingRuleUpdate(ctx context.Context, d } func resourceApplicationLoadBalancerForwardingRuleDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) albID := d.Get("application_loadbalancer_id").(string) @@ -379,7 +379,7 @@ func resourceApplicationLoadBalancerForwardingRuleDelete(ctx context.Context, d } func resourceApplicationLoadBalancerForwardingRuleImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient parts := strings.Split(d.Id(), "/") diff --git a/ionoscloud/resource_application_loadbalancer_forwardingrule_test.go b/ionoscloud/resource_application_loadbalancer_forwardingrule_test.go index ab1e76f1f..38d1f6c3b 100644 --- a/ionoscloud/resource_application_loadbalancer_forwardingrule_test.go +++ b/ionoscloud/resource_application_loadbalancer_forwardingrule_test.go @@ -171,7 +171,7 @@ func TestAccApplicationLoadBalancerForwardingRuleBasic(t *testing.T) { } func testAccCheckApplicationLoadBalancerForwardingRuleDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -204,7 +204,7 @@ func testAccCheckApplicationLoadBalancerForwardingRuleDestroyCheck(s *terraform. func testAccCheckApplicationLoadBalancerForwardingRuleExists(n string, alb *ionoscloud.ApplicationLoadBalancerForwardingRule) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_application_loadbalancer_test.go b/ionoscloud/resource_application_loadbalancer_test.go index cc6ee62d8..0a4060397 100644 --- a/ionoscloud/resource_application_loadbalancer_test.go +++ b/ionoscloud/resource_application_loadbalancer_test.go @@ -115,7 +115,7 @@ func TestAccApplicationLoadBalancerBasic(t *testing.T) { } func testAccCheckApplicationLoadBalancerDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -147,7 +147,7 @@ func testAccCheckApplicationLoadBalancerDestroyCheck(s *terraform.State) error { func testAccCheckApplicationLoadBalancerExists(n string, alb *ionoscloud.ApplicationLoadBalancer) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_backup_unit.go b/ionoscloud/resource_backup_unit.go index ff300947f..a2c663694 100644 --- a/ionoscloud/resource_backup_unit.go +++ b/ionoscloud/resource_backup_unit.go @@ -61,7 +61,7 @@ func resourceBackupUnit() *schema.Resource { } func resourceBackupUnitCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient backupUnitName := d.Get("name").(string) backupUnitPassword := d.Get("password").(string) @@ -96,7 +96,7 @@ func resourceBackupUnitCreate(ctx context.Context, d *schema.ResourceData, meta func resourceBackupUnitRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient backupUnit, apiResponse, err := BackupUnitFindByID(ctx, d.Id(), client) logApiRequestTime(apiResponse) @@ -130,7 +130,7 @@ func resourceBackupUnitRead(ctx context.Context, d *schema.ResourceData, meta in } func resourceBackupUnitUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.BackupUnit{} request.Properties = &ionoscloud.BackupUnitProperties{} @@ -206,7 +206,7 @@ func waitForUnitToBeReady(ctx context.Context, d *schema.ResourceData, client *i } func resourceBackupUnitDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient apiResponse, err := client.BackupUnitsApi.BackupunitsDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -249,7 +249,7 @@ func resourceBackupUnitDelete(ctx context.Context, d *schema.ResourceData, meta } func resourceBackupUnitImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient buId := d.Id() diff --git a/ionoscloud/resource_backup_unit_test.go b/ionoscloud/resource_backup_unit_test.go index 227a2d613..6c7759866 100644 --- a/ionoscloud/resource_backup_unit_test.go +++ b/ionoscloud/resource_backup_unit_test.go @@ -79,7 +79,7 @@ func TestAccBackupUnitBasic(t *testing.T) { } func testAccCheckBackupUnitDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -111,7 +111,7 @@ func testAccCheckBackupUnitDestroyCheck(s *terraform.State) error { func testAccCheckBackupUnitExists(n string, backupUnit *ionoscloud.BackupUnit) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_cube_server.go b/ionoscloud/resource_cube_server.go index 2aca75421..611beaa3c 100644 --- a/ionoscloud/resource_cube_server.go +++ b/ionoscloud/resource_cube_server.go @@ -381,7 +381,7 @@ func resourceCubeServer() *schema.Resource { } func resourceCubeServerCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient server := ionoscloud.Server{ Properties: &ionoscloud.ServerProperties{}, @@ -631,7 +631,7 @@ func resourceCubeServerCreate(ctx context.Context, d *schema.ResourceData, meta } func resourceCubeServerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) serverId := d.Id() @@ -791,7 +791,7 @@ func resourceCubeServerRead(ctx context.Context, d *schema.ResourceData, meta in } func resourceCubeServerUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient ss := cloudapiserver.Service{Client: client, Meta: meta, D: d} dcId := d.Get("datacenter_id").(string) @@ -838,7 +838,7 @@ func resourceCubeServerUpdate(ctx context.Context, d *schema.ResourceData, meta bootCdrom := n.(string) if utils.IsValidUUID(bootCdrom) { - ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} + ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} ss.UpdateBootDevice(ctx, dcId, d.Id(), bootCdrom) } } @@ -1094,7 +1094,7 @@ func SetCubeVolumeProperties(volume ionoscloud.Volume) map[string]interface{} { } func resourceCubeServerDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) apiResponse, err := client.ServersApi.DatacentersServersDelete(ctx, dcId, d.Id()).Execute() @@ -1123,7 +1123,7 @@ func resourceCubeServerImport(ctx context.Context, d *schema.ResourceData, meta datacenterId := parts[0] serverId := parts[1] - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient server, apiResponse, err := client.ServersApi.DatacentersServersFindById(ctx, datacenterId, serverId).Depth(3).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_cube_server_test.go b/ionoscloud/resource_cube_server_test.go index 5dbef5808..f9c334848 100644 --- a/ionoscloud/resource_cube_server_test.go +++ b/ionoscloud/resource_cube_server_test.go @@ -338,7 +338,7 @@ func TestAccCubeServerWithICMP(t *testing.T) { } func testAccCheckCubeServerDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -371,7 +371,7 @@ func testAccCheckCubeServerDestroyCheck(s *terraform.State) error { func testAccCheckCubeServerExists(n string, server *ionoscloud.Server) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_datacenter.go b/ionoscloud/resource_datacenter.go index f311d832d..d451b2b30 100644 --- a/ionoscloud/resource_datacenter.go +++ b/ionoscloud/resource_datacenter.go @@ -94,7 +94,7 @@ func resourceDatacenter() *schema.Resource { func resourceDatacenterCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterName := d.Get("name").(string) datacenterLocation := d.Get("location").(string) @@ -137,7 +137,7 @@ func resourceDatacenterCreate(ctx context.Context, d *schema.ResourceData, meta func resourceDatacenterRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenter, apiResponse, err := client.DataCentersApi.DatacentersFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -160,7 +160,7 @@ func resourceDatacenterRead(ctx context.Context, d *schema.ResourceData, meta in func resourceDatacenterUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient obj := ionoscloud.DatacenterPropertiesPut{} if d.HasChange("name") { @@ -204,7 +204,7 @@ func resourceDatacenterUpdate(ctx context.Context, d *schema.ResourceData, meta func resourceDatacenterDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient apiResponse, err := client.DataCentersApi.DatacentersDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -223,7 +223,7 @@ func resourceDatacenterDelete(ctx context.Context, d *schema.ResourceData, meta } func resourceDatacenterImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Id() diff --git a/ionoscloud/resource_datacenter_nsg_selection.go b/ionoscloud/resource_datacenter_nsg_selection.go index 2abab798c..bbaf1697b 100644 --- a/ionoscloud/resource_datacenter_nsg_selection.go +++ b/ionoscloud/resource_datacenter_nsg_selection.go @@ -45,7 +45,7 @@ func resourceDatacenterNSGSelectionCreate(ctx context.Context, d *schema.Resourc dcID := d.Get("datacenter_id").(string) nsgID := d.Get("nsg_id").(string) - ns := nsg.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} + ns := nsg.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} if diags := ns.SetDefaultDatacenterNSG(ctx, dcID, nsgID); diags.HasError() { return diags } @@ -55,7 +55,7 @@ func resourceDatacenterNSGSelectionCreate(ctx context.Context, d *schema.Resourc } func resourceDatacenterNSGSelectionRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcID := d.Get("datacenter_id").(string) nsgID := d.Get("nsg_id").(string) @@ -80,7 +80,7 @@ func resourceDatacenterNSGSelectionUpdate(ctx context.Context, d *schema.Resourc if d.HasChange("nsg_id") { _, newID := d.GetChange("nsg_id") - ns := nsg.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} + ns := nsg.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} if diags := ns.SetDefaultDatacenterNSG(ctx, dcID, newID.(string)); diags.HasError() { return diags } @@ -92,7 +92,7 @@ func resourceDatacenterNSGSelectionUpdate(ctx context.Context, d *schema.Resourc func resourceDatacenterNSGSelectionDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { dcID := d.Get("datacenter_id").(string) - ns := nsg.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} + ns := nsg.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} if diags := ns.SetDefaultDatacenterNSG(ctx, dcID, ""); diags.HasError() { return diags } diff --git a/ionoscloud/resource_datacenter_test.go b/ionoscloud/resource_datacenter_test.go index fe7942093..4c8625ced 100644 --- a/ionoscloud/resource_datacenter_test.go +++ b/ionoscloud/resource_datacenter_test.go @@ -104,7 +104,7 @@ func TestAccDataCenterBasic(t *testing.T) { } func testAccCheckDatacenterDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -134,7 +134,7 @@ func testAccCheckDatacenterDestroyCheck(s *terraform.State) error { func testAccCheckDatacenterExists(n string, datacenter *ionoscloud.Datacenter) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_firewall.go b/ionoscloud/resource_firewall.go index 2daca4439..55f690ce1 100644 --- a/ionoscloud/resource_firewall.go +++ b/ionoscloud/resource_firewall.go @@ -101,7 +101,7 @@ func resourceFirewall() *schema.Resource { } func resourceFirewallCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient firewall, diags := getFirewallData(d, "", false) if diags != nil { @@ -130,7 +130,7 @@ func resourceFirewallCreate(ctx context.Context, d *schema.ResourceData, meta in } func resourceFirewallRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient fw, apiResponse, err := client.FirewallRulesApi.DatacentersServersNicsFirewallrulesFindById(ctx, d.Get("datacenter_id").(string), d.Get("server_id").(string), d.Get("nic_id").(string), d.Id()).Execute() @@ -155,7 +155,7 @@ func resourceFirewallRead(ctx context.Context, d *schema.ResourceData, meta inte } func resourceFirewallUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient firewall, diags := getFirewallData(d, "", true) if diags != nil { @@ -177,7 +177,7 @@ func resourceFirewallUpdate(ctx context.Context, d *schema.ResourceData, meta in } func resourceFirewallDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient apiResponse, err := client.FirewallRulesApi. DatacentersServersNicsFirewallrulesDelete( @@ -201,7 +201,7 @@ func resourceFirewallDelete(ctx context.Context, d *schema.ResourceData, meta in func resourceFirewallImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient parts := strings.Split(d.Id(), "/") if len(parts) != 4 || parts[0] == "" || parts[1] == "" || parts[2] == "" || parts[3] == "" { diff --git a/ionoscloud/resource_firewall_test.go b/ionoscloud/resource_firewall_test.go index adc5b5204..e0adfd6b2 100644 --- a/ionoscloud/resource_firewall_test.go +++ b/ionoscloud/resource_firewall_test.go @@ -144,7 +144,7 @@ func TestAccFirewallUDP(t *testing.T) { } func testAccCheckFirewallDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -175,7 +175,7 @@ func testAccCheckFirewallDestroyCheck(s *terraform.State) error { func testAccCheckFirewallExists(n string, firewall *ionoscloud.FirewallRule) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_group.go b/ionoscloud/resource_group.go index b6bbe7c61..c49aca6be 100644 --- a/ionoscloud/resource_group.go +++ b/ionoscloud/resource_group.go @@ -181,7 +181,7 @@ func resourceGroup() *schema.Resource { //} func resourceGroupCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.Group{ Properties: &ionoscloud.GroupProperties{}, @@ -262,7 +262,7 @@ func resourceGroupCreate(ctx context.Context, d *schema.ResourceData, meta inter } func resourceGroupRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient group, apiResponse, err := client.UserManagementApi.UmGroupsFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -284,7 +284,7 @@ func resourceGroupRead(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient tempCreateDataCenter := d.Get("create_datacenter").(bool) tempCreateSnapshot := d.Get("create_snapshot").(bool) @@ -386,7 +386,7 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter } func resourceGroupDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient apiResponse, err := client.UserManagementApi.UmGroupsDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -404,7 +404,7 @@ func resourceGroupDelete(ctx context.Context, d *schema.ResourceData, meta inter } func resourceGroupImporter(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient grpId := d.Id() @@ -586,7 +586,7 @@ func setGroupData(ctx context.Context, client *ionoscloud.APIClient, d *schema.R } func addUserToGroup(userId, groupId string, ctx context.Context, d *schema.ResourceData, meta interface{}) error { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient userToAdd := ionoscloud.UserGroupPost{ Id: &userId, } @@ -608,7 +608,7 @@ func addUserToGroup(userId, groupId string, ctx context.Context, d *schema.Resou } func deleteUserFromGroup(userId, groupId string, ctx context.Context, d *schema.ResourceData, meta interface{}) error { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient apiResponse, err := client.UserManagementApi.UmGroupsUsersDelete(ctx, groupId, userId).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_group_test.go b/ionoscloud/resource_group_test.go index 9f4e5b154..0fc520a13 100644 --- a/ionoscloud/resource_group_test.go +++ b/ionoscloud/resource_group_test.go @@ -162,7 +162,7 @@ func TestAccGroupBasic(t *testing.T) { } func testAccCheckGroupDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) if cancel != nil { @@ -191,7 +191,7 @@ func testAccCheckGroupDestroyCheck(s *terraform.State) error { func testAccCheckGroupExists(n string, group *ionoscloud.Group) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_ipblock.go b/ionoscloud/resource_ipblock.go index c507461d9..62d8cf1bb 100644 --- a/ionoscloud/resource_ipblock.go +++ b/ionoscloud/resource_ipblock.go @@ -98,7 +98,7 @@ func resourceIPBlock() *schema.Resource { } func resourceIPBlockCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient size := d.Get("size").(int) sizeConverted := int32(size) @@ -132,7 +132,7 @@ func resourceIPBlockCreate(ctx context.Context, d *schema.ResourceData, meta int } func resourceIPBlockRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient ipBlock, apiResponse, err := client.IPBlocksApi.IpblocksFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -155,7 +155,7 @@ func resourceIPBlockRead(ctx context.Context, d *schema.ResourceData, meta inter return nil } func resourceIPBlockUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.IpBlockProperties{} @@ -178,7 +178,7 @@ func resourceIPBlockUpdate(ctx context.Context, d *schema.ResourceData, meta int } func resourceIPBlockDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient apiResponse, err := client.IPBlocksApi.IpblocksDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -196,7 +196,7 @@ func resourceIPBlockDelete(ctx context.Context, d *schema.ResourceData, meta int } func resourceIpBlockImporter(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient ipBlockId := d.Id() diff --git a/ionoscloud/resource_ipblock_test.go b/ionoscloud/resource_ipblock_test.go index 78f77bd26..782eeb647 100644 --- a/ionoscloud/resource_ipblock_test.go +++ b/ionoscloud/resource_ipblock_test.go @@ -106,7 +106,7 @@ func TestAccIPBlockBasic(t *testing.T) { } func testAccCheckIPBlockDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -148,7 +148,7 @@ func testAccCheckIPBlockAttributes(n string, location string) resource.TestCheck func testAccCheckIPBlockExists(n string, ipblock *ionoscloud.IpBlock) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_ipfailover.go b/ionoscloud/resource_ipfailover.go index 6ea682024..ba1bd4eee 100644 --- a/ionoscloud/resource_ipfailover.go +++ b/ionoscloud/resource_ipfailover.go @@ -63,7 +63,7 @@ func resourceLanIPFailover() *schema.Resource { } func resourceLanIPFailoverCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) lanId := d.Get("lan_id").(string) ip := d.Get("ip").(string) @@ -104,7 +104,7 @@ func resourceLanIPFailoverCreate(ctx context.Context, d *schema.ResourceData, me } func resourceLanIPFailoverRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) lanId := d.Get("lan_id").(string) ip := d.Get("ip").(string) @@ -149,7 +149,7 @@ func resourceLanIPFailoverRead(ctx context.Context, d *schema.ResourceData, meta } func resourceLanIPFailoverUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) lanId := d.Get("lan_id").(string) ip := d.Get("ip").(string) @@ -198,7 +198,7 @@ func resourceLanIPFailoverUpdate(ctx context.Context, d *schema.ResourceData, me } func resourceLanIPFailoverDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) lanId := d.Get("lan_id").(string) ip := d.Get("ip").(string) @@ -246,7 +246,7 @@ func resourceIpFailoverImporter(ctx context.Context, d *schema.ResourceData, met lanId := parts[1] ip := parts[2] - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient lan, apiResponse, err := client.LANsApi.DatacentersLansFindById(ctx, dcId, lanId).Execute() apiResponse.LogInfo() diff --git a/ionoscloud/resource_ipfailover_test.go b/ionoscloud/resource_ipfailover_test.go index 57412dbe5..40bc24816 100644 --- a/ionoscloud/resource_ipfailover_test.go +++ b/ionoscloud/resource_ipfailover_test.go @@ -76,7 +76,7 @@ func TestAccLanIPFailoverBasic(t *testing.T) { func testAccCheckLanIPFailoverGroupExists(n string) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] if !ok { @@ -112,7 +112,7 @@ func testAccCheckLanIPFailoverGroupExists(n string) resource.TestCheckFunc { } func testAccCheckLanIPFailoverDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) defer cancel() diff --git a/ionoscloud/resource_k8s_cluster.go b/ionoscloud/resource_k8s_cluster.go index 5c831661e..43e790159 100644 --- a/ionoscloud/resource_k8s_cluster.go +++ b/ionoscloud/resource_k8s_cluster.go @@ -160,7 +160,7 @@ func checkClusterImmutableFields(_ context.Context, diff *schema.ResourceDiff, _ } func resourcek8sClusterCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient clusterName := d.Get("name").(string) cluster := ionoscloud.KubernetesClusterForPost{ @@ -291,7 +291,7 @@ func resourcek8sClusterCreate(ctx context.Context, d *schema.ResourceData, meta } func resourcek8sClusterRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient cluster, apiResponse, err := client.KubernetesApi.K8sFindByClusterId(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -316,7 +316,7 @@ func resourcek8sClusterRead(ctx context.Context, d *schema.ResourceData, meta in func resourcek8sClusterUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.KubernetesClusterForPut{} @@ -460,7 +460,7 @@ func resourcek8sClusterUpdate(ctx context.Context, d *schema.ResourceData, meta func resourcek8sClusterDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient apiResponse, err := client.KubernetesApi.K8sDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -504,7 +504,7 @@ func resourcek8sClusterDelete(ctx context.Context, d *schema.ResourceData, meta } func resourceK8sClusterImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient clusterId := d.Id() diff --git a/ionoscloud/resource_k8s_cluster_test.go b/ionoscloud/resource_k8s_cluster_test.go index e16fa5dd1..550e08932 100644 --- a/ionoscloud/resource_k8s_cluster_test.go +++ b/ionoscloud/resource_k8s_cluster_test.go @@ -204,7 +204,7 @@ func TestAccK8sClusters(t *testing.T) { } func testAccCheckK8sClusterDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -235,7 +235,7 @@ func testAccCheckK8sClusterDestroyCheck(s *terraform.State) error { func testAccCheckK8sClusterExists(n string, k8sCluster *ionoscloud.KubernetesCluster) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_k8s_node_pool.go b/ionoscloud/resource_k8s_node_pool.go index 840fdd4f9..33c056420 100644 --- a/ionoscloud/resource_k8s_node_pool.go +++ b/ionoscloud/resource_k8s_node_pool.go @@ -405,7 +405,7 @@ func getAutoscalingData(d *schema.ResourceData) (*ionoscloud.KubernetesAutoScali return &autoscaling, nil } func resourcek8sNodePoolCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient name := d.Get("name").(string) datacenterId := d.Get("datacenter_id").(string) @@ -549,7 +549,7 @@ func resourcek8sNodePoolCreate(ctx context.Context, d *schema.ResourceData, meta } func resourcek8sNodePoolRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient k8sNodepool, apiResponse, err := client.KubernetesApi.K8sNodepoolsFindById(ctx, d.Get("k8s_cluster_id").(string), d.Id()).Execute() logApiRequestTime(apiResponse) @@ -574,7 +574,7 @@ func resourcek8sNodePoolRead(ctx context.Context, d *schema.ResourceData, meta i } func resourcek8sNodePoolUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.KubernetesNodePoolForPut{} @@ -766,7 +766,7 @@ func resourcek8sNodePoolUpdate(ctx context.Context, d *schema.ResourceData, meta } func resourcek8sNodePoolDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient apiResponse, err := client.KubernetesApi.K8sNodepoolsDelete(ctx, d.Get("k8s_cluster_id").(string), d.Id()).Execute() logApiRequestTime(apiResponse) @@ -818,7 +818,7 @@ func resourceK8sNodepoolImport(ctx context.Context, d *schema.ResourceData, meta clusterId := parts[0] npId := parts[1] - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient k8sNodepool, apiResponse, err := client.KubernetesApi.K8sNodepoolsFindById(ctx, clusterId, npId).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_k8s_node_pool_test.go b/ionoscloud/resource_k8s_node_pool_test.go index c336a166e..8b0689a17 100644 --- a/ionoscloud/resource_k8s_node_pool_test.go +++ b/ionoscloud/resource_k8s_node_pool_test.go @@ -249,7 +249,7 @@ func TestAccK8sNodePoolNoOptionalAndNodesDataSource(t *testing.T) { } func testAccCheckK8sNodePoolDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -280,7 +280,7 @@ func testAccCheckK8sNodePoolDestroyCheck(s *terraform.State) error { func testAccCheckK8sNodePoolExists(n string, k8sNodepool *ionoscloud.KubernetesNodePool) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_lan.go b/ionoscloud/resource_lan.go index ecbad9731..0e2ee1980 100644 --- a/ionoscloud/resource_lan.go +++ b/ionoscloud/resource_lan.go @@ -84,7 +84,7 @@ func resourceLan() *schema.Resource { } func resourceLanCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient public := d.Get("public").(bool) request := ionoscloud.Lan{ Properties: &ionoscloud.LanProperties{ @@ -164,7 +164,7 @@ func resourceLanCreate(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceLanRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcid := d.Get("datacenter_id").(string) @@ -192,7 +192,7 @@ func resourceLanRead(ctx context.Context, d *schema.ResourceData, meta interface } func resourceLanUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient properties := &ionoscloud.LanProperties{} newValue := d.Get("public") public := newValue.(bool) @@ -243,7 +243,7 @@ func resourceLanUpdate(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceLanDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) if err := waitForLanNicsDeletion(ctx, client, d); err != nil { @@ -268,7 +268,7 @@ func resourceLanDelete(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceLanImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient parts := strings.Split(d.Id(), "/") diff --git a/ionoscloud/resource_lan_test.go b/ionoscloud/resource_lan_test.go index 5b1880cd8..5c77d2944 100644 --- a/ionoscloud/resource_lan_test.go +++ b/ionoscloud/resource_lan_test.go @@ -78,7 +78,7 @@ func TestAccLanBasic(t *testing.T) { } func testAccCheckLanDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -108,7 +108,7 @@ func testAccCheckLanDestroyCheck(s *terraform.State) error { func testAccCheckLanExists(n string, lan *ionoscloud.Lan) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_loadbalancer.go b/ionoscloud/resource_loadbalancer.go index 072783e58..9ffadf7db 100644 --- a/ionoscloud/resource_loadbalancer.go +++ b/ionoscloud/resource_loadbalancer.go @@ -60,7 +60,7 @@ func resourceLoadbalancer() *schema.Resource { } func resourceLoadbalancerCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient rawIds := d.Get("nic_ids").([]interface{}) var nicIds []ionoscloud.Nic @@ -105,7 +105,7 @@ func resourceLoadbalancerCreate(ctx context.Context, d *schema.ResourceData, met } func resourceLoadbalancerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient lb, apiResponse, err := client.LoadBalancersApi.DatacentersLoadbalancersFindById(ctx, d.Get("datacenter_id").(string), d.Id()).Execute() logApiRequestTime(apiResponse) @@ -143,7 +143,7 @@ func resourceLoadbalancerRead(ctx context.Context, d *schema.ResourceData, meta } func resourceLoadbalancerUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient properties := &ionoscloud.LoadbalancerProperties{} @@ -223,7 +223,7 @@ func resourceLoadbalancerUpdate(ctx context.Context, d *schema.ResourceData, met } func resourceLoadbalancerDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcid := d.Get("datacenter_id").(string) apiResponse, err := client.LoadBalancersApi.DatacentersLoadbalancersDelete(ctx, dcid, d.Id()).Execute() @@ -251,7 +251,7 @@ func resourceLoadbalancerImporter(ctx context.Context, d *schema.ResourceData, m dcId := parts[0] lbId := parts[1] - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient loadbalancer, apiResponse, err := client.LoadBalancersApi.DatacentersLoadbalancersFindById(ctx, dcId, lbId).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_loadbalancer_test.go b/ionoscloud/resource_loadbalancer_test.go index 43a1d0ea7..0d0b5e167 100644 --- a/ionoscloud/resource_loadbalancer_test.go +++ b/ionoscloud/resource_loadbalancer_test.go @@ -49,7 +49,7 @@ func TestAccLoadbalancerBasic(t *testing.T) { } func testAccCheckLoadbalancerDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -95,7 +95,7 @@ func testAccCheckLoadbalancerAttributes(n string, name string) resource.TestChec func testAccCheckLoadbalancerExists(n string, loadbalancer *ionoscloud.Loadbalancer) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_natgateway.go b/ionoscloud/resource_natgateway.go index 6fbefbb6b..7994f7dd1 100644 --- a/ionoscloud/resource_natgateway.go +++ b/ionoscloud/resource_natgateway.go @@ -76,7 +76,7 @@ func resourceNatGateway() *schema.Resource { } func resourceNatGatewayCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient name := d.Get("name").(string) @@ -167,7 +167,7 @@ func resourceNatGatewayCreate(ctx context.Context, d *schema.ResourceData, meta } func resourceNatGatewayRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) @@ -193,7 +193,7 @@ func resourceNatGatewayRead(ctx context.Context, d *schema.ResourceData, meta in } func resourceNatGatewayUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.NatGateway{ Properties: &ionoscloud.NatGatewayProperties{}, } @@ -275,7 +275,7 @@ func resourceNatGatewayUpdate(ctx context.Context, d *schema.ResourceData, meta } func resourceNatGatewayDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) @@ -297,7 +297,7 @@ func resourceNatGatewayDelete(ctx context.Context, d *schema.ResourceData, meta } func resourceNatGatewayImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient parts := strings.Split(d.Id(), "/") if len(parts) != 2 || parts[0] == "" || parts[1] == "" { diff --git a/ionoscloud/resource_natgateway_rule.go b/ionoscloud/resource_natgateway_rule.go index 620e22c94..59f1d2c94 100644 --- a/ionoscloud/resource_natgateway_rule.go +++ b/ionoscloud/resource_natgateway_rule.go @@ -111,7 +111,7 @@ func resourceNatGatewayRule() *schema.Resource { func resourceNatGatewayRuleCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient natGatewayRule := ionoscloud.NatGatewayRule{ Properties: &ionoscloud.NatGatewayRuleProperties{}, @@ -209,7 +209,7 @@ func resourceNatGatewayRuleCreate(ctx context.Context, d *schema.ResourceData, m } func resourceNatGatewayRuleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) ngId := d.Get("natgateway_id").(string) @@ -234,7 +234,7 @@ func resourceNatGatewayRuleRead(ctx context.Context, d *schema.ResourceData, met return nil } func resourceNatGatewayRuleUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.NatGatewayRule{ Properties: &ionoscloud.NatGatewayRuleProperties{}, } @@ -331,7 +331,7 @@ func resourceNatGatewayRuleUpdate(ctx context.Context, d *schema.ResourceData, m } func resourceNatGatewayRuleDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) ngId := d.Get("natgateway_id").(string) @@ -354,7 +354,7 @@ func resourceNatGatewayRuleDelete(ctx context.Context, d *schema.ResourceData, m } func resourceNatGatewayRuleImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient parts := strings.Split(d.Id(), "/") if len(parts) != 3 || parts[0] == "" || parts[1] == "" || parts[2] == "" { diff --git a/ionoscloud/resource_natgateway_rule_test.go b/ionoscloud/resource_natgateway_rule_test.go index 965792a1f..4f19776f0 100644 --- a/ionoscloud/resource_natgateway_rule_test.go +++ b/ionoscloud/resource_natgateway_rule_test.go @@ -92,7 +92,7 @@ func TestAccNatGatewayRuleBasic(t *testing.T) { } func testAccCheckNatGatewayRuleDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) @@ -122,7 +122,7 @@ func testAccCheckNatGatewayRuleDestroyCheck(s *terraform.State) error { func testAccCheckNatGatewayRuleExists(n string, natGateway *ionoscloud.NatGatewayRule) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_natgateway_test.go b/ionoscloud/resource_natgateway_test.go index 739c33390..ece3c7591 100644 --- a/ionoscloud/resource_natgateway_test.go +++ b/ionoscloud/resource_natgateway_test.go @@ -78,7 +78,7 @@ func TestAccNatGatewayBasic(t *testing.T) { } func testAccCheckNatGatewayDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -107,7 +107,7 @@ func testAccCheckNatGatewayDestroyCheck(s *terraform.State) error { func testAccCheckNatGatewayExists(n string, natGateway *ionoscloud.NatGateway) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_networkloadbalancer.go b/ionoscloud/resource_networkloadbalancer.go index 3c16ae3f3..e2b1d00e9 100644 --- a/ionoscloud/resource_networkloadbalancer.go +++ b/ionoscloud/resource_networkloadbalancer.go @@ -100,7 +100,7 @@ and log the extent to which your instances are being accessed.`, } func resourceNetworkLoadBalancerCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient networkLoadBalancer := ionoscloud.NetworkLoadBalancer{ Properties: &ionoscloud.NetworkLoadBalancerProperties{}, @@ -200,7 +200,7 @@ func resourceNetworkLoadBalancerCreate(ctx context.Context, d *schema.ResourceDa } func resourceNetworkLoadBalancerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) @@ -225,7 +225,7 @@ func resourceNetworkLoadBalancerRead(ctx context.Context, d *schema.ResourceData } func resourceNetworkLoadBalancerUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.NetworkLoadBalancer{ Properties: &ionoscloud.NetworkLoadBalancerProperties{}, } @@ -342,7 +342,7 @@ func resourceNetworkLoadBalancerUpdate(ctx context.Context, d *schema.ResourceDa } func resourceNetworkLoadBalancerDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) @@ -364,7 +364,7 @@ func resourceNetworkLoadBalancerDelete(ctx context.Context, d *schema.ResourceDa } func resourceNetworkLoadBalancerImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient parts := strings.Split(d.Id(), "/") if len(parts) != 2 || parts[0] == "" || parts[1] == "" { diff --git a/ionoscloud/resource_networkloadbalancer_forwardingrule.go b/ionoscloud/resource_networkloadbalancer_forwardingrule.go index 87ba32ac5..acb579648 100644 --- a/ionoscloud/resource_networkloadbalancer_forwardingrule.go +++ b/ionoscloud/resource_networkloadbalancer_forwardingrule.go @@ -171,7 +171,7 @@ func resourceNetworkLoadBalancerForwardingRule() *schema.Resource { } func resourceNetworkLoadBalancerForwardingRuleCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient networkLoadBalancerForwardingRule := ionoscloud.NetworkLoadBalancerForwardingRule{ Properties: &ionoscloud.NetworkLoadBalancerForwardingRuleProperties{}, @@ -347,7 +347,7 @@ func getTargetsData(targets interface{}) ([]ionoscloud.NetworkLoadBalancerForwar func resourceNetworkLoadBalancerForwardingRuleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) @@ -374,7 +374,7 @@ func resourceNetworkLoadBalancerForwardingRuleRead(ctx context.Context, d *schem } func resourceNetworkLoadBalancerForwardingRuleUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.NetworkLoadBalancerForwardingRule{ Properties: &ionoscloud.NetworkLoadBalancerForwardingRuleProperties{}, @@ -481,7 +481,7 @@ func resourceNetworkLoadBalancerForwardingRuleUpdate(ctx context.Context, d *sch } func resourceNetworkLoadBalancerForwardingRuleDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) nlbID := d.Get("networkloadbalancer_id").(string) @@ -504,7 +504,7 @@ func resourceNetworkLoadBalancerForwardingRuleDelete(ctx context.Context, d *sch } func resourceNetworLoadBalancerForwardingRuleImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient parts := strings.Split(d.Id(), "/") if len(parts) != 3 || parts[0] == "" || parts[1] == "" || parts[2] == "" { diff --git a/ionoscloud/resource_networkloadbalancer_forwardingrule_test.go b/ionoscloud/resource_networkloadbalancer_forwardingrule_test.go index 1753ed49a..67585e3ce 100644 --- a/ionoscloud/resource_networkloadbalancer_forwardingrule_test.go +++ b/ionoscloud/resource_networkloadbalancer_forwardingrule_test.go @@ -143,7 +143,7 @@ func TestAccNetworkLoadBalancerForwardingRuleBasic(t *testing.T) { } func testAccCheckNetworkLoadBalancerForwardingRuleDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) @@ -173,7 +173,7 @@ func testAccCheckNetworkLoadBalancerForwardingRuleDestroyCheck(s *terraform.Stat func testAccCheckNetworkLoadBalancerForwardingRuleExists(n string, networkLoadBalancerForwardingRule *ionoscloud.NetworkLoadBalancerForwardingRule) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_networkloadbalancer_test.go b/ionoscloud/resource_networkloadbalancer_test.go index 0cfba0823..e2ac91ef9 100644 --- a/ionoscloud/resource_networkloadbalancer_test.go +++ b/ionoscloud/resource_networkloadbalancer_test.go @@ -117,7 +117,7 @@ func TestAccNetworkLoadBalancerBasic(t *testing.T) { } func testAccCheckNetworkLoadBalancerDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) @@ -147,7 +147,7 @@ func testAccCheckNetworkLoadBalancerDestroyCheck(s *terraform.State) error { func testAccCheckNetworkLoadBalancerExists(n string, networkLoadBalancer *ionoscloud.NetworkLoadBalancer) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_nic.go b/ionoscloud/resource_nic.go index d3c66d03d..d0f7feb8a 100644 --- a/ionoscloud/resource_nic.go +++ b/ionoscloud/resource_nic.go @@ -176,7 +176,7 @@ func ForceNewForFlowlogChanges(_ context.Context, d *schema.ResourceDiff, _ inte return nil } func resourceNicCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient ns := cloudapinic.Service{Client: client, Meta: meta, D: d} nic, err := cloudapinic.GetNicFromSchema(d, "") @@ -237,7 +237,7 @@ func resourceNicCreate(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceNicRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient ns := cloudapinic.Service{Client: client, Meta: meta, D: d} dcid := d.Get("datacenter_id").(string) srvid := d.Get("server_id").(string) @@ -261,7 +261,7 @@ func resourceNicRead(ctx context.Context, d *schema.ResourceData, meta interface } func resourceNicUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient ns := cloudapinic.Service{Client: client, Meta: meta, D: d} dcID := d.Get("datacenter_id").(string) srvID := d.Get("server_id").(string) @@ -321,7 +321,7 @@ func resourceNicUpdate(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceNicDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient ns := cloudapinic.Service{Client: client, Meta: meta, D: d} dcid := d.Get("datacenter_id").(string) srvid := d.Get("server_id").(string) @@ -344,7 +344,7 @@ func resourceNicImport(ctx context.Context, d *schema.ResourceData, meta interfa sId := parts[1] nicId := parts[2] - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient nic, apiResponse, err := client.NetworkInterfacesApi.DatacentersServersNicsFindById(ctx, dcId, sId, nicId).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_nic_test.go b/ionoscloud/resource_nic_test.go index 99cab9185..f9d29b312 100644 --- a/ionoscloud/resource_nic_test.go +++ b/ionoscloud/resource_nic_test.go @@ -132,7 +132,7 @@ func TestAccNicBasic(t *testing.T) { } func testAccCheckNicDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -165,7 +165,7 @@ func testAccCheckNicDestroyCheck(s *terraform.State) error { func testAccCheckNICExists(n string, nic *ionoscloud.Nic) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_nsg.go b/ionoscloud/resource_nsg.go index bd5051ad4..357104acd 100644 --- a/ionoscloud/resource_nsg.go +++ b/ionoscloud/resource_nsg.go @@ -51,7 +51,7 @@ func resourceNSG() *schema.Resource { } func resourceNSGCreate(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterID := d.Get("datacenter_id").(string) sgName := d.Get("name").(string) @@ -78,7 +78,7 @@ func resourceNSGCreate(ctx context.Context, d *schema.ResourceData, meta any) di } func resourceNSGRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterID := d.Get("datacenter_id").(string) securityGroup, apiResponse, err := client.SecurityGroupsApi.DatacentersSecuritygroupsFindById(ctx, datacenterID, d.Id()).Depth(2).Execute() @@ -94,7 +94,7 @@ func resourceNSGRead(ctx context.Context, d *schema.ResourceData, meta interface } func resourceNSGUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterID := d.Get("datacenter_id").(string) sgName := d.Get("name").(string) @@ -122,7 +122,7 @@ func resourceNSGUpdate(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceNSGDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterID := d.Get("datacenter_id").(string) @@ -141,7 +141,7 @@ func resourceNSGDelete(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceNSGImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient parts := strings.Split(d.Id(), "/") diff --git a/ionoscloud/resource_nsg_firewallrule.go b/ionoscloud/resource_nsg_firewallrule.go index b9e51def7..7d73cd71b 100644 --- a/ionoscloud/resource_nsg_firewallrule.go +++ b/ionoscloud/resource_nsg_firewallrule.go @@ -89,7 +89,7 @@ func resourceNSGFirewallRule() *schema.Resource { } func resourceNSGFirewallCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient firewall, diags := getFirewallData(d, "", false) if diags != nil { @@ -115,7 +115,7 @@ func resourceNSGFirewallCreate(ctx context.Context, d *schema.ResourceData, meta } func resourceNSGFirewallRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient fw, apiResponse, err := client.SecurityGroupsApi.DatacentersSecuritygroupsRulesFindById(ctx, d.Get("datacenter_id").(string), d.Get("nsg_id").(string), d.Id()).Execute() @@ -140,7 +140,7 @@ func resourceNSGFirewallRead(ctx context.Context, d *schema.ResourceData, meta i } func resourceNSGFirewallUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient firewall, diags := getFirewallData(d, "", true) if diags != nil { @@ -164,7 +164,7 @@ func resourceNSGFirewallUpdate(ctx context.Context, d *schema.ResourceData, meta } func resourceNSGFirewallDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcID := d.Get("datacenter_id").(string) nsgID := d.Get("nsg_id").(string) apiResponse, err := client.SecurityGroupsApi. @@ -189,7 +189,7 @@ func resourceNSGFirewallDelete(ctx context.Context, d *schema.ResourceData, meta func resourceNSGFirewallImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient parts := strings.Split(d.Id(), "/") if len(parts) != 3 || parts[0] == "" || parts[1] == "" || parts[2] == "" { diff --git a/ionoscloud/resource_nsg_test.go b/ionoscloud/resource_nsg_test.go index cdfade2cb..f3a676f4a 100644 --- a/ionoscloud/resource_nsg_test.go +++ b/ionoscloud/resource_nsg_test.go @@ -226,7 +226,7 @@ func TestAccNSGFirewallRules(t *testing.T) { } func testAccCheckNSGDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -255,7 +255,7 @@ func testAccCheckNSGDestroyCheck(s *terraform.State) error { func testAccCheckNSGExists(n string, nsg *ionoscloud.SecurityGroup) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] @@ -287,7 +287,7 @@ func testAccCheckNSGExists(n string, nsg *ionoscloud.SecurityGroup) resource.Tes } func testAccCheckNSGRuleDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -316,7 +316,7 @@ func testAccCheckNSGRuleDestroyCheck(s *terraform.State) error { func testAccCheckNSGFirewallRuleExists(n string, rule *ionoscloud.FirewallRule) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_private_crossconnect.go b/ionoscloud/resource_private_crossconnect.go index 8c3053008..307ae2da8 100644 --- a/ionoscloud/resource_private_crossconnect.go +++ b/ionoscloud/resource_private_crossconnect.go @@ -103,7 +103,7 @@ func resourcePrivateCrossConnect() *schema.Resource { } func resourcePrivateCrossConnectCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient name := d.Get("name").(string) pcc := ionoscloud.PrivateCrossConnect{ @@ -137,7 +137,7 @@ func resourcePrivateCrossConnectCreate(ctx context.Context, d *schema.ResourceDa } func resourcePrivateCrossConnectRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient pcc, apiResponse, err := client.PrivateCrossConnectsApi.PccsFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -160,7 +160,7 @@ func resourcePrivateCrossConnectRead(ctx context.Context, d *schema.ResourceData } func resourcePrivateCrossConnectUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.PrivateCrossConnect{} name := d.Get("name").(string) @@ -205,7 +205,7 @@ func resourcePrivateCrossConnectUpdate(ctx context.Context, d *schema.ResourceDa } func resourcePrivateCrossConnectDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient apiResponse, err := client.PrivateCrossConnectsApi.PccsDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -248,7 +248,7 @@ func resourcePrivateCrossConnectDelete(ctx context.Context, d *schema.ResourceDa } func resourcePrivateCrossConnectImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient pccId := d.Id() diff --git a/ionoscloud/resource_private_crossconnect_test.go b/ionoscloud/resource_private_crossconnect_test.go index 2de2b789d..9cf6c7158 100644 --- a/ionoscloud/resource_private_crossconnect_test.go +++ b/ionoscloud/resource_private_crossconnect_test.go @@ -73,7 +73,7 @@ func TestAccPrivateCrossConnectBasic(t *testing.T) { } func testAccCheckPrivateCrossConnectDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -102,7 +102,7 @@ func testAccCheckPrivateCrossConnectDestroyCheck(s *terraform.State) error { func testAccCheckPrivateCrossConnectExists(n string, privateCrossConnect *ionoscloud.PrivateCrossConnect) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) diff --git a/ionoscloud/resource_s3_key.go b/ionoscloud/resource_s3_key.go index ac978d92a..3e5455646 100644 --- a/ionoscloud/resource_s3_key.go +++ b/ionoscloud/resource_s3_key.go @@ -50,7 +50,7 @@ func resourceS3Key() *schema.Resource { } func resourceS3KeyCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient userId := d.Get("user_id").(string) rsp, apiResponse, err := client.UserS3KeysApi.UmUsersS3keysPost(ctx, userId).Execute() @@ -94,7 +94,7 @@ func resourceS3KeyCreate(ctx context.Context, d *schema.ResourceData, meta inter } func resourceS3KeyRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient userId := d.Get("user_id").(string) @@ -124,7 +124,7 @@ func resourceS3KeyRead(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceS3KeyUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.S3Key{} request.Properties = &ionoscloud.S3KeyProperties{} @@ -157,7 +157,7 @@ func resourceS3KeyUpdate(ctx context.Context, d *schema.ResourceData, meta inter } func resourceS3KeyDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient userId := d.Get("user_id").(string) apiResponse, err := client.UserS3KeysApi.UmUsersS3keysDelete(ctx, userId, d.Id()).Execute() @@ -236,7 +236,7 @@ func resourceS3KeyImport(ctx context.Context, d *schema.ResourceData, meta inter userId := parts[0] keyId := parts[1] - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient s3Key, apiResponse, err := client.UserS3KeysApi.UmUsersS3keysFindByKeyId(ctx, userId, keyId).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_s3_key_test.go b/ionoscloud/resource_s3_key_test.go index 55e5a5f30..d8d110c2b 100644 --- a/ionoscloud/resource_s3_key_test.go +++ b/ionoscloud/resource_s3_key_test.go @@ -58,7 +58,7 @@ func TestAccKeyBasic(t *testing.T) { func testAccChecksKeyDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient for _, rs := range s.RootModule().Resources { if rs.Type != constant.S3KeyResource { @@ -84,7 +84,7 @@ func testAccChecksKeyDestroyCheck(s *terraform.State) error { func testAccCheckKeyExists(n string, s3Key *ionoscloud.S3Key) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_server.go b/ionoscloud/resource_server.go index b026f737b..b01c529e0 100644 --- a/ionoscloud/resource_server.go +++ b/ionoscloud/resource_server.go @@ -535,7 +535,7 @@ func checkServerImmutableFields(_ context.Context, diff *schema.ResourceDiff, _ } func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient datacenterId := d.Get("datacenter_id").(string) serverReq, err := initializeCreateRequests(d) @@ -794,7 +794,7 @@ func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta inte } func resourceServerRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) serverId := d.Id() @@ -852,7 +852,7 @@ func SetVolumeProperties(volume ionoscloud.Volume) map[string]interface{} { } func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient ss := cloudapiserver.Service{Client: client, Meta: meta, D: d} dcId := d.Get("datacenter_id").(string) @@ -919,7 +919,7 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte bootCdrom := n.(string) if utils.IsValidUUID(bootCdrom) { - ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} + ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} ss.UpdateBootDevice(ctx, dcId, d.Id(), bootCdrom) } } @@ -1196,11 +1196,11 @@ func deleteInlineVolumes(ctx context.Context, d *schema.ResourceData, meta inter dcId := d.Get("datacenter_id").(string) volumeIds := d.Get("inline_volume_ids").([]interface{}) - for _, volumeID := range volumeIds { - apiResponse, err := client.VolumesApi.DatacentersVolumesDelete(ctx, dcId, volumeID.(string)).Execute() + for _, volumeId := range volumeIds { + apiResponse, err := client.VolumesApi.DatacentersVolumesDelete(ctx, dcId, volumeId.(string)).Execute() logApiRequestTime(apiResponse) if err != nil { - diags := diag.FromErr(fmt.Errorf("error occurred while deleting volume with ID: %s of server ID %s %w", volumeID.(string), d.Id(), err)) + diags := diag.FromErr(fmt.Errorf("error occurred while deleting volume with ID: %s of server ID %s %w", volumeId.(string), d.Id(), err)) return diags } @@ -1213,7 +1213,7 @@ func deleteInlineVolumes(ctx context.Context, d *schema.ResourceData, meta inter } func resourceServerDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) // A bigger depth is required since we need all volumes items. server, apiResponse, err := client.ServersApi.DatacentersServersFindById(ctx, dcId, d.Id()).Depth(2).Execute() @@ -1258,7 +1258,7 @@ func resourceServerImport(ctx context.Context, d *schema.ResourceData, meta inte datacenterId := parts[0] serverId := parts[1] - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient server, apiResponse, err := client.ServersApi.DatacentersServersFindById(ctx, datacenterId, serverId).Depth(3).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_server_boot_device_selection.go b/ionoscloud/resource_server_boot_device_selection.go index e82f17e96..1f7fb0aab 100644 --- a/ionoscloud/resource_server_boot_device_selection.go +++ b/ionoscloud/resource_server_boot_device_selection.go @@ -89,7 +89,7 @@ func resourceServerBootDeviceSelectionCreate(ctx context.Context, d *schema.Reso } func resourceServerBootDeviceSelectionRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} + ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} dcId := d.Get("datacenter_id").(string) serverId := d.Get("server_id").(string) @@ -133,7 +133,7 @@ func resourceServerBootDeviceSelectionUpdate(ctx context.Context, d *schema.Reso } func resourceServerBootDeviceSelectionDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudAPIClient, Meta: meta, D: d} + ss := cloudapiserver.Service{Client: meta.(services.SdkBundle).CloudApiClient, Meta: meta, D: d} dcId := d.Get("datacenter_id").(string) serverId := d.Get("server_id").(string) diff --git a/ionoscloud/resource_server_test.go b/ionoscloud/resource_server_test.go index 9d668306a..0d6dba453 100644 --- a/ionoscloud/resource_server_test.go +++ b/ionoscloud/resource_server_test.go @@ -870,7 +870,7 @@ func TestAccServerBootDeviceSelection(t *testing.T) { } func testAccCheckServerDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -903,7 +903,7 @@ func testAccCheckServerDestroyCheck(s *terraform.State) error { func testAccCheckServerAndVolumesDestroyed(dcName string) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) defer cancel() @@ -946,7 +946,7 @@ func testAccCheckServerAndVolumesDestroyed(dcName string) resource.TestCheckFunc func testAccCheckServerExists(serverName string, server *ionoscloud.Server) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[serverName] diff --git a/ionoscloud/resource_share.go b/ionoscloud/resource_share.go index 57a2d5397..78e7b7198 100644 --- a/ionoscloud/resource_share.go +++ b/ionoscloud/resource_share.go @@ -51,7 +51,7 @@ func resourceShare() *schema.Resource { } func resourceShareCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.GroupShare{ Properties: &ionoscloud.GroupShareProperties{}, @@ -82,7 +82,7 @@ func resourceShareCreate(ctx context.Context, d *schema.ResourceData, meta inter } func resourceShareRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient rsp, apiResponse, err := client.UserManagementApi.UmGroupsSharesFindByResourceId(ctx, d.Get("group_id").(string), d.Get("resource_id").(string)).Execute() logApiRequestTime(apiResponse) @@ -107,7 +107,7 @@ func resourceShareRead(ctx context.Context, d *schema.ResourceData, meta interfa } func resourceShareUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient tempSharePrivilege := d.Get("share_privilege").(bool) tempEditPrivilege := d.Get("edit_privilege").(bool) @@ -135,7 +135,7 @@ func resourceShareUpdate(ctx context.Context, d *schema.ResourceData, meta inter } func resourceShareDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient groupId := d.Get("group_id").(string) resourceId := d.Get("resource_id").(string) @@ -177,7 +177,7 @@ func resourceShareImporter(ctx context.Context, d *schema.ResourceData, meta int grpId := parts[0] rscId := parts[1] - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient share, apiResponse, err := client.UserManagementApi.UmGroupsSharesFindByResourceId(ctx, grpId, rscId).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/resource_share_test.go b/ionoscloud/resource_share_test.go index 1603bda11..d38866f22 100644 --- a/ionoscloud/resource_share_test.go +++ b/ionoscloud/resource_share_test.go @@ -57,7 +57,7 @@ func TestAccShareBasic(t *testing.T) { } func testAccCheckShareDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) @@ -91,7 +91,7 @@ func testAccCheckShareDestroyCheck(s *terraform.State) error { func testAccCheckShareExists(n string, share *ionoscloud.GroupShare) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_snapshot.go b/ionoscloud/resource_snapshot.go index 024dfa84e..425082f68 100644 --- a/ionoscloud/resource_snapshot.go +++ b/ionoscloud/resource_snapshot.go @@ -122,7 +122,7 @@ func resourceSnapshot() *schema.Resource { } func resourceSnapshotCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) volumeId := d.Get("volume_id").(string) @@ -159,7 +159,7 @@ func resourceSnapshotCreate(ctx context.Context, d *schema.ResourceData, meta in } func resourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient snapshot, apiResponse, err := client.SnapshotsApi.SnapshotsFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -181,7 +181,7 @@ func resourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta inte } func resourceSnapshotUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient name := d.Get("name").(string) input := ionoscloud.NewSnapshotProperties() @@ -229,7 +229,7 @@ func resourceSnapshotUpdate(ctx context.Context, d *schema.ResourceData, meta in } func resourceSnapshotDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient apiResponse, err := client.SnapshotsApi.SnapshotsDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -247,7 +247,7 @@ func resourceSnapshotDelete(ctx context.Context, d *schema.ResourceData, meta in } func resourceSnapshotImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient snapshotId := d.Id() snapshot, apiResponse, err := client.SnapshotsApi.SnapshotsFindById(ctx, d.Id()).Execute() diff --git a/ionoscloud/resource_snapshot_test.go b/ionoscloud/resource_snapshot_test.go index 399185ccd..9f1661c7a 100644 --- a/ionoscloud/resource_snapshot_test.go +++ b/ionoscloud/resource_snapshot_test.go @@ -131,7 +131,7 @@ func TestAccSnapshotBasic(t *testing.T) { } func testAccCheckSnapshotDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -160,7 +160,7 @@ func testAccCheckSnapshotDestroyCheck(s *terraform.State) error { func testAccCheckSnapshotExists(n string, snapshot *ionoscloud.Snapshot) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/resource_target_group.go b/ionoscloud/resource_target_group.go index 35043cba5..35e18f6e6 100644 --- a/ionoscloud/resource_target_group.go +++ b/ionoscloud/resource_target_group.go @@ -171,7 +171,7 @@ func resourceTargetGroup() *schema.Resource { } func resourceTargetGroupCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient targetGroup := ionoscloud.TargetGroup{ Properties: &ionoscloud.TargetGroupProperties{}, @@ -227,7 +227,7 @@ func resourceTargetGroupCreate(ctx context.Context, d *schema.ResourceData, meta } func resourceTargetGroupRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient rsp, apiResponse, err := client.TargetGroupsApi.TargetgroupsFindByTargetGroupId(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -249,7 +249,7 @@ func resourceTargetGroupRead(ctx context.Context, d *schema.ResourceData, meta i } func resourceTargetGroupUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient targetGroup := ionoscloud.TargetGroupPut{ Properties: &ionoscloud.TargetGroupProperties{}, @@ -303,7 +303,7 @@ func resourceTargetGroupUpdate(ctx context.Context, d *schema.ResourceData, meta } func resourceTargetGroupDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient apiResponse, err := client.TargetGroupsApi.TargetGroupsDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -323,7 +323,7 @@ func resourceTargetGroupDelete(ctx context.Context, d *schema.ResourceData, meta } func resourceTargetGroupImport(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient groupIp := d.Id() diff --git a/ionoscloud/resource_target_group_test.go b/ionoscloud/resource_target_group_test.go index a70423495..f6fcaeea0 100644 --- a/ionoscloud/resource_target_group_test.go +++ b/ionoscloud/resource_target_group_test.go @@ -195,7 +195,7 @@ func TestAccTargetGroupBasic(t *testing.T) { } func testAccCheckTargetGroupDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) @@ -225,7 +225,7 @@ func testAccCheckTargetGroupDestroyCheck(s *terraform.State) error { func testAccCheckTargetGroupExists(n string, targetGroup *ionoscloud.TargetGroup) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] if !ok { diff --git a/ionoscloud/resource_user.go b/ionoscloud/resource_user.go index 7c0cd9b69..ae6b648b6 100644 --- a/ionoscloud/resource_user.go +++ b/ionoscloud/resource_user.go @@ -88,7 +88,7 @@ func resourceUser() *schema.Resource { } func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.UserPost{ Properties: &ionoscloud.UserPropertiesPost{}, } @@ -161,7 +161,7 @@ func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interf } func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient user, apiResponse, err := client.UserManagementApi.UmUsersFindById(ctx, d.Id()).Depth(1).Execute() logApiRequestTime(apiResponse) @@ -187,7 +187,7 @@ func resourceUserRead(ctx context.Context, d *schema.ResourceData, meta interfac } func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient foundUser, apiResponse, err := client.UserManagementApi.UmUsersFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -288,7 +288,7 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf } func resourceUserDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient apiResponse, err := client.UserManagementApi.UmUsersDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) @@ -307,7 +307,7 @@ func resourceUserDelete(ctx context.Context, d *schema.ResourceData, meta interf } func resourceUserImporter(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient userId := d.Id() diff --git a/ionoscloud/resource_user_test.go b/ionoscloud/resource_user_test.go index 5cb599eb0..b7cf1f8c5 100644 --- a/ionoscloud/resource_user_test.go +++ b/ionoscloud/resource_user_test.go @@ -136,7 +136,7 @@ func TestAccUserBasic(t *testing.T) { } func testAccCheckUserDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) if cancel != nil { @@ -164,7 +164,7 @@ func testAccCheckUserDestroyCheck(s *terraform.State) error { func testAccCheckUserExists(n string, user *ionoscloud.User) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] if !ok { @@ -199,7 +199,7 @@ func testAccCheckUserExists(n string, user *ionoscloud.User) resource.TestCheckF func testAccRemoveUserFromGroup(group, user string) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient gr, ok := s.RootModule().Resources[group] if !ok { return fmt.Errorf("testAccRemoveUserFromGroup: group not found: %s", group) diff --git a/ionoscloud/resource_vcpu_server_test.go b/ionoscloud/resource_vcpu_server_test.go index 11d03ad52..2121836b6 100644 --- a/ionoscloud/resource_vcpu_server_test.go +++ b/ionoscloud/resource_vcpu_server_test.go @@ -758,7 +758,7 @@ func TestAccServerVCPUWithLabels(t *testing.T) { } func testAccCheckServerVCPUDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) @@ -791,7 +791,7 @@ func testAccCheckServerVCPUDestroyCheck(s *terraform.State) error { func testAccCheckServerVCPUAndVolumesDestroyed(dcName string) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Default) defer cancel() @@ -834,7 +834,7 @@ func testAccCheckServerVCPUAndVolumesDestroyed(dcName string) resource.TestCheck func testAccCheckServerVCPUExists(serverName string, server *ionoscloud.Server) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[serverName] diff --git a/ionoscloud/resource_volume.go b/ionoscloud/resource_volume.go index 94a2f5577..7beea5088 100644 --- a/ionoscloud/resource_volume.go +++ b/ionoscloud/resource_volume.go @@ -196,7 +196,7 @@ func checkVolumeImmutableFields(_ context.Context, diff *schema.ResourceDiff, _ func resourceVolumeCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient var image, imageAlias string @@ -300,7 +300,7 @@ func resourceVolumeCreate(ctx context.Context, d *schema.ResourceData, meta inte } func resourceVolumeRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) serverID := d.Get("server_id").(string) @@ -335,7 +335,7 @@ func resourceVolumeRead(ctx context.Context, d *schema.ResourceData, meta interf } func resourceVolumeUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient properties := ionoscloud.VolumeProperties{} dcId := d.Get("datacenter_id").(string) @@ -397,7 +397,7 @@ func resourceVolumeUpdate(ctx context.Context, d *schema.ResourceData, meta inte } func resourceVolumeDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := d.Get("datacenter_id").(string) @@ -423,7 +423,7 @@ func resourceVolumeImporter(ctx context.Context, d *schema.ResourceData, meta in return nil, fmt.Errorf("invalid import id %q. Expecting {datacenter}/{server}/{volume}", d.Id()) } - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient dcId := parts[0] srvId := parts[1] diff --git a/ionoscloud/resource_volume_test.go b/ionoscloud/resource_volume_test.go index 8d95dd07b..4efc42e04 100644 --- a/ionoscloud/resource_volume_test.go +++ b/ionoscloud/resource_volume_test.go @@ -167,7 +167,7 @@ func TestAccVolumeResolveImageName(t *testing.T) { } func testAccCheckVolumeDestroyCheck(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient ctx, cancel := context.WithTimeout(context.Background(), *resourceDefaultTimeouts.Delete) @@ -197,7 +197,7 @@ func testAccCheckVolumeDestroyCheck(s *terraform.State) error { func testAccCheckVolumeExists(n string, volume *ionoscloud.Volume) resource.TestCheckFunc { return func(s *terraform.State) error { - client := testAccProvider.Meta().(services.SdkBundle).CloudAPIClient + client := testAccProvider.Meta().(services.SdkBundle).CloudApiClient rs, ok := s.RootModule().Resources[n] diff --git a/ionoscloud/testUtil.go b/ionoscloud/testUtil.go index 6ab1ecfa0..f82958c85 100644 --- a/ionoscloud/testUtil.go +++ b/ionoscloud/testUtil.go @@ -35,7 +35,7 @@ func getMockedClient(jsonResponse string) interface{} { cfg.HTTPClient = ts.Client() return services.SdkBundle{ - CloudAPIClient: ionoscloud.NewAPIClient(cfg), + CloudApiClient: ionoscloud.NewAPIClient(cfg), } } diff --git a/services/clients.go b/services/clients.go index a2075ceab..cf0db1e7a 100644 --- a/services/clients.go +++ b/services/clients.go @@ -22,7 +22,7 @@ import ( ) type SdkBundle struct { - CloudAPIClient *ionoscloud.APIClient + CloudApiClient *ionoscloud.APIClient InMemoryDBClient *inmemorydb.InMemoryDBClient PsqlClient *dbaas.PsqlClient MongoClient *dbaas.MongoClient diff --git a/services/cloudapi/cloudapiserver/server.go b/services/cloudapi/cloudapiserver/server.go index 3729c2a3f..ffcd4442d 100644 --- a/services/cloudapi/cloudapiserver/server.go +++ b/services/cloudapi/cloudapiserver/server.go @@ -50,7 +50,7 @@ type Service struct { // The concrete Service is created with a dummy ResourceData reference which has the ID of the Server this service will interact with // This ensure state tracking functions such as WaitForResourceToBeReady use the correct ID func NewUnboundService(serverID string, meta any) UnboundService { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient d := &schema.ResourceData{} d.SetId(serverID) return &Service{client, meta, d} diff --git a/services/cloudapi/state.go b/services/cloudapi/state.go index cbb6242d6..1d704a492 100644 --- a/services/cloudapi/state.go +++ b/services/cloudapi/state.go @@ -34,7 +34,7 @@ func GetStateChangeConf(meta interface{}, d *schema.ResourceData, location strin // resourceStateRefreshFunc tracks progress of a request func resourceStateRefreshFunc(meta interface{}, path string) retry.StateRefreshFunc { return func() (interface{}, string, error) { - client := meta.(services.SdkBundle).CloudAPIClient + client := meta.(services.SdkBundle).CloudApiClient log.Printf("[INFO] Checking PATH %s\n", path) if path == "" { From 41e4198da3e4ffb4f0bc3dd0b803e84e5952af97 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Mon, 25 Nov 2024 10:31:05 +0200 Subject: [PATCH 27/30] fix: make description computed --- .../data_source_object_storage_accesskey.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go index d883d6c77..606e1628d 100644 --- a/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go @@ -59,7 +59,7 @@ func (d *accessKeyDataSource) Schema(ctx context.Context, req datasource.SchemaR }, "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.", From 045db72419f723d0635986568afb42aa4473582e Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Mon, 25 Nov 2024 14:00:03 +0200 Subject: [PATCH 28/30] feat: added option to get access key using accesskeyid or description --- docs/data-sources/object_storage_accesskey.md | 4 +- go.mod | 2 +- .../data_source_object_storage_accesskey.go | 89 ++++++-- ...ta_source_object_storage_accesskey_test.go | 75 +++++++ .../objectstoragemanagement/accesskeys.go | 7 + .../sdk-go-object-storage-management/LICENSE | 201 ++++++++++++++++++ .../configuration.go | 2 +- vendor/modules.txt | 2 +- 8 files changed, 366 insertions(+), 16 deletions(-) create mode 100644 vendor/github.com/ionos-cloud/sdk-go-object-storage-management/LICENSE diff --git a/docs/data-sources/object_storage_accesskey.md b/docs/data-sources/object_storage_accesskey.md index d70439ee5..f22580a5a 100644 --- a/docs/data-sources/object_storage_accesskey.md +++ b/docs/data-sources/object_storage_accesskey.md @@ -22,7 +22,9 @@ data "ionoscloud_object_storage_accesskey" "example" { ## Argument Reference - * `id` - (Required) Id of an existing object storage accesskey that you want to search for. + * `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 diff --git a/go.mod b/go.mod index 81b94dc6d..2e8d552d2 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 ) -replace github.com/ionos-cloud/sdk-go-object-storage-management v1.0.0 => /home/radu/work/rubygeneration/sdk-go-object-storage-management +replace github.com/ionos-cloud/sdk-go-object-storage-management v1.0.0 => /home/radu/work/sdk-go-object-storage-management require ( github.com/hashicorp/go-retryablehttp v0.7.7 // indirect diff --git a/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go index 606e1628d..f499db21c 100644 --- a/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go @@ -10,6 +10,7 @@ import ( "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) @@ -54,14 +55,17 @@ func (d *accessKeyDataSource) Schema(ctx context.Context, req datasource.SchemaR resp.Schema = schema.Schema{ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ - Required: true, + 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, }, @@ -90,17 +94,78 @@ func (d *accessKeyDataSource) Read(ctx context.Context, req datasource.ReadReque return } - id := data.ID.String() - - 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 + 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 + + if !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 + } + } else if !data.AccessKey.IsNull() { + accessKeys, apiResponse, err = d.client.ListAccessKeysFilter(ctx, accessKeyId) + 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 + } + } else if !data.Description.IsNull() { + accessKeys, apiResponse, err = d.client.ListAccessKeys(ctx) + 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 + } } objectStorageManagementService.SetAccessKeyPropertiesToDataSourcePlan(data, accessKey) 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 index 59f932699..2ce131768 100644 --- a/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey_test.go +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey_test.go @@ -30,6 +30,46 @@ func TestAccS3AccesskeyDataSource(t *testing.T) { 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"), + ), + }, }, }) } @@ -41,3 +81,38 @@ data "ionoscloud_object_storage_accesskey" "testres" { } `) } + +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/services/objectstoragemanagement/accesskeys.go b/services/objectstoragemanagement/accesskeys.go index 839564fe2..3962d7c05 100644 --- a/services/objectstoragemanagement/accesskeys.go +++ b/services/objectstoragemanagement/accesskeys.go @@ -46,6 +46,13 @@ func (c *Client) ListAccessKeys(ctx context.Context) (objectstoragemanagement.Ac return accessKeys, apiResponse, err } +// ListAccessKeys 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() 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/configuration.go b/vendor/github.com/ionos-cloud/sdk-go-object-storage-management/configuration.go index 8e4305b26..6f9c35140 100644 --- 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 @@ -134,7 +134,7 @@ func NewConfiguration(username, password, token, hostUrl string) *Configuration cfg := &Configuration{ DefaultHeader: make(map[string]string), DefaultQueryParams: url.Values{}, - UserAgent: "ionos-cloud-ionoscloud_object_storage_management/v1.0.0", + UserAgent: "ionos-cloud-sdk-go-object-storage-management/v1.0.0", Debug: false, Username: username, Password: password, diff --git a/vendor/modules.txt b/vendor/modules.txt index 1de847ddb..a0f49815e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -355,7 +355,7 @@ 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 => /home/radu/work/rubygeneration/sdk-go-object-storage-management +# github.com/ionos-cloud/sdk-go-object-storage-management v1.0.0 => /home/radu/work/sdk-go-object-storage-management ## explicit; go 1.18 github.com/ionos-cloud/sdk-go-object-storage-management # github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.1 From 3e7544bebdcbd7388bb2ec7bf91803d4445d5ac9 Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Mon, 25 Nov 2024 17:12:58 +0200 Subject: [PATCH 29/30] doc: added changelog, summary, use sdk from github --- CHANGELOG.md | 6 ++++++ gitbook_docs/summary.md | 7 +++++++ go.mod | 2 -- go.sum | 2 ++ .../data_source_object_storage_accesskey_test.go | 4 ++-- .../data_source_object_storage_region_test.go | 4 ++-- .../resource_object_storage_accesskey_test.go | 4 ++-- services/objectstoragemanagement/accesskeys.go | 6 +++--- vendor/modules.txt | 2 +- 9 files changed, 25 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07cf09fe6..f8fd595f4 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/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 2e8d552d2..7b8c8cb37 100644 --- a/go.mod +++ b/go.mod @@ -39,8 +39,6 @@ require ( gopkg.in/yaml.v3 v3.0.1 ) -replace github.com/ionos-cloud/sdk-go-object-storage-management v1.0.0 => /home/radu/work/sdk-go-object-storage-management - require ( github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect 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/services/objectstoragemanagement/data_source_object_storage_accesskey_test.go b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey_test.go index 2ce131768..0054b9ae8 100644 --- a/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey_test.go +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey_test.go @@ -1,5 +1,5 @@ -//go:build all || objectstoragemanagement -// +build all objectstoragemanagement +//go:build all || objectstorage || objectstoragemanagement +// +build all objectstorage objectstoragemanagement package objectstoragemanagement_test 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 index b93a60765..1bcbe4e1b 100644 --- a/internal/framework/services/objectstoragemanagement/data_source_object_storage_region_test.go +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_region_test.go @@ -1,5 +1,5 @@ -//go:build all || objectstoragemanagement -// +build all objectstoragemanagement +//go:build all || objectstorage || objectstoragemanagement +// +build all objectstorage objectstoragemanagement package objectstoragemanagement_test diff --git a/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey_test.go b/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey_test.go index a8ac5f820..5e6b10bed 100644 --- a/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey_test.go +++ b/internal/framework/services/objectstoragemanagement/resource_object_storage_accesskey_test.go @@ -1,5 +1,5 @@ -//go:build all || objectstoragemanagement -// +build all objectstoragemanagement +//go:build all || objectstorage || objectstoragemanagement +// +build all objectstorage objectstoragemanagement package objectstoragemanagement_test diff --git a/services/objectstoragemanagement/accesskeys.go b/services/objectstoragemanagement/accesskeys.go index 3962d7c05..16e2f2451 100644 --- a/services/objectstoragemanagement/accesskeys.go +++ b/services/objectstoragemanagement/accesskeys.go @@ -46,9 +46,9 @@ func (c *Client) ListAccessKeys(ctx context.Context) (objectstoragemanagement.Ac return accessKeys, apiResponse, err } -// ListAccessKeys 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() +// 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 } diff --git a/vendor/modules.txt b/vendor/modules.txt index a0f49815e..de5e474fe 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -355,7 +355,7 @@ 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 => /home/radu/work/sdk-go-object-storage-management +# 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 From 50958b2a9a28c088d4a198b5ece0f9ef11c85d1e Mon Sep 17 00:00:00 2001 From: Radu Mocanu Date: Mon, 25 Nov 2024 17:20:06 +0200 Subject: [PATCH 30/30] fix: added check for when no identifier is set or calls fail, linter errors --- .../data_source_object_storage_accesskey.go | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go index f499db21c..eb5900b5a 100644 --- a/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go +++ b/internal/framework/services/objectstoragemanagement/data_source_object_storage_accesskey.go @@ -95,15 +95,15 @@ func (d *accessKeyDataSource) Read(ctx context.Context, req datasource.ReadReque } id := data.ID.ValueString() - accessKeyId := data.AccessKey.ValueString() + accessKeyID := data.AccessKey.ValueString() description := data.Description.ValueString() var accessKey objectstoragemanagementApi.AccessKeyRead var accessKeys objectstoragemanagementApi.AccessKeyReadList var apiResponse *objectstoragemanagementApi.APIResponse var err error - - if !data.ID.IsNull() { + switch { + case !data.ID.IsNull(): accessKey, apiResponse, err = d.client.GetAccessKey(ctx, id) if apiResponse.HttpNotFound() { @@ -114,19 +114,19 @@ func (d *accessKeyDataSource) Read(ctx context.Context, req datasource.ReadReque resp.Diagnostics.AddError("an error occurred while fetching the accesskey with", err.Error()) return } - if !data.AccessKey.IsNull() && *accessKey.Properties.AccessKey != accessKeyId { + if !data.AccessKey.IsNull() && *accessKey.Properties.AccessKey != accessKeyID { resp.Diagnostics.AddError( - "accesskeyId does not match", + "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, + *accessKey.Id, *accessKey.Properties.AccessKey, accessKeyID, ), ) return } if !data.Description.IsNull() && *accessKey.Properties.Description != description { resp.Diagnostics.AddError( - "accesskeyId does not match", + "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, @@ -134,8 +134,12 @@ func (d *accessKeyDataSource) Read(ctx context.Context, req datasource.ReadReque ) return } - } else if !data.AccessKey.IsNull() { - accessKeys, apiResponse, err = d.client.ListAccessKeysFilter(ctx, accessKeyId) + 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 { @@ -144,7 +148,7 @@ func (d *accessKeyDataSource) Read(ctx context.Context, req datasource.ReadReque } if !data.Description.IsNull() && *accessKey.Properties.Description != description { resp.Diagnostics.AddError( - "accesskeyId does not match", + "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, @@ -152,8 +156,12 @@ func (d *accessKeyDataSource) Read(ctx context.Context, req datasource.ReadReque ) return } - } else if !data.Description.IsNull() { - accessKeys, apiResponse, err = d.client.ListAccessKeys(ctx) + 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 { @@ -166,6 +174,9 @@ func (d *accessKeyDataSource) Read(ctx context.Context, req datasource.ReadReque 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)