Skip to content

Commit bc314c1

Browse files
committed
Update example and add support for GenAIFeaturesEnabled
1 parent a91cb84 commit bc314c1

File tree

7 files changed

+68
-3
lines changed

7 files changed

+68
-3
lines changed

cfn-resources/organization/cmd/resource/model.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cfn-resources/organization/cmd/resource/resource.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func Create(req handler.Request, prevModel *Model, currentModel *Model) (handler
8888
}
8989

9090
apikeyInputs := setAPIkeyInputs(currentModel)
91+
setDefaultsIfNotDefined(currentModel)
9192

9293
// Set the roles from model
9394
orgInput := &admin.CreateOrganizationRequest{
@@ -171,7 +172,9 @@ func Update(req handler.Request, prevModel *Model, currentModel *Model) (handler
171172
conn := newOrgClient.AtlasSDK
172173
ctx := context.Background()
173174

175+
setDefaultsIfNotDefined(currentModel)
174176
atlasOrg := admin.AtlasOrganization{Id: currentModel.OrgId, Name: *currentModel.Name, SkipDefaultAlertsSettings: currentModel.SkipDefaultAlertsSettings}
177+
175178
if _, response, err := conn.OrganizationsApi.UpdateOrganization(ctx, *currentModel.OrgId, &atlasOrg).Execute(); err != nil {
176179
return handleError(response, constants.UPDATE, err)
177180
}
@@ -311,6 +314,7 @@ func (model *Model) getOrgDetails(ctx context.Context, conn *admin.APIClient, cu
311314
model.ApiAccessListRequired = settings.ApiAccessListRequired
312315
model.MultiFactorAuthRequired = settings.MultiFactorAuthRequired
313316
model.RestrictEmployeeAccess = settings.RestrictEmployeeAccess
317+
model.GenAIFeaturesEnabled = settings.GenAIFeaturesEnabled
314318

315319
return model, response, nil
316320
}
@@ -354,5 +358,19 @@ func newOrganizationSettings(model *Model) *admin.OrganizationSettings {
354358
ApiAccessListRequired: model.ApiAccessListRequired,
355359
MultiFactorAuthRequired: model.MultiFactorAuthRequired,
356360
RestrictEmployeeAccess: model.RestrictEmployeeAccess,
361+
GenAIFeaturesEnabled: model.GenAIFeaturesEnabled,
362+
}
363+
}
364+
365+
func setDefaultsIfNotDefined(m *Model) {
366+
if m == nil {
367+
return
357368
}
369+
if m.SkipDefaultAlertsSettings == nil {
370+
m.SkipDefaultAlertsSettings = util.Pointer(true)
371+
}
372+
if m.GenAIFeaturesEnabled == nil {
373+
m.GenAIFeaturesEnabled = util.Pointer(true)
374+
}
375+
358376
}

cfn-resources/organization/docs/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ To declare this entity in your AWS CloudFormation template, use the following sy
1919
"<a href="#profile" title="Profile">Profile</a>" : <i>String</i>,
2020
"<a href="#awssecretname" title="AwsSecretName">AwsSecretName</a>" : <i>String</i>,
2121
"<a href="#skipdefaultalertssettings" title="SkipDefaultAlertsSettings">SkipDefaultAlertsSettings</a>" : <i>Boolean</i>,
22+
"<a href="#genaifeaturesenabled" title="GenAIFeaturesEnabled">GenAIFeaturesEnabled</a>" : <i>Boolean</i>,
2223
"<a href="#isdeleted" title="IsDeleted">IsDeleted</a>" : <i>Boolean</i>,
2324
"<a href="#apiaccesslistrequired" title="ApiAccessListRequired">ApiAccessListRequired</a>" : <i>Boolean</i>,
2425
"<a href="#multifactorauthrequired" title="MultiFactorAuthRequired">MultiFactorAuthRequired</a>" : <i>Boolean</i>,
@@ -39,6 +40,7 @@ Properties:
3940
<a href="#profile" title="Profile">Profile</a>: <i>String</i>
4041
<a href="#awssecretname" title="AwsSecretName">AwsSecretName</a>: <i>String</i>
4142
<a href="#skipdefaultalertssettings" title="SkipDefaultAlertsSettings">SkipDefaultAlertsSettings</a>: <i>Boolean</i>
43+
<a href="#genaifeaturesenabled" title="GenAIFeaturesEnabled">GenAIFeaturesEnabled</a>: <i>Boolean</i>
4244
<a href="#isdeleted" title="IsDeleted">IsDeleted</a>: <i>Boolean</i>
4345
<a href="#apiaccesslistrequired" title="ApiAccessListRequired">ApiAccessListRequired</a>: <i>Boolean</i>
4446
<a href="#multifactorauthrequired" title="MultiFactorAuthRequired">MultiFactorAuthRequired</a>: <i>Boolean</i>
@@ -121,6 +123,16 @@ _Type_: Boolean
121123

122124
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
123125

126+
#### GenAIFeaturesEnabled
127+
128+
Flag that indicates whether this organization has access to generative AI features. This setting only applies to Atlas Commercial and defaults to `true`. With this setting on, Project Owners may be able to enable or disable individual AI features at the project level. To learn more, see https://www.mongodb.com/docs/generative-ai-faq/
129+
130+
_Required_: No
131+
132+
_Type_: Boolean
133+
134+
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
135+
124136
#### IsDeleted
125137

126138
Flag that indicates whether this organization has been deleted.

cfn-resources/organization/mongodb-atlas-organization.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@
5454
"SkipDefaultAlertsSettings": {
5555
"type": "boolean",
5656
"description": "Disables automatic alert creation. When set to `true`, Atlas doesn't automatically create organization-level alerts. Defaults to `true` for new Atlas Organizations created with the provider to prevent infrastructure drift caused by creation of new alerts.",
57-
"default": "true"
57+
"default": true
58+
},
59+
"GenAIFeaturesEnabled": {
60+
"type": "boolean",
61+
"description": "Flag that indicates whether this organization has access to generative AI features. This setting only applies to Atlas Commercial and defaults to `true`. With this setting on, Project Owners may be able to enable or disable individual AI features at the project level. To learn more, see https://www.mongodb.com/docs/generative-ai-faq/",
62+
"default": true
5863
},
5964
"OrgId": {
6065
"type": "string",

cfn-resources/organization/test/inputs_1_create.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@
1212
},
1313
"MultiFactorAuthRequired": "true",
1414
"RestrictEmployeeAccess": "false",
15-
"ApiAccessListRequired": "false"
15+
"ApiAccessListRequired": "false",
16+
"SkipDefaultAlertsSettings": "true",
17+
"GenAIFeaturesEnabled": "true"
1618
}

cfn-resources/organization/test/inputs_1_update.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
"MultiFactorAuthRequired": "true",
1414
"RestrictEmployeeAccess": "true",
1515
"ApiAccessListRequired": "false",
16-
"SkipDefaultAlertsSettings": "false"
16+
"SkipDefaultAlertsSettings": "false",
17+
"GenAIFeaturesEnabled": "false"
1718
}

examples/organization/organization.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,26 @@
6161
"false"
6262
],
6363
"Default": "false"
64+
},
65+
"SkipDefaultAlertsSettings": {
66+
"Type": "String",
67+
"ConstraintDescription": "boolean",
68+
"AllowedValues": [
69+
"true",
70+
"false"
71+
],
72+
"Default": "true",
73+
"Description": "SkipDefaultAlertsSettings"
74+
},
75+
"GenAIFeaturesEnabled": {
76+
"Type": "String",
77+
"ConstraintDescription": "boolean",
78+
"AllowedValues": [
79+
"true",
80+
"false"
81+
],
82+
"Default": "true",
83+
"Description": "Flag that indicates whether this organization has access to generative AI features. This setting only applies to Atlas Commercial and defaults to `true`. With this setting on, Project Owners may be able to enable or disable individual AI features at the project level. To learn more, see https://www.mongodb.com/docs/generative-ai-faq/"
6484
}
6585
},
6686
"Mappings": {},
@@ -113,6 +133,12 @@
113133
},
114134
"RestrictEmployeeAccess": {
115135
"Ref": "RestrictEmployeeAccess"
136+
},
137+
"SkipDefaultAlertsSettings": {
138+
"Ref": "SkipDefaultAlertsSettings"
139+
},
140+
"GenAIFeaturesEnabled": {
141+
"Ref": "GenAIFeaturesEnabled"
116142
}
117143
}
118144
}

0 commit comments

Comments
 (0)