@@ -11,7 +11,7 @@ import (
1111
1212// Example for Service Account Management API
1313// Example uses Service Account to create Service Account.
14- // Please ensure that Service Account has organizational admin permission.
14+ // Please ensure that Service Account has ORG_OWNER permission.
1515
1616// Required env variables to run example:
1717// export MONGODB_ATLAS_CLIENT_ID="your_client_id"
@@ -58,14 +58,15 @@ func main() {
5858 admin .NewOrgServiceAccountRequest (
5959 "SA created by sdk-example" ,
6060 "example" ,
61- []string {"ORG_OWNER " },
61+ []string {"ORG_READ_ONLY " },
6262 365 * 24 ,
6363 ),
6464 )
6565 sa , _ , err := request .Execute ()
6666 if err != nil {
6767 log .Fatalf ("Error: %v" , err )
6868 }
69+ fmt .Println ("Created new service account." )
6970
7071 // 2. Rotate secret
7172 newSecret , _ , err := sdk .ServiceAccountsApi .CreateServiceAccountSecret (
@@ -110,4 +111,5 @@ func main() {
110111
111112 // 6. Remove created Service Account. We would not be able to use it afterward without access to Secret value.
112113 sdk .ServiceAccountsApi .DeleteServiceAccount (ctx , sa .GetClientId (), orgID )
114+ fmt .Println ("Created service account was deleted." )
113115}
0 commit comments