Skip to content

Commit d6325b6

Browse files
committed
Change ProjectAPIKeys.Assign POST -> Patch
1 parent c4701ea commit d6325b6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

mongodbatlas/project_api_key.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var _ ProjectAPIKeysService = &ProjectAPIKeysOp{}
2828

2929
// AssignAPIKey contains the roles to be assigned to an Organization API key into a Project
3030
type AssignAPIKey struct {
31-
Roles []string `json:"roles,omitempty"`
31+
Roles []string `json:"roles"`
3232
}
3333

3434
//List all API-KEY in the organization associated to {GROUP-ID}.
@@ -87,7 +87,7 @@ func (s *ProjectAPIKeysOp) Create(ctx context.Context, groupID string, createReq
8787
//See more: https://docs.atlas.mongodb.com/reference/api/projectApiKeys/assign-one-org-apiKey-to-one-project/
8888
func (s *ProjectAPIKeysOp) Assign(ctx context.Context, groupID string, keyID string, assignAPIKeyRequest *AssignAPIKey) (*Response, error) {
8989
if groupID == "" {
90-
return nil, NewArgError("apiKeyID", "must be set")
90+
return nil, NewArgError("groupID", "must be set")
9191
}
9292

9393
if keyID == "" {
@@ -98,7 +98,7 @@ func (s *ProjectAPIKeysOp) Assign(ctx context.Context, groupID string, keyID str
9898

9999
path := fmt.Sprintf("%s/%s", basePath, keyID)
100100

101-
req, err := s.client.NewRequest(ctx, http.MethodPost, path, assignAPIKeyRequest)
101+
req, err := s.client.NewRequest(ctx, http.MethodPatch, path, assignAPIKeyRequest)
102102
if err != nil {
103103
return nil, err
104104
}

mongodbatlas/project_api_key_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func TestProjectAPIKeys_Assign(t *testing.T) {
108108
keyID := "5d1d12c087d9d63e6d682438"
109109

110110
mux.HandleFunc(fmt.Sprintf("/groups/%s/apiKeys/%s", groupID, keyID), func(w http.ResponseWriter, r *http.Request) {
111-
testMethod(t, r, http.MethodPost)
111+
testMethod(t, r, http.MethodPatch)
112112
})
113113

114114
_, err := client.ProjectAPIKeys.Assign(ctx, groupID, keyID, &AssignAPIKey{})

0 commit comments

Comments
 (0)