SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
Account Info (#7507)
Leonardo Larad8cac1a6cc85
diff --git a/weed/shell/command_s3_configure.go b/weed/shell/command_s3_configure.goindex 478d62a6d8..eb5e151096 100644--- a/weed/shell/command_s3_configure.go+++ b/weed/shell/command_s3_configure.go@@ -30,6 +30,9 @@ func (c *commandS3Configure) Help() string {# see the current configuration file contents3.configure++ # create a new identity with account information+ s3.configure -user=username -actions=Read,Write,List,Tagging -buckets=bucket-name -access_key=key -secret_key=secret -account_id=id -account_display_name=name [email protected] -apply`}@@ -45,12 +48,40 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer iobuckets := s3ConfigureCommand.String("buckets", "", "bucket name")accessKey := s3ConfigureCommand.String("access_key", "", "specify the access key")secretKey := s3ConfigureCommand.String("secret_key", "", "specify the secret key")+ accountId := s3ConfigureCommand.String("account_id", "", "specify the account id")+ accountDisplayName := s3ConfigureCommand.String("account_display_name", "", "specify the account display name")+ accountEmail := s3ConfigureCommand.String("account_email", "", "specify the account email address")isDelete := s3ConfigureCommand.Bool("delete", false, "delete users, actions or access keys")apply := s3ConfigureCommand.Bool("apply", false, "update and apply s3 configuration")if err = s3ConfigureCommand.Parse(args); err != nil {return nil}+ // Check which account flags were provided and build update functions+ var accountUpdates []func(*iam_pb.Account)+ s3ConfigureCommand.Visit(func(f *flag.Flag) {+ switch f.Name {+ case "account_id":+ accountUpdates = append(accountUpdates, func(a *iam_pb.Account) { a.Id = *accountId })+ case "account_display_name":+ accountUpdates = append(accountUpdates, func(a *iam_pb.Account) { a.DisplayName = *accountDisplayName })+ case "account_email":+ accountUpdates = append(accountUpdates, func(a *iam_pb.Account) { a.EmailAddress = *accountEmail })+ }+ })++ // Helper function to update account information on an identity+ updateAccountInfo := func(account **iam_pb.Account) {+ if len(accountUpdates) > 0 {+ if *account == nil {+ *account = &iam_pb.Account{}+ }+ for _, update := range accountUpdates {+ update(*account)+ }+ }+ }+var buf bytes.Bufferif err = commandEnv.WithFilerClient(false, func(client filer_pb.SeaweedFilerClient) error {return filer.ReadEntry(commandEnv.MasterClient, client, filer.IamConfigDirectory, filer.IamIdentityFile, &buf)@@ -154,6 +185,8 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer io})}}+ // Update account information if provided+ updateAccountInfo(&s3cfg.Identities[idx].Account)}} else if *user != "" && *actions != "" {infoAboutSimulationMode(writer, *apply, "-apply")@@ -166,6 +199,8 @@ func (c *commandS3Configure) Do(args []string, commandEnv *CommandEnv, writer ioidentity.Credentials = append(identity.Credentials,&iam_pb.Credential{AccessKey: *accessKey, SecretKey: *secretKey})}+ // Add account information if provided+ updateAccountInfo(&identity.Account)s3cfg.Identities = append(s3cfg.Identities, &identity)}