@@ -21,7 +21,8 @@ import (
2121)
2222
2323const (
24- usersBasePath = "api/atlas/v1.0/groups/%s/users"
24+ usersGroupBasePath = "api/atlas/v1.0/groups/%s/users"
25+ usersBasePath = "api/atlas/v1.0/users"
2526)
2627
2728// AtlasUsersService is an interface for interfacing with the AtlasUsers
@@ -66,7 +67,7 @@ type AtlasUser struct {
6667//
6768// See more: https://docs.atlas.mongodb.com/reference/api/user-get-all/
6869func (s * AtlasUsersServiceOp ) List (ctx context.Context , orgID string , listOptions * ListOptions ) ([]AtlasUser , * Response , error ) {
69- path := fmt .Sprintf (usersBasePath , orgID )
70+ path := fmt .Sprintf (usersGroupBasePath , orgID )
7071
7172 // Add query params from listOptions
7273 path , err := setListOptions (path , listOptions )
@@ -100,7 +101,7 @@ func (s *AtlasUsersServiceOp) Get(ctx context.Context, userID string) (*AtlasUse
100101 return nil , nil , NewArgError ("userID" , "must be set" )
101102 }
102103
103- path := fmt .Sprintf ("api/atlas/v1.0/users/ %s" , userID )
104+ path := fmt .Sprintf ("%s/ %s" , usersBasePath , userID )
104105
105106 req , err := s .Client .NewRequest (ctx , http .MethodGet , path , nil )
106107 if err != nil {
@@ -124,7 +125,7 @@ func (s *AtlasUsersServiceOp) GetByName(ctx context.Context, username string) (*
124125 return nil , nil , NewArgError ("username" , "must be set" )
125126 }
126127
127- path := fmt .Sprintf ("api/atlas/v1.0/users/ byName/%s" , username )
128+ path := fmt .Sprintf ("%s/ byName/%s" , usersBasePath , username )
128129
129130 req , err := s .Client .NewRequest (ctx , http .MethodGet , path , nil )
130131 if err != nil {
@@ -148,7 +149,7 @@ func (s *AtlasUsersServiceOp) Create(ctx context.Context, createRequest *AtlasUs
148149 return nil , nil , NewArgError ("createRequest" , "cannot be nil" )
149150 }
150151
151- req , err := s .Client .NewRequest (ctx , http .MethodPost , "users" , createRequest )
152+ req , err := s .Client .NewRequest (ctx , http .MethodPost , usersBasePath , createRequest )
152153 if err != nil {
153154 return nil , nil , err
154155 }
0 commit comments