1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package sqs 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/sqs/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// Delivers up to ten messages to the specified queue. This is a batch version of 15// SendMessage. For a FIFO queue, multiple messages within a single batch are 16// enqueued in the order they are sent. The result of sending each message is 17// reported individually in the response. Because the batch request can result in a 18// combination of successful and unsuccessful actions, you should check for batch 19// errors even when the call returns an HTTP status code of 200. The maximum 20// allowed individual message size and the maximum total payload size (the sum of 21// the individual lengths of all of the batched messages) are both 256 KB (262,144 22// bytes). A message can include only XML, JSON, and unformatted text. The 23// following Unicode characters are allowed: #x9 | #xA | #xD | #x20 to #xD7FF | 24// #xE000 to #xFFFD | #x10000 to #x10FFFF Any characters not included in this list 25// will be rejected. For more information, see the W3C specification for characters 26// (http://www.w3.org/TR/REC-xml/#charsets). If you don't specify the DelaySeconds 27// parameter for an entry, Amazon SQS uses the default value for the queue. Some 28// actions take lists of parameters. These lists are specified using the param.n 29// notation. Values of n are integers starting from 1. For example, a parameter 30// list with two elements looks like this: &AttributeName.1=first 31// 32// &AttributeName.2=second 33func (c *Client) SendMessageBatch(ctx context.Context, params *SendMessageBatchInput, optFns ...func(*Options)) (*SendMessageBatchOutput, error) { 34 if params == nil { 35 params = &SendMessageBatchInput{} 36 } 37 38 result, metadata, err := c.invokeOperation(ctx, "SendMessageBatch", params, optFns, addOperationSendMessageBatchMiddlewares) 39 if err != nil { 40 return nil, err 41 } 42 43 out := result.(*SendMessageBatchOutput) 44 out.ResultMetadata = metadata 45 return out, nil 46} 47 48// 49type SendMessageBatchInput struct { 50 51 // A list of SendMessageBatchRequestEntry items. 52 // 53 // This member is required. 54 Entries []types.SendMessageBatchRequestEntry 55 56 // The URL of the Amazon SQS queue to which batched messages are sent. Queue URLs 57 // and names are case-sensitive. 58 // 59 // This member is required. 60 QueueUrl *string 61} 62 63// For each message in the batch, the response contains a 64// SendMessageBatchResultEntry tag if the message succeeds or a 65// BatchResultErrorEntry tag if the message fails. 66type SendMessageBatchOutput struct { 67 68 // A list of BatchResultErrorEntry items with error details about each message that 69 // can't be enqueued. 70 // 71 // This member is required. 72 Failed []types.BatchResultErrorEntry 73 74 // A list of SendMessageBatchResultEntry items. 75 // 76 // This member is required. 77 Successful []types.SendMessageBatchResultEntry 78 79 // Metadata pertaining to the operation's result. 80 ResultMetadata middleware.Metadata 81} 82 83func addOperationSendMessageBatchMiddlewares(stack *middleware.Stack, options Options) (err error) { 84 err = stack.Serialize.Add(&awsAwsquery_serializeOpSendMessageBatch{}, middleware.After) 85 if err != nil { 86 return err 87 } 88 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpSendMessageBatch{}, middleware.After) 89 if err != nil { 90 return err 91 } 92 if err = addSetLoggerMiddleware(stack, options); err != nil { 93 return err 94 } 95 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 96 return err 97 } 98 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 99 return err 100 } 101 if err = addResolveEndpointMiddleware(stack, options); err != nil { 102 return err 103 } 104 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 105 return err 106 } 107 if err = addRetryMiddlewares(stack, options); err != nil { 108 return err 109 } 110 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 111 return err 112 } 113 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 114 return err 115 } 116 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 117 return err 118 } 119 if err = addClientUserAgent(stack); err != nil { 120 return err 121 } 122 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 123 return err 124 } 125 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 126 return err 127 } 128 if err = addOpSendMessageBatchValidationMiddleware(stack); err != nil { 129 return err 130 } 131 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSendMessageBatch(options.Region), middleware.Before); err != nil { 132 return err 133 } 134 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 135 return err 136 } 137 if err = addResponseErrorMiddleware(stack); err != nil { 138 return err 139 } 140 if err = addRequestResponseLogging(stack, options); err != nil { 141 return err 142 } 143 return nil 144} 145 146func newServiceMetadataMiddleware_opSendMessageBatch(region string) *awsmiddleware.RegisterServiceMetadata { 147 return &awsmiddleware.RegisterServiceMetadata{ 148 Region: region, 149 ServiceID: ServiceID, 150 SigningName: "sqs", 151 OperationName: "SendMessageBatch", 152 } 153} 154