Skip to content

Commit 71c6a05

Browse files
authored
feat: Adds optional description field to CfnDatabaseUserProps and update documentation of using empty string for custom db role (#446)
1 parent 863fe7d commit 71c6a05

File tree

5 files changed

+32
-9
lines changed

5 files changed

+32
-9
lines changed

API.md

Lines changed: 15 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/l1-resources/custom-db-role.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ export class CdkTestingStack extends cdk.Stack {
2121
profile: atlasProps.profile,
2222
actions:[
2323
{
24-
action: "GROUP_READ",
24+
action: "FIND",
2525
resources: [
2626
{
2727
collection: atlasProps.collectionName,
28-
},
29-
{
3028
db: atlasProps.dbName,
31-
}
29+
},
3230
]
3331
}
3432
],

examples/l1-resources/database-user.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ interface AtlasStackProps {
1010
readonly dbName: string;
1111
readonly username: string;
1212
readonly password: string;
13+
readonly description: string;
1314
}
1415

1516
export class CdkTestingStack extends cdk.Stack {
@@ -23,6 +24,7 @@ export class CdkTestingStack extends cdk.Stack {
2324
username: atlasProps.username,
2425
password: atlasProps.password,
2526
databaseName: atlasProps.dbName,
27+
description: atlasProps.description,
2628
roles: [
2729
{
2830
roleName: atlasProps.roleName,
@@ -43,6 +45,7 @@ export class CdkTestingStack extends cdk.Stack {
4345
const dbName = this.node.tryGetContext('dbName');
4446
const username = this.node.tryGetContext('username');
4547
const password = this.node.tryGetContext('password');
48+
const description = this.node.tryGetContext('userDescription');
4649

4750

4851
return {
@@ -51,7 +54,8 @@ export class CdkTestingStack extends cdk.Stack {
5154
roleName,
5255
dbName,
5356
username,
54-
password
57+
password,
58+
description
5559
}
5660
}
5761
}

src/l1-resources/custom-db-role/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ export function toJson_InheritedRole(
154154
*/
155155
export interface Resource {
156156
/**
157-
* Human-readable label that identifies the collection on which you grant the action to one MongoDB user. If you don't set this parameter, you grant the action to all collections in the database specified in the actions.resources.db parameter. If you set "actions.resources.cluster" : true, MongoDB Cloud ignores this parameter.
157+
* Human-readable label that identifies the collection on which you grant the action to one MongoDB user. If you don't set this parameter, you grant the action to all collections in the database specified in the actions.resources.db parameter. If you set "actions.resources.cluster" : true, MongoDB Cloud ignores this parameter. Use the empty string ("") to allow an action on all collections.
158158
*
159159
* @schema Resource#Collection
160160
*/
161161
readonly collection?: string;
162162

163163
/**
164-
* Human-readable label that identifies the database on which you grant the action to one MongoDB user. If you set "actions.resources.cluster" : true, MongoDB Cloud ignores this parameter.
164+
* Human-readable label that identifies the database on which you grant the action to one MongoDB user. If you set "actions.resources.cluster" : true, MongoDB Cloud ignores this parameter. Use the empty string ("") to allow an action on all databases.
165165
*
166166
* @schema Resource#DB
167167
*/

src/l1-resources/database-user/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ export interface CfnDatabaseUserProps {
2929
*/
3030
readonly databaseName: string;
3131

32+
/**
33+
* Description of this database user.
34+
*
35+
* @schema CfnDatabaseUserProps#Description
36+
*/
37+
readonly description?: string;
38+
3239
/**
3340
* List that contains the key-value pairs for tagging and categorizing the MongoDB database user. The labels that you define do not appear in the console.
3441
*
@@ -107,6 +114,7 @@ export function toJson_CfnDatabaseUserProps(
107114
DeleteAfterDate: obj.deleteAfterDate,
108115
AWSIAMType: obj.awsiamType,
109116
DatabaseName: obj.databaseName,
117+
Description: obj.description,
110118
Labels: obj.labels?.map((y) => toJson_LabelDefinition(y)),
111119
LdapAuthType: obj.ldapAuthType,
112120
X509Type: obj.x509Type,

0 commit comments

Comments
 (0)