Vendor aws-sdk-go (dep ensure) (#178)
This commit is contained in:
69501
vendor/github.com/aws/aws-sdk-go/service/ec2/api.go
generated
vendored
Normal file
69501
vendor/github.com/aws/aws-sdk-go/service/ec2/api.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
120
vendor/github.com/aws/aws-sdk-go/service/ec2/customizations.go
generated
vendored
Normal file
120
vendor/github.com/aws/aws-sdk-go/service/ec2/customizations.go
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
package ec2
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awsutil"
|
||||
"github.com/aws/aws-sdk-go/aws/client"
|
||||
"github.com/aws/aws-sdk-go/aws/endpoints"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/internal/sdkrand"
|
||||
)
|
||||
|
||||
type retryer struct {
|
||||
client.DefaultRetryer
|
||||
}
|
||||
|
||||
func (d retryer) RetryRules(r *request.Request) time.Duration {
|
||||
switch r.Operation.Name {
|
||||
case opModifyNetworkInterfaceAttribute:
|
||||
fallthrough
|
||||
case opAssignPrivateIpAddresses:
|
||||
return customRetryRule(r)
|
||||
default:
|
||||
return d.DefaultRetryer.RetryRules(r)
|
||||
}
|
||||
}
|
||||
|
||||
func customRetryRule(r *request.Request) time.Duration {
|
||||
retryTimes := []time.Duration{
|
||||
time.Second,
|
||||
3 * time.Second,
|
||||
5 * time.Second,
|
||||
}
|
||||
|
||||
count := r.RetryCount
|
||||
if count >= len(retryTimes) {
|
||||
count = len(retryTimes) - 1
|
||||
}
|
||||
|
||||
minTime := int(retryTimes[count])
|
||||
return time.Duration(sdkrand.SeededRand.Intn(minTime) + minTime)
|
||||
}
|
||||
|
||||
func setCustomRetryer(c *client.Client) {
|
||||
maxRetries := aws.IntValue(c.Config.MaxRetries)
|
||||
if c.Config.MaxRetries == nil || maxRetries == aws.UseServiceDefaultRetries {
|
||||
maxRetries = 3
|
||||
}
|
||||
|
||||
c.Retryer = retryer{
|
||||
DefaultRetryer: client.DefaultRetryer{
|
||||
NumMaxRetries: maxRetries,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
initClient = func(c *client.Client) {
|
||||
if c.Config.Retryer == nil {
|
||||
// Only override the retryer with a custom one if the config
|
||||
// does not already contain a retryer
|
||||
setCustomRetryer(c)
|
||||
}
|
||||
}
|
||||
initRequest = func(r *request.Request) {
|
||||
if r.Operation.Name == opCopySnapshot { // fill the PresignedURL parameter
|
||||
r.Handlers.Build.PushFront(fillPresignedURL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func fillPresignedURL(r *request.Request) {
|
||||
if !r.ParamsFilled() {
|
||||
return
|
||||
}
|
||||
|
||||
origParams := r.Params.(*CopySnapshotInput)
|
||||
|
||||
// Stop if PresignedURL/DestinationRegion is set
|
||||
if origParams.PresignedUrl != nil || origParams.DestinationRegion != nil {
|
||||
return
|
||||
}
|
||||
|
||||
origParams.DestinationRegion = r.Config.Region
|
||||
newParams := awsutil.CopyOf(r.Params).(*CopySnapshotInput)
|
||||
|
||||
// Create a new request based on the existing request. We will use this to
|
||||
// presign the CopySnapshot request against the source region.
|
||||
cfg := r.Config.Copy(aws.NewConfig().
|
||||
WithEndpoint("").
|
||||
WithRegion(aws.StringValue(origParams.SourceRegion)))
|
||||
|
||||
clientInfo := r.ClientInfo
|
||||
resolved, err := r.Config.EndpointResolver.EndpointFor(
|
||||
clientInfo.ServiceName, aws.StringValue(cfg.Region),
|
||||
func(opt *endpoints.Options) {
|
||||
opt.DisableSSL = aws.BoolValue(cfg.DisableSSL)
|
||||
opt.UseDualStack = aws.BoolValue(cfg.UseDualStack)
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
r.Error = err
|
||||
return
|
||||
}
|
||||
|
||||
clientInfo.Endpoint = resolved.URL
|
||||
clientInfo.SigningRegion = resolved.SigningRegion
|
||||
|
||||
// Presign a CopySnapshot request with modified params
|
||||
req := request.New(*cfg, clientInfo, r.Handlers, r.Retryer, r.Operation, newParams, r.Data)
|
||||
url, err := req.Presign(5 * time.Minute) // 5 minutes should be enough.
|
||||
if err != nil { // bubble error back up to original request
|
||||
r.Error = err
|
||||
return
|
||||
}
|
||||
|
||||
// We have our URL, set it on params
|
||||
origParams.PresignedUrl = &url
|
||||
}
|
||||
48
vendor/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go
generated
vendored
Normal file
48
vendor/github.com/aws/aws-sdk-go/service/ec2/customizations_test.go
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
package ec2_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/awstesting/unit"
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
)
|
||||
|
||||
func TestCopySnapshotPresignedURL(t *testing.T) {
|
||||
svc := ec2.New(unit.Session, &aws.Config{Region: aws.String("us-west-2")})
|
||||
|
||||
func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
t.Fatalf("expect CopySnapshotRequest with nill")
|
||||
}
|
||||
}()
|
||||
// Doesn't panic on nil input
|
||||
req, _ := svc.CopySnapshotRequest(nil)
|
||||
req.Sign()
|
||||
}()
|
||||
|
||||
req, _ := svc.CopySnapshotRequest(&ec2.CopySnapshotInput{
|
||||
SourceRegion: aws.String("us-west-1"),
|
||||
SourceSnapshotId: aws.String("snap-id"),
|
||||
})
|
||||
req.Sign()
|
||||
|
||||
b, _ := ioutil.ReadAll(req.HTTPRequest.Body)
|
||||
q, _ := url.ParseQuery(string(b))
|
||||
u, _ := url.QueryUnescape(q.Get("PresignedUrl"))
|
||||
if e, a := "us-west-2", q.Get("DestinationRegion"); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
if e, a := "us-west-1", q.Get("SourceRegion"); e != a {
|
||||
t.Errorf("expect %v, got %v", e, a)
|
||||
}
|
||||
|
||||
r := regexp.MustCompile(`^https://ec2\.us-west-1\.amazonaws\.com/.+&DestinationRegion=us-west-2`)
|
||||
if !r.MatchString(u) {
|
||||
t.Errorf("expect %v to match, got %v", r.String(), u)
|
||||
}
|
||||
}
|
||||
30
vendor/github.com/aws/aws-sdk-go/service/ec2/doc.go
generated
vendored
Normal file
30
vendor/github.com/aws/aws-sdk-go/service/ec2/doc.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// Package ec2 provides the client and types for making API
|
||||
// requests to Amazon Elastic Compute Cloud.
|
||||
//
|
||||
// Amazon Elastic Compute Cloud (Amazon EC2) provides resizable computing capacity
|
||||
// in the AWS Cloud. Using Amazon EC2 eliminates the need to invest in hardware
|
||||
// up front, so you can develop and deploy applications faster.
|
||||
//
|
||||
// See https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15 for more information on this service.
|
||||
//
|
||||
// See ec2 package documentation for more information.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/
|
||||
//
|
||||
// Using the Client
|
||||
//
|
||||
// To contact Amazon Elastic Compute Cloud 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 Elastic Compute Cloud client EC2 for more
|
||||
// information on creating client for this service.
|
||||
// https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#New
|
||||
package ec2
|
||||
1262
vendor/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go
generated
vendored
Normal file
1262
vendor/github.com/aws/aws-sdk-go/service/ec2/ec2iface/interface.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
vendor/github.com/aws/aws-sdk-go/service/ec2/errors.go
generated
vendored
Normal file
3
vendor/github.com/aws/aws-sdk-go/service/ec2/errors.go
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package ec2
|
||||
4213
vendor/github.com/aws/aws-sdk-go/service/ec2/examples_test.go
generated
vendored
Normal file
4213
vendor/github.com/aws/aws-sdk-go/service/ec2/examples_test.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
37
vendor/github.com/aws/aws-sdk-go/service/ec2/retryer_test.go
generated
vendored
Normal file
37
vendor/github.com/aws/aws-sdk-go/service/ec2/retryer_test.go
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
package ec2
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/client"
|
||||
"github.com/aws/aws-sdk-go/awstesting/unit"
|
||||
)
|
||||
|
||||
func TestCustomRetryer(t *testing.T) {
|
||||
svc := New(unit.Session, &aws.Config{Region: aws.String("us-west-2")})
|
||||
if _, ok := svc.Client.Retryer.(retryer); !ok {
|
||||
t.Error("expected custom retryer, but received otherwise")
|
||||
}
|
||||
|
||||
req, _ := svc.ModifyNetworkInterfaceAttributeRequest(&ModifyNetworkInterfaceAttributeInput{
|
||||
NetworkInterfaceId: aws.String("foo"),
|
||||
})
|
||||
|
||||
duration := svc.Client.Retryer.RetryRules(req)
|
||||
if duration < time.Second*1 || duration > time.Second*2 {
|
||||
t.Errorf("expected duration to be between 1 and 2, but received %v", duration)
|
||||
}
|
||||
|
||||
req.RetryCount = 15
|
||||
duration = svc.Client.Retryer.RetryRules(req)
|
||||
if duration < time.Second*5 || duration > time.Second*10 {
|
||||
t.Errorf("expected duration to be between 1 and 2, but received %v", duration)
|
||||
}
|
||||
|
||||
svc = New(unit.Session, &aws.Config{Region: aws.String("us-west-2"), Retryer: client.DefaultRetryer{}})
|
||||
if _, ok := svc.Client.Retryer.(client.DefaultRetryer); !ok {
|
||||
t.Error("expected default retryer, but received otherwise")
|
||||
}
|
||||
}
|
||||
93
vendor/github.com/aws/aws-sdk-go/service/ec2/service.go
generated
vendored
Normal file
93
vendor/github.com/aws/aws-sdk-go/service/ec2/service.go
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package ec2
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/client"
|
||||
"github.com/aws/aws-sdk-go/aws/client/metadata"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/aws/signer/v4"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/ec2query"
|
||||
)
|
||||
|
||||
// EC2 provides the API operation methods for making requests to
|
||||
// Amazon Elastic Compute Cloud. See this package's package overview docs
|
||||
// for details on the service.
|
||||
//
|
||||
// EC2 methods are safe to use concurrently. It is not safe to
|
||||
// modify mutate any of the struct's properties though.
|
||||
type EC2 struct {
|
||||
*client.Client
|
||||
}
|
||||
|
||||
// Used for custom client initialization logic
|
||||
var initClient func(*client.Client)
|
||||
|
||||
// Used for custom request initialization logic
|
||||
var initRequest func(*request.Request)
|
||||
|
||||
// Service information constants
|
||||
const (
|
||||
ServiceName = "ec2" // Service endpoint prefix API calls made to.
|
||||
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
|
||||
)
|
||||
|
||||
// New creates a new instance of the EC2 client with a session.
|
||||
// If additional configuration is needed for the client instance use the optional
|
||||
// aws.Config parameter to add your extra config.
|
||||
//
|
||||
// Example:
|
||||
// // Create a EC2 client from just a session.
|
||||
// svc := ec2.New(mySession)
|
||||
//
|
||||
// // Create a EC2 client with additional configuration
|
||||
// svc := ec2.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func New(p client.ConfigProvider, cfgs ...*aws.Config) *EC2 {
|
||||
c := p.ClientConfig(EndpointsID, cfgs...)
|
||||
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
|
||||
}
|
||||
|
||||
// newClient creates, initializes and returns a new service client instance.
|
||||
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *EC2 {
|
||||
svc := &EC2{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "2016-11-15",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
|
||||
// Handlers
|
||||
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
|
||||
svc.Handlers.Build.PushBackNamed(ec2query.BuildHandler)
|
||||
svc.Handlers.Unmarshal.PushBackNamed(ec2query.UnmarshalHandler)
|
||||
svc.Handlers.UnmarshalMeta.PushBackNamed(ec2query.UnmarshalMetaHandler)
|
||||
svc.Handlers.UnmarshalError.PushBackNamed(ec2query.UnmarshalErrorHandler)
|
||||
|
||||
// Run custom client initialization if present
|
||||
if initClient != nil {
|
||||
initClient(svc.Client)
|
||||
}
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a EC2 operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *EC2) newRequest(op *request.Operation, params, data interface{}) *request.Request {
|
||||
req := c.NewRequest(op, params, data)
|
||||
|
||||
// Run custom request initialization if present
|
||||
if initRequest != nil {
|
||||
initRequest(req)
|
||||
}
|
||||
|
||||
return req
|
||||
}
|
||||
1626
vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go
generated
vendored
Normal file
1626
vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user