gpt4 book ai didi

amazon-web-services - AWS::ApiGatewayV2::Integration 如何在 CloudFormation 中使用 MessageAttributes

转载 作者:行者123 更新时间:2023-12-03 07:15:20 25 4
gpt4 key购买 nike

我在 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 引用中。请参阅SendMessageMessageAttributeValue页。

文档的正确部分是说 MessageAttributes 必须是“StringMessageAttributeValue 对象映射”。文档的其余部分提到 MessageAttribute.N.Name 似乎是错误的。

关于amazon-web-services - AWS::ApiGatewayV2::Integration 如何在 CloudFormation 中使用 MessageAttributes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67308591/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com