Upgrade AWS SDK to the latest version

This commit is contained in:
Andrey Smirnov
2017-09-28 17:57:05 +03:00
parent 9a767b7631
commit 182c21e38c
1096 changed files with 309697 additions and 132612 deletions
+2277 -1528
View File
File diff suppressed because it is too large Load Diff
+69
View File
@@ -0,0 +1,69 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package rds provides the client and types for making API
// requests to Amazon Relational Database Service.
//
// Amazon Relational Database Service (Amazon RDS) is a web service that makes
// it easier to set up, operate, and scale a relational database in the cloud.
// It provides cost-efficient, resizable capacity for an industry-standard relational
// database and manages common database administration tasks, freeing up developers
// to focus on what makes their applications and businesses unique.
//
// Amazon RDS gives you access to the capabilities of a MySQL, MariaDB, PostgreSQL,
// Microsoft SQL Server, Oracle, or Amazon Aurora database server. These capabilities
// mean that the code, applications, and tools you already use today with your
// existing databases work with Amazon RDS without modification. Amazon RDS
// automatically backs up your database and maintains the database software
// that powers your DB instance. Amazon RDS is flexible: you can scale your
// database instance's compute resources and storage capacity to meet your application's
// demand. As with all Amazon Web Services, there are no up-front investments,
// and you pay only for the resources you use.
//
// This interface reference for Amazon RDS contains documentation for a programming
// or command line interface you can use to manage Amazon RDS. Note that Amazon
// RDS is asynchronous, which means that some interfaces might require techniques
// such as polling or callback functions to determine when a command has been
// applied. In this reference, the parameter descriptions indicate whether a
// command is applied immediately, on the next instance reboot, or during the
// maintenance window. The reference structure is as follows, and we list following
// some related topics from the user guide.
//
// Amazon RDS API Reference
//
// * For the alphabetical list of API actions, see API Actions (http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_Operations.html).
//
// * For the alphabetical list of data types, see Data Types (http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_Types.html).
//
// * For a list of common query parameters, see Common Parameters (http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/CommonParameters.html).
//
// * For descriptions of the error codes, see Common Errors (http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/CommonErrors.html).
//
// Amazon RDS User Guide
//
// * For a summary of the Amazon RDS interfaces, see Available RDS Interfaces
// (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html#Welcome.Interfaces).
//
// * For more information about how to use the Query API, see Using the Query
// API (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Using_the_Query_API.html).
//
// See https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31 for more information on this service.
//
// See rds package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/rds/
//
// Using the Client
//
// To Amazon Relational Database Service with the SDK use the New function to create
// a new service client. With that client you can make API requests to the service.
// These clients are safe to use concurrently.
//
// See the SDK's documentation for more information on how to use the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws.Config documentation for more information on configuring SDK clients.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the Amazon Relational Database Service client RDS for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/rds/#New
package rds
+25
View File
@@ -0,0 +1,25 @@
// IAM User or Role Database Authentication
//
// The rdsutil package's BuildAuthToken function provides a connection
// authentication token builder. Given an endpoint of the RDS database,
// AWS region, DB user, and AWS credentials the function will create an
// presigned URL to use as the authentication token for the database's
// connection.
//
// The following example shows how to use BuildAuthToken to create an authentication
// token for connecting to a MySQL database in RDS.
//
// authToken, err := rdsutils.BuildAuthToken(dbEndpoint, awsRegion, dbUser, awsCreds)
//
// // Create the MySQL DNS string for the DB connection
// // user:password@protocol(endpoint)/dbname?<params>
// dnsStr = fmt.Sprintf("%s:%s@tcp(%s)/%s?tls=true",
// dbUser, authToken, dbEndpoint, dbName,
// )
//
// // Use db to perform SQL operations on database
// db, err := sql.Open("mysql", dnsStr)
//
// See rdsutil package for more information.
// http://docs.aws.amazon.com/sdk-for-go/api/service/rds/rdsutils/
package rds
+4 -2
View File
@@ -1,4 +1,4 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package rds
@@ -272,7 +272,9 @@ const (
// ErrCodeInvalidDBParameterGroupStateFault for service response error code
// "InvalidDBParameterGroupState".
//
// The DB parameter group cannot be deleted because it is in use.
// The DB parameter group is in use or is in an invalid state. If you are attempting
// to delete the parameter group, you cannot delete it when the parameter group
// is in this state.
ErrCodeInvalidDBParameterGroupStateFault = "InvalidDBParameterGroupState"
// ErrCodeInvalidDBSecurityGroupStateFault for service response error code
File diff suppressed because it is too large Load Diff
+10 -2
View File
@@ -1,4 +1,4 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package rdsiface provides an interface to enable mocking the Amazon Relational Database Service service client
// for testing your code.
@@ -21,7 +21,7 @@ import (
//
// The best way to use this interface is so the SDK's service client's calls
// can be stubbed out for unit testing your code with the SDK without needing
// to inject custom request handlers into the the SDK's request pipeline.
// to inject custom request handlers into the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // Amazon Relational Database Service.
@@ -459,6 +459,14 @@ type RDSAPI interface {
RevokeDBSecurityGroupIngressWithContext(aws.Context, *rds.RevokeDBSecurityGroupIngressInput, ...request.Option) (*rds.RevokeDBSecurityGroupIngressOutput, error)
RevokeDBSecurityGroupIngressRequest(*rds.RevokeDBSecurityGroupIngressInput) (*request.Request, *rds.RevokeDBSecurityGroupIngressOutput)
StartDBInstance(*rds.StartDBInstanceInput) (*rds.StartDBInstanceOutput, error)
StartDBInstanceWithContext(aws.Context, *rds.StartDBInstanceInput, ...request.Option) (*rds.StartDBInstanceOutput, error)
StartDBInstanceRequest(*rds.StartDBInstanceInput) (*request.Request, *rds.StartDBInstanceOutput)
StopDBInstance(*rds.StopDBInstanceInput) (*rds.StopDBInstanceOutput, error)
StopDBInstanceWithContext(aws.Context, *rds.StopDBInstanceInput, ...request.Option) (*rds.StopDBInstanceOutput, error)
StopDBInstanceRequest(*rds.StopDBInstanceInput) (*request.Request, *rds.StopDBInstanceOutput)
WaitUntilDBInstanceAvailable(*rds.DescribeDBInstancesInput) error
WaitUntilDBInstanceAvailableWithContext(aws.Context, *rds.DescribeDBInstancesInput, ...request.WaiterOption) error
+70
View File
@@ -0,0 +1,70 @@
package rdsutils
import (
"net/http"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/signer/v4"
)
// BuildAuthToken will return a authentication token for the database's connect
// based on the RDS database endpoint, AWS region, IAM user or role, and AWS credentials.
//
// Endpoint consists of the hostname and port, IE hostname:port, of the RDS database.
// Region is the AWS region the RDS database is in and where the authentication token
// will be generated for. DbUser is the IAM user or role the request will be authenticated
// for. The creds is the AWS credentials the authentication token is signed with.
//
// An error is returned if the authentication token is unable to be signed with
// the credentials, or the endpoint is not a valid URL.
//
// The following example shows how to use BuildAuthToken to create an authentication
// token for connecting to a MySQL database in RDS.
//
// authToken, err := BuildAuthToken(dbEndpoint, awsRegion, dbUser, awsCreds)
//
// // Create the MySQL DNS string for the DB connection
// // user:password@protocol(endpoint)/dbname?<params>
// dnsStr = fmt.Sprintf("%s:%s@tcp(%s)/%s?tls=true",
// dbUser, authToken, dbEndpoint, dbName,
// )
//
// // Use db to perform SQL operations on database
// db, err := sql.Open("mysql", dnsStr)
//
// See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html
// for more information on using IAM database authentication with RDS.
func BuildAuthToken(endpoint, region, dbUser string, creds *credentials.Credentials) (string, error) {
// the scheme is arbitrary and is only needed because validation of the URL requires one.
if !(strings.HasPrefix(endpoint, "http://") || strings.HasPrefix(endpoint, "https://")) {
endpoint = "https://" + endpoint
}
req, err := http.NewRequest("GET", endpoint, nil)
if err != nil {
return "", err
}
values := req.URL.Query()
values.Set("Action", "connect")
values.Set("DBUser", dbUser)
req.URL.RawQuery = values.Encode()
signer := v4.Signer{
Credentials: creds,
}
_, err = signer.Presign(req, nil, "rds-db", region, 15*time.Minute, time.Now())
if err != nil {
return "", err
}
url := req.URL.String()
if strings.HasPrefix(url, "http://") {
url = url[len("http://"):]
} else if strings.HasPrefix(url, "https://") {
url = url[len("https://"):]
}
return url, nil
}
+39
View File
@@ -0,0 +1,39 @@
package rdsutils_test
import (
"testing"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/service/rds/rdsutils"
"github.com/stretchr/testify/assert"
)
func TestBuildAuthToken(t *testing.T) {
cases := []struct {
endpoint string
region string
user string
expectedRegex string
}{
{
"https://prod-instance.us-east-1.rds.amazonaws.com:3306",
"us-west-2",
"mysqlUser",
`^prod-instance\.us-east-1\.rds\.amazonaws\.com:3306\?Action=connect.*?DBUser=mysqlUser.*`,
},
{
"prod-instance.us-east-1.rds.amazonaws.com:3306",
"us-west-2",
"mysqlUser",
`^prod-instance\.us-east-1\.rds\.amazonaws\.com:3306\?Action=connect.*?DBUser=mysqlUser.*`,
},
}
for _, c := range cases {
creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")
url, err := rdsutils.BuildAuthToken(c.endpoint, c.region, c.user, creds)
assert.NoError(t, err)
assert.Regexp(t, c.expectedRegex, url)
}
}
+6 -46
View File
@@ -1,4 +1,4 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package rds
@@ -11,52 +11,12 @@ import (
"github.com/aws/aws-sdk-go/private/protocol/query"
)
// RDS provides the API operation methods for making requests to
// Amazon Relational Database Service. See this package's package overview docs
// for details on the service.
//
// Amazon Relational Database Service (Amazon RDS) is a web service that makes
// it easier to set up, operate, and scale a relational database in the cloud.
// It provides cost-efficient, resizeable capacity for an industry-standard
// relational database and manages common database administration tasks, freeing
// up developers to focus on what makes their applications and businesses unique.
//
// Amazon RDS gives you access to the capabilities of a MySQL, MariaDB, PostgreSQL,
// Microsoft SQL Server, Oracle, or Amazon Aurora database server. These capabilities
// mean that the code, applications, and tools you already use today with your
// existing databases work with Amazon RDS without modification. Amazon RDS
// automatically backs up your database and maintains the database software
// that powers your DB instance. Amazon RDS is flexible: you can scale your
// database instance's compute resources and storage capacity to meet your application's
// demand. As with all Amazon Web Services, there are no up-front investments,
// and you pay only for the resources you use.
//
// This interface reference for Amazon RDS contains documentation for a programming
// or command line interface you can use to manage Amazon RDS. Note that Amazon
// RDS is asynchronous, which means that some interfaces might require techniques
// such as polling or callback functions to determine when a command has been
// applied. In this reference, the parameter descriptions indicate whether a
// command is applied immediately, on the next instance reboot, or during the
// maintenance window. The reference structure is as follows, and we list following
// some related topics from the user guide.
//
// Amazon RDS API Reference
//
// * For the alphabetical list of API actions, see API Actions (http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_Operations.html).
//
// * For the alphabetical list of data types, see Data Types (http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_Types.html).
//
// * For a list of common query parameters, see Common Parameters (http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/CommonParameters.html).
//
// * For descriptions of the error codes, see Common Errors (http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/CommonErrors.html).
//
// Amazon RDS User Guide
//
// * For a summary of the Amazon RDS interfaces, see Available RDS Interfaces
// (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html#Welcome.Interfaces).
//
// * For more information about how to use the Query API, see Using the Query
// API (http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Using_the_Query_API.html).
// The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/rds-2014-10-31
// RDS methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type RDS struct {
*client.Client
}
+15 -5
View File
@@ -1,4 +1,4 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package rds
@@ -11,7 +11,7 @@ import (
// WaitUntilDBInstanceAvailable uses the Amazon RDS API operation
// DescribeDBInstances to wait for a condition to be met before returning.
// If the condition is not meet within the max attempt window an error will
// If the condition is not met within the max attempt window, an error will
// be returned.
func (c *RDS) WaitUntilDBInstanceAvailable(input *DescribeDBInstancesInput) error {
return c.WaitUntilDBInstanceAvailableWithContext(aws.BackgroundContext(), input)
@@ -64,7 +64,12 @@ func (c *RDS) WaitUntilDBInstanceAvailableWithContext(ctx aws.Context, input *De
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
req, _ := c.DescribeDBInstancesRequest(input)
var inCpy *DescribeDBInstancesInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req, _ := c.DescribeDBInstancesRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
@@ -77,7 +82,7 @@ func (c *RDS) WaitUntilDBInstanceAvailableWithContext(ctx aws.Context, input *De
// WaitUntilDBInstanceDeleted uses the Amazon RDS API operation
// DescribeDBInstances to wait for a condition to be met before returning.
// If the condition is not meet within the max attempt window an error will
// If the condition is not met within the max attempt window, an error will
// be returned.
func (c *RDS) WaitUntilDBInstanceDeleted(input *DescribeDBInstancesInput) error {
return c.WaitUntilDBInstanceDeletedWithContext(aws.BackgroundContext(), input)
@@ -130,7 +135,12 @@ func (c *RDS) WaitUntilDBInstanceDeletedWithContext(ctx aws.Context, input *Desc
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
req, _ := c.DescribeDBInstancesRequest(input)
var inCpy *DescribeDBInstancesInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req, _ := c.DescribeDBInstancesRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil