Vendor aws-sdk-go (dep ensure) (#178)

This commit is contained in:
Onur Filiz
2018-04-27 18:18:36 -07:00
committed by Robbie Zhang
parent 228a1f7a5f
commit 8d67098d06
2785 changed files with 1973570 additions and 25 deletions

4923
vendor/github.com/aws/aws-sdk-go/service/sqs/api.go generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
// +build integration
package sqs_test
import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting/unit"
"github.com/aws/aws-sdk-go/service/sqs"
)
func TestFlattenedTraits(t *testing.T) {
s := sqs.New(unit.Session)
_, err := s.DeleteMessageBatch(&sqs.DeleteMessageBatchInput{
QueueURL: aws.String("QUEUE"),
Entries: []*sqs.DeleteMessageBatchRequestEntry{
{
ID: aws.String("TEST"),
ReceiptHandle: aws.String("RECEIPT"),
},
},
})
if err == nil {
t.Fatalf("expect error, got nil")
}
if e, a := "InvalidAddress", err.Code(); e != a {
t.Errorf("expect %v, got %v", e, a)
}
if e, a := "The address QUEUE is not valid for this endpoint.", err.Message(); e != a {
t.Errorf("expect %v, got %v", e, a)
}
}

View File

@@ -0,0 +1,115 @@
package sqs
import (
"crypto/md5"
"encoding/hex"
"fmt"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
)
var (
errChecksumMissingBody = fmt.Errorf("cannot compute checksum. missing body")
errChecksumMissingMD5 = fmt.Errorf("cannot verify checksum. missing response MD5")
)
func setupChecksumValidation(r *request.Request) {
if aws.BoolValue(r.Config.DisableComputeChecksums) {
return
}
switch r.Operation.Name {
case opSendMessage:
r.Handlers.Unmarshal.PushBack(verifySendMessage)
case opSendMessageBatch:
r.Handlers.Unmarshal.PushBack(verifySendMessageBatch)
case opReceiveMessage:
r.Handlers.Unmarshal.PushBack(verifyReceiveMessage)
}
}
func verifySendMessage(r *request.Request) {
if r.DataFilled() && r.ParamsFilled() {
in := r.Params.(*SendMessageInput)
out := r.Data.(*SendMessageOutput)
err := checksumsMatch(in.MessageBody, out.MD5OfMessageBody)
if err != nil {
setChecksumError(r, err.Error())
}
}
}
func verifySendMessageBatch(r *request.Request) {
if r.DataFilled() && r.ParamsFilled() {
entries := map[string]*SendMessageBatchResultEntry{}
ids := []string{}
out := r.Data.(*SendMessageBatchOutput)
for _, entry := range out.Successful {
entries[*entry.Id] = entry
}
in := r.Params.(*SendMessageBatchInput)
for _, entry := range in.Entries {
if e := entries[*entry.Id]; e != nil {
err := checksumsMatch(entry.MessageBody, e.MD5OfMessageBody)
if err != nil {
ids = append(ids, *e.MessageId)
}
}
}
if len(ids) > 0 {
setChecksumError(r, "invalid messages: %s", strings.Join(ids, ", "))
}
}
}
func verifyReceiveMessage(r *request.Request) {
if r.DataFilled() && r.ParamsFilled() {
ids := []string{}
out := r.Data.(*ReceiveMessageOutput)
for i, msg := range out.Messages {
err := checksumsMatch(msg.Body, msg.MD5OfBody)
if err != nil {
if msg.MessageId == nil {
if r.Config.Logger != nil {
r.Config.Logger.Log(fmt.Sprintf(
"WARN: SQS.ReceiveMessage failed checksum request id: %s, message %d has no message ID.",
r.RequestID, i,
))
}
continue
}
ids = append(ids, *msg.MessageId)
}
}
if len(ids) > 0 {
setChecksumError(r, "invalid messages: %s", strings.Join(ids, ", "))
}
}
}
func checksumsMatch(body, expectedMD5 *string) error {
if body == nil {
return errChecksumMissingBody
} else if expectedMD5 == nil {
return errChecksumMissingMD5
}
msum := md5.Sum([]byte(*body))
sum := hex.EncodeToString(msum[:])
if sum != *expectedMD5 {
return fmt.Errorf("expected MD5 checksum '%s', got '%s'", *expectedMD5, sum)
}
return nil
}
func setChecksumError(r *request.Request, format string, args ...interface{}) {
r.Retryable = aws.Bool(true)
r.Error = awserr.New("InvalidChecksum", fmt.Sprintf(format, args...), nil)
}

View File

@@ -0,0 +1,245 @@
package sqs_test
import (
"bytes"
"io/ioutil"
"net/http"
"strings"
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/awstesting/unit"
"github.com/aws/aws-sdk-go/service/sqs"
)
var svc = func() *sqs.SQS {
s := sqs.New(unit.Session, &aws.Config{
DisableParamValidation: aws.Bool(true),
})
s.Handlers.Send.Clear()
return s
}()
func TestSendMessageChecksum(t *testing.T) {
req, _ := svc.SendMessageRequest(&sqs.SendMessageInput{
MessageBody: aws.String("test"),
})
req.Handlers.Send.PushBack(func(r *request.Request) {
body := ioutil.NopCloser(bytes.NewReader([]byte("")))
r.HTTPResponse = &http.Response{StatusCode: 200, Body: body}
r.Data = &sqs.SendMessageOutput{
MD5OfMessageBody: aws.String("098f6bcd4621d373cade4e832627b4f6"),
MessageId: aws.String("12345"),
}
})
err := req.Send()
if err != nil {
t.Errorf("expect no error, got %v", err)
}
}
func TestSendMessageChecksumInvalid(t *testing.T) {
req, _ := svc.SendMessageRequest(&sqs.SendMessageInput{
MessageBody: aws.String("test"),
})
req.Handlers.Send.PushBack(func(r *request.Request) {
body := ioutil.NopCloser(bytes.NewReader([]byte("")))
r.HTTPResponse = &http.Response{StatusCode: 200, Body: body}
r.Data = &sqs.SendMessageOutput{
MD5OfMessageBody: aws.String("000"),
MessageId: aws.String("12345"),
}
})
err := req.Send()
if err == nil {
t.Fatalf("expect error, got nil")
}
if e, a := "InvalidChecksum", err.(awserr.Error).Code(); e != a {
t.Errorf("expect %v, got %v", e, a)
}
if e, a := err.(awserr.Error).Message(), "expected MD5 checksum '000', got '098f6bcd4621d373cade4e832627b4f6'"; !strings.Contains(a, e) {
t.Errorf("expect %v to be in %v, was not", e, a)
}
}
func TestSendMessageChecksumInvalidNoValidation(t *testing.T) {
s := sqs.New(unit.Session, &aws.Config{
DisableParamValidation: aws.Bool(true),
DisableComputeChecksums: aws.Bool(true),
})
s.Handlers.Send.Clear()
req, _ := s.SendMessageRequest(&sqs.SendMessageInput{
MessageBody: aws.String("test"),
})
req.Handlers.Send.PushBack(func(r *request.Request) {
body := ioutil.NopCloser(bytes.NewReader([]byte("")))
r.HTTPResponse = &http.Response{StatusCode: 200, Body: body}
r.Data = &sqs.SendMessageOutput{
MD5OfMessageBody: aws.String("000"),
MessageId: aws.String("12345"),
}
})
err := req.Send()
if err != nil {
t.Errorf("expect no error, got %v", err)
}
}
func TestSendMessageChecksumNoInput(t *testing.T) {
req, _ := svc.SendMessageRequest(&sqs.SendMessageInput{})
req.Handlers.Send.PushBack(func(r *request.Request) {
body := ioutil.NopCloser(bytes.NewReader([]byte("")))
r.HTTPResponse = &http.Response{StatusCode: 200, Body: body}
r.Data = &sqs.SendMessageOutput{}
})
err := req.Send()
if err == nil {
t.Fatalf("expect error, got nil")
}
if e, a := "InvalidChecksum", err.(awserr.Error).Code(); e != a {
t.Errorf("expect %v, got %v", e, a)
}
if e, a := err.(awserr.Error).Message(), "cannot compute checksum. missing body"; !strings.Contains(a, e) {
t.Errorf("expect %v to be in %v, was not", e, a)
}
}
func TestSendMessageChecksumNoOutput(t *testing.T) {
req, _ := svc.SendMessageRequest(&sqs.SendMessageInput{
MessageBody: aws.String("test"),
})
req.Handlers.Send.PushBack(func(r *request.Request) {
body := ioutil.NopCloser(bytes.NewReader([]byte("")))
r.HTTPResponse = &http.Response{StatusCode: 200, Body: body}
r.Data = &sqs.SendMessageOutput{}
})
err := req.Send()
if err == nil {
t.Fatalf("expect error, got nil")
}
if e, a := "InvalidChecksum", err.(awserr.Error).Code(); e != a {
t.Errorf("expect %v, got %v", e, a)
}
if e, a := err.(awserr.Error).Message(), "cannot verify checksum. missing response MD5"; !strings.Contains(a, e) {
t.Errorf("expect %v to be in %v, was not", e, a)
}
}
func TestRecieveMessageChecksum(t *testing.T) {
req, _ := svc.ReceiveMessageRequest(&sqs.ReceiveMessageInput{})
req.Handlers.Send.PushBack(func(r *request.Request) {
md5 := "098f6bcd4621d373cade4e832627b4f6"
body := ioutil.NopCloser(bytes.NewReader([]byte("")))
r.HTTPResponse = &http.Response{StatusCode: 200, Body: body}
r.Data = &sqs.ReceiveMessageOutput{
Messages: []*sqs.Message{
{Body: aws.String("test"), MD5OfBody: &md5},
{Body: aws.String("test"), MD5OfBody: &md5},
{Body: aws.String("test"), MD5OfBody: &md5},
{Body: aws.String("test"), MD5OfBody: &md5},
},
}
})
err := req.Send()
if err != nil {
t.Errorf("expect no error, got %v", err)
}
}
func TestRecieveMessageChecksumInvalid(t *testing.T) {
req, _ := svc.ReceiveMessageRequest(&sqs.ReceiveMessageInput{})
req.Handlers.Send.PushBack(func(r *request.Request) {
md5 := "098f6bcd4621d373cade4e832627b4f6"
body := ioutil.NopCloser(bytes.NewReader([]byte("")))
r.HTTPResponse = &http.Response{StatusCode: 200, Body: body}
r.Data = &sqs.ReceiveMessageOutput{
Messages: []*sqs.Message{
{Body: aws.String("test"), MD5OfBody: &md5},
{Body: aws.String("test"), MD5OfBody: aws.String("000"), MessageId: aws.String("123")},
{Body: aws.String("test"), MD5OfBody: aws.String("000"), MessageId: aws.String("456")},
{Body: aws.String("test"), MD5OfBody: aws.String("000")},
{Body: aws.String("test"), MD5OfBody: &md5},
},
}
})
err := req.Send()
if err == nil {
t.Fatalf("expect error, got nil")
}
if e, a := "InvalidChecksum", err.(awserr.Error).Code(); e != a {
t.Errorf("expect %v, got %v", e, a)
}
if e, a := err.(awserr.Error).Message(), "invalid messages: 123, 456"; !strings.Contains(a, e) {
t.Errorf("expect %v to be in %v, was not", e, a)
}
}
func TestSendMessageBatchChecksum(t *testing.T) {
req, _ := svc.SendMessageBatchRequest(&sqs.SendMessageBatchInput{
Entries: []*sqs.SendMessageBatchRequestEntry{
{Id: aws.String("1"), MessageBody: aws.String("test")},
{Id: aws.String("2"), MessageBody: aws.String("test")},
{Id: aws.String("3"), MessageBody: aws.String("test")},
{Id: aws.String("4"), MessageBody: aws.String("test")},
},
})
req.Handlers.Send.PushBack(func(r *request.Request) {
md5 := "098f6bcd4621d373cade4e832627b4f6"
body := ioutil.NopCloser(bytes.NewReader([]byte("")))
r.HTTPResponse = &http.Response{StatusCode: 200, Body: body}
r.Data = &sqs.SendMessageBatchOutput{
Successful: []*sqs.SendMessageBatchResultEntry{
{MD5OfMessageBody: &md5, MessageId: aws.String("123"), Id: aws.String("1")},
{MD5OfMessageBody: &md5, MessageId: aws.String("456"), Id: aws.String("2")},
{MD5OfMessageBody: &md5, MessageId: aws.String("789"), Id: aws.String("3")},
{MD5OfMessageBody: &md5, MessageId: aws.String("012"), Id: aws.String("4")},
},
}
})
err := req.Send()
if err != nil {
t.Errorf("expect no error, got %v", err)
}
}
func TestSendMessageBatchChecksumInvalid(t *testing.T) {
req, _ := svc.SendMessageBatchRequest(&sqs.SendMessageBatchInput{
Entries: []*sqs.SendMessageBatchRequestEntry{
{Id: aws.String("1"), MessageBody: aws.String("test")},
{Id: aws.String("2"), MessageBody: aws.String("test")},
{Id: aws.String("3"), MessageBody: aws.String("test")},
{Id: aws.String("4"), MessageBody: aws.String("test")},
},
})
req.Handlers.Send.PushBack(func(r *request.Request) {
md5 := "098f6bcd4621d373cade4e832627b4f6"
body := ioutil.NopCloser(bytes.NewReader([]byte("")))
r.HTTPResponse = &http.Response{StatusCode: 200, Body: body}
r.Data = &sqs.SendMessageBatchOutput{
Successful: []*sqs.SendMessageBatchResultEntry{
{MD5OfMessageBody: &md5, MessageId: aws.String("123"), Id: aws.String("1")},
{MD5OfMessageBody: aws.String("000"), MessageId: aws.String("456"), Id: aws.String("2")},
{MD5OfMessageBody: aws.String("000"), MessageId: aws.String("789"), Id: aws.String("3")},
{MD5OfMessageBody: &md5, MessageId: aws.String("012"), Id: aws.String("4")},
},
}
})
err := req.Send()
if err == nil {
t.Fatalf("expect error, got nil")
}
if e, a := "InvalidChecksum", err.(awserr.Error).Code(); e != a {
t.Errorf("expect %v, got %v", e, a)
}
if e, a := err.(awserr.Error).Message(), "invalid messages: 456, 789"; !strings.Contains(a, e) {
t.Errorf("expect %v to be in %v, was not", e, a)
}
}

View File

@@ -0,0 +1,9 @@
package sqs
import "github.com/aws/aws-sdk-go/aws/request"
func init() {
initRequest = func(r *request.Request) {
setupChecksumValidation(r)
}
}

64
vendor/github.com/aws/aws-sdk-go/service/sqs/doc.go generated vendored Normal file
View File

@@ -0,0 +1,64 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package sqs provides the client and types for making API
// requests to Amazon Simple Queue Service.
//
// Welcome to the Amazon Simple Queue Service API Reference.
//
// Amazon Simple Queue Service (Amazon SQS) is a reliable, highly-scalable hosted
// queue for storing messages as they travel between applications or microservices.
// Amazon SQS moves data between distributed application components and helps
// you decouple these components.
//
// Standard queues (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/standard-queues.html)
// are available in all regions. FIFO queues (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html)
// are available in the US East (N. Virginia), US East (Ohio), US West (Oregon),
// and EU (Ireland) regions.
//
// You can use AWS SDKs (http://aws.amazon.com/tools/#sdk) to access Amazon
// SQS using your favorite programming language. The SDKs perform tasks such
// as the following automatically:
//
// * Cryptographically sign your service requests
//
// * Retry requests
//
// * Handle error responses
//
// Additional Information
//
// * Amazon SQS Product Page (http://aws.amazon.com/sqs/)
//
// * Amazon Simple Queue Service Developer Guide
//
// Making API Requests (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/MakingRequestsArticle.html)
//
// Using Amazon SQS Message Attributes (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html)
//
// Using Amazon SQS Dead-Letter Queues (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html)
//
// * Amazon Web Services General Reference
//
// Regions and Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html#sqs_region)
//
// See https://docs.aws.amazon.com/goto/WebAPI/sqs-2012-11-05 for more information on this service.
//
// See sqs package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/sqs/
//
// Using the Client
//
// To contact Amazon Simple Queue 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 Simple Queue Service client SQS for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/sqs/#New
package sqs

110
vendor/github.com/aws/aws-sdk-go/service/sqs/errors.go generated vendored Normal file
View File

@@ -0,0 +1,110 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package sqs
const (
// ErrCodeBatchEntryIdsNotDistinct for service response error code
// "AWS.SimpleQueueService.BatchEntryIdsNotDistinct".
//
// Two or more batch entries in the request have the same Id.
ErrCodeBatchEntryIdsNotDistinct = "AWS.SimpleQueueService.BatchEntryIdsNotDistinct"
// ErrCodeBatchRequestTooLong for service response error code
// "AWS.SimpleQueueService.BatchRequestTooLong".
//
// The length of all the messages put together is more than the limit.
ErrCodeBatchRequestTooLong = "AWS.SimpleQueueService.BatchRequestTooLong"
// ErrCodeEmptyBatchRequest for service response error code
// "AWS.SimpleQueueService.EmptyBatchRequest".
//
// The batch request doesn't contain any entries.
ErrCodeEmptyBatchRequest = "AWS.SimpleQueueService.EmptyBatchRequest"
// ErrCodeInvalidAttributeName for service response error code
// "InvalidAttributeName".
//
// The attribute referred to doesn't exist.
ErrCodeInvalidAttributeName = "InvalidAttributeName"
// ErrCodeInvalidBatchEntryId for service response error code
// "AWS.SimpleQueueService.InvalidBatchEntryId".
//
// The Id of a batch entry in a batch request doesn't abide by the specification.
ErrCodeInvalidBatchEntryId = "AWS.SimpleQueueService.InvalidBatchEntryId"
// ErrCodeInvalidIdFormat for service response error code
// "InvalidIdFormat".
//
// The receipt handle isn't valid for the current version.
ErrCodeInvalidIdFormat = "InvalidIdFormat"
// ErrCodeInvalidMessageContents for service response error code
// "InvalidMessageContents".
//
// The message contains characters outside the allowed set.
ErrCodeInvalidMessageContents = "InvalidMessageContents"
// ErrCodeMessageNotInflight for service response error code
// "AWS.SimpleQueueService.MessageNotInflight".
//
// The message referred to isn't in flight.
ErrCodeMessageNotInflight = "AWS.SimpleQueueService.MessageNotInflight"
// ErrCodeOverLimit for service response error code
// "OverLimit".
//
// The action that you requested would violate a limit. For example, ReceiveMessage
// returns this error if the maximum number of inflight messages is reached.
// AddPermission returns this error if the maximum number of permissions for
// the queue is reached.
ErrCodeOverLimit = "OverLimit"
// ErrCodePurgeQueueInProgress for service response error code
// "AWS.SimpleQueueService.PurgeQueueInProgress".
//
// Indicates that the specified queue previously received a PurgeQueue request
// within the last 60 seconds (the time it can take to delete the messages in
// the queue).
ErrCodePurgeQueueInProgress = "AWS.SimpleQueueService.PurgeQueueInProgress"
// ErrCodeQueueDeletedRecently for service response error code
// "AWS.SimpleQueueService.QueueDeletedRecently".
//
// You must wait 60 seconds after deleting a queue before you can create another
// one with the same name.
ErrCodeQueueDeletedRecently = "AWS.SimpleQueueService.QueueDeletedRecently"
// ErrCodeQueueDoesNotExist for service response error code
// "AWS.SimpleQueueService.NonExistentQueue".
//
// The queue referred to doesn't exist.
ErrCodeQueueDoesNotExist = "AWS.SimpleQueueService.NonExistentQueue"
// ErrCodeQueueNameExists for service response error code
// "QueueAlreadyExists".
//
// A queue already exists with this name. Amazon SQS returns this error only
// if the request includes attributes whose values differ from those of the
// existing queue.
ErrCodeQueueNameExists = "QueueAlreadyExists"
// ErrCodeReceiptHandleIsInvalid for service response error code
// "ReceiptHandleIsInvalid".
//
// The receipt handle provided isn't valid.
ErrCodeReceiptHandleIsInvalid = "ReceiptHandleIsInvalid"
// ErrCodeTooManyEntriesInBatchRequest for service response error code
// "AWS.SimpleQueueService.TooManyEntriesInBatchRequest".
//
// The batch request contains more entries than permissible.
ErrCodeTooManyEntriesInBatchRequest = "AWS.SimpleQueueService.TooManyEntriesInBatchRequest"
// ErrCodeUnsupportedOperation for service response error code
// "AWS.SimpleQueueService.UnsupportedOperation".
//
// Error code 400. Unsupported operation.
ErrCodeUnsupportedOperation = "AWS.SimpleQueueService.UnsupportedOperation"
)

View File

@@ -0,0 +1,93 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package sqs
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/query"
)
// SQS provides the API operation methods for making requests to
// Amazon Simple Queue Service. See this package's package overview docs
// for details on the service.
//
// SQS methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type SQS 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 = "sqs" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the SQS 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 SQS client from just a session.
// svc := sqs.New(mySession)
//
// // Create a SQS client with additional configuration
// svc := sqs.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *SQS {
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) *SQS {
svc := &SQS{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2012-11-05",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(query.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a SQS operation and runs any
// custom request initialization.
func (c *SQS) 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
}

View File

@@ -0,0 +1,144 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package sqsiface provides an interface to enable mocking the Amazon Simple Queue Service service client
// for testing your code.
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters.
package sqsiface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/sqs"
)
// SQSAPI provides an interface to enable mocking the
// sqs.SQS service client's API operation,
// paginators, and waiters. This make unit testing your code that calls out
// to the SDK's service client's calls easier.
//
// 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 SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // Amazon Simple Queue Service.
// func myFunc(svc sqsiface.SQSAPI) bool {
// // Make svc.AddPermission request
// }
//
// func main() {
// sess := session.New()
// svc := sqs.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockSQSClient struct {
// sqsiface.SQSAPI
// }
// func (m *mockSQSClient) AddPermission(input *sqs.AddPermissionInput) (*sqs.AddPermissionOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockSQSClient{}
//
// myfunc(mockSvc)
//
// // Verify myFunc's functionality
// }
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters. Its suggested to use the pattern above for testing, or using
// tooling to generate mocks to satisfy the interfaces.
type SQSAPI interface {
AddPermission(*sqs.AddPermissionInput) (*sqs.AddPermissionOutput, error)
AddPermissionWithContext(aws.Context, *sqs.AddPermissionInput, ...request.Option) (*sqs.AddPermissionOutput, error)
AddPermissionRequest(*sqs.AddPermissionInput) (*request.Request, *sqs.AddPermissionOutput)
ChangeMessageVisibility(*sqs.ChangeMessageVisibilityInput) (*sqs.ChangeMessageVisibilityOutput, error)
ChangeMessageVisibilityWithContext(aws.Context, *sqs.ChangeMessageVisibilityInput, ...request.Option) (*sqs.ChangeMessageVisibilityOutput, error)
ChangeMessageVisibilityRequest(*sqs.ChangeMessageVisibilityInput) (*request.Request, *sqs.ChangeMessageVisibilityOutput)
ChangeMessageVisibilityBatch(*sqs.ChangeMessageVisibilityBatchInput) (*sqs.ChangeMessageVisibilityBatchOutput, error)
ChangeMessageVisibilityBatchWithContext(aws.Context, *sqs.ChangeMessageVisibilityBatchInput, ...request.Option) (*sqs.ChangeMessageVisibilityBatchOutput, error)
ChangeMessageVisibilityBatchRequest(*sqs.ChangeMessageVisibilityBatchInput) (*request.Request, *sqs.ChangeMessageVisibilityBatchOutput)
CreateQueue(*sqs.CreateQueueInput) (*sqs.CreateQueueOutput, error)
CreateQueueWithContext(aws.Context, *sqs.CreateQueueInput, ...request.Option) (*sqs.CreateQueueOutput, error)
CreateQueueRequest(*sqs.CreateQueueInput) (*request.Request, *sqs.CreateQueueOutput)
DeleteMessage(*sqs.DeleteMessageInput) (*sqs.DeleteMessageOutput, error)
DeleteMessageWithContext(aws.Context, *sqs.DeleteMessageInput, ...request.Option) (*sqs.DeleteMessageOutput, error)
DeleteMessageRequest(*sqs.DeleteMessageInput) (*request.Request, *sqs.DeleteMessageOutput)
DeleteMessageBatch(*sqs.DeleteMessageBatchInput) (*sqs.DeleteMessageBatchOutput, error)
DeleteMessageBatchWithContext(aws.Context, *sqs.DeleteMessageBatchInput, ...request.Option) (*sqs.DeleteMessageBatchOutput, error)
DeleteMessageBatchRequest(*sqs.DeleteMessageBatchInput) (*request.Request, *sqs.DeleteMessageBatchOutput)
DeleteQueue(*sqs.DeleteQueueInput) (*sqs.DeleteQueueOutput, error)
DeleteQueueWithContext(aws.Context, *sqs.DeleteQueueInput, ...request.Option) (*sqs.DeleteQueueOutput, error)
DeleteQueueRequest(*sqs.DeleteQueueInput) (*request.Request, *sqs.DeleteQueueOutput)
GetQueueAttributes(*sqs.GetQueueAttributesInput) (*sqs.GetQueueAttributesOutput, error)
GetQueueAttributesWithContext(aws.Context, *sqs.GetQueueAttributesInput, ...request.Option) (*sqs.GetQueueAttributesOutput, error)
GetQueueAttributesRequest(*sqs.GetQueueAttributesInput) (*request.Request, *sqs.GetQueueAttributesOutput)
GetQueueUrl(*sqs.GetQueueUrlInput) (*sqs.GetQueueUrlOutput, error)
GetQueueUrlWithContext(aws.Context, *sqs.GetQueueUrlInput, ...request.Option) (*sqs.GetQueueUrlOutput, error)
GetQueueUrlRequest(*sqs.GetQueueUrlInput) (*request.Request, *sqs.GetQueueUrlOutput)
ListDeadLetterSourceQueues(*sqs.ListDeadLetterSourceQueuesInput) (*sqs.ListDeadLetterSourceQueuesOutput, error)
ListDeadLetterSourceQueuesWithContext(aws.Context, *sqs.ListDeadLetterSourceQueuesInput, ...request.Option) (*sqs.ListDeadLetterSourceQueuesOutput, error)
ListDeadLetterSourceQueuesRequest(*sqs.ListDeadLetterSourceQueuesInput) (*request.Request, *sqs.ListDeadLetterSourceQueuesOutput)
ListQueueTags(*sqs.ListQueueTagsInput) (*sqs.ListQueueTagsOutput, error)
ListQueueTagsWithContext(aws.Context, *sqs.ListQueueTagsInput, ...request.Option) (*sqs.ListQueueTagsOutput, error)
ListQueueTagsRequest(*sqs.ListQueueTagsInput) (*request.Request, *sqs.ListQueueTagsOutput)
ListQueues(*sqs.ListQueuesInput) (*sqs.ListQueuesOutput, error)
ListQueuesWithContext(aws.Context, *sqs.ListQueuesInput, ...request.Option) (*sqs.ListQueuesOutput, error)
ListQueuesRequest(*sqs.ListQueuesInput) (*request.Request, *sqs.ListQueuesOutput)
PurgeQueue(*sqs.PurgeQueueInput) (*sqs.PurgeQueueOutput, error)
PurgeQueueWithContext(aws.Context, *sqs.PurgeQueueInput, ...request.Option) (*sqs.PurgeQueueOutput, error)
PurgeQueueRequest(*sqs.PurgeQueueInput) (*request.Request, *sqs.PurgeQueueOutput)
ReceiveMessage(*sqs.ReceiveMessageInput) (*sqs.ReceiveMessageOutput, error)
ReceiveMessageWithContext(aws.Context, *sqs.ReceiveMessageInput, ...request.Option) (*sqs.ReceiveMessageOutput, error)
ReceiveMessageRequest(*sqs.ReceiveMessageInput) (*request.Request, *sqs.ReceiveMessageOutput)
RemovePermission(*sqs.RemovePermissionInput) (*sqs.RemovePermissionOutput, error)
RemovePermissionWithContext(aws.Context, *sqs.RemovePermissionInput, ...request.Option) (*sqs.RemovePermissionOutput, error)
RemovePermissionRequest(*sqs.RemovePermissionInput) (*request.Request, *sqs.RemovePermissionOutput)
SendMessage(*sqs.SendMessageInput) (*sqs.SendMessageOutput, error)
SendMessageWithContext(aws.Context, *sqs.SendMessageInput, ...request.Option) (*sqs.SendMessageOutput, error)
SendMessageRequest(*sqs.SendMessageInput) (*request.Request, *sqs.SendMessageOutput)
SendMessageBatch(*sqs.SendMessageBatchInput) (*sqs.SendMessageBatchOutput, error)
SendMessageBatchWithContext(aws.Context, *sqs.SendMessageBatchInput, ...request.Option) (*sqs.SendMessageBatchOutput, error)
SendMessageBatchRequest(*sqs.SendMessageBatchInput) (*request.Request, *sqs.SendMessageBatchOutput)
SetQueueAttributes(*sqs.SetQueueAttributesInput) (*sqs.SetQueueAttributesOutput, error)
SetQueueAttributesWithContext(aws.Context, *sqs.SetQueueAttributesInput, ...request.Option) (*sqs.SetQueueAttributesOutput, error)
SetQueueAttributesRequest(*sqs.SetQueueAttributesInput) (*request.Request, *sqs.SetQueueAttributesOutput)
TagQueue(*sqs.TagQueueInput) (*sqs.TagQueueOutput, error)
TagQueueWithContext(aws.Context, *sqs.TagQueueInput, ...request.Option) (*sqs.TagQueueOutput, error)
TagQueueRequest(*sqs.TagQueueInput) (*request.Request, *sqs.TagQueueOutput)
UntagQueue(*sqs.UntagQueueInput) (*sqs.UntagQueueOutput, error)
UntagQueueWithContext(aws.Context, *sqs.UntagQueueInput, ...request.Option) (*sqs.UntagQueueOutput, error)
UntagQueueRequest(*sqs.UntagQueueInput) (*request.Request, *sqs.UntagQueueOutput)
}
var _ SQSAPI = (*sqs.SQS)(nil)