Skip to content

Commit a5ce37b

Browse files
committed
rgw/admin: fix op-mask url parameter
When creating a user, the RGW expects the op-mask in the URL with a dash instead of an underscore as used for the JSON schema. Signed-off-by: Simon Jürgensmeyer <simon.juergensmeyer@hetzner-cloud.de>
1 parent 8dac64f commit a5ce37b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

rgw/admin/user.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type User struct {
1818
Keys []UserKeySpec `json:"keys"`
1919
SwiftKeys []SwiftKeySpec `json:"swift_keys" url:"-"`
2020
Caps []UserCapSpec `json:"caps"`
21-
OpMask string `json:"op_mask"`
21+
OpMask string `json:"op_mask" url:"op-mask"`
2222
DefaultPlacement string `json:"default_placement"`
2323
DefaultStorageClass string `json:"default_storage_class"`
2424
PlacementTags []interface{} `json:"placement_tags"`

rgw/admin/user_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func (suite *RadosGWTestSuite) TestUser() {
107107

108108
suite.T().Run("user creation success", func(_ *testing.T) {
109109
usercaps := "users=read"
110-
user, err := co.CreateUser(context.Background(), User{ID: "leseb", DisplayName: "This is leseb", Email: "leseb@example.com", UserCaps: usercaps})
110+
user, err := co.CreateUser(context.Background(), User{ID: "leseb", DisplayName: "This is leseb", Email: "leseb@example.com", UserCaps: usercaps, OpMask: "delete"})
111111
assert.NoError(suite.T(), err)
112112
assert.Equal(suite.T(), "leseb@example.com", user.Email)
113113
})
@@ -118,6 +118,7 @@ func (suite *RadosGWTestSuite) TestUser() {
118118
assert.Equal(suite.T(), "leseb@example.com", user.Email)
119119
assert.Equal(suite.T(), "users", user.Caps[0].Type)
120120
assert.Equal(suite.T(), "read", user.Caps[0].Perm)
121+
assert.Equal(suite.T(), "delete", user.OpMask)
121122
os.Setenv("LESEB_ACCESS_KEY", user.Keys[0].AccessKey)
122123
})
123124

0 commit comments

Comments
 (0)