Skip to content

Commit baa0b4e

Browse files
authored
Merge pull request #45 from mongodb/custom_roles
Custom DB Roles
2 parents 52ebd01 + 00cb7e1 commit baa0b4e

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

mongodbatlas/custom_db_roles.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var _ CustomDBRolesService = &CustomDBRolesServiceOp{}
3131
type Resource struct {
3232
Collection string `json:"collection,omitempty"`
3333
Db string `json:"db,omitempty"`
34-
Cluster bool `json:"cluster,omitempty"`
34+
Cluster *bool `json:"cluster,omitempty"`
3535
}
3636

3737
// An Action describes the operation the role will include, for a specific set of Resources.
@@ -53,8 +53,8 @@ type CustomDBRole struct {
5353
RoleName string `json:"roleName,omitempty"`
5454
}
5555

56-
//List gets all custom db roles in the project.
57-
//See more: https://docs.atlas.mongodb.com/reference/api/custom-roles-get-all-roles/
56+
// List gets all custom db roles in the project.
57+
// See more: https://docs.atlas.mongodb.com/reference/api/custom-roles-get-all-roles/
5858
func (s *CustomDBRolesServiceOp) List(ctx context.Context, groupID string, listOptions *ListOptions) (*[]CustomDBRole, *Response, error) {
5959
path := fmt.Sprintf(dbCustomDBRolesBasePath, groupID)
6060

@@ -77,7 +77,7 @@ func (s *CustomDBRolesServiceOp) List(ctx context.Context, groupID string, listO
7777
return root, resp, nil
7878
}
7979

80-
// Gets a single Custom MongoDB Role in the project.
80+
// Get gets a single Custom MongoDB Role in the project.
8181
// See more: https://docs.atlas.mongodb.com/reference/api/custom-roles-get-single-role/
8282
func (s *CustomDBRolesServiceOp) Get(ctx context.Context, groupID string, roleName string) (*CustomDBRole, *Response, error) {
8383
if roleName == "" {
@@ -101,7 +101,7 @@ func (s *CustomDBRolesServiceOp) Get(ctx context.Context, groupID string, roleNa
101101
return root, resp, err
102102
}
103103

104-
// Creates a new Custom MongoDB Role in the project.
104+
// Create create a new Custom MongoDB Role in the project.
105105
// See more: https://docs.atlas.mongodb.com/reference/api/custom-roles-create-a-role/
106106
func (s *CustomDBRolesServiceOp) Create(ctx context.Context, groupID string, createRequest *CustomDBRole) (*CustomDBRole, *Response, error) {
107107
if createRequest == nil {
@@ -124,7 +124,7 @@ func (s *CustomDBRolesServiceOp) Create(ctx context.Context, groupID string, cre
124124
return root, resp, err
125125
}
126126

127-
// Updates a single Custom MongoDB Role.
127+
// Update updates a single Custom MongoDB Role.
128128
// See more: https://docs.atlas.mongodb.com/reference/api/custom-roles-update-a-role/
129129
func (s *CustomDBRolesServiceOp) Update(ctx context.Context, groupID string, roleName string, updateRequest *CustomDBRole) (*CustomDBRole, *Response, error) {
130130
if updateRequest == nil {
@@ -148,7 +148,7 @@ func (s *CustomDBRolesServiceOp) Update(ctx context.Context, groupID string, rol
148148
return root, resp, err
149149
}
150150

151-
// Deletes a single Custom MongoDB Role.
151+
// Delete deletes a single Custom MongoDB Role.
152152
// See more: https://docs.atlas.mongodb.com/reference/api/custom-roles-delete-a-role/
153153
func (s *CustomDBRolesServiceOp) Delete(ctx context.Context, groupID string, roleName string) (*Response, error) {
154154
if roleName == "" {

mongodbatlas/custom_db_roles_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ func TestCustomDBRoles_ListCustomDBRoles(t *testing.T) {
2828
Resources: []Resource{{
2929
Collection: "test-collection",
3030
Db: "test-db",
31-
Cluster: false,
3231
}},
3332
}},
3433
InheritedRoles: []InheritedRole{{
@@ -62,7 +61,6 @@ func TestCustomDBRoles_GetCustomDBRole(t *testing.T) {
6261
Resources: []Resource{{
6362
Collection: "test-collection",
6463
Db: "test-db",
65-
Cluster: false,
6664
}},
6765
}},
6866
InheritedRoles: []InheritedRole{{
@@ -86,7 +84,6 @@ func TestCustomDBRoles_CreateCustomDBRole(t *testing.T) {
8684
Resources: []Resource{{
8785
Collection: "test-collection",
8886
Db: "test-db",
89-
Cluster: false,
9087
}},
9188
}},
9289
InheritedRoles: []InheritedRole{{
@@ -168,7 +165,6 @@ func TestCustomDBRoles_UpdateCustomDBRole(t *testing.T) {
168165
Resources: []Resource{{
169166
Collection: "test-collection",
170167
Db: "test-db",
171-
Cluster: false,
172168
}},
173169
}},
174170
InheritedRoles: []InheritedRole{{

0 commit comments

Comments
 (0)