mongocli iam globalApiKey update
The iam globalApiKey update
command updates the roles and the description
of the specified Global API Key. You can also modify the Global API Key
roles and description using the Ops Manager UI and API. You must have
the Global Owner role
to update a Global API key.
Syntax
mongocli iam globalApiKey|globalApiKeys update <api-key-id> --desc "<description-of-key>" [ --output|-o <output-format> ] [ --profile|-P <profile-name> ] --role <list-of-roles>
Note
Use -h
or --help
to view the command-line help for
this command.
Arguments
Argument | Type | Description | Required? |
---|---|---|---|
<api-key-id> | string | Unique identifier of the Global API Key to update. | yes |
Options
Option | Type | Description | Required? | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
--desc | string | Description of the Global API Key to update. This description
can’t be longer than 250 characters. | yes | ||||||||||||||
--output , -o | string | Command output format. Valid values are:
If omitted, the command returns output in the default format. | no | ||||||||||||||
--profile , -P | string | Name of the profile where your credentials are saved. If omitted, uses the default profile. To learn more about creating a profile, see Configure the MongoDB CLI. You must have credentials with the | no | ||||||||||||||
--role | string | Role or roles to assign to the API key. To assign more than
one role, you can specify each role with a
| yes |
Output
If the command succeeds, it returns the following output in the default format. If the command returns errors, see Troubleshooting for recommended solutions.
API Key '<api-key-id>' successfully updated.
The default output is a subset of the fields returned by this command. For the complete list of JSON fields returned by the command, see the API reference.
Examples
The following command updates the description and role of a Global API Key using the default profile, which contains credentials for accessing the Ops Manager instance. The output is returned in the default format.
mongocli iam globalApiKey update 5f3d8790c9022019903c1234 --role GLOBAL_MONITORING_ADMIN --desc "My Sample Global API Key"
The previous command prints the following to the terminal.
API Key '5f3d8790c9022019903c1234' successfully updated.
The following command updates the role and description of a Global
API Key using the myOM
profile, which contains the credentials
for accessing the Ops Manager instance. The output is returned in JSON
format.
mongocli iam globalApiKey update 5f3d8790c9022019903c1234 --desc "My Sample Global API Key" --role GLOBAL_MONITORING_ADMIN -P myOM --output json
The previous command updates the API key and prints the following to the terminal in JSON format.
{ "id": "5f3d8790c9022019903c1234", "desc": "My Sample Global API Key", "roles": [ { "roleName": "GLOBAL_READ_ONLY" }, { "roleName": "GLOBAL_USER_ADMIN" }, { "roleName": "GLOBAL_OWNER" } ], "privateKey": "********-****-****-f4d64595457e", "publicKey": "ijklmnop" }