diff --git a/rds/rds.go b/rds/rds.go index 9774333a..8dcb4508 100644 --- a/rds/rds.go +++ b/rds/rds.go @@ -93,6 +93,7 @@ func makeParams(action string) map[string]string { type DBInstance struct { Address string `xml:"Endpoint>Address"` AllocatedStorage int `xml:"AllocatedStorage"` + StorageType string `xml:"StorageType"` AvailabilityZone string `xml:"AvailabilityZone"` BackupRetentionPeriod int `xml:"BackupRetentionPeriod"` DBInstanceClass string `xml:"DBInstanceClass"` @@ -170,6 +171,7 @@ type Parameter struct { // The CreateDBInstance request parameters type CreateDBInstance struct { AllocatedStorage int + StorageType string AvailabilityZone string BackupRetentionPeriod int DBInstanceClass string @@ -203,6 +205,10 @@ func (rds *Rds) CreateDBInstance(options *CreateDBInstance) (resp *SimpleResp, e params["AllocatedStorage"] = strconv.Itoa(options.AllocatedStorage) } + if options.StorageType != "" { + params["StorageType"] = options.StorageType + } + if options.SetBackupRetentionPeriod { params["BackupRetentionPeriod"] = strconv.Itoa(options.BackupRetentionPeriod) } diff --git a/rds/rds_test.go b/rds/rds_test.go index 8adadac4..fcc6dd93 100644 --- a/rds/rds_test.go +++ b/rds/rds_test.go @@ -44,6 +44,7 @@ func (s *S) Test_CreateDBInstance(c *C) { EngineVersion: "", DBName: "5.6.13", AllocatedStorage: 10, + StorageType: "gp2", MasterUsername: "foobar", MasterUserPassword: "bazbarbaz", DBInstanceClass: "db.m1.small", @@ -58,6 +59,7 @@ func (s *S) Test_CreateDBInstance(c *C) { c.Assert(req.Form["Action"], DeepEquals, []string{"CreateDBInstance"}) c.Assert(req.Form["Engine"], DeepEquals, []string{"mysql"}) + c.Assert(req.Form["StorageType"], DeepEquals, []string{"gp2"}) c.Assert(req.Form["DBSecurityGroups.member.1"], DeepEquals, []string{"foo"}) c.Assert(err, IsNil) c.Assert(resp.RequestId, Equals, "523e3218-afc7-11c3-90f5-f90431260ab4") @@ -139,6 +141,7 @@ func (s *S) Test_DescribeDBInstances(c *C) { c.Assert(resp.DBInstances[0].DBName, Equals, "mysampledb") c.Assert(resp.DBInstances[0].DBSecurityGroupNames, DeepEquals, []string{"my-db-secgroup"}) c.Assert(resp.DBInstances[0].DBParameterGroupName, Equals, "default.mysql5.6") + c.Assert(resp.DBInstances[0].StorageType, Equals, "gp2") c.Assert(resp.DBInstances[1].VpcSecurityGroupIds, DeepEquals, []string{"my-vpc-secgroup"}) } diff --git a/rds/responses_test.go b/rds/responses_test.go index 0156c568..048557f4 100644 --- a/rds/responses_test.go +++ b/rds/responses_test.go @@ -54,6 +54,7 @@ var DescribeDBInstancesExample = ` true 2014-01-29T22:58:24.231Z 5 + gp2 myawsuser db.t1.micro