mongocli iam organizations apiKeys assign
Modify the roles or description for the specified organization API key.
Ao modificar os roles de uma chave de API da organização com esse comando, os valores especificados substituem os roles existentes atribuídos à chave de API.
To view possible values for the apiKeyId argument, run mongocli iam organizations apiKeys list.
Para usar esse comando, você deve se autenticar com uma conta de usuário ou uma chave de API com a role de administrador do usuário da organização.
Sintaxe
mongocli iam organizations apiKeys assign <apiKeyId> [options]
argumentos
Nome | Tipo | Obrigatório | Descrição |
---|---|---|---|
apiKeyId | string | true | Sequência única de 24 dígitos que identifica sua chave API. |
Opções
Nome | Tipo | Obrigatório | Descrição |
---|---|---|---|
--desc | string | false | Descrição da chave API. |
-h, --help | false | ajuda para atribuir | |
--orgId | string | false | ID da organização a ser usada. Esta opção substitui as configurações no arquivo de configuração ou variável de ambiente. |
-o, --output | string | false | Formato de saída. Os valores válidos são JSON, json-path, go-template ou go-template-file. Para ver o resultado completo, use a opção -o JSON. |
--role | strings | false | Role or roles that you want to assign to the API key. To assign more than one role, specify each role with a separate role flag or specify all of the roles as a comma-separated list using one role flag. To learn which values the CLI accepts, see the Items Enum for roles in the Atlas API spec: https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Programmatic-API-Keys/operation/createApiKey/. Passing this flag replaces preexisting data. |
Opções herdadas
Nome | Tipo | Obrigatório | Descrição |
---|---|---|---|
-P, --profile | string | false | Nome do perfil a ser usado no arquivo de configuração. Para saber mais sobre perfis para MongoCLI, consulte https://dochub.mongodb.org/core/atlas-cli-configuration-file. |
Saída
Se o comando for bem-sucedido, a CLI retornará uma saída semelhante à amostra a seguir. Os valores entre colchetes representam seus valores.
API Key '<ID>' successfully updated.
Exemplos
# Modify the role and description for the API key with the ID 5f24084d8dbffa3ad3f21234 for the organization with the ID 5a1b39eec902201990f12345: mongocli iam organizations apiKeys assign 5f24084d8dbffa3ad3f21234 --role ORG_MEMBER --desc "User1 Member Key" --orgId 5a1b39eec902201990f12345 --output json