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

mongocli iam globalWhitelist list

On this page

  • Syntax
  • Options
  • Output
  • Examples

The iam globalWhitelist list command lists all the global whitelist entries in an Ops Manager instance. You can also list all the whitelist entries using the Ops Manager API.

You must have credentials with the Global Read Only role to list the global whitelist entries for an Ops Manager instance.

mongocli iam globalWhitelist|ipwhitelist list|ls
[ --limit <items-per-page> ]
[ --output|-o <output-format> ]
[ --page <page-number> ]
[ --profile|-P <profile-name> ]

Note

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

Option
Type
Description
Required?
--limit
integer
Number of items per page, up to a maximum of 500. Defaults to 100 if omitted.
no
--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
--page
integer
Page number (1-based). Defaults to 1 if not specified.
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 Read Only role to list the global whitelist entries for an Ops Manager instance.

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.

ID CIDR BLOCK CREATED AT
<whitelist-entry-id> <cidr-block-1> <date>
<whitelist-entry-id> <cidr-block-2> <date>

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 lists the global whitelist entries 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 list

The previous command prints the following to the terminal.

ID CIDR BLOCK CREATED AT
5f5bb07e57aef32b04ed0770 192.168.0.1/32 2020-09-11T17:37:22Z
5f5bb0e857aef32b04ed0835 198.51.100.0/32 2020-09-11T17:37:22Z

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

mongocli iam globalWhitelists list -P myOM --output json

The previous command prints the following output to the terminal in JSON format.

{
"results": [
{
"id": "5f5bb07e57aef32b04ed0770",
"cidrBlock": "192.168.0.1/32",
"created": "2020-09-11T17:38:10Z",
"description": "My Global IP",
"type": "GLOBAL_ROLE",
"updated": "2020-09-11T17:38:10Z"
},
{
"id": "5f5bb0e857aef32b04ed0835",
"cidrBlock": "198.51.100.0/32",
"created": "2020-09-11T17:38:10Z",
"description": "My Local IP",
"type": "GLOBAL_ROLE",
"updated": "2020-09-11T17:38:10Z"
}
],
"links": [
{
"rel": "self",
"href": "http://example.mongodb.com/api/public/v1.0/admin/whitelist?pageNum=1\u0026itemsPerPage=100"
}
],
"totalCount": 2
}

Back

Create a Global Whitelist Entry for an Ops Manager Instance