diff --git a/go.mod b/go.mod index 05a80ef83..2096512cb 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.23 require ( github.com/aiven/aiven-go-client/v2 v2.27.0 - github.com/aiven/go-client-codegen v0.30.0 + github.com/aiven/go-client-codegen v0.30.1-0.20240913123648-ebf410109925 github.com/avast/retry-go v3.0.0+incompatible github.com/dave/jennifer v1.7.1 github.com/docker/go-units v0.5.0 diff --git a/go.sum b/go.sum index 11d73265d..5c8b96114 100644 --- a/go.sum +++ b/go.sum @@ -203,6 +203,8 @@ github.com/aiven/go-api-schemas v1.85.0 h1:wpTCQWjTLKQvVQq184u6Ji0ZksDZkNPqS6f6z github.com/aiven/go-api-schemas v1.85.0/go.mod h1:/F7Rr8UVErsRxhgGN7CSo+Ac/uAg/OiAVCEKCfm3VAo= github.com/aiven/go-client-codegen v0.30.0 h1:K+FZW4MvA68xMy5B2p85npeZ3qOwhAcDw/GAhmrJyWY= github.com/aiven/go-client-codegen v0.30.0/go.mod h1:FfbH32Xb+Hx5zeKTIug1Y8SfMeB+AKNRzxgrzkts2oA= +github.com/aiven/go-client-codegen v0.30.1-0.20240913123648-ebf410109925 h1:oN5ZXpSALpf+jQIn4OSbHFgF0dzIxb1gNb08htspyts= +github.com/aiven/go-client-codegen v0.30.1-0.20240913123648-ebf410109925/go.mod h1:FfbH32Xb+Hx5zeKTIug1Y8SfMeB+AKNRzxgrzkts2oA= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= diff --git a/internal/sdkprovider/service/serviceintegration/service_integration.go b/internal/sdkprovider/service/serviceintegration/service_integration.go index bc0d7fe3e..832642014 100644 --- a/internal/sdkprovider/service/serviceintegration/service_integration.go +++ b/internal/sdkprovider/service/serviceintegration/service_integration.go @@ -9,7 +9,7 @@ import ( "github.com/aiven/aiven-go-client/v2" avngen "github.com/aiven/go-client-codegen" - codegenintegrations "github.com/aiven/go-client-codegen/handler/serviceintegration" + "github.com/aiven/go-client-codegen/handler/service" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" @@ -45,11 +45,11 @@ func aivenServiceIntegrationSchema() map[string]*schema.Schema { Type: schema.TypeString, }, "integration_type": { - Description: "Type of the service integration. Possible values: " + schemautil.JoinQuoted(codegenintegrations.IntegrationTypeChoices(), ", ", "`"), + Description: "Type of the service integration. Possible values: " + schemautil.JoinQuoted(service.IntegrationTypeChoices(), ", ", "`"), ForceNew: true, Required: true, Type: schema.TypeString, - ValidateFunc: validation.StringInSlice(codegenintegrations.IntegrationTypeChoices(), false), + ValidateFunc: validation.StringInSlice(service.IntegrationTypeChoices(), false), }, "project": { Description: "Project the integration belongs to.", @@ -126,10 +126,10 @@ func resourceServiceIntegrationCreate(ctx context.Context, d *schema.ResourceDat } } - req := &codegenintegrations.ServiceIntegrationCreateIn{ + req := &service.ServiceIntegrationCreateIn{ DestEndpointId: plainEndpointID(schemautil.OptionalStringPointer(d, "destination_endpoint_id")), DestService: schemautil.OptionalStringPointer(d, "destination_service_name"), - IntegrationType: codegenintegrations.IntegrationType(integrationType), + IntegrationType: service.IntegrationType(integrationType), SourceEndpointId: plainEndpointID(schemautil.OptionalStringPointer(d, "source_endpoint_id")), SourceService: schemautil.OptionalStringPointer(d, "source_service_name"), } @@ -198,7 +198,7 @@ func resourceServiceIntegrationUpdate(ctx context.Context, d *schema.ResourceDat ctx, projectName, integrationID, - &codegenintegrations.ServiceIntegrationUpdateIn{ + &service.ServiceIntegrationUpdateIn{ UserConfig: userConfig, }, ) @@ -226,7 +226,7 @@ func resourceServiceIntegrationDelete(ctx context.Context, d *schema.ResourceDat return nil } -func resourceServiceIntegrationCheckForPreexistingResource(ctx context.Context, d *schema.ResourceData, client avngen.Client) (*codegenintegrations.ServiceIntegrationOut, error) { +func resourceServiceIntegrationCheckForPreexistingResource(ctx context.Context, d *schema.ResourceData, client avngen.Client) (*service.ServiceIntegrationOut, error) { projectName := d.Get("project").(string) integrationType := d.Get("integration_type").(string) sourceServiceName := d.Get("source_service_name").(string) @@ -303,7 +303,7 @@ func resourceServiceIntegrationWaitUntilActive(ctx context.Context, d *schema.Re func resourceServiceIntegrationCopyAPIResponseToTerraform( d *schema.ResourceData, - res *codegenintegrations.ServiceIntegrationGetOut, + res *service.ServiceIntegrationGetOut, project string, ) error { if err := d.Set("project", project); err != nil { diff --git a/internal/sdkprovider/service/serviceintegration/service_integration_endpoint.go b/internal/sdkprovider/service/serviceintegration/service_integration_endpoint.go index 87ac2232d..deb33bbfc 100644 --- a/internal/sdkprovider/service/serviceintegration/service_integration_endpoint.go +++ b/internal/sdkprovider/service/serviceintegration/service_integration_endpoint.go @@ -6,7 +6,7 @@ import ( "slices" avngen "github.com/aiven/go-client-codegen" - codegenintegrations "github.com/aiven/go-client-codegen/handler/serviceintegration" + "github.com/aiven/go-client-codegen/handler/service" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" @@ -17,7 +17,7 @@ import ( "github.com/aiven/terraform-provider-aiven/internal/sdkprovider/userconfig/serviceintegrationendpoint" ) -func hasEndpointConfig[T string | codegenintegrations.EndpointType](kind T) bool { +func hasEndpointConfig[T string | service.EndpointType](kind T) bool { return slices.Contains(serviceintegrationendpoint.UserConfigTypes(), string(kind)) } @@ -37,11 +37,11 @@ func aivenServiceIntegrationEndpointSchema() map[string]*schema.Schema { }, "endpoint_type": { Description: "Type of the service integration endpoint. Possible values: " + - schemautil.JoinQuoted(codegenintegrations.EndpointTypeChoices(), ", ", "`"), + schemautil.JoinQuoted(service.EndpointTypeChoices(), ", ", "`"), ForceNew: true, Required: true, Type: schema.TypeString, - ValidateFunc: validation.StringInSlice(codegenintegrations.EndpointTypeChoices(), false), + ValidateFunc: validation.StringInSlice(service.EndpointTypeChoices(), false), }, "endpoint_config": { Description: "Integration endpoint specific backend configuration", @@ -80,9 +80,9 @@ func resourceServiceIntegrationEndpointCreate(ctx context.Context, d *schema.Res projectName := d.Get("project").(string) endpointType := d.Get("endpoint_type").(string) - req := &codegenintegrations.ServiceIntegrationEndpointCreateIn{ + req := &service.ServiceIntegrationEndpointCreateIn{ EndpointName: d.Get("endpoint_name").(string), - EndpointType: codegenintegrations.EndpointType(endpointType), + EndpointType: service.EndpointType(endpointType), UserConfig: make(map[string]interface{}), } @@ -111,7 +111,7 @@ func resourceServiceIntegrationEndpointRead(ctx context.Context, d *schema.Resou return err } - endpoint, err := client.ServiceIntegrationEndpointGet(ctx, projectName, endpointID, codegenintegrations.ServiceIntegrationEndpointGetIncludeSecrets(true)) + endpoint, err := client.ServiceIntegrationEndpointGet(ctx, projectName, endpointID, service.ServiceIntegrationEndpointGetIncludeSecrets(true)) if err != nil { return schemautil.ResourceReadHandleNotFound(err, d) } @@ -137,7 +137,7 @@ func resourceServiceIntegrationEndpointUpdate(ctx context.Context, d *schema.Res } endpointType := d.Get("endpoint_type").(string) - req := &codegenintegrations.ServiceIntegrationEndpointUpdateIn{ + req := &service.ServiceIntegrationEndpointUpdateIn{ UserConfig: make(map[string]interface{}), } @@ -175,7 +175,7 @@ func resourceServiceIntegrationEndpointDelete(ctx context.Context, d *schema.Res func copyServiceIntegrationEndpointPropertiesFromAPIResponseToTerraform( d *schema.ResourceData, - endpoint *codegenintegrations.ServiceIntegrationEndpointGetOut, + endpoint *service.ServiceIntegrationEndpointGetOut, project string, ) error { if err := d.Set("project", project); err != nil {