|
| 1 | +.. _mcli-iam-organization-apikey-whitelist-create: |
| 2 | + |
| 3 | +================================================= |
| 4 | +mongocli iam organization apikey whitelist create |
| 5 | +================================================= |
| 6 | + |
| 7 | +.. default-domain:: mongodb |
| 8 | + |
| 9 | +.. contents:: On this page |
| 10 | + :local: |
| 11 | + :backlinks: none |
| 12 | + :depth: 1 |
| 13 | + :class: singlecol |
| 14 | + |
| 15 | +The ``iam organization apikey whitelist create`` command creates one or |
| 16 | +more new whitelist entries for the specified |api| key. |
| 17 | + |
| 18 | +.. _mcli-iam-organization-apikey-whitelist-create-syntax: |
| 19 | + |
| 20 | +Syntax |
| 21 | +------ |
| 22 | + |
| 23 | +.. code-block:: sh |
| 24 | + |
| 25 | + mongocli iam organization|organizations|org|orgs apiKey|apiKeys|apikeys whitelist|whitelists create |
| 26 | + --apiKey <api-key-id> |
| 27 | + [ --cidr <cidr-entry> ] |
| 28 | + [ --ip <id-entry> ] |
| 29 | + [ --orgId <organization-id> ] |
| 30 | + [ --output|-o <output-format> ] |
| 31 | + [ --profile|-P <profile-name> ] |
| 32 | + |
| 33 | +.. include:: /includes/fact-command-line-help.rst |
| 34 | + |
| 35 | +.. _mcli-iam-organization-apikey-whitelist-create-options: |
| 36 | + |
| 37 | +Options |
| 38 | +------- |
| 39 | + |
| 40 | +.. list-table:: |
| 41 | + :header-rows: 1 |
| 42 | + :widths: 20 10 60 10 |
| 43 | + |
| 44 | + * - Option |
| 45 | + - Type |
| 46 | + - Description |
| 47 | + - Required? |
| 48 | + |
| 49 | + * - ``--apikey`` |
| 50 | + - string |
| 51 | + - Unique identifier of the |api| key. |
| 52 | + - yes |
| 53 | + |
| 54 | + * - ``--cidr`` |
| 55 | + - string |
| 56 | + - Whitelist entry in |cidr| notation to be added for the API key. |
| 57 | + To add more than one entry in |cidr| notation, you can specify |
| 58 | + each entry with a ``--cidr`` flag or specify the entries in a |
| 59 | + comma-separated list with one ``--cidr`` flag. |
| 60 | + - no |
| 61 | + |
| 62 | + * - ``--ip`` |
| 63 | + - string |
| 64 | + - IP address to be added to the whitelist for the |api| key. |
| 65 | + To add more than one IP address, you can specify |
| 66 | + each address with an ``--ip`` flag or specify the addresses in a |
| 67 | + comma-separated list with one ``--ip`` flag. |
| 68 | + - no |
| 69 | + |
| 70 | + * - ``--orgId`` |
| 71 | + - string |
| 72 | + - Unique identifier of the organization to which the target |api| |
| 73 | + key belongs. |
| 74 | + |
| 75 | + If specified, this value overrides any organization ID |
| 76 | + stored in your :ref:`profile <mcli-profiles>` or |
| 77 | + :ref:`environment variable <mcli-env-var>`. |
| 78 | + |
| 79 | + If omitted, your profile must contain the |
| 80 | + organization ID. |
| 81 | + - no |
| 82 | + |
| 83 | + * - ``--output``, ``-o`` |
| 84 | + - string |
| 85 | + - .. include:: /includes/extracts/fact-basic-options-output.rst |
| 86 | + - no |
| 87 | + |
| 88 | + * - ``--profile``, ``-P`` |
| 89 | + - string |
| 90 | + - Name of the profile where your credentials are saved. |
| 91 | + |
| 92 | + You must have credentials with the ``Organization Owner`` role to |
| 93 | + create an |api| key for the organization. |
| 94 | + |
| 95 | + If omitted, uses the {+default-profile+}. To learn more about |
| 96 | + creating a profile, see :ref:`mcli-configure`. |
| 97 | + - no |
| 98 | + |
| 99 | +.. _mcli-iam-organization-apikey-whitelist-create-output: |
| 100 | + |
| 101 | +Output |
| 102 | +------ |
| 103 | + |
| 104 | +If the command succeeds, it prints the following output to the terminal. |
| 105 | +If the command returns errors, see :ref:`Troubleshooting |
| 106 | +<troubleshooting>` for recommended solutions. |
| 107 | + |
| 108 | +.. code-block:: sh |
| 109 | + :copyable: false |
| 110 | + |
| 111 | + Created new whitelist entry(s). |
| 112 | + |
| 113 | +.. include:: /includes/fact-default-output.rst |
| 114 | + |
| 115 | +- :atlas:`Atlas </reference/api/apiKeys-org-whitelist-create/#response>` |
| 116 | +- :cloudmgr:`Cloud Manager </reference/api/api-keys/org/create-org-api-key-whitelist/#response>` |
| 117 | +- :opsmgr:`Ops Manager </reference/api/api-keys/org/create-org-api-key-whitelist/#response>` |
| 118 | + |
| 119 | +.. _mcli-iam-organization-apikey-whitelist-create-examples: |
| 120 | + |
| 121 | +Examples |
| 122 | +-------- |
| 123 | + |
| 124 | +.. tabs:: |
| 125 | + |
| 126 | + .. tab:: Default Output |
| 127 | + :tabid: default-output |
| 128 | + |
| 129 | + The following command creates a whitelist entry for an |api| key |
| 130 | + using the {+default-profile+}, which contains credentials, the |
| 131 | + organization ID, and specifies the |service| service. The output |
| 132 | + is returned in the default format. |
| 133 | + |
| 134 | + .. code-block:: sh |
| 135 | + |
| 136 | + mongocli iam orgs apikey whitelist create --apiKey 5f24084d8dbffa3ad3f21234 --ip 192.0.2.0 |
| 137 | + |
| 138 | + The previous command creates the whitelist entry and |
| 139 | + prints the following to the terminal. |
| 140 | + |
| 141 | + .. code-block:: json |
| 142 | + :copyable: false |
| 143 | + |
| 144 | + Created new whitelist entry(s). |
| 145 | + |
| 146 | + .. tab:: JSON Output |
| 147 | + :tabid: json-output |
| 148 | + |
| 149 | + The following command creates two whitelist entries for an |api| key using the ``myOM`` profile, which contains credentials and |
| 150 | + specifies the |onprem| service. The output is returned in |json| |
| 151 | + format. |
| 152 | + |
| 153 | + .. code-block:: sh |
| 154 | + |
| 155 | + mongocli iam orgs apikey whitelist create --apiKey 5f24084d8dbffa3ad3f21234 --cidr 192.0.2.0/24,198.51.100.0/24 --orgId 5a1b39eec902201990f12345 --output json |
| 156 | + |
| 157 | + The previous command creates the whitelist entries and |
| 158 | + prints the following to the terminal in |json| format. |
| 159 | + |
| 160 | + .. code-block:: json |
| 161 | + :copyable: false |
| 162 | + |
| 163 | + { |
| 164 | + "results": [ |
| 165 | + { |
| 166 | + "cidrBlock": "198.51.100.0/24", |
| 167 | + "created": "2020-08-04T10:16:51Z", |
| 168 | + "ipAddress": "198.51.100.0", |
| 169 | + "links": [ |
| 170 | + { |
| 171 | + "rel": "self", |
| 172 | + "href": "https://example.mongodb.com/api/atlas/v1.0/orgs/5a1b39eec902201990f12345/apiKeys/5f24084d8dbffa3ad3f21234/whitelist/198.51.100.0" |
| 173 | + } |
| 174 | + ] |
| 175 | + }, |
| 176 | + { |
| 177 | + "cidrBlock": "192.0.2.0/24", |
| 178 | + "created": "2020-08-04T10:16:51Z", |
| 179 | + "ipAddress": "192.0.2.0", |
| 180 | + "links": [ |
| 181 | + { |
| 182 | + "rel": "self", |
| 183 | + "href": "https://example.mongodb.com/api/atlas/v1.0/orgs/5a1b39eec902201990f12345/apiKeys/5f24084d8dbffa3ad3f21234/whitelist/192.0.2.0" |
| 184 | + } |
| 185 | + ] |
| 186 | + } |
| 187 | + ], |
| 188 | + "links": [ |
| 189 | + { |
| 190 | + "rel": "self", |
| 191 | + "href": "https://example.mongodb.com/api/atlas/v1.0/orgs/5a1b39eec902201990f12345/apiKeys/5f24084d8dbffa3ad3f21234/whitelist?pageNum=1\u0026itemsPerPage=100" |
| 192 | + } |
| 193 | + ], |
| 194 | + "totalCount": 2 |
| 195 | + } |
0 commit comments