diff --git a/weed/filer/s3iam_conf_test.go b/weed/filer/s3iam_conf_test.go index 88f446151..65cc49840 100644 --- a/weed/filer/s3iam_conf_test.go +++ b/weed/filer/s3iam_conf_test.go @@ -2,7 +2,7 @@ package filer import ( "bytes" - "github.com/chrislusf/seaweedfs/weed/s3api" + . "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants" "testing" "github.com/chrislusf/seaweedfs/weed/pb/iam_pb" @@ -22,9 +22,9 @@ func TestS3Conf(t *testing.T) { }, }, Actions: []string{ - s3api.ACTION_ADMIN, - s3api.ACTION_READ, - s3api.ACTION_WRITE, + ACTION_ADMIN, + ACTION_READ, + ACTION_WRITE, }, }, { @@ -36,9 +36,9 @@ func TestS3Conf(t *testing.T) { }, }, Actions: []string{ - s3api.ACTION_READ, - s3api.ACTION_TAGGING, - s3api.ACTION_LIST, + ACTION_READ, + ACTION_TAGGING, + ACTION_LIST, }, }, }, diff --git a/weed/s3api/auth_credentials.go b/weed/s3api/auth_credentials.go index 452557619..83f5269b7 100644 --- a/weed/s3api/auth_credentials.go +++ b/weed/s3api/auth_credentials.go @@ -14,14 +14,6 @@ import ( type Action string -const ( - ACTION_READ = "Read" - ACTION_WRITE = "Write" - ACTION_ADMIN = "Admin" - ACTION_TAGGING = "Tagging" - ACTION_LIST = "List" -) - type Iam interface { Check(f http.HandlerFunc, actions ...Action) http.HandlerFunc } diff --git a/weed/s3api/auth_credentials_test.go b/weed/s3api/auth_credentials_test.go index c6f76560c..0383ddbcd 100644 --- a/weed/s3api/auth_credentials_test.go +++ b/weed/s3api/auth_credentials_test.go @@ -1,6 +1,7 @@ package s3api import ( + . "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants" "testing" "github.com/golang/protobuf/jsonpb" diff --git a/weed/s3api/s3_constants/s3_actions.go b/weed/s3api/s3_constants/s3_actions.go new file mode 100644 index 000000000..f6056ef78 --- /dev/null +++ b/weed/s3api/s3_constants/s3_actions.go @@ -0,0 +1,10 @@ +package s3_constants + +const ( + ACTION_READ = "Read" + ACTION_WRITE = "Write" + ACTION_ADMIN = "Admin" + ACTION_TAGGING = "Tagging" + ACTION_LIST = "List" +) + diff --git a/weed/s3api/s3api_server.go b/weed/s3api/s3api_server.go index 18f8b563f..93e2bb575 100644 --- a/weed/s3api/s3api_server.go +++ b/weed/s3api/s3api_server.go @@ -3,6 +3,7 @@ package s3api import ( "fmt" "github.com/chrislusf/seaweedfs/weed/filer" + . "github.com/chrislusf/seaweedfs/weed/s3api/s3_constants" "net/http" "strings" "time"