Skip to content

Commit 1bc7f6c

Browse files
authored
feat: Adds AdvancedConfiguration attribute (#547)
1 parent 696afb9 commit 1bc7f6c

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

mongodbatlas/clusters.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ type Cluster struct {
174174
RootCertType string `json:"rootCertType,omitempty"`
175175
TerminationProtectionEnabled *bool `json:"terminationProtectionEnabled,omitempty"`
176176
Tags *[]*Tag `json:"tags,omitempty"`
177+
AdvancedConfiguration *AdvancedConfiguration `json:"advancedConfiguration,omitempty"`
178+
}
179+
180+
// AdvancedConfiguration group of settings that configures a subset of the advanced configuration details.
181+
type AdvancedConfiguration struct {
182+
CustomOpensslCipherConfigTLS12 *[]string `json:"customOpensslCipherConfigTls12,omitempty"`
183+
MinimumEnabledTLSProtocol *string `json:"minimumEnabledTlsProtocol,omitempty"`
184+
TLSCipherConfigMode *string `json:"tlsCipherConfigMode,omitempty"`
177185
}
178186

179187
// ProcessArgs represents the advanced configuration options for the cluster.

mongodbatlas/clusters_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,11 @@ func TestClusters_Create(t *testing.T) {
366366

367367
createRequest := &Cluster{
368368
ID: "1",
369+
AdvancedConfiguration: &AdvancedConfiguration{
370+
MinimumEnabledTLSProtocol: pointer("TLS1_2"),
371+
TLSCipherConfigMode: pointer("CUSTOM"),
372+
CustomOpensslCipherConfigTLS12: &[]string{"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"},
373+
},
369374
AcceptDataRisksAndForceReplicaSetReconfig: "2017-10-23T21:26:17Z",
370375
AutoScaling: &AutoScaling{DiskGBEnabled: pointer(true),
371376
Compute: &Compute{Enabled: pointer(true), ScaleDownEnabled: pointer(true)}},
@@ -415,6 +420,11 @@ func TestClusters_Create(t *testing.T) {
415420
expected := map[string]interface{}{
416421
"id": "1",
417422
"acceptDataRisksAndForceReplicaSetReconfig": "2017-10-23T21:26:17Z",
423+
"advancedConfiguration": map[string]interface{}{
424+
"customOpensslCipherConfigTls12": []interface{}{"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"},
425+
"minimumEnabledTlsProtocol": "TLS1_2",
426+
"tlsCipherConfigMode": "CUSTOM",
427+
},
418428
"autoScaling": map[string]interface{}{
419429
"diskGBEnabled": true,
420430
"compute": map[string]interface{}{
@@ -475,6 +485,13 @@ func TestClusters_Create(t *testing.T) {
475485
{
476486
"id":"1",
477487
"acceptDataRisksAndForceReplicaSetReconfig": "2017-10-23T21:26:17Z",
488+
"advancedConfiguration": {
489+
"customOpensslCipherConfigTls12": [
490+
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
491+
],
492+
"minimumEnabledTlsProtocol": "TLS1_2",
493+
"tlsCipherConfigMode": "CUSTOM"
494+
},
478495
"autoScaling": {
479496
"diskGBEnabled": true,
480497
"compute": {
@@ -909,6 +926,10 @@ func TestClusters_Get(t *testing.T) {
909926
fmt.Fprint(w, `{
910927
"id":"1",
911928
"acceptDataRisksAndForceReplicaSetReconfig": "2017-10-23T21:26:17Z",
929+
"advancedConfiguration": {
930+
"minimumEnabledTlsProtocol": "TLS1_2",
931+
"tlsCipherConfigMode": "DEFAULT"
932+
},
912933
"autoScaling": {
913934
"diskGBEnabled": true
914935
},
@@ -986,6 +1007,10 @@ func TestClusters_Get(t *testing.T) {
9861007
expected := &Cluster{
9871008
ID: "1",
9881009
AcceptDataRisksAndForceReplicaSetReconfig: "2017-10-23T21:26:17Z",
1010+
AdvancedConfiguration: &AdvancedConfiguration{
1011+
MinimumEnabledTLSProtocol: pointer("TLS1_2"),
1012+
TLSCipherConfigMode: pointer("DEFAULT"),
1013+
},
9891014
AutoScaling: &AutoScaling{DiskGBEnabled: pointer(true)},
9901015
BackupEnabled: pointer(true),
9911016
BiConnector: &BiConnector{Enabled: pointer(false), ReadPreference: "secondary"},

0 commit comments

Comments
 (0)