@@ -25,13 +25,14 @@ Syntax
25
25
26
26
.. code-block:: text
27
27
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> ]
30
31
[ --profile|-P <profile-name> ]
31
32
[ --projectId <project-ID> ]
32
33
--role <name-of-role>
33
- --username|-u <name-of-user>
34
34
[ --authDB <authentication-database> ]
35
+ [ --deleteAfter <date-of-deletion> ]
35
36
36
37
.. include:: /includes/fact-command-line-help.rst
37
38
@@ -49,11 +50,16 @@ Options
49
50
- Description
50
51
- Required?
51
52
52
- * - ``--password ``, ``-p ``
53
+ * - ``--username ``, ``-u ``
53
54
- string
54
- - Password for authenticating the user to MongoDB.
55
+ - Username for authenticating the user to MongoDB.
55
56
- yes
56
57
58
+ * - ``--password``, ``-p``
59
+ - string
60
+ - Password for authenticating the user to MongoDB.
61
+ - no
62
+
57
63
* - ``--profile``, ``-P``
58
64
- string
59
65
- Name of the profile where the public and private
@@ -79,19 +85,36 @@ Options
79
85
</security-add-mongodb-users/index.html#mongodb-database-user-privileges>`.
80
86
- yes
81
87
82
- * - ``--username``, ``-u``
83
- - string
84
- - Username for authenticating the user to MongoDB.
85
- - yes
86
-
87
88
* - ``--authDB``
88
89
- string
89
90
- Name of the authentication database. Defaults to ``admin``.
90
91
- no
91
92
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
+
92
115
.. _dbuser-create-command-output:
93
116
94
- Output
117
+ Output
95
118
------
96
119
.. include:: /includes/command-output-intro.rst
97
120
@@ -191,3 +214,45 @@ To learn more about these fields, see :ref:`Output
191
214
"databaseName": "admin",
192
215
"ldapAuthType": "NONE"
193
216
}
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