Skip to content

Commit

Permalink
chore: update madmin-go to version 3
Browse files Browse the repository at this point in the history
  • Loading branch information
acolombier committed Sep 7, 2023
1 parent 8338bdd commit d5c2338
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 208 deletions.
8 changes: 7 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/hashicorp/awspolicyequivalence v1.6.0
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637
github.com/hashicorp/terraform-plugin-sdk/v2 v2.28.0
github.com/minio/madmin-go v1.7.5
github.com/minio/madmin-go/v3 v3.0.18
github.com/minio/minio-go/v7 v7.0.63
gotest.tools/v3 v3.5.0
)
Expand All @@ -21,6 +21,7 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand All @@ -44,9 +45,11 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
Expand All @@ -59,7 +62,10 @@ require (
github.com/oklog/run v1.1.0 // indirect
github.com/philhofer/fwd v1.1.2 // indirect
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/prom2json v1.3.3 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/secure-io/sio-go v0.3.1 // indirect
github.com/shirou/gopsutil/v3 v3.23.3 // indirect
Expand Down
201 changes: 19 additions & 182 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion minio/new_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/http"
"os"

"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
)
Expand Down
2 changes: 1 addition & 1 deletion minio/payload.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package minio

import (
"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"
minio "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/notification"
"github.com/minio/minio-go/v7/pkg/policy"
Expand Down
2 changes: 1 addition & 1 deletion minio/resource_minio_iam_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion minio/resource_minio_iam_group_membership.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/aws/aws-sdk-go/aws"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"
)

func resourceMinioIAMGroupMembership() *schema.Resource {
Expand Down
2 changes: 1 addition & 1 deletion minio/resource_minio_iam_group_membership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"
)

func TestAccMinioGroupMembership_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion minio/resource_minio_iam_group_policy_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/id"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"
)

var groupPolicyAttachmentLock = NewMutexKV()
Expand Down
2 changes: 1 addition & 1 deletion minio/resource_minio_iam_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"
)

func TestValidateMinioIamGroupName(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion minio/resource_minio_iam_group_user_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/id"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"
)

func resourceMinioIAMGroupUserAttachment() *schema.Resource {
Expand Down
2 changes: 1 addition & 1 deletion minio/resource_minio_iam_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/aws/aws-sdk-go/aws"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion minio/resource_minio_iam_user_policy_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/id"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"
)

var userPolicyAttachmentLock = NewMutexKV()
Expand Down
2 changes: 1 addition & 1 deletion minio/resource_minio_iam_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"
)

func TestValidateMinioIamUserName(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion minio/resource_minio_s3_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/id"
"github.com/minio/minio-go/v7"

"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
Expand Down
29 changes: 17 additions & 12 deletions minio/resource_minio_service_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"
)

func resourceMinioServiceAccount() *schema.Resource {
Expand Down Expand Up @@ -195,19 +195,24 @@ func minioDeleteServiceAccount(ctx context.Context, d *schema.ResourceData, meta
return nil
}

func deleteMinioServiceAccount(ctx context.Context, serviceAccountConfig *S3MinioServiceAccountConfig) error {
func deleteMinioServiceAccount(ctx context.Context, serviceAccountConfig *S3MinioServiceAccountConfig) (err error) {
log.Println("[DEBUG] Deleting service account request:", serviceAccountConfig.MinioAccessKey)
err := serviceAccountConfig.MinioAdmin.DeleteServiceAccount(ctx, serviceAccountConfig.MinioAccessKey)
err = serviceAccountConfig.MinioAdmin.DeleteServiceAccount(ctx, serviceAccountConfig.MinioAccessKey)
if err == nil {
return
}

serviceAccountList, err := serviceAccountConfig.MinioAdmin.ListServiceAccounts(ctx, serviceAccountConfig.MinioTargetUser)
if err != nil {
serviceAccountList, err := serviceAccountConfig.MinioAdmin.ListServiceAccounts(ctx, serviceAccountConfig.MinioTargetUser)
if err != nil {
return err
}
if Contains(serviceAccountList.Accounts, serviceAccountConfig.MinioAccessKey) {
return fmt.Errorf("service account %s not deleted", serviceAccountConfig.MinioAccessKey)
}
return
}

return nil
for _, account := range serviceAccountList.Accounts {
if account.AccessKey == serviceAccountConfig.MinioAccessKey {
err = fmt.Errorf("service account %s not deleted", serviceAccountConfig.MinioAccessKey)
return
}
}
return nil

return
}
2 changes: 1 addition & 1 deletion minio/resource_minio_service_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/minio/madmin-go"
"github.com/minio/madmin-go/v3"
)

func TestServiceAccount_basic(t *testing.T) {
Expand Down

0 comments on commit d5c2338

Please sign in to comment.