mongocli iam organizations apiKeys accessLists create
为您的API密钥创建一个IP访问列表条目。
要查看apiKey选项的可能值,请运行mongocli iam organizations apiKeys list。
要使用此命令,您必须使用具有读写角色的用户帐户或API密钥进行身份验证。
语法
命令语法
mongocli iam organizations apiKeys accessLists create [options]
选项
名称 | 类型 | 必需 | 描述 |
---|---|---|---|
--apiKey | 字符串 | 是 | 一个唯一24位数字ID,用于标识您的API密钥。 |
--cidr | 字符串列表 | 否 | 使用CIDR表示法添加到您的API密钥的访问列表条目。要添加多个条目,您可以使用单独的cidr标志指定每个条目,或者使用单个cidr标志指定以逗号分隔的列表。您不能在同一命令中同时设置cidr和ip。 |
-h, --help | 否 | create的帮助信息 | |
--ip | 字符串列表 | 否 | 要添加到您的API密钥访问列表的IP地址。要添加多个IP地址,您可以使用单独的ip标志指定每个地址,或者使用单个ip标志指定以逗号分隔的列表。您不能在同一命令中同时设置ip和cidr。 |
--orgId | 字符串 | 否 | 要使用的组织ID。此选项会覆盖配置文件或环境变量中的设置。 |
-o, --output | 字符串 | 否 | 输出格式。有效值是json、json-path、go-template或go-template-file。要查看完整输出,请使用-o json选项。 |
继承选项
名称 | 类型 | 必需 | 描述 |
---|---|---|---|
-P, --profile | 字符串 | 否 | 从配置文件中使用的配置文件名。有关MongoCLI配置文件中配置文件的信息,请参阅https://dochub.mongodb.org/core/atlas-cli-configuration-file. |
输出
如果命令成功执行,CLI 返回的输出类似于以下示例。括号中的值代表您的值。
Created new access list entry(s).
示例
# Create access list entries for two IP addresses for the API key with the ID 5f24084d8dbffa3ad3f21234 in the organization with the ID 5a1b39eec902201990f12345: mongocli iam organizations apiKeys accessLists create --apiKey 5f24084d8dbffa3ad3f21234 --cidr 192.0.2.0/24,198.51.100.0/24 --orgId 5a1b39eec902201990f12345 --output json