Docs Menu
Docs Home
/ /
MongoDB Command Line Interface
/ / /

mongocli iam globalWhitelist create

On this page

  • Syntax
  • Options
  • Output
  • Examples

The iam globalWhitelist create command creates one global whitelist entry for an Ops Manager instance. The entry represents a CIDR block from which Ops Manager accepts incoming API requests. You can also create a whitelist entry using the Ops Manager UI or API.

You must have credentials with the Global Owner role to create a global whitelist entry.

mongocli iam globalWhitelist|ipwhitelist create
--cidr <cidr-entry>
--desc <description-of-entry>
[ --output|-o <output-format> ]
[ --profile|-P <profile-name> ]

Note

Use -h or --help to view the command-line help for this command.

Option
Type
Description
Required?
--cidr
string
Whitelist entry in IPv4 or IPv6 CIDR notation to add to the Ops Manager instance.
yes
--desc
string
Description of the global whitelist entry. Description must be between 1 and 250 characters in length.
yes
--output, -o
string

Command output format. Valid values are:

  • json for output in JSON format

  • go-template for custom output using the Go template

  • go-template-file for custom output specified using Go template file

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 Global Owner role to create a global whitelist entry.

no

If the command succeeds, it prints the following output to the terminal in the default format. If the command returns errors, see Troubleshooting for recommended solutions.

Global whitelist entry '<whitelist-id>' created.

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.

The following command creates a whitelist entry for an Ops Manager instance using the default profile, which contains credentials for accessing the instance. The output is returned in the default format.

mongocli iam globalWhitelists create --cidr 192.168.0.1/32 --desc "My Global IP"

The previous command creates the whitelist entry and prints the following to the terminal.

Global whitelist entry '5f5bacd457aef32b04ed00e4' created.

The following command creates a whitelist entry for an Ops Manager instance using the myOM profile, which contains credentials for accessing the Ops Manager instance. The output is returned in JSON format.

mongocli iam globalWhitelists create --cidr 192.168.0.1/32 --desc "My Global IP" --profile myOM --output json

The previous command creates the whitelist entry and prints the following to the terminal in JSON format.

{
"id": "5f5bb07e57aef32b04ed0770",
"cidrBlock": "192.168.0.1/32",
"created": "2020-09-11T17:14:38Z",
"description": "My Global IP",
"type": "GLOBAL_ROLE",
"updated": "2020-09-11T17:14:38Z"
}

Back

Global Whitelist