|
| 1 | +.. _mcli-iam-organization-apikey-assign: |
| 2 | + |
| 3 | +======================================= |
| 4 | +mongocli iam organization apikey assign |
| 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 assign`` command updates the description |
| 16 | +or roles of the specified organization |api| key. |
| 17 | + |
| 18 | +.. _mcli-iam-organization-apikey-assign-syntax: |
| 19 | + |
| 20 | +Syntax |
| 21 | +------ |
| 22 | + |
| 23 | +.. code-block:: text |
| 24 | + |
| 25 | + mongocli iam organization|organizations|org|orgs apiKey|apiKeys|apikeys assign|updates <api-key-id> |
| 26 | + [ --desc "<description-of-key>" ] |
| 27 | + [ --orgId <organization-id> ] |
| 28 | + [ --output|-o <output-format> ] |
| 29 | + [ --profile|-P <profile-name> ] |
| 30 | + [ --role <list-of-roles> ] |
| 31 | + |
| 32 | +.. include:: /includes/fact-command-line-help.rst |
| 33 | + |
| 34 | +.. _mcli-iam-organization-apikey-assign-arguments: |
| 35 | + |
| 36 | +Arguments |
| 37 | +--------- |
| 38 | + |
| 39 | +.. list-table:: |
| 40 | + :header-rows: 1 |
| 41 | + :widths: 20 10 60 10 |
| 42 | + |
| 43 | + * - Argument |
| 44 | + - Type |
| 45 | + - Description |
| 46 | + - Required? |
| 47 | + |
| 48 | + * - ``<api-key-id>`` |
| 49 | + - string |
| 50 | + - Unique identifier for this organization API key. |
| 51 | + - yes |
| 52 | + |
| 53 | +.. _mcli-iam-organization-apikey-assign-options: |
| 54 | + |
| 55 | +Options |
| 56 | +------- |
| 57 | + |
| 58 | +.. list-table:: |
| 59 | + :header-rows: 1 |
| 60 | + :widths: 20 10 60 10 |
| 61 | + |
| 62 | + * - Option |
| 63 | + - Type |
| 64 | + - Description |
| 65 | + - Required? |
| 66 | + |
| 67 | + * - ``--desc`` |
| 68 | + - string |
| 69 | + - Description of the |api| key to update. |
| 70 | + - no |
| 71 | + |
| 72 | + * - ``--orgId`` |
| 73 | + - string |
| 74 | + - Unique identifier of the organization of the |api| key you want |
| 75 | + to update. |
| 76 | + |
| 77 | + If specified, this value overrides any organization ID |
| 78 | + stored in your :ref:`profile <mcli-profiles>` or |
| 79 | + :ref:`environment variable <mcli-env-var>`. |
| 80 | + |
| 81 | + If omitted, your profile must contain the |
| 82 | + organization ID. |
| 83 | + - no |
| 84 | + |
| 85 | + * - ``--output``, ``-o`` |
| 86 | + - string |
| 87 | + - .. include:: /includes/extracts/fact-basic-options-output.rst |
| 88 | + - no |
| 89 | + |
| 90 | + * - ``--profile``, ``-P`` |
| 91 | + - string |
| 92 | + - Name of the profile where your credentials are saved. |
| 93 | + |
| 94 | + If omitted, uses the {+default-profile+}. To learn more about |
| 95 | + creating a profile, see :ref:`mcli-configure`. |
| 96 | + - no |
| 97 | + |
| 98 | + * - ``--role`` |
| 99 | + - string |
| 100 | + - Role or roles to assign to the |api| key. To assign more than |
| 101 | + one role, you can specify each role with a ``--role`` flag or |
| 102 | + specify the roles in a comma-separated list with one ``--role`` |
| 103 | + flag. |
| 104 | + - no |
| 105 | + |
| 106 | +.. _mcli-iam-organization-apikey-assign-output: |
| 107 | + |
| 108 | +Output |
| 109 | +------ |
| 110 | + |
| 111 | +If the command succeeds, it returns the following output in the default |
| 112 | +format. If the command returns errors, see :ref:`Troubleshooting |
| 113 | +<troubleshooting>` for recommended solutions. |
| 114 | + |
| 115 | +.. code-block:: sh |
| 116 | + :copyable: false |
| 117 | + |
| 118 | + API Key '<api-key-id>' successfully updated. |
| 119 | + |
| 120 | +.. include:: /includes/fact-default-output.rst |
| 121 | + |
| 122 | +- :atlas:`Atlas API </reference/api/apiKeys-orgs-update-one/#response>` |
| 123 | +- :cloudmgr:`Cloud Manager API </reference/api/api-keys/org/update-one-org-api-key/#response>` |
| 124 | +- :opsmgr:`Ops Manager API </reference/api/api-keys/org/update-one-org-api-key/#response>` |
| 125 | + |
| 126 | +.. _mcli-iam-organization-apikey-assign-examples: |
| 127 | + |
| 128 | +Examples |
| 129 | +-------- |
| 130 | + |
| 131 | +.. tabs:: |
| 132 | + |
| 133 | + .. tab:: Default Output |
| 134 | + :tabid: default-output |
| 135 | + |
| 136 | + The following command updates the description and role of an |
| 137 | + organization |api| key using the {+default-profile+}, which |
| 138 | + contains credentials and the organization ID. The output is |
| 139 | + returned in the default format. |
| 140 | + |
| 141 | + .. code-block:: sh |
| 142 | + |
| 143 | + mongocli iam org apikey assign 5f3d8790c9022019903c1234 --role ORG_MEMBER --desc "User1 Member Key" |
| 144 | + |
| 145 | + The previous command prints the following to the terminal. |
| 146 | + |
| 147 | + .. code-block:: json |
| 148 | + :copyable: false |
| 149 | + |
| 150 | + API Key '5f3d8790c9022019903c1234' successfully updated. |
| 151 | + |
| 152 | + .. tab:: JSON Output |
| 153 | + :tabid: json-output |
| 154 | + |
| 155 | + The following command updates the role and description of an |
| 156 | + |api| key using the ``myOM`` profile, which contains credentials. |
| 157 | + The output is returned in |json| format. |
| 158 | + |
| 159 | + .. code-block:: sh |
| 160 | + |
| 161 | + mongocli iam organization apikey assign 5f3d8790c9022019903c1234 --role ORG_MEMBER --desc "User1 Member Key" --orgId 5a1b39eec902201990f12345 -P myOM --output json |
| 162 | + |
| 163 | + The previous command updates the |api| key and |
| 164 | + prints the following to the terminal in |json| format. |
| 165 | + |
| 166 | + .. code-block:: json |
| 167 | + :copyable: false |
| 168 | + |
| 169 | + [ |
| 170 | + { |
| 171 | + "id": "5f3d8790c9022019903c1234", |
| 172 | + "desc": "User1 Member Key", |
| 173 | + "roles": [ |
| 174 | + { |
| 175 | + "orgId": "5e429f2e12345c6eac4d59c9", |
| 176 | + "roleName": "ORG_MEMBER" |
| 177 | + } |
| 178 | + ], |
| 179 | + "privateKey": "********-****-****-123468e0b5be", |
| 180 | + "publicKey": "abcdefgh" |
| 181 | + } |
| 182 | + ] |
0 commit comments