mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-30 04:20:53 +00:00
Update vendored deps, including AWS SDK, openpgp, ftp, ...
This commit is contained in:
+2361
-1813
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"),
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
// 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
|
||||
// DB 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.
|
||||
//
|
||||
@@ -53,7 +53,7 @@
|
||||
//
|
||||
// Using the Client
|
||||
//
|
||||
// To Amazon Relational Database Service with the SDK use the New function to create
|
||||
// To contact 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.
|
||||
//
|
||||
|
||||
+14
@@ -344,6 +344,10 @@ type RDSAPI interface {
|
||||
DescribeSourceRegionsWithContext(aws.Context, *rds.DescribeSourceRegionsInput, ...request.Option) (*rds.DescribeSourceRegionsOutput, error)
|
||||
DescribeSourceRegionsRequest(*rds.DescribeSourceRegionsInput) (*request.Request, *rds.DescribeSourceRegionsOutput)
|
||||
|
||||
DescribeValidDBInstanceModifications(*rds.DescribeValidDBInstanceModificationsInput) (*rds.DescribeValidDBInstanceModificationsOutput, error)
|
||||
DescribeValidDBInstanceModificationsWithContext(aws.Context, *rds.DescribeValidDBInstanceModificationsInput, ...request.Option) (*rds.DescribeValidDBInstanceModificationsOutput, error)
|
||||
DescribeValidDBInstanceModificationsRequest(*rds.DescribeValidDBInstanceModificationsInput) (*request.Request, *rds.DescribeValidDBInstanceModificationsOutput)
|
||||
|
||||
DownloadDBLogFilePortion(*rds.DownloadDBLogFilePortionInput) (*rds.DownloadDBLogFilePortionOutput, error)
|
||||
DownloadDBLogFilePortionWithContext(aws.Context, *rds.DownloadDBLogFilePortionInput, ...request.Option) (*rds.DownloadDBLogFilePortionOutput, error)
|
||||
DownloadDBLogFilePortionRequest(*rds.DownloadDBLogFilePortionInput) (*request.Request, *rds.DownloadDBLogFilePortionOutput)
|
||||
@@ -451,6 +455,10 @@ type RDSAPI interface {
|
||||
RestoreDBInstanceFromDBSnapshotWithContext(aws.Context, *rds.RestoreDBInstanceFromDBSnapshotInput, ...request.Option) (*rds.RestoreDBInstanceFromDBSnapshotOutput, error)
|
||||
RestoreDBInstanceFromDBSnapshotRequest(*rds.RestoreDBInstanceFromDBSnapshotInput) (*request.Request, *rds.RestoreDBInstanceFromDBSnapshotOutput)
|
||||
|
||||
RestoreDBInstanceFromS3(*rds.RestoreDBInstanceFromS3Input) (*rds.RestoreDBInstanceFromS3Output, error)
|
||||
RestoreDBInstanceFromS3WithContext(aws.Context, *rds.RestoreDBInstanceFromS3Input, ...request.Option) (*rds.RestoreDBInstanceFromS3Output, error)
|
||||
RestoreDBInstanceFromS3Request(*rds.RestoreDBInstanceFromS3Input) (*request.Request, *rds.RestoreDBInstanceFromS3Output)
|
||||
|
||||
RestoreDBInstanceToPointInTime(*rds.RestoreDBInstanceToPointInTimeInput) (*rds.RestoreDBInstanceToPointInTimeOutput, error)
|
||||
RestoreDBInstanceToPointInTimeWithContext(aws.Context, *rds.RestoreDBInstanceToPointInTimeInput, ...request.Option) (*rds.RestoreDBInstanceToPointInTimeOutput, error)
|
||||
RestoreDBInstanceToPointInTimeRequest(*rds.RestoreDBInstanceToPointInTimeInput) (*request.Request, *rds.RestoreDBInstanceToPointInTimeOutput)
|
||||
@@ -472,6 +480,12 @@ type RDSAPI interface {
|
||||
|
||||
WaitUntilDBInstanceDeleted(*rds.DescribeDBInstancesInput) error
|
||||
WaitUntilDBInstanceDeletedWithContext(aws.Context, *rds.DescribeDBInstancesInput, ...request.WaiterOption) error
|
||||
|
||||
WaitUntilDBSnapshotAvailable(*rds.DescribeDBSnapshotsInput) error
|
||||
WaitUntilDBSnapshotAvailableWithContext(aws.Context, *rds.DescribeDBSnapshotsInput, ...request.WaiterOption) error
|
||||
|
||||
WaitUntilDBSnapshotDeleted(*rds.DescribeDBSnapshotsInput) error
|
||||
WaitUntilDBSnapshotDeletedWithContext(aws.Context, *rds.DescribeDBSnapshotsInput, ...request.WaiterOption) error
|
||||
}
|
||||
|
||||
var _ RDSAPI = (*rds.RDS)(nil)
|
||||
|
||||
+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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+142
@@ -150,3 +150,145 @@ func (c *RDS) WaitUntilDBInstanceDeletedWithContext(ctx aws.Context, input *Desc
|
||||
|
||||
return w.WaitWithContext(ctx)
|
||||
}
|
||||
|
||||
// WaitUntilDBSnapshotAvailable uses the Amazon RDS API operation
|
||||
// DescribeDBSnapshots to wait for a condition to be met before returning.
|
||||
// If the condition is not met within the max attempt window, an error will
|
||||
// be returned.
|
||||
func (c *RDS) WaitUntilDBSnapshotAvailable(input *DescribeDBSnapshotsInput) error {
|
||||
return c.WaitUntilDBSnapshotAvailableWithContext(aws.BackgroundContext(), input)
|
||||
}
|
||||
|
||||
// WaitUntilDBSnapshotAvailableWithContext is an extended version of WaitUntilDBSnapshotAvailable.
|
||||
// With the support for passing in a context and options to configure the
|
||||
// Waiter and the underlying request options.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *RDS) WaitUntilDBSnapshotAvailableWithContext(ctx aws.Context, input *DescribeDBSnapshotsInput, opts ...request.WaiterOption) error {
|
||||
w := request.Waiter{
|
||||
Name: "WaitUntilDBSnapshotAvailable",
|
||||
MaxAttempts: 60,
|
||||
Delay: request.ConstantWaiterDelay(30 * time.Second),
|
||||
Acceptors: []request.WaiterAcceptor{
|
||||
{
|
||||
State: request.SuccessWaiterState,
|
||||
Matcher: request.PathAllWaiterMatch, Argument: "DBSnapshots[].Status",
|
||||
Expected: "available",
|
||||
},
|
||||
{
|
||||
State: request.FailureWaiterState,
|
||||
Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
|
||||
Expected: "deleted",
|
||||
},
|
||||
{
|
||||
State: request.FailureWaiterState,
|
||||
Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
|
||||
Expected: "deleting",
|
||||
},
|
||||
{
|
||||
State: request.FailureWaiterState,
|
||||
Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
|
||||
Expected: "failed",
|
||||
},
|
||||
{
|
||||
State: request.FailureWaiterState,
|
||||
Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
|
||||
Expected: "incompatible-restore",
|
||||
},
|
||||
{
|
||||
State: request.FailureWaiterState,
|
||||
Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
|
||||
Expected: "incompatible-parameters",
|
||||
},
|
||||
},
|
||||
Logger: c.Config.Logger,
|
||||
NewRequest: func(opts []request.Option) (*request.Request, error) {
|
||||
var inCpy *DescribeDBSnapshotsInput
|
||||
if input != nil {
|
||||
tmp := *input
|
||||
inCpy = &tmp
|
||||
}
|
||||
req, _ := c.DescribeDBSnapshotsRequest(inCpy)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return req, nil
|
||||
},
|
||||
}
|
||||
w.ApplyOptions(opts...)
|
||||
|
||||
return w.WaitWithContext(ctx)
|
||||
}
|
||||
|
||||
// WaitUntilDBSnapshotDeleted uses the Amazon RDS API operation
|
||||
// DescribeDBSnapshots to wait for a condition to be met before returning.
|
||||
// If the condition is not met within the max attempt window, an error will
|
||||
// be returned.
|
||||
func (c *RDS) WaitUntilDBSnapshotDeleted(input *DescribeDBSnapshotsInput) error {
|
||||
return c.WaitUntilDBSnapshotDeletedWithContext(aws.BackgroundContext(), input)
|
||||
}
|
||||
|
||||
// WaitUntilDBSnapshotDeletedWithContext is an extended version of WaitUntilDBSnapshotDeleted.
|
||||
// With the support for passing in a context and options to configure the
|
||||
// Waiter and the underlying request options.
|
||||
//
|
||||
// The context must be non-nil and will be used for request cancellation. If
|
||||
// the context is nil a panic will occur. In the future the SDK may create
|
||||
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
|
||||
// for more information on using Contexts.
|
||||
func (c *RDS) WaitUntilDBSnapshotDeletedWithContext(ctx aws.Context, input *DescribeDBSnapshotsInput, opts ...request.WaiterOption) error {
|
||||
w := request.Waiter{
|
||||
Name: "WaitUntilDBSnapshotDeleted",
|
||||
MaxAttempts: 60,
|
||||
Delay: request.ConstantWaiterDelay(30 * time.Second),
|
||||
Acceptors: []request.WaiterAcceptor{
|
||||
{
|
||||
State: request.SuccessWaiterState,
|
||||
Matcher: request.PathAllWaiterMatch, Argument: "DBSnapshots[].Status",
|
||||
Expected: "deleted",
|
||||
},
|
||||
{
|
||||
State: request.SuccessWaiterState,
|
||||
Matcher: request.ErrorWaiterMatch,
|
||||
Expected: "DBSnapshotNotFound",
|
||||
},
|
||||
{
|
||||
State: request.FailureWaiterState,
|
||||
Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
|
||||
Expected: "creating",
|
||||
},
|
||||
{
|
||||
State: request.FailureWaiterState,
|
||||
Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
|
||||
Expected: "modifying",
|
||||
},
|
||||
{
|
||||
State: request.FailureWaiterState,
|
||||
Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
|
||||
Expected: "rebooting",
|
||||
},
|
||||
{
|
||||
State: request.FailureWaiterState,
|
||||
Matcher: request.PathAnyWaiterMatch, Argument: "DBSnapshots[].Status",
|
||||
Expected: "resetting-master-credentials",
|
||||
},
|
||||
},
|
||||
Logger: c.Config.Logger,
|
||||
NewRequest: func(opts []request.Option) (*request.Request, error) {
|
||||
var inCpy *DescribeDBSnapshotsInput
|
||||
if input != nil {
|
||||
tmp := *input
|
||||
inCpy = &tmp
|
||||
}
|
||||
req, _ := c.DescribeDBSnapshotsRequest(inCpy)
|
||||
req.SetContext(ctx)
|
||||
req.ApplyOptions(opts...)
|
||||
return req, nil
|
||||
},
|
||||
}
|
||||
w.ApplyOptions(opts...)
|
||||
|
||||
return w.WaitWithContext(ctx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user