From e684ab8fc9b7ba5f0dc2df16509f2b5ce18f6ad6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 16:06:52 +0000 Subject: [PATCH 1/2] Bump github.com/jfrog/terraform-provider-shared from 1.22.0 to 1.25.1 Bumps [github.com/jfrog/terraform-provider-shared](https://github.com/jfrog/terraform-provider-shared) from 1.22.0 to 1.25.1. - [Changelog](https://github.com/jfrog/terraform-provider-shared/blob/main/CHANGELOG.md) - [Commits](https://github.com/jfrog/terraform-provider-shared/compare/v1.22.0...v1.25.1) --- updated-dependencies: - dependency-name: github.com/jfrog/terraform-provider-shared dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index ca2116c6..a55c8c24 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/hashicorp/terraform-plugin-log v0.9.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 github.com/hashicorp/terraform-plugin-testing v1.7.0 - github.com/jfrog/terraform-provider-shared v1.22.0 + github.com/jfrog/terraform-provider-shared v1.25.1 github.com/samber/lo v1.39.0 golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 ) diff --git a/go.sum b/go.sum index 1dcb6bcb..da0d83e3 100644 --- a/go.sum +++ b/go.sum @@ -124,8 +124,8 @@ github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= -github.com/jfrog/terraform-provider-shared v1.22.0 h1:6nmAltCTz/dvPDprK4iYFB9huwiJDiTHWOkOoVqQTgg= -github.com/jfrog/terraform-provider-shared v1.22.0/go.mod h1:rIiQMiefaHAlsh+vSCX+7W4tilJcqgQZLGwlHRqLMSg= +github.com/jfrog/terraform-provider-shared v1.25.1 h1:ndbE78OvIUy5QfjnxCs7xq/M0PwBVk2p2FU3Gr4M6G0= +github.com/jfrog/terraform-provider-shared v1.25.1/go.mod h1:L987Z8XO4cuv7ys4Tw6sP/LESw7z0Dji0U2ysR8FUP4= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= From 1d99e12873879444521d8b36cb1910eb8374b1f3 Mon Sep 17 00:00:00 2001 From: Alex Hung Date: Fri, 3 May 2024 16:00:21 -0700 Subject: [PATCH 2/2] Update to use latest shared module --- pkg/project/membership.go | 6 +++--- pkg/project/provider.go | 8 ++++---- pkg/project/repo.go | 6 +++--- pkg/project/resource_project.go | 8 ++++---- pkg/project/resource_project_environment.go | 8 ++++---- pkg/project/resource_project_group.go | 6 +++--- pkg/project/resource_project_repository.go | 8 ++++---- pkg/project/resource_project_role.go | 8 ++++---- pkg/project/resource_project_user.go | 6 +++--- pkg/project/role.go | 8 ++++---- pkg/project/util_test.go | 2 +- 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/pkg/project/membership.go b/pkg/project/membership.go index a2f87933..4254d95f 100644 --- a/pkg/project/membership.go +++ b/pkg/project/membership.go @@ -103,7 +103,7 @@ var readMembers = func(ctx context.Context, projectKey string, membershipType st membership := Membership{} var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectKey, "membershipType": membershipType, @@ -170,7 +170,7 @@ var updateMember = func(ctx context.Context, projectKey string, membershipType s } var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectKey, "membershipType": membershipType, @@ -211,7 +211,7 @@ var deleteMember = func(ctx context.Context, projectKey string, membershipType s } var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectKey, "membershipType": membershipType, diff --git a/pkg/project/provider.go b/pkg/project/provider.go index 62a67f1c..eee71638 100644 --- a/pkg/project/provider.go +++ b/pkg/project/provider.go @@ -91,9 +91,9 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, terraformVer checkLicense := d.Get("check_license").(bool) if checkLicense { - licenseErr := sdk.CheckArtifactoryLicense(restyBase, "Enterprise", "Commercial", "Edge") + licenseErr := util.CheckArtifactoryLicense(restyBase, "Enterprise", "Commercial", "Edge") if licenseErr != nil { - return nil, licenseErr + return nil, diag.FromErr(licenseErr) } } @@ -103,9 +103,9 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, terraformVer } featureUsage := fmt.Sprintf("Terraform/%s", terraformVersion) - util.SendUsage(ctx, restyBase, productId, featureUsage) + util.SendUsage(ctx, restyBase.R(), productId, featureUsage) - return util.ProvderMetadata{ + return util.ProviderMetadata{ Client: restyBase, ArtifactoryVersion: version, }, nil diff --git a/pkg/project/repo.go b/pkg/project/repo.go index bd882b51..2b20ba1f 100644 --- a/pkg/project/repo.go +++ b/pkg/project/repo.go @@ -55,7 +55,7 @@ var readRepos = func(ctx context.Context, projectKey string, m interface{}) ([]R artifactoryRepos := []ArtifactoryRepo{} var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParam("projectKey", projectKey). SetResult(&artifactoryRepos). SetError(&projectError). @@ -114,7 +114,7 @@ var updateRepos = func(ctx context.Context, projectKey string, terraformRepoKeys var addRepos = func(ctx context.Context, projectKey string, repoKeys []RepoKey, m interface{}) error { tflog.Debug(ctx, fmt.Sprintf("addRepos: %s", repoKeys)) - req := m.(util.ProvderMetadata).Client.R(). + req := m.(util.ProviderMetadata).Client.R(). AddRetryCondition(retryOnSpecificMsgBody("A timeout occurred")). AddRetryCondition(retryOnSpecificMsgBody("Web server is down")). AddRetryCondition(retryOnSpecificMsgBody("Web server is returning an unknown error")) @@ -154,7 +154,7 @@ var addRepo = func(ctx context.Context, projectKey string, repoKey RepoKey, req var deleteRepos = func(ctx context.Context, repoKeys []RepoKey, m interface{}) error { tflog.Debug(ctx, fmt.Sprintf("deleteRepos: %s", repoKeys)) - req := m.(util.ProvderMetadata).Client.R(). + req := m.(util.ProviderMetadata).Client.R(). AddRetryCondition(retryOnSpecificMsgBody("A timeout occurred")). AddRetryCondition(retryOnSpecificMsgBody("Web server is down")). AddRetryCondition(retryOnSpecificMsgBody("Web server is returning an unknown error")) diff --git a/pkg/project/resource_project.go b/pkg/project/resource_project.go index 7ac8a7c5..383a5786 100644 --- a/pkg/project/resource_project.go +++ b/pkg/project/resource_project.go @@ -438,7 +438,7 @@ func projectResource() *schema.Resource { project := Project{} var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParam("projectKey", data.Id()). SetResult(&project). SetError(&projectError). @@ -504,7 +504,7 @@ func projectResource() *schema.Resource { } var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetBody(project). SetError(&projectError). Post(projectsUrl) @@ -563,7 +563,7 @@ func projectResource() *schema.Resource { } var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParam("projectKey", data.Id()). SetBody(project). SetError(&projectError). @@ -627,7 +627,7 @@ func projectResource() *schema.Resource { return diag.FromErr(fmt.Errorf("failed to delete repos for project: %s", deleteErr)) } - req := m.(util.ProvderMetadata).Client.R() + req := m.(util.ProviderMetadata).Client.R() req.AddRetryCondition( func(r *resty.Response, _ error) bool { return r.StatusCode() == http.StatusBadRequest && diff --git a/pkg/project/resource_project_environment.go b/pkg/project/resource_project_environment.go index c7921160..1c5f1be9 100644 --- a/pkg/project/resource_project_environment.go +++ b/pkg/project/resource_project_environment.go @@ -59,7 +59,7 @@ func projectEnvironmentResource() *schema.Resource { var envs []ProjectEnvironment var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParam("projectKey", projectKey). SetResult(&envs). SetError(&projectError). @@ -102,7 +102,7 @@ func projectEnvironmentResource() *schema.Resource { } var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParam("projectKey", projectKey). SetBody(projectEnvironment). SetError(&projectError). @@ -128,7 +128,7 @@ func projectEnvironmentResource() *schema.Resource { } var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectKey, "environmentName": fmt.Sprintf("%s-%s", projectKey, oldName), @@ -153,7 +153,7 @@ func projectEnvironmentResource() *schema.Resource { projectKey := data.Get("project_key").(string) var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectKey, "environmentName": fmt.Sprintf("%s-%s", projectKey, data.Get("name")), diff --git a/pkg/project/resource_project_group.go b/pkg/project/resource_project_group.go index f225d636..4825aee3 100644 --- a/pkg/project/resource_project_group.go +++ b/pkg/project/resource_project_group.go @@ -77,7 +77,7 @@ func projectGroupResource() *schema.Resource { var loadedProjectGroup ProjectGroup var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectGroup.ProjectKey, "name": projectGroup.Name, @@ -106,7 +106,7 @@ func projectGroupResource() *schema.Resource { projectGroup := unpackProjectGroup(data) var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectGroup.ProjectKey, "name": projectGroup.Name, @@ -131,7 +131,7 @@ func projectGroupResource() *schema.Resource { projectGroup := unpackProjectGroup(data) var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectGroup.ProjectKey, "name": projectGroup.Name, diff --git a/pkg/project/resource_project_repository.go b/pkg/project/resource_project_repository.go index b0312acf..29660031 100644 --- a/pkg/project/resource_project_repository.go +++ b/pkg/project/resource_project_repository.go @@ -62,7 +62,7 @@ func projectRepositoryResource() *schema.Resource { repoKey := data.Get("key").(string) var repo Repository - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetResult(&repo). SetPathParam("key", repoKey). Get(repositoryEndpoint) @@ -97,7 +97,7 @@ func projectRepositoryResource() *schema.Resource { repoKey := data.Get("key").(string) var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectKey, "repoKey": repoKey, @@ -114,7 +114,7 @@ func projectRepositoryResource() *schema.Resource { retryError := retry.RetryContext(ctx, data.Timeout(schema.TimeoutCreate), func() *retry.RetryError { var repo Repository - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetResult(&repo). SetPathParam("key", repoKey). Get(repositoryEndpoint) @@ -149,7 +149,7 @@ func projectRepositoryResource() *schema.Resource { repoKey := data.Get("key").(string) var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParam("repoKey", repoKey). SetError(&projectError). Delete("/access/api/v1/projects/_/attach/repositories/{repoKey}") diff --git a/pkg/project/resource_project_role.go b/pkg/project/resource_project_role.go index f5014a45..3f9acbec 100644 --- a/pkg/project/resource_project_role.go +++ b/pkg/project/resource_project_role.go @@ -133,7 +133,7 @@ func projectRoleResource() *schema.Resource { projectKey := data.Get("project_key").(string) var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectKey, "roleName": data.Id(), @@ -172,7 +172,7 @@ func projectRoleResource() *schema.Resource { role := unpackRole(data) var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParam("projectKey", projectKey). SetBody(role). SetError(&projectError). @@ -195,7 +195,7 @@ func projectRoleResource() *schema.Resource { role := unpackRole(data) var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectKey, "roleName": role.Name, @@ -218,7 +218,7 @@ func projectRoleResource() *schema.Resource { var deleteProjectRole = func(ctx context.Context, data *schema.ResourceData, m interface{}) diag.Diagnostics { var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "roleName": data.Id(), "projectKey": data.Get("project_key").(string), diff --git a/pkg/project/resource_project_user.go b/pkg/project/resource_project_user.go index cb7880b5..0215d1b6 100644 --- a/pkg/project/resource_project_user.go +++ b/pkg/project/resource_project_user.go @@ -86,7 +86,7 @@ func projectUserResource() *schema.Resource { var loadedProjectUser ProjectUser var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectUser.ProjectKey, "name": projectUser.Name, @@ -115,7 +115,7 @@ func projectUserResource() *schema.Resource { projectUser := unpackProjectUser(data) var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectUser.ProjectKey, "name": projectUser.Name, @@ -158,7 +158,7 @@ func projectUserResource() *schema.Resource { projectUser := unpackProjectUser(data) var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectUser.ProjectKey, "name": projectUser.Name, diff --git a/pkg/project/role.go b/pkg/project/role.go index db7c6a3d..3587061f 100644 --- a/pkg/project/role.go +++ b/pkg/project/role.go @@ -81,7 +81,7 @@ var readRoles = func(ctx context.Context, projectKey string, m interface{}) ([]R roles := []Role{} var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParam("projectKey", projectKey). SetResult(&roles). SetError(&projectError). @@ -152,7 +152,7 @@ var addRole = func(ctx context.Context, projectKey string, role Role, m interfac tflog.Debug(ctx, "addRole") var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParam("projectKey", projectKey). SetBody(role). SetError(&projectError). @@ -171,7 +171,7 @@ var updateRole = func(ctx context.Context, projectKey string, role Role, m inter tflog.Debug(ctx, "updateRole") var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectKey, "roleName": role.Name, @@ -207,7 +207,7 @@ var deleteRole = func(ctx context.Context, projectKey string, role Role, m inter tflog.Trace(ctx, fmt.Sprintf("%+v\n", role)) var projectError ProjectErrorsResponse - resp, err := m.(util.ProvderMetadata).Client.R(). + resp, err := m.(util.ProviderMetadata).Client.R(). SetPathParams(map[string]string{ "projectKey": projectKey, "roleName": role.Name, diff --git a/pkg/project/util_test.go b/pkg/project/util_test.go index 55983462..34b0c917 100644 --- a/pkg/project/util_test.go +++ b/pkg/project/util_test.go @@ -53,7 +53,7 @@ func verifyDeleted(id string, check CheckFun) func(*terraform.State) error { return fmt.Errorf("error: Resource id [%s] not found", id) } - client := TestProvider.Meta().(util.ProvderMetadata).Client + client := TestProvider.Meta().(util.ProviderMetadata).Client resp, err := check(rs.Primary.ID, client.R()) if err != nil { return err