Skip to content

Commit 35875e4

Browse files
trstneTristen Lawrence
and
Tristen Lawrence
authored
Support serverless V2 (#78)
Co-authored-by: Tristen Lawrence <[email protected]>
1 parent 20e8c24 commit 35875e4

File tree

2 files changed

+31
-16
lines changed

2 files changed

+31
-16
lines changed

actions/orchestration.go

+9
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ func (o *rdsOrchestrator) databaseCreate(c buffalo.Context, req *DatabaseCreateR
298298
VpcSecurityGroupIds: req.Cluster.VpcSecurityGroupIds,
299299
}
300300

301+
// Handle Serverless V1
301302
if req.Cluster.ScalingConfiguration != nil {
302303
input.ScalingConfiguration = &rds.ScalingConfiguration{
303304
AutoPause: req.Cluster.ScalingConfiguration.AutoPause,
@@ -308,6 +309,14 @@ func (o *rdsOrchestrator) databaseCreate(c buffalo.Context, req *DatabaseCreateR
308309
}
309310
}
310311

312+
// Handle Serverless V2
313+
if req.Cluster.ServerlessV2ScalingConfiguration != nil {
314+
input.ServerlessV2ScalingConfiguration = &rds.ServerlessV2ScalingConfiguration{
315+
MaxCapacity: req.Cluster.ServerlessV2ScalingConfiguration.MaxCapacity,
316+
MinCapacity: req.Cluster.ServerlessV2ScalingConfiguration.MinCapacity,
317+
}
318+
}
319+
311320
if clusterOutput, err = o.client.Service.CreateDBClusterWithContext(c, input); err != nil {
312321
return nil, ErrCode("failed to create database cluster", err)
313322
}

actions/types.go

+22-16
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,23 @@ type CreateDBInstanceInput struct {
5252
// CreateDBClusterInput is the input for creating a new database cluster
5353
// based on https://docs.aws.amazon.com/sdk-for-go/api/service/rds/#CreateDBClusterInput
5454
type CreateDBClusterInput struct {
55-
BackupRetentionPeriod *int64
56-
DBClusterIdentifier *string
57-
DBClusterParameterGroupName *string
58-
DBSubnetGroupName *string
59-
EnableCloudwatchLogsExports []*string
60-
Engine *string
61-
EngineMode *string
62-
EngineVersion *string
63-
MasterUserPassword *string
64-
MasterUsername *string
65-
Port *int64
66-
ScalingConfiguration *ScalingConfiguration
67-
SnapshotIdentifier *string
68-
StorageEncrypted *bool
69-
Tags []*Tag
70-
VpcSecurityGroupIds []*string
55+
BackupRetentionPeriod *int64
56+
DBClusterIdentifier *string
57+
DBClusterParameterGroupName *string
58+
DBSubnetGroupName *string
59+
EnableCloudwatchLogsExports []*string
60+
Engine *string
61+
EngineMode *string
62+
EngineVersion *string
63+
MasterUserPassword *string
64+
MasterUsername *string
65+
Port *int64
66+
ScalingConfiguration *ScalingConfiguration
67+
ServerlessV2ScalingConfiguration *ServerlessV2ScalingConfiguration
68+
SnapshotIdentifier *string
69+
StorageEncrypted *bool
70+
Tags []*Tag
71+
VpcSecurityGroupIds []*string
7172
}
7273

7374
type ScalingConfiguration struct {
@@ -78,6 +79,11 @@ type ScalingConfiguration struct {
7879
TimeoutAction *string
7980
}
8081

82+
type ServerlessV2ScalingConfiguration struct {
83+
MaxCapacity *float64
84+
MinCapacity *float64
85+
}
86+
8187
type Tag struct {
8288
Key *string
8389
Value *string

0 commit comments

Comments
 (0)