作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 CloudFormation 文档中尝试了使用 MessageAttributes
的多种变体,但无法使其工作。这就是我所得到的:
HttpApiSqsIntegration:
Type: AWS::ApiGatewayV2::Integration
Properties:
ApiId: !Ref HttpApiRef
CredentialsArn: !GetAtt MyHttpApiRole.Arn
IntegrationType: AWS_PROXY
IntegrationSubtype: SQS-SendMessage
PayloadFormatVersion: "1.0"
RequestParameters:
QueueUrl: !Ref InputMessageSqs
MessageBody: $request.body
MessageAttributes.entry.1.Name: foo
MessageAttributes.entry.1.Value.StringValue: bar
MessageAttributes.entry.1.Value.DataType: String
我遵循 here 指定的格式, here ,和here但它给出以下错误消息:
Parameter: MessageAttributes.entry.1.Name does not fit schema for Operation:
SQS-SendMessage. (Service: AmazonApiGatewayV2; Status Code: 400;
Error Code: BadRequestException; Request ID: ...; Proxy: null)
感谢任何帮助。谢谢。
最佳答案
我还没有在 CloudFormation 中完成此操作,但设法从 Web 控制台使其正常工作。我想该语法与您在 CloudFormation 中使用的语法等效。
例如,假设您要添加一个名为 timestamp
的属性,其值等于请求 header x-timestamp
。您可以在 MessageAttributes
字段中使用此语法:
{ "timestamp": { "DataType": "String", "StringValue": "${request.header.x-timestamp}" } }
这(非常糟糕)记录在 SQS API 引用中。请参阅SendMessage和 MessageAttributeValue页。
文档的正确部分是说 MessageAttributes 必须是“String
到 MessageAttributeValue
对象映射”。文档的其余部分提到 MessageAttribute.N.Name
似乎是错误的。
关于amazon-web-services - AWS::ApiGatewayV2::Integration 如何在 CloudFormation 中使用 MessageAttributes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67308591/
我是一名优秀的程序员,十分优秀!