@@ -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