ANNOUNCEMENT: Voyage AI joins MongoDB to power more accurate and trustworthy AI applications on Atlas.
Learn more
Docs Menu

mongocli iam organizations apiKeys assign

Modify the roles or description for the specified organization API key.

このコマンドを使用して組織 API キーのロールを変更すると、指定した値が API キーに割り当てられた既存のロールを上書きします。

To view possible values for the apiKeyId argument, run mongocli iam organizations apiKeys list.

このコマンドを使用するには、ユーザー アカウントまたは組織ユーザー管理者ロールの API キーで認証する必要があります。

コマンド構文
mongocli iam organizations apiKeys assign <apiKeyId> [options]
名前
タイプ
必須
説明

apiKeyId

string

true

キーを識別する一意な 24stringAPI 桁の 。

名前
タイプ
必須
説明

--desc

string

false

API キーの説明。

-h, --help

false

割り当てられるヘルプ

--orgId

string

false

使用する組織ID。 このオプションは、構成ファイルまたは環境変数の 設定を上書きします。

-o, --output

string

false

出力形式。 有効な値は、 JSON 、 JSON -path、go-template、または go-template-file です。 完全な出力を表示するには、 -o JSONオプションを使用します。

--role

string

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.

名前
タイプ
必須
説明

-P, --profile

string

false

構成ファイルから使用するプロファイルの名前。 MongoCLI のプロファイルの詳細については、 https://docub.mongodb.org/core/atlas-cli-configuration-file を参照してください。

コマンドが成功すると、CLI は次のサンプルのような出力を返します。 括弧内の値は 値を表します。

API Key '<ID>' successfully updated.
# 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