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/smithy-go/middleware" 10 smithyhttp "github.com/aws/smithy-go/transport/http" 11) 12 13// Sets the value of one or more queue attributes. When you change a queue's 14// attributes, the change can take up to 60 seconds for most of the attributes to 15// propagate throughout the Amazon SQS system. Changes made to the 16// MessageRetentionPeriod attribute can take up to 15 minutes. 17// 18// * In the future, 19// new attributes might be added. If you write code that calls this action, we 20// recommend that you structure your code so that it can handle new attributes 21// gracefully. 22// 23// * Cross-account permissions don't apply to this action. For more 24// information, see Grant cross-account permissions to a role and a user name 25// (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-customer-managed-policy-examples.html#grant-cross-account-permissions-to-role-and-user-name) 26// in the Amazon Simple Queue Service Developer Guide. 27// 28// * To remove the ability to 29// change queue permissions, you must deny permission to the AddPermission, 30// RemovePermission, and SetQueueAttributes actions in your IAM policy. 31func (c *Client) SetQueueAttributes(ctx context.Context, params *SetQueueAttributesInput, optFns ...func(*Options)) (*SetQueueAttributesOutput, error) { 32 if params == nil { 33 params = &SetQueueAttributesInput{} 34 } 35 36 result, metadata, err := c.invokeOperation(ctx, "SetQueueAttributes", params, optFns, addOperationSetQueueAttributesMiddlewares) 37 if err != nil { 38 return nil, err 39 } 40 41 out := result.(*SetQueueAttributesOutput) 42 out.ResultMetadata = metadata 43 return out, nil 44} 45 46// 47type SetQueueAttributesInput struct { 48 49 // A map of attributes to set. The following lists the names, descriptions, and 50 // values of the special request parameters that the SetQueueAttributes action 51 // uses: 52 // 53 // * DelaySeconds – The length of time, in seconds, for which the delivery 54 // of all messages in the queue is delayed. Valid values: An integer from 0 to 900 55 // (15 minutes). Default: 0. 56 // 57 // * MaximumMessageSize – The limit of how many bytes a 58 // message can contain before Amazon SQS rejects it. Valid values: An integer from 59 // 1,024 bytes (1 KiB) up to 262,144 bytes (256 KiB). Default: 262,144 (256 60 // KiB). 61 // 62 // * MessageRetentionPeriod – The length of time, in seconds, for which 63 // Amazon SQS retains a message. Valid values: An integer representing seconds, 64 // from 60 (1 minute) to 1,209,600 (14 days). Default: 345,600 (4 days). 65 // 66 // * Policy 67 // – The queue's policy. A valid AWS policy. For more information about policy 68 // structure, see Overview of AWS IAM Policies 69 // (https://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html) in the 70 // Amazon IAM User Guide. 71 // 72 // * ReceiveMessageWaitTimeSeconds – The length of time, in 73 // seconds, for which a ReceiveMessage action waits for a message to arrive. Valid 74 // values: An integer from 0 to 20 (seconds). Default: 0. 75 // 76 // * RedrivePolicy – The 77 // string that includes the parameters for the dead-letter queue functionality of 78 // the source queue as a JSON object. For more information about the redrive policy 79 // and dead-letter queues, see Using Amazon SQS Dead-Letter Queues 80 // (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html) 81 // in the Amazon Simple Queue Service Developer Guide. 82 // 83 // * deadLetterTargetArn – The 84 // Amazon Resource Name (ARN) of the dead-letter queue to which Amazon SQS moves 85 // messages after the value of maxReceiveCount is exceeded. 86 // 87 // * maxReceiveCount – 88 // The number of times a message is delivered to the source queue before being 89 // moved to the dead-letter queue. When the ReceiveCount for a message exceeds the 90 // maxReceiveCount for a queue, Amazon SQS moves the message to the 91 // dead-letter-queue. 92 // 93 // The dead-letter queue of a FIFO queue must also be a FIFO 94 // queue. Similarly, the dead-letter queue of a standard queue must also be a 95 // standard queue. 96 // 97 // * VisibilityTimeout – The visibility timeout for the queue, in 98 // seconds. Valid values: An integer from 0 to 43,200 (12 hours). Default: 30. For 99 // more information about the visibility timeout, see Visibility Timeout 100 // (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html) 101 // in the Amazon Simple Queue Service Developer Guide. 102 // 103 // The following attributes 104 // apply only to server-side-encryption 105 // (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html): 106 // 107 // * 108 // KmsMasterKeyId – The ID of an AWS-managed customer master key (CMK) for Amazon 109 // SQS or a custom CMK. For more information, see Key Terms 110 // (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-sse-key-terms). 111 // While the alias of the AWS-managed CMK for Amazon SQS is always alias/aws/sqs, 112 // the alias of a custom CMK can, for example, be alias/MyAlias . For more 113 // examples, see KeyId 114 // (https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html#API_DescribeKey_RequestParameters) 115 // in the AWS Key Management Service API Reference. 116 // 117 // * KmsDataKeyReusePeriodSeconds 118 // – The length of time, in seconds, for which Amazon SQS can reuse a data key 119 // (https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#data-keys) 120 // to encrypt or decrypt messages before calling AWS KMS again. An integer 121 // representing seconds, between 60 seconds (1 minute) and 86,400 seconds (24 122 // hours). Default: 300 (5 minutes). A shorter time period provides better security 123 // but results in more calls to KMS which might incur charges after Free Tier. For 124 // more information, see How Does the Data Key Reuse Period Work? 125 // (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-how-does-the-data-key-reuse-period-work). 126 // 127 // The 128 // following attribute applies only to FIFO (first-in-first-out) queues 129 // (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html): 130 // 131 // * 132 // ContentBasedDeduplication – Enables content-based deduplication. For more 133 // information, see Exactly-Once Processing 134 // (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html#FIFO-queues-exactly-once-processing) 135 // in the Amazon Simple Queue Service Developer Guide. Note the following: 136 // 137 // * Every 138 // message must have a unique MessageDeduplicationId. 139 // 140 // * You may provide a 141 // MessageDeduplicationId explicitly. 142 // 143 // * If you aren't able to provide a 144 // MessageDeduplicationId and you enable ContentBasedDeduplication for your queue, 145 // Amazon SQS uses a SHA-256 hash to generate the MessageDeduplicationId using the 146 // body of the message (but not the attributes of the message). 147 // 148 // * If you don't 149 // provide a MessageDeduplicationId and the queue doesn't have 150 // ContentBasedDeduplication set, the action fails with an error. 151 // 152 // * If the queue 153 // has ContentBasedDeduplication set, your MessageDeduplicationId overrides the 154 // generated one. 155 // 156 // * When ContentBasedDeduplication is in effect, messages with 157 // identical content sent within the deduplication interval are treated as 158 // duplicates and only one copy of the message is delivered. 159 // 160 // * If you send one 161 // message with ContentBasedDeduplication enabled and then another message with a 162 // MessageDeduplicationId that is the same as the one generated for the first 163 // MessageDeduplicationId, the two messages are treated as duplicates and only one 164 // copy of the message is delivered. 165 // 166 // Preview: High throughput for FIFO queues High 167 // throughput for Amazon SQS FIFO queues is in preview release and is subject to 168 // change. This feature provides a high number of transactions per second (TPS) for 169 // messages in FIFO queues. For information on throughput quotas, see Quotas 170 // related to messages 171 // (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/quotas-messages.html) 172 // in the Amazon Simple Queue Service Developer Guide. This preview includes two 173 // new attributes: 174 // 175 // * DeduplicationScope – Specifies whether message deduplication 176 // occurs at the message group or queue level. Valid values are messageGroup and 177 // queue. 178 // 179 // * FifoThroughputLimit – Specifies whether the FIFO queue throughput 180 // quota applies to the entire queue or per message group. Valid values are 181 // perQueue and perMessageGroupId. The perMessageGroupId value is allowed only when 182 // the value for DeduplicationScope is messageGroup. 183 // 184 // To enable high throughput for 185 // FIFO queues, do the following: 186 // 187 // * Set DeduplicationScope to messageGroup. 188 // 189 // * Set 190 // FifoThroughputLimit to perMessageGroupId. 191 // 192 // If you set these attributes to 193 // anything other than the values shown for enabling high throughput, standard 194 // throughput is in effect and deduplication occurs as specified. This preview is 195 // available in the following AWS Regions: 196 // 197 // * US East (Ohio); us-east-2 198 // 199 // * US East 200 // (N. Virginia); us-east-1 201 // 202 // * US West (Oregon); us-west-2 203 // 204 // * Europe (Ireland); 205 // eu-west-1 206 // 207 // For more information about high throughput for FIFO queues, see 208 // Preview: High throughput for FIFO queues 209 // (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/high-throughput-fifo.html) 210 // in the Amazon Simple Queue Service Developer Guide. 211 // 212 // This member is required. 213 Attributes map[string]string 214 215 // The URL of the Amazon SQS queue whose attributes are set. Queue URLs and names 216 // are case-sensitive. 217 // 218 // This member is required. 219 QueueUrl *string 220} 221 222type SetQueueAttributesOutput struct { 223 // Metadata pertaining to the operation's result. 224 ResultMetadata middleware.Metadata 225} 226 227func addOperationSetQueueAttributesMiddlewares(stack *middleware.Stack, options Options) (err error) { 228 err = stack.Serialize.Add(&awsAwsquery_serializeOpSetQueueAttributes{}, middleware.After) 229 if err != nil { 230 return err 231 } 232 err = stack.Deserialize.Add(&awsAwsquery_deserializeOpSetQueueAttributes{}, middleware.After) 233 if err != nil { 234 return err 235 } 236 if err = addSetLoggerMiddleware(stack, options); err != nil { 237 return err 238 } 239 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 240 return err 241 } 242 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 243 return err 244 } 245 if err = addResolveEndpointMiddleware(stack, options); err != nil { 246 return err 247 } 248 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 249 return err 250 } 251 if err = addRetryMiddlewares(stack, options); err != nil { 252 return err 253 } 254 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 255 return err 256 } 257 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 258 return err 259 } 260 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 261 return err 262 } 263 if err = addClientUserAgent(stack); err != nil { 264 return err 265 } 266 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 267 return err 268 } 269 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 270 return err 271 } 272 if err = addOpSetQueueAttributesValidationMiddleware(stack); err != nil { 273 return err 274 } 275 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSetQueueAttributes(options.Region), middleware.Before); err != nil { 276 return err 277 } 278 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 279 return err 280 } 281 if err = addResponseErrorMiddleware(stack); err != nil { 282 return err 283 } 284 if err = addRequestResponseLogging(stack, options); err != nil { 285 return err 286 } 287 return nil 288} 289 290func newServiceMetadataMiddleware_opSetQueueAttributes(region string) *awsmiddleware.RegisterServiceMetadata { 291 return &awsmiddleware.RegisterServiceMetadata{ 292 Region: region, 293 ServiceID: ServiceID, 294 SigningName: "sqs", 295 OperationName: "SetQueueAttributes", 296 } 297} 298