Skip to content

Instantly share code, notes, and snippets.

@datashaman
Last active August 13, 2020 10:12
Show Gist options
  • Save datashaman/054f128968311cc7c4a20c51f7bd21ee to your computer and use it in GitHub Desktop.
Save datashaman/054f128968311cc7c4a20c51f7bd21ee to your computer and use it in GitHub Desktop.
DefinitionBody:
swagger: 2.0
info:
title: !Ref AWS::StackName
paths:
/ingest:
post:
consumes:
- application/json
produces:
- application/json
responses:
"200":
statusCode: "200"
description: "OK"
x-amazon-apigateway-integration:
httpMethod: POST
statusCode: 200
type: AWS
credentials: !GetAtt SnsPublishRole.Arn
uri: !Sub arn:aws:apigateway:${AWS::Region}:sns:path//
passthroughBehaviour: NEVER
requestParameters:
integration.request.header.Content-Type: "'application/x-www-form-urlencoded'"
requestTemplates:
application/json: !Sub
- |
Action=Publish##
&Version=2010-03-31##
&TopicArn=$util.urlEncode('${Topic}')##
&Message=$util.urlEncode($input.json('$'))##
&MessageAttributes.entry.1.Name=event##
&MessageAttributes.entry.1.Value.StringValue=EventReceived##
&MessageAttributes.entry.1.Value.DataType=String
- Topic: !Ref EventReceived
responses:
"2\\d{2}":
statusCode: "200"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment