aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Lebedev <lebedev_k@tochka.com>2020-12-10 21:03:25 +0500
committerKonstantin Lebedev <lebedev_k@tochka.com>2021-03-25 12:34:11 +0500
commit40938d6a47136a47f612d7a4c93862ff5e17ec45 (patch)
treecfd62109d2bcc731d5f2d12241e161af64a772ab
parent9f26f2815c756d2125bf35032058ddd0d0efba1d (diff)
downloadseaweedfs-40938d6a47136a47f612d7a4c93862ff5e17ec45.tar.xz
seaweedfs-40938d6a47136a47f612d7a4c93862ff5e17ec45.zip
SaveInsideFiler S3 Configuration
-rw-r--r--weed/iamapi/iamapi_management_handlers.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/weed/iamapi/iamapi_management_handlers.go b/weed/iamapi/iamapi_management_handlers.go
index 4316f0fd5..322c16d73 100644
--- a/weed/iamapi/iamapi_management_handlers.go
+++ b/weed/iamapi/iamapi_management_handlers.go
@@ -8,6 +8,8 @@ import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/filer"
"github.com/chrislusf/seaweedfs/weed/glog"
+ "github.com/chrislusf/seaweedfs/weed/pb"
+ "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/pb/iam_pb"
"github.com/chrislusf/seaweedfs/weed/s3api/s3_constants"
"github.com/chrislusf/seaweedfs/weed/s3api/s3err"
@@ -216,7 +218,7 @@ func GetActions(policy *PolicyDocument) (actions []string) {
// Parse "arn:aws:s3:::my-bucket/shared/*"
res := strings.Split(resource, ":")
if len(res) != 6 || res[0] != "arn" || res[1] != "aws" || res[2] != "s3" {
- glog.Infof("not math resource: %s", res)
+ glog.Infof("not match resource: %s", res)
continue
}
for _, action := range statement.Action {
@@ -237,7 +239,6 @@ func GetActions(policy *PolicyDocument) (actions []string) {
continue
}
actions = append(actions, fmt.Sprintf("%s:%s", MapAction(act[1]), path[0]))
-
}
}
}
@@ -360,14 +361,17 @@ func (iama *IamApiServer) DoActions(w http.ResponseWriter, r *http.Request) {
writeErrorResponse(w, s3err.ErrInternalError, r.URL)
return
}
- if err := filer.SaveAs(
- iama.option.Filer,
- 0,
- filer.IamConfigDirecotry,
- filer.IamIdentityFile,
- "text/plain; charset=utf-8",
- &buf); err != nil {
- glog.Error("SaveAs: ", err)
+ err := pb.WithGrpcFilerClient(
+ iama.option.FilerGrpcAddress,
+ iama.option.GrpcDialOption,
+ func(client filer_pb.SeaweedFilerClient) error {
+ if err := filer.SaveInsideFiler(client, filer.IamConfigDirecotry, filer.IamIdentityFile, buf.Bytes()); err != nil {
+ return err
+ }
+ return nil
+ },
+ )
+ if err != nil {
writeErrorResponse(w, s3err.ErrInternalError, r.URL)
return
}