Skip to content

Commit b8f8771

Browse files
authored
(DOCSP-11437) Add --deleteAfter to atlas dbuser create (#171)
(DOCSP-11437) Add --deleteAfter to atlas dbuser create
1 parent c52b1a3 commit b8f8771

File tree

2 files changed

+88
-19
lines changed

2 files changed

+88
-19
lines changed

source/includes/atlas-dbuser-output-fields.rst

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020

2121
Groups and projects are synonymous terms. Your {GROUP-ID}
2222
is the same as your project ID.
23+
24+
* - ``roles``
25+
- User's roles and the databases or collections on which the
26+
roles apply.
27+
28+
* - ``username``
29+
- Username for authentication.
2330

2431
* - ``ldapAuthType``
2532
- Method by which the specified ``username`` is
@@ -74,11 +81,8 @@
7481
* - ``ROLE``
7582
- This user authenticates with :atlas:`AWS IAM role credentials
7683
</security-add-mongodb-users/#database-user-authentication>`.
77-
78-
* - ``roles``
79-
- User's roles and the databases or collections on which the
80-
roles apply.
81-
82-
* - ``username``
83-
- Username for authentication.
84-
84+
85+
* - ``deleteAfterDate``
86+
- |iso8601-time| after which |service| deletes the user. This
87+
field is only present if an expiration date was specified when
88+
creating the entry.

source/reference/atlas/dbuser-create.txt

Lines changed: 76 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@ Syntax
2525

2626
.. code-block:: text
2727

28-
mongocli atlas dbuser create
29-
--password|-p <password-of-user>
28+
mongocli atlas dbuser create
29+
--username|-u <name-of-user>
30+
[ --password|-p <password-of-user> ]
3031
[ --profile|-P <profile-name> ]
3132
[ --projectId <project-ID> ]
3233
--role <name-of-role>
33-
--username|-u <name-of-user>
3434
[ --authDB <authentication-database> ]
35+
[ --deleteAfter <date-of-deletion> ]
3536

3637
.. include:: /includes/fact-command-line-help.rst
3738

@@ -49,11 +50,16 @@ Options
4950
- Description
5051
- Required?
5152

52-
* - ``--password``, ``-p``
53+
* - ``--username``, ``-u``
5354
- string
54-
- Password for authenticating the user to MongoDB.
55+
- Username for authenticating the user to MongoDB.
5556
- yes
5657

58+
* - ``--password``, ``-p``
59+
- string
60+
- Password for authenticating the user to MongoDB.
61+
- no
62+
5763
* - ``--profile``, ``-P``
5864
- string
5965
- Name of the profile where the public and private
@@ -79,19 +85,36 @@ Options
7985
</security-add-mongodb-users/index.html#mongodb-database-user-privileges>`.
8086
- yes
8187

82-
* - ``--username``, ``-u``
83-
- string
84-
- Username for authenticating the user to MongoDB.
85-
- yes
86-
8788
* - ``--authDB``
8889
- string
8990
- Name of the authentication database. Defaults to ``admin``.
9091
- no
9192

93+
* - ``--deleteAfter``
94+
- date
95+
- |iso8601-time| after which |service| deletes the user. The
96+
specified date must be in the future and within one week of the
97+
time you make the API request.
98+
99+
.. note::
100+
You may include an |iso8601| time zone designator to ensure
101+
that the expiration date occurs with respect to the local
102+
time in the specified time zone. Time zones are represented
103+
as an offset from |utc|.
104+
105+
.. example::
106+
To delete a database user on August 1st, 2020, at 12:30pm in
107+
New York (Eastern Daylight Time), use the option:
108+
109+
.. code-block:: sh
110+
:copyable: true
111+
112+
--deleteAfter 2020-08-01T12:30-04:00
113+
- no
114+
92115
.. _dbuser-create-command-output:
93116

94-
Output
117+
Output
95118
------
96119
.. include:: /includes/command-output-intro.rst
97120

@@ -191,3 +214,45 @@ To learn more about these fields, see :ref:`Output
191214
"databaseName": "admin",
192215
"ldapAuthType": "NONE"
193216
}
217+
218+
.. _dbuser-create-eg-3:
219+
220+
Example 3
221+
~~~~~~~~~
222+
223+
The following command creates a temporary user with credentials that
224+
expire in one week.
225+
226+
- Username: ``tempUser``
227+
- Password: ``ChangeThisToAStrongPassword``
228+
- Role: ``clusterMonitor``
229+
- Credential expiry date: ``2020-07-31``
230+
231+
The command uses the {+default-profile+} to access |service| and create
232+
the user.
233+
234+
.. code-block:: sh
235+
:copyable: false
236+
237+
mongocli atlas dbuser create --username tempUser --password ChangeThisToAStrongPassword --role clusterMonitor@admin --deleteAfter 2020-07-31 --projectId 5e2211c17a3e5a48f5497de3
238+
239+
The previous command prints the following fields
240+
to the terminal. To learn more about these fields, see
241+
:ref:`Output <dbuser-create-command-output>`.
242+
243+
.. code-block:: json
244+
:copyable: false
245+
246+
{
247+
"roles": [{
248+
"roleName": "clusterMonitor",
249+
"databaseName": "admin"
250+
}],
251+
"groupId": "5e2211c17a3e5a48f5497de3",
252+
"username": "tempUser",
253+
"databaseName": "admin",
254+
"ldapAuthType": "NONE",
255+
"x509Type": "NONE",
256+
"awsIAMType": "NONE",
257+
"deleteAfterDate": "2020-07-31T00:00:00Z"
258+
}

0 commit comments

Comments
 (0)