@@ -547,7 +547,7 @@ func clusterFromAtlas(clusterDesc *admin.ClusterDescription20240805) *Cluster {
547
547
MongoDBMajorVersion : clusterDesc .GetMongoDBMajorVersion (),
548
548
MongoDBVersion : clusterDesc .GetMongoDBVersion (),
549
549
VersionReleaseSystem : clusterDesc .GetVersionReleaseSystem (),
550
- DiskSizeGB : diskSizeFromAtlas (clusterDesc . GetDiskSizeGB () ),
550
+ DiskSizeGB : diskSizeFromAtlas (clusterDesc ),
551
551
BackupEnabled : clusterDesc .BackupEnabled ,
552
552
BiConnector : biConnectFromAtlas (clusterDesc .BiConnector ),
553
553
EncryptionAtRestProvider : clusterDesc .GetEncryptionAtRestProvider (),
@@ -575,14 +575,13 @@ func clusterCreateToAtlas(cluster *Cluster) *admin.ClusterDescription20240805 {
575
575
ClusterType : pointer .MakePtrOrNil (cluster .ClusterType ),
576
576
MongoDBMajorVersion : pointer .MakePtrOrNil (cluster .MongoDBMajorVersion ),
577
577
VersionReleaseSystem : pointer .MakePtrOrNil (cluster .VersionReleaseSystem ),
578
- DiskSizeGB : diskSizeToAtlas (cluster .DiskSizeGB ),
579
578
BackupEnabled : cluster .BackupEnabled ,
580
579
BiConnector : biConnectToAtlas (cluster .BiConnector ),
581
580
EncryptionAtRestProvider : pointer .MakePtrOrNil (cluster .EncryptionAtRestProvider ),
582
581
Labels : labelsToAtlas (cluster .Labels ),
583
582
Paused : cluster .Paused ,
584
583
PitEnabled : cluster .PitEnabled ,
585
- ReplicationSpecs : replicationSpecToAtlas (cluster .ReplicationSpecs ),
584
+ ReplicationSpecs : replicationSpecToAtlas (cluster .ReplicationSpecs , cluster . DiskSizeGB ),
586
585
RootCertType : pointer .MakePtrOrNil (cluster .RootCertType ),
587
586
Tags : tag .ToAtlas (cluster .Tags ),
588
587
TerminationProtectionEnabled : pointer .MakePtrOrNil (cluster .TerminationProtectionEnabled ),
@@ -594,14 +593,13 @@ func clusterUpdateToAtlas(cluster *Cluster) *admin.ClusterDescription20240805 {
594
593
ClusterType : pointer .MakePtrOrNil (cluster .ClusterType ),
595
594
MongoDBMajorVersion : pointer .MakePtrOrNil (cluster .MongoDBMajorVersion ),
596
595
VersionReleaseSystem : pointer .MakePtrOrNil (cluster .VersionReleaseSystem ),
597
- DiskSizeGB : diskSizeToAtlas (cluster .DiskSizeGB ),
598
596
BackupEnabled : cluster .BackupEnabled ,
599
597
BiConnector : biConnectToAtlas (cluster .BiConnector ),
600
598
EncryptionAtRestProvider : pointer .MakePtrOrNil (cluster .EncryptionAtRestProvider ),
601
599
Labels : labelsToAtlas (cluster .Labels ),
602
600
Paused : cluster .Paused ,
603
601
PitEnabled : cluster .PitEnabled ,
604
- ReplicationSpecs : replicationSpecToAtlas (cluster .ReplicationSpecs ),
602
+ ReplicationSpecs : replicationSpecToAtlas (cluster .ReplicationSpecs , cluster . DiskSizeGB ),
605
603
RootCertType : pointer .MakePtrOrNil (cluster .RootCertType ),
606
604
Tags : tag .ToAtlas (cluster .Tags ),
607
605
TerminationProtectionEnabled : pointer .MakePtrOrNil (cluster .TerminationProtectionEnabled ),
@@ -623,7 +621,22 @@ func replicaSetFromAtlas(replicationSpecs []admin.ReplicationSpec20240805) []sta
623
621
return replicaSet
624
622
}
625
623
626
- func diskSizeFromAtlas (value float64 ) * int {
624
+ func diskSizeFromAtlas (cluster * admin.ClusterDescription20240805 ) * int {
625
+
626
+ var value float64
627
+
628
+ if specs := cluster .GetReplicationSpecs (); len (specs ) > 0 {
629
+ if configs := specs [0 ].GetRegionConfigs (); len (configs ) > 0 {
630
+ if e , ok := configs [0 ].GetElectableSpecsOk (); ok {
631
+ value = e .GetDiskSizeGB ()
632
+ } else if r , ok := configs [0 ].GetReadOnlySpecsOk (); ok {
633
+ value = r .GetDiskSizeGB ()
634
+ } else if a , ok := configs [0 ].GetAnalyticsSpecsOk (); ok {
635
+ value = a .GetDiskSizeGB ()
636
+ }
637
+ }
638
+ }
639
+
627
640
if value >= 1 {
628
641
return pointer .MakePtr (int (value ))
629
642
}
@@ -804,11 +817,16 @@ func labelsToAtlas(labels []common.LabelSpec) *[]admin.ComponentLabel {
804
817
return & cLabels
805
818
}
806
819
807
- func replicationSpecToAtlas (replicationSpecs []* akov2.AdvancedReplicationSpec ) * []admin.ReplicationSpec20240805 {
820
+ func replicationSpecToAtlas (replicationSpecs []* akov2.AdvancedReplicationSpec , diskSize * int ) * []admin.ReplicationSpec20240805 {
808
821
if len (replicationSpecs ) == 0 {
809
822
return nil
810
823
}
811
824
825
+ var diskSizeGB * float64
826
+ if diskSize != nil {
827
+ diskSizeGB = pointer .MakePtr (float64 (* diskSize ))
828
+ }
829
+
812
830
hSpecOrDefault := func (spec * akov2.Specs ) * admin.HardwareSpec20240805 {
813
831
if spec == nil {
814
832
return nil
@@ -824,6 +842,7 @@ func replicationSpecToAtlas(replicationSpecs []*akov2.AdvancedReplicationSpec) *
824
842
NodeCount : spec .NodeCount ,
825
843
EbsVolumeType : pointer .NonZeroOrDefault (spec .EbsVolumeType , "STANDARD" ),
826
844
DiskIOPS : diskIOPs ,
845
+ DiskSizeGB : diskSizeGB ,
827
846
}
828
847
}
829
848
dHSpecOrDefault := func (spec * akov2.Specs ) * admin.DedicatedHardwareSpec20240805 {
@@ -841,6 +860,7 @@ func replicationSpecToAtlas(replicationSpecs []*akov2.AdvancedReplicationSpec) *
841
860
NodeCount : spec .NodeCount ,
842
861
EbsVolumeType : pointer .NonZeroOrDefault (spec .EbsVolumeType , "STANDARD" ),
843
862
DiskIOPS : diskIOPs ,
863
+ DiskSizeGB : diskSizeGB ,
844
864
}
845
865
}
846
866
autoScalingOrDefault := func (spec * akov2.AdvancedAutoScalingSpec ) * admin.AdvancedAutoScalingSettings {
0 commit comments