diff --git a/rds/rds.go b/rds/rds.go index 9950bc3c..8dcb4508 100644 --- a/rds/rds.go +++ b/rds/rds.go @@ -19,7 +19,7 @@ type Rds struct { httpClient *http.Client } -const APIVersion = "2013-09-09" +const APIVersion = "2014-10-31" // New creates a new Rds instance. func New(auth aws.Auth, region aws.Region) *Rds { @@ -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 36b810d7..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") @@ -138,7 +140,8 @@ func (s *S) Test_DescribeDBInstances(c *C) { c.Assert(resp.RequestId, Equals, "01b2685a-b978-11d3-f272-7cd6cce12cc5") 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, "my-db-paramgroup") + 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"}) } @@ -206,7 +209,7 @@ func (s *S) Test_DescribeDBParameters(c *C) { options := rds.DescribeDBParameters{ DBParameterGroupName: "mydbparamgroup3", - Source: "user", + Source: "user", } resp, err := s.rds.DescribeDBParameters(&options) @@ -379,7 +382,7 @@ func (s *S) Test_ModifyDBParameterGroup(c *C) { options := rds.ModifyDBParameterGroup{ DBParameterGroupName: "mydbparamgroup3", - Parameters: []rds.Parameter{ + Parameters: []rds.Parameter{ rds.Parameter{ ApplyMethod: "immediate", ParameterName: "character_set_server", diff --git a/rds/responses_test.go b/rds/responses_test.go index ceafe39c..048557f4 100644 --- a/rds/responses_test.go +++ b/rds/responses_test.go @@ -9,11 +9,11 @@ var ErrorDump = ` // http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeDBInstances.html var DescribeDBInstancesExample = ` - + - 1 + 7 false available @@ -29,7 +29,7 @@ var DescribeDBInstancesExample = ` in-sync - my-db-paramgroup + default.mysql5.6 @@ -54,11 +54,12 @@ var DescribeDBInstancesExample = ` true 2014-01-29T22:58:24.231Z 5 + gp2 myawsuser db.t1.micro - 1 + 7 false available @@ -111,10 +112,10 @@ var DescribeDBInstancesExample = ` ` var CreateDBInstanceExample = ` - + - 1 + 7 creating false @@ -161,10 +162,10 @@ var CreateDBInstanceExample = ` ` var DeleteDBInstanceExample = ` - + - 2 + 7 deleting false @@ -212,10 +213,11 @@ var DeleteDBInstanceExample = ` 7369556f-b70d-11c3-faca-6ba18376ea1b -` + +` var DescribeDBSecurityGroupsExample = ` - + @@ -261,17 +263,19 @@ var DescribeDBSecurityGroupsExample = ` b76e692c-b98c-11d3-a907-5a2c468b9cb0 -` + +` var DeleteDBSecurityGroupExample = ` - + 7aec7454-ba25-11d3-855b-576787000e19 ` + var CreateDBSecurityGroupExample = ` - + @@ -288,7 +292,7 @@ var CreateDBSecurityGroupExample = ` ` var AuthorizeDBSecurityGroupIngressExample = ` - + @@ -329,7 +333,7 @@ var AuthorizeDBSecurityGroupIngressExample = ` ` var DescribeDBSubnetGroupsExample = ` - + @@ -397,7 +401,7 @@ var DescribeDBSubnetGroupsExample = ` ` var DeleteDBSubnetGroupExample = ` - + 6295e5ab-bbf3-11d3-f4c6-37db295f7674 @@ -405,7 +409,7 @@ var DeleteDBSubnetGroupExample = ` ` var CreateDBSubnetGroupExample = ` - + vpc-33dc97ea @@ -439,7 +443,7 @@ var CreateDBSubnetGroupExample = ` ` var DescribeDBSnapshotsExample = ` - + @@ -502,10 +506,10 @@ var DescribeDBSnapshotsExample = ` ` var RestoreDBInstanceFromDBSnapshotExample = ` - + - 2 + 7 false creating @@ -553,7 +557,7 @@ var CreateDBParameterGroupExample = ` - mysql5.6 + mysql5.1 My new DB Parameter Group mydbparamgroup3