Skip to content

Commit b76d61a

Browse files
authored
(DOCSP-11538) mongocli iam project apikey create|list|assign|delete (#202)
(DOCSP-11538) iam project apikey create|list|assign|delete
1 parent d7b1131 commit b76d61a

11 files changed

+726
-12
lines changed

source/reference/access.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
:ref:`project <mcli-reference-iam-project>`
2222
Manage projects in your |service|, |com| instance.
2323

24+
:ref:`project apikey <mcli-reference-iam-project-apikeys>`
25+
Manage |api| keys in your project.
26+
2427
.. class:: hidden
2528

2629
.. toctree::
@@ -29,3 +32,4 @@
2932
Organizations </reference/iam/organization-commands>
3033
Organization API Keys </reference/iam/organization-apikey-commands>
3134
Projects </reference/iam/project-commands>
35+
Project API Keys </reference/iam/project-apikey-commands>

source/reference/iam/iam-organization-apikey-assign.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Syntax
2222

2323
.. code-block:: text
2424

25-
mongocli iam organization|organizations|org|orgs apiKey|apiKeys|apikeys assign|updates <api-key-id>
25+
mongocli iam organization|organizations|org|orgs apiKey|apiKeys|apikeys assign|update <api-key-id>
2626
[ --desc "<description-of-key>" ]
2727
[ --orgId <organization-id> ]
2828
[ --output|-o <output-format> ]

source/reference/iam/iam-organization-apikey-create.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Examples
158158

159159
.. code-block:: sh
160160

161-
mongocli iam organization apikey create --desc "My API key" --orgId 5a1b39eec902201990f12345 --role ORG_OWNER,ORG_MEMBER --output json
161+
mongocli iam organization apikey create --desc "My API key" --orgId 5a1b39eec902201990f12345 --role ORG_OWNER,ORG_MEMBER --profile myOM --output json
162162

163163
The previous command creates the |api| key and
164164
prints the following to the terminal in |json| format.

source/reference/iam/iam-organization-apikey-delete.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,13 @@ Examples
142142
:tabid: json-output
143143

144144
The following command deletes an organization |api| key without
145-
confirmation. The command uses the ``myOM`` profile, which contains
146-
credentials, and returns the output in |json| format.
145+
confirmation. The command uses the ``myOM`` profile, which
146+
contains credentials and specifies the |onprem| service, and
147+
returns the output in |json| format.
147148

148149
.. code-block:: sh
149150

150-
mongocli iam org apikey delete 5f3d8790c9022019903c1234 --force -P
151-
myOM -o json
151+
mongocli iam org apikey delete 5f3d8790c9022019903c1234 --force -P myOM -o json
152152

153153
The previous command updates the |api| key and
154154
prints the following to the terminal in |json| format.

source/reference/iam/iam-organization-apikey-list.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,17 @@ Examples
121121
.. tab:: JSON Output
122122
:tabid: json-output
123123

124-
The following command creates an |api| key using the
125-
``myOM`` profile, which contains credentials. The output is
126-
returned in |json| format.
124+
The following command retrieves the |api| keys for an
125+
organization using the ``myOM`` profile, which contains
126+
credentials. The output is returned in |json| format.
127127

128128
.. code-block:: sh
129129

130130
mongocli iam organization apikey list --orgId 5a1b39eec902201990f12345 -P myOM --output json
131131

132-
The previous command creates the |api| key and
133-
prints the following to the terminal in |json| format.
132+
The previous command retrieves the |api| keys for an
133+
organization and prints the following to the terminal in |json|
134+
format.
134135

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

0 commit comments

Comments
 (0)