Update Go AWS SDK to the latest version

This commit is contained in:
Andrey Smirnov
2019-07-13 00:03:55 +03:00
committed by Andrey Smirnov
parent d08be990ef
commit 94a72b23ff
2183 changed files with 885887 additions and 228114 deletions
+355 -423
View File
File diff suppressed because it is too large Load Diff
-34
View File
@@ -1,34 +0,0 @@
// +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)
}
}
+2 -3
View File
@@ -54,9 +54,8 @@ func verifySendMessageBatch(r *request.Request) {
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 {
if e, ok := entries[*entry.Id]; ok {
if err := checksumsMatch(entry.MessageBody, e.MD5OfMessageBody); err != nil {
ids = append(ids, *e.MessageId)
}
}
+46
View File
@@ -209,6 +209,52 @@ func TestSendMessageBatchChecksum(t *testing.T) {
}
}
func TestSendMessageBatchChecksumFailed(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) {
body := ioutil.NopCloser(bytes.NewReader([]byte("")))
r.HTTPResponse = &http.Response{StatusCode: 200, Body: body}
r.Data = &sqs.SendMessageBatchOutput{
Failed: []*sqs.BatchResultErrorEntry{
{
Id: aws.String("1"),
Code: aws.String("test"),
Message: aws.String("test"),
SenderFault: aws.Bool(false),
},
{
Id: aws.String("2"),
Code: aws.String("test"),
Message: aws.String("test"),
SenderFault: aws.Bool(false),
},
{
Id: aws.String("3"),
Code: aws.String("test"),
Message: aws.String("test"),
SenderFault: aws.Bool(false),
},
{
Id: aws.String("4"),
Code: aws.String("test"),
Message: aws.String("test"),
SenderFault: aws.Bool(false),
},
},
}
})
if err := req.Send(); err != nil {
t.Errorf("expect no error, got %v", err)
}
}
func TestSendMessageBatchChecksumInvalid(t *testing.T) {
req, _ := svc.SendMessageBatchRequest(&sqs.SendMessageBatchInput{
Entries: []*sqs.SendMessageBatchRequestEntry{
+5 -9
View File
@@ -29,17 +29,13 @@
//
// * Amazon SQS Product Page (http://aws.amazon.com/sqs/)
//
// * Amazon Simple Queue Service Developer Guide
// * Amazon Simple Queue Service Developer Guide Making API Requests (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-making-api-requests.html)
// Amazon SQS Message Attributes (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html)
// Amazon SQS Dead-Letter Queues (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html)
//
// Making API Requests (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/MakingRequestsArticle.html)
// * Amazon SQS in the AWS CLI Command Reference (http://docs.aws.amazon.com/cli/latest/reference/sqs/index.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)
// * 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.
//
+11 -11
View File
@@ -25,7 +25,7 @@ const (
// ErrCodeInvalidAttributeName for service response error code
// "InvalidAttributeName".
//
// The attribute referred to doesn't exist.
// The specified attribute doesn't exist.
ErrCodeInvalidAttributeName = "InvalidAttributeName"
// ErrCodeInvalidBatchEntryId for service response error code
@@ -37,7 +37,7 @@ const (
// ErrCodeInvalidIdFormat for service response error code
// "InvalidIdFormat".
//
// The receipt handle isn't valid for the current version.
// The specified receipt handle isn't valid for the current version.
ErrCodeInvalidIdFormat = "InvalidIdFormat"
// ErrCodeInvalidMessageContents for service response error code
@@ -49,16 +49,16 @@ const (
// ErrCodeMessageNotInflight for service response error code
// "AWS.SimpleQueueService.MessageNotInflight".
//
// The message referred to isn't in flight.
// The specified message 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.
// The specified action violates a limit. For example, ReceiveMessage returns
// this error if the maximum number of inflight messages is reached and AddPermission
// returns this error if the maximum number of permissions for the queue is
// reached.
ErrCodeOverLimit = "OverLimit"
// ErrCodePurgeQueueInProgress for service response error code
@@ -73,19 +73,19 @@ const (
// "AWS.SimpleQueueService.QueueDeletedRecently".
//
// You must wait 60 seconds after deleting a queue before you can create another
// one with the same name.
// queue with the same name.
ErrCodeQueueDeletedRecently = "AWS.SimpleQueueService.QueueDeletedRecently"
// ErrCodeQueueDoesNotExist for service response error code
// "AWS.SimpleQueueService.NonExistentQueue".
//
// The queue referred to doesn't exist.
// The specified queue 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
// A queue with this name already exists. Amazon SQS returns this error only
// if the request includes attributes whose values differ from those of the
// existing queue.
ErrCodeQueueNameExists = "QueueAlreadyExists"
@@ -93,7 +93,7 @@ const (
// ErrCodeReceiptHandleIsInvalid for service response error code
// "ReceiptHandleIsInvalid".
//
// The receipt handle provided isn't valid.
// The specified receipt handle isn't valid.
ErrCodeReceiptHandleIsInvalid = "ReceiptHandleIsInvalid"
// ErrCodeTooManyEntriesInBatchRequest for service response error code
+58
View File
@@ -0,0 +1,58 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// +build go1.10,integration
package sqs_test
import (
"context"
"testing"
"time"
"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/integration"
"github.com/aws/aws-sdk-go/service/sqs"
)
var _ aws.Config
var _ awserr.Error
var _ request.Request
func TestInteg_00_ListQueues(t *testing.T) {
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
defer cancelFn()
sess := integration.SessionWithDefaultRegion("us-west-2")
svc := sqs.New(sess)
params := &sqs.ListQueuesInput{}
_, err := svc.ListQueuesWithContext(ctx, params)
if err != nil {
t.Errorf("expect no error, got %v", err)
}
}
func TestInteg_01_GetQueueUrl(t *testing.T) {
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
defer cancelFn()
sess := integration.SessionWithDefaultRegion("us-west-2")
svc := sqs.New(sess)
params := &sqs.GetQueueUrlInput{
QueueName: aws.String("fake_queue"),
}
_, err := svc.GetQueueUrlWithContext(ctx, params)
if err == nil {
t.Fatalf("expect request to fail")
}
aerr, ok := err.(awserr.RequestFailure)
if !ok {
t.Fatalf("expect awserr, was %T", err)
}
if len(aerr.Code()) == 0 {
t.Errorf("expect non-empty error code")
}
if v := aerr.Code(); v == request.ErrCodeSerialization {
t.Errorf("expect API error code got serialization failure")
}
}
+4 -2
View File
@@ -29,8 +29,9 @@ 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.
ServiceName = "sqs" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "SQS" // ServiceID is a unique identifer of a specific service.
)
// New creates a new instance of the SQS client with a session.
@@ -55,6 +56,7 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
ServiceID: ServiceID,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,