vendor: update all dependencies to latest versions
This commit is contained in:
+1294
-1186
File diff suppressed because it is too large
Load Diff
+26
-10
@@ -4,25 +4,29 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/awstesting"
|
||||
"github.com/aws/aws-sdk-go/awstesting/unit"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestPresignWithPresignNotSet(t *testing.T) {
|
||||
reqs := map[string]*request.Request{}
|
||||
svc := New(unit.Session, &aws.Config{Region: aws.String("us-west-2")})
|
||||
|
||||
assert.NotPanics(t, func() {
|
||||
f := func() {
|
||||
// Doesn't panic on nil input
|
||||
req, _ := svc.CopyDBSnapshotRequest(nil)
|
||||
req.Sign()
|
||||
})
|
||||
}
|
||||
if paniced, p := awstesting.DidPanic(f); paniced {
|
||||
t.Errorf("expect no panic, got %v", p)
|
||||
}
|
||||
|
||||
reqs[opCopyDBSnapshot], _ = svc.CopyDBSnapshotRequest(&CopyDBSnapshotInput{
|
||||
SourceRegion: aws.String("us-west-1"),
|
||||
@@ -42,7 +46,11 @@ func TestPresignWithPresignNotSet(t *testing.T) {
|
||||
q, _ := url.ParseQuery(string(b))
|
||||
|
||||
u, _ := url.QueryUnescape(q.Get("PreSignedUrl"))
|
||||
assert.Regexp(t, fmt.Sprintf(`^https://rds.us-west-1\.amazonaws\.com/\?Action=%s.+?DestinationRegion=us-west-2.+`, op), u)
|
||||
|
||||
exp := fmt.Sprintf(`^https://rds.us-west-1\.amazonaws\.com/\?Action=%s.+?DestinationRegion=us-west-2.+`, op)
|
||||
if re, a := regexp.MustCompile(exp), u; !re.MatchString(a) {
|
||||
t.Errorf("expect %s to match %s", re, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,11 +58,14 @@ func TestPresignWithPresignSet(t *testing.T) {
|
||||
reqs := map[string]*request.Request{}
|
||||
svc := New(unit.Session, &aws.Config{Region: aws.String("us-west-2")})
|
||||
|
||||
assert.NotPanics(t, func() {
|
||||
f := func() {
|
||||
// Doesn't panic on nil input
|
||||
req, _ := svc.CopyDBSnapshotRequest(nil)
|
||||
req.Sign()
|
||||
})
|
||||
}
|
||||
if paniced, p := awstesting.DidPanic(f); paniced {
|
||||
t.Errorf("expect no panic, got %v", p)
|
||||
}
|
||||
|
||||
reqs[opCopyDBSnapshot], _ = svc.CopyDBSnapshotRequest(&CopyDBSnapshotInput{
|
||||
SourceRegion: aws.String("us-west-1"),
|
||||
@@ -77,7 +88,9 @@ func TestPresignWithPresignSet(t *testing.T) {
|
||||
q, _ := url.ParseQuery(string(b))
|
||||
|
||||
u, _ := url.QueryUnescape(q.Get("PreSignedUrl"))
|
||||
assert.Regexp(t, `presignedURL`, u)
|
||||
if e, a := "presignedURL", u; !strings.Contains(a, e) {
|
||||
t.Errorf("expect %s to be in %s", e, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,11 +98,14 @@ func TestPresignWithSourceNotSet(t *testing.T) {
|
||||
reqs := map[string]*request.Request{}
|
||||
svc := New(unit.Session, &aws.Config{Region: aws.String("us-west-2")})
|
||||
|
||||
assert.NotPanics(t, func() {
|
||||
f := func() {
|
||||
// Doesn't panic on nil input
|
||||
req, _ := svc.CopyDBSnapshotRequest(nil)
|
||||
req.Sign()
|
||||
})
|
||||
}
|
||||
if paniced, p := awstesting.DidPanic(f); paniced {
|
||||
t.Errorf("expect no panic, got %v", p)
|
||||
}
|
||||
|
||||
reqs[opCopyDBSnapshot], _ = svc.CopyDBSnapshotRequest(&CopyDBSnapshotInput{
|
||||
SourceDBSnapshotIdentifier: aws.String("foo"),
|
||||
|
||||
+6
-58
@@ -53,69 +53,17 @@
|
||||
//
|
||||
// Using the Client
|
||||
//
|
||||
// To use the client for Amazon Relational Database Service you will first need
|
||||
// to create a new instance of it.
|
||||
// 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.
|
||||
//
|
||||
// When creating a client for an AWS service you'll first need to have a Session
|
||||
// already created. The Session provides configuration that can be shared
|
||||
// between multiple service clients. Additional configuration can be applied to
|
||||
// the Session and service's client when they are constructed. The aws package's
|
||||
// Config type contains several fields such as Region for the AWS Region the
|
||||
// client should make API requests too. The optional Config value can be provided
|
||||
// as the variadic argument for Sessions and client creation.
|
||||
//
|
||||
// Once the service's client is created you can use it to make API requests the
|
||||
// AWS service. These clients are safe to use concurrently.
|
||||
//
|
||||
// // Create a session to share configuration, and load external configuration.
|
||||
// sess := session.Must(session.NewSession())
|
||||
//
|
||||
// // Create the service's client with the session.
|
||||
// svc := rds.New(sess)
|
||||
//
|
||||
// See the SDK's documentation for more information on how to use service clients.
|
||||
// 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 package's Config type for more information on configuration options.
|
||||
// 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 the service's client.
|
||||
// information on creating client for this service.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/rds/#New
|
||||
//
|
||||
// Once the client is created you can make an API request to the service.
|
||||
// Each API method takes a input parameter, and returns the service response
|
||||
// and an error.
|
||||
//
|
||||
// The API method will document which error codes the service can be returned
|
||||
// by the operation if the service models the API operation's errors. These
|
||||
// errors will also be available as const strings prefixed with "ErrCode".
|
||||
//
|
||||
// result, err := svc.AddRoleToDBCluster(params)
|
||||
// if err != nil {
|
||||
// // Cast err to awserr.Error to handle specific error codes.
|
||||
// aerr, ok := err.(awserr.Error)
|
||||
// if ok && aerr.Code() == <error code to check for> {
|
||||
// // Specific error code handling
|
||||
// }
|
||||
// return err
|
||||
// }
|
||||
//
|
||||
// fmt.Println("AddRoleToDBCluster result:")
|
||||
// fmt.Println(result)
|
||||
//
|
||||
// Using the Client with Context
|
||||
//
|
||||
// The service's client also provides methods to make API requests with a Context
|
||||
// value. This allows you to control the timeout, and cancellation of pending
|
||||
// requests. These methods also take request Option as variadic parameter to apply
|
||||
// additional configuration to the API request.
|
||||
//
|
||||
// ctx := context.Background()
|
||||
//
|
||||
// result, err := svc.AddRoleToDBClusterWithContext(ctx, params)
|
||||
//
|
||||
// See the request package documentation for more information on using Context pattern
|
||||
// with the SDK.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/aws/request/
|
||||
package rds
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
+7
-4
@@ -1,12 +1,11 @@
|
||||
package rdsutils_test
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"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) {
|
||||
@@ -33,7 +32,11 @@ func TestBuildAuthToken(t *testing.T) {
|
||||
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)
|
||||
if err != nil {
|
||||
t.Errorf("expect no error, got %v", err)
|
||||
}
|
||||
if re, a := regexp.MustCompile(c.expectedRegex), url; !re.MatchString(a) {
|
||||
t.Errorf("expect %s to match %s", re, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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)
|
||||
@@ -82,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)
|
||||
|
||||
Reference in New Issue
Block a user