From a6eaec49c0c26163a04736bb319ab31f33ec484b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 22 Oct 2023 21:59:13 +0000 Subject: [PATCH] build(deps): bump github.com/aiven/aiven-go-client/v2 from 2.1.0 to 2.2.0 (#1400) --- go.mod | 2 +- go.sum | 4 +-- .../sdkprovider/service/opensearch/common.go | 28 +++++++++---------- .../opensearch/opensearch_acl_config.go | 10 +++---- .../opensearch_acl_config_data_source.go | 2 +- .../opensearch/opensearch_acl_config_test.go | 2 +- .../service/opensearch/opensearch_acl_rule.go | 16 +++++------ .../opensearch_acl_rule_data_source.go | 4 +-- .../opensearch/opensearch_acl_rule_test.go | 4 +-- 9 files changed, 36 insertions(+), 36 deletions(-) diff --git a/go.mod b/go.mod index 079de931b..10714d534 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/aiven/terraform-provider-aiven go 1.21.1 require ( - github.com/aiven/aiven-go-client/v2 v2.1.0 + github.com/aiven/aiven-go-client/v2 v2.2.0 github.com/avast/retry-go v3.0.0+incompatible github.com/dave/jennifer v1.7.0 github.com/docker/go-units v0.5.0 diff --git a/go.sum b/go.sum index 1f66c7661..8151e42ce 100644 --- a/go.sum +++ b/go.sum @@ -201,8 +201,8 @@ github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/aiven/aiven-go-client/v2 v2.1.0 h1:n8k34HpEQ7KgxRcyX/F5WKR6xh8MSAM6TtPHnghDNGg= -github.com/aiven/aiven-go-client/v2 v2.1.0/go.mod h1:x0xhzxWEKAwKv0xY5FvECiI6tesWshcPHvjwl0B/1SU= +github.com/aiven/aiven-go-client/v2 v2.2.0 h1:ZPeIMF3Jt/wPrwFj3mO1Z8KtP9OHc6GpMtZXmwfBsE4= +github.com/aiven/aiven-go-client/v2 v2.2.0/go.mod h1:x0xhzxWEKAwKv0xY5FvECiI6tesWshcPHvjwl0B/1SU= github.com/aiven/go-api-schemas v1.38.0 h1:l+OOMYRG1tddTFQN4OihE6+sxVdP5fKeRN/9uoKFnkk= github.com/aiven/go-api-schemas v1.38.0/go.mod h1:/bPxBUHza/2Aeer6hIIdB++GxKiw9K1KCBtRa2rtZ5I= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= diff --git a/internal/sdkprovider/service/opensearch/common.go b/internal/sdkprovider/service/opensearch/common.go index f4788e841..058b5c00c 100644 --- a/internal/sdkprovider/service/opensearch/common.go +++ b/internal/sdkprovider/service/opensearch/common.go @@ -20,26 +20,26 @@ func resourceOpenSearchACLModifyRemoteConfig( project string, serviceName string, client *aiven.Client, - modifiers ...func(*aiven.ElasticSearchACLConfig), + modifiers ...func(*aiven.OpenSearchACLConfig), ) error { resourceOpenSearchACLModifierMutex.Lock() defer resourceOpenSearchACLModifierMutex.Unlock() - r, err := client.ElasticsearchACLs.Get(ctx, project, serviceName) + r, err := client.OpenSearchACLs.Get(ctx, project, serviceName) if err != nil { return err } - config := r.ElasticSearchACLConfig + config := r.OpenSearchACLConfig for i := range modifiers { modifiers[i](&config) } - _, err = client.ElasticsearchACLs.Update( + _, err = client.OpenSearchACLs.Update( ctx, project, serviceName, - aiven.ElasticsearchACLRequest{ElasticSearchACLConfig: config}) + aiven.OpenSearchACLRequest{OpenSearchACLConfig: config}) if err != nil { return err } @@ -48,35 +48,35 @@ func resourceOpenSearchACLModifyRemoteConfig( // some modifiers -func resourceElasticsearchACLModifierUpdateACLRule( +func resourceOpenSearchACLModifierUpdateACLRule( ctx context.Context, username string, index string, permission string, -) func(*aiven.ElasticSearchACLConfig) { - return func(cfg *aiven.ElasticSearchACLConfig) { +) func(*aiven.OpenSearchACLConfig) { + return func(cfg *aiven.OpenSearchACLConfig) { cfg.Add(resourceOpenSearchACLRuleMkAivenACL(username, index, permission)) // delete the old acl if it's there - if prevPerm, ok := resourceElasticsearchACLRuleGetPermissionFromACLResponse(*cfg, username, index); ok && prevPerm != permission { + if prevPerm, ok := resourceOpenSearchACLRuleGetPermissionFromACLResponse(*cfg, username, index); ok && prevPerm != permission { cfg.Delete(ctx, resourceOpenSearchACLRuleMkAivenACL(username, index, prevPerm)) } } } -func resourceElasticsearchACLModifierDeleteACLRule( +func resourceOpenSearchACLModifierDeleteACLRule( ctx context.Context, username string, index string, permission string, -) func(*aiven.ElasticSearchACLConfig) { - return func(cfg *aiven.ElasticSearchACLConfig) { +) func(*aiven.OpenSearchACLConfig) { + return func(cfg *aiven.OpenSearchACLConfig) { cfg.Delete(ctx, resourceOpenSearchACLRuleMkAivenACL(username, index, permission)) } } -func resourceElasticsearchACLModifierToggleConfigFields(enabled, extednedACL bool) func(*aiven.ElasticSearchACLConfig) { - return func(cfg *aiven.ElasticSearchACLConfig) { +func resourceOpenSearchACLModifierToggleConfigFields(enabled, extednedACL bool) func(*aiven.OpenSearchACLConfig) { + return func(cfg *aiven.OpenSearchACLConfig) { cfg.Enabled = enabled cfg.ExtendedAcl = extednedACL } diff --git a/internal/sdkprovider/service/opensearch/opensearch_acl_config.go b/internal/sdkprovider/service/opensearch/opensearch_acl_config.go index 304eb6fc6..a61edace1 100644 --- a/internal/sdkprovider/service/opensearch/opensearch_acl_config.go +++ b/internal/sdkprovider/service/opensearch/opensearch_acl_config.go @@ -53,7 +53,7 @@ func resourceOpenSearchACLConfigRead(ctx context.Context, d *schema.ResourceData return diag.FromErr(err) } - r, err := client.ElasticsearchACLs.Get(ctx, project, serviceName) + r, err := client.OpenSearchACLs.Get(ctx, project, serviceName) if err != nil { return diag.FromErr(schemautil.ResourceReadHandleNotFound(err, d)) } @@ -64,10 +64,10 @@ func resourceOpenSearchACLConfigRead(ctx context.Context, d *schema.ResourceData if err := d.Set("service_name", serviceName); err != nil { return diag.Errorf("error setting ACLs `service_name` for resource %s: %s", d.Id(), err) } - if err := d.Set("extended_acl", r.ElasticSearchACLConfig.ExtendedAcl); err != nil { + if err := d.Set("extended_acl", r.OpenSearchACLConfig.ExtendedAcl); err != nil { return diag.Errorf("error setting ACLs `extended_acl` for resource %s: %s", d.Id(), err) } - if err := d.Set("enabled", r.ElasticSearchACLConfig.Enabled); err != nil { + if err := d.Set("enabled", r.OpenSearchACLConfig.Enabled); err != nil { return diag.Errorf("error setting ACLs `enable` for resource %s: %s", d.Id(), err) } return nil @@ -79,7 +79,7 @@ func resourceOpenSearchACLConfigUpdate(ctx context.Context, d *schema.ResourceDa project := d.Get("project").(string) serviceName := d.Get("service_name").(string) - modifier := resourceElasticsearchACLModifierToggleConfigFields(d.Get("enabled").(bool), d.Get("extended_acl").(bool)) + modifier := resourceOpenSearchACLModifierToggleConfigFields(d.Get("enabled").(bool), d.Get("extended_acl").(bool)) err := resourceOpenSearchACLModifyRemoteConfig(ctx, project, serviceName, client, modifier) if err != nil { return diag.FromErr(err) @@ -96,7 +96,7 @@ func resourceOpenSearchACLConfigDelete(ctx context.Context, d *schema.ResourceDa project := d.Get("project").(string) serviceName := d.Get("service_name").(string) - modifier := resourceElasticsearchACLModifierToggleConfigFields(false, false) + modifier := resourceOpenSearchACLModifierToggleConfigFields(false, false) err := resourceOpenSearchACLModifyRemoteConfig(ctx, project, serviceName, client, modifier) if err != nil { return diag.FromErr(err) diff --git a/internal/sdkprovider/service/opensearch/opensearch_acl_config_data_source.go b/internal/sdkprovider/service/opensearch/opensearch_acl_config_data_source.go index 587fb2ddf..4cc38f9aa 100644 --- a/internal/sdkprovider/service/opensearch/opensearch_acl_config_data_source.go +++ b/internal/sdkprovider/service/opensearch/opensearch_acl_config_data_source.go @@ -24,7 +24,7 @@ func datasourceOpenSearchACLConfigRead(ctx context.Context, d *schema.ResourceDa projectName := d.Get("project").(string) serviceName := d.Get("service_name").(string) - acl, err := client.ElasticsearchACLs.Get(ctx, projectName, serviceName) + acl, err := client.OpenSearchACLs.Get(ctx, projectName, serviceName) if err != nil { return diag.FromErr(err) } diff --git a/internal/sdkprovider/service/opensearch/opensearch_acl_config_test.go b/internal/sdkprovider/service/opensearch/opensearch_acl_config_test.go index 0b2130773..9bd4b5981 100644 --- a/internal/sdkprovider/service/opensearch/opensearch_acl_config_test.go +++ b/internal/sdkprovider/service/opensearch/opensearch_acl_config_test.go @@ -82,7 +82,7 @@ func testAccCheckAivenOpenSearchACLConfigResourceDestroy(s *terraform.State) err return err } - r, err := c.ElasticsearchACLs.Get(ctx, projectName, serviceName) + r, err := c.OpenSearchACLs.Get(ctx, projectName, serviceName) if err != nil { if err.(aiven.Error).Status != 404 { return err diff --git a/internal/sdkprovider/service/opensearch/opensearch_acl_rule.go b/internal/sdkprovider/service/opensearch/opensearch_acl_rule.go index 9eadc54ef..7d5f783be 100644 --- a/internal/sdkprovider/service/opensearch/opensearch_acl_rule.go +++ b/internal/sdkprovider/service/opensearch/opensearch_acl_rule.go @@ -53,7 +53,7 @@ func ResourceOpenSearchACLRule() *schema.Resource { } } -func resourceElasticsearchACLRuleGetPermissionFromACLResponse(cfg aiven.ElasticSearchACLConfig, username, index string) (string, bool) { +func resourceOpenSearchACLRuleGetPermissionFromACLResponse(cfg aiven.OpenSearchACLConfig, username, index string) (string, bool) { for _, acl := range cfg.ACLs { if acl.Username != username { continue @@ -75,11 +75,11 @@ func resourceOpenSearchACLRuleRead(ctx context.Context, d *schema.ResourceData, return diag.FromErr(err) } - r, err := client.ElasticsearchACLs.Get(ctx, project, serviceName) + r, err := client.OpenSearchACLs.Get(ctx, project, serviceName) if err != nil { return diag.FromErr(schemautil.ResourceReadHandleNotFound(err, d)) } - permission, found := resourceElasticsearchACLRuleGetPermissionFromACLResponse(r.ElasticSearchACLConfig, username, index) + permission, found := resourceOpenSearchACLRuleGetPermissionFromACLResponse(r.OpenSearchACLConfig, username, index) if !found { return diag.FromErr(schemautil.ResourceReadHandleNotFound(err, d)) } @@ -103,10 +103,10 @@ func resourceOpenSearchACLRuleRead(ctx context.Context, d *schema.ResourceData, return nil } -func resourceOpenSearchACLRuleMkAivenACL(username, index, permission string) aiven.ElasticSearchACL { - return aiven.ElasticSearchACL{ +func resourceOpenSearchACLRuleMkAivenACL(username, index, permission string) aiven.OpenSearchACL { + return aiven.OpenSearchACL{ Username: username, - Rules: []aiven.ElasticsearchACLRule{ + Rules: []aiven.OpenSearchACLRule{ { Index: index, Permission: permission, @@ -124,7 +124,7 @@ func resourceOpenSearchACLRuleUpdate(ctx context.Context, d *schema.ResourceData index := d.Get("index").(string) permission := d.Get("permission").(string) - modifier := resourceElasticsearchACLModifierUpdateACLRule(ctx, username, index, permission) + modifier := resourceOpenSearchACLModifierUpdateACLRule(ctx, username, index, permission) err := resourceOpenSearchACLModifyRemoteConfig(ctx, project, serviceName, client, modifier) if err != nil { return diag.FromErr(err) @@ -144,7 +144,7 @@ func resourceOpenSearchACLRuleDelete(ctx context.Context, d *schema.ResourceData index := d.Get("index").(string) permission := d.Get("permission").(string) - modifier := resourceElasticsearchACLModifierDeleteACLRule(ctx, username, index, permission) + modifier := resourceOpenSearchACLModifierDeleteACLRule(ctx, username, index, permission) err := resourceOpenSearchACLModifyRemoteConfig(ctx, project, serviceName, client, modifier) if err != nil { return diag.FromErr(err) diff --git a/internal/sdkprovider/service/opensearch/opensearch_acl_rule_data_source.go b/internal/sdkprovider/service/opensearch/opensearch_acl_rule_data_source.go index e8f87d0cd..666ed967b 100644 --- a/internal/sdkprovider/service/opensearch/opensearch_acl_rule_data_source.go +++ b/internal/sdkprovider/service/opensearch/opensearch_acl_rule_data_source.go @@ -26,12 +26,12 @@ func datasourceOpenSearchACLRuleRead(ctx context.Context, d *schema.ResourceData username := d.Get("username").(string) index := d.Get("index").(string) - r, err := client.ElasticsearchACLs.Get(ctx, projectName, serviceName) + r, err := client.OpenSearchACLs.Get(ctx, projectName, serviceName) if err != nil { return diag.FromErr(err) } - if _, found := resourceElasticsearchACLRuleGetPermissionFromACLResponse(r.ElasticSearchACLConfig, username, index); !found { + if _, found := resourceOpenSearchACLRuleGetPermissionFromACLResponse(r.OpenSearchACLConfig, username, index); !found { return diag.Errorf("acl rule %s/%s/%s/%s not found", projectName, serviceName, username, index) } diff --git a/internal/sdkprovider/service/opensearch/opensearch_acl_rule_test.go b/internal/sdkprovider/service/opensearch/opensearch_acl_rule_test.go index 77b6873bd..f18209aaa 100644 --- a/internal/sdkprovider/service/opensearch/opensearch_acl_rule_test.go +++ b/internal/sdkprovider/service/opensearch/opensearch_acl_rule_test.go @@ -91,7 +91,7 @@ func testAccCheckAivenOpenSearchACLRuleResourceDestroy(s *terraform.State) error return err } - r, err := c.ElasticsearchACLs.Get(ctx, projectName, serviceName) + r, err := c.OpenSearchACLs.Get(ctx, projectName, serviceName) if err != nil { if err.(aiven.Error).Status != 404 { return err @@ -101,7 +101,7 @@ func testAccCheckAivenOpenSearchACLRuleResourceDestroy(s *terraform.State) error return nil } - for _, acl := range r.ElasticSearchACLConfig.ACLs { + for _, acl := range r.OpenSearchACLConfig.ACLs { if acl.Username != username { continue }