Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SQSProvider #399

Merged
merged 2 commits into from
Mar 25, 2018
Merged

Add SQSProvider #399

merged 2 commits into from
Mar 25, 2018

Conversation

alexdebrie
Copy link
Contributor

@alexdebrie alexdebrie commented Mar 25, 2018

What did you implement:

Adds a provider for AWS SQS that puts an event into an SQS Queue with a provider type of awssqs.

How did you implement it:

Pretty straight-forward -- implemented the required provider code.

How can we verify it:

Provision an SQS queue and save the Queue URL. Create some AWS access keys for a user that have sendMessage permission on the queue. Then:

  1. Register the Queue as a function:
curl -X POST \
http://localhost:4001/v1/spaces/default/functions \
  -H 'Content-Type: application/json' \
  -d '{
    "functionId": "sqs",
    "type": "awssqs",
    "provider": {
        "queueUrl": "<yourQueueUrl>",
        "region": "us-east-1",
        "awsAccessKeyId": "<key>",
        "awsSecretAccessKey": "<secret>"
    }
}’
  1. Register a subscription for the function:
curl -X POST \
http://localhost:4001/v1/spaces/default/subscriptions \
  -H 'Content-Type: application/json' \
  -d '{
    "functionId": "sqs", 
    "event": "http",
    "method": "POST",
    "path": "/"
}’
  1. Trigger the subscription:
curl -X POST \
http://localhost:4000/ \
  -H 'Content-Type: application/json' \
  -d '{
    "message": "test message"
}’
  1. Verify that your Queue has a message:
aws sqs receive-message --queue-url https://queue.amazonaws.com/786336638212/testQueue
{
    "Messages": [
        {
            "Body": "{\"event\":\"http\",\"id\":\"fed3bee0-7a75-42ef-85a7-0dcb118acba5\",\"receivedAt\":1521942191472,\"data\":{\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate\",\"Cache-Control\":\"no-cache\",\"Connection\":\"keep-alive\",\"Content-Length\":\"30\",\"Content-Type\":\"application/json\",\"Postman-Token\":\"1d0947c7-48f9-400c-8b76-37f94403f40a\",\"User-Agent\":\"PostmanRuntime/7.1.1\"},\"query\":{},\"body\":{\"message\":\"test message\"},\"host\":\"localhost:4000\",\"path\":\"/\",\"method\":\"POST\",\"params\":null},\"dataType\":\"application/json\"}",
            "ReceiptHandle": "AQEBDf4eQm17dSDC5x7HGg2WhPci6/vCZJ0XKLNUg8jRxSNWpUAG/ic53+t6GkhsZYwyGzhK21Lz/tsOFCJeNA55N5FG5yApdlxmMQdmCs4hjsLfstcr7KG5/OQzgT3zj+o0+QWZjPfl+QFu1cVcTcBoa2JlpsHMnylm8tifRCP2tbE61+QClqlv63yyuryc5ICwHLhPvvWqokQaW+bbhaHaSkgeLxulILY1/MCE+PV/UhVwzCNQ/2RqLWlkPLdkQoaPSJEjwuerQcEgJKvecgFJlkbRexxVA7VPhSpmtsb6lOjaiA/eeRKGaUdDipkfvnTsiWZV7Jkwclxt1JGjsHgMeB/0kMu8ac78eLRehcWZJpMzedMpjSHvBAUhHLnnL6kN",
            "MD5OfBody": "3d8830dd49818fee5a2fd3b8d598acb4",
            "MessageId": "78540693-d590-4a14-8691-2cd1eebb31e5"
        }
    ]
}

💥

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES
Is it a breaking change?: NO

@alexdebrie alexdebrie requested a review from mthenw March 25, 2018 01:53
@codecov
Copy link

codecov bot commented Mar 25, 2018

Codecov Report

Merging #399 into master will increase coverage by 0.57%.
The diff coverage is 79.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #399      +/-   ##
==========================================
+ Coverage   59.51%   60.09%   +0.57%     
==========================================
  Files          25       26       +1     
  Lines        1477     1521      +44     
==========================================
+ Hits          879      914      +35     
- Misses        555      564       +9     
  Partials       43       43
Impacted Files Coverage Δ
providers/awssqs/awssqs.go 79.54% <79.54%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c909055...3deae6e. Read the comment docs.

Copy link
Contributor

@mthenw mthenw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update OpenAPI spec (also would be great if you could update awsfirehose there :))

@mthenw
Copy link
Contributor

mthenw commented Mar 25, 2018

@alexdebrie ignore the Codacy status.

@alexdebrie
Copy link
Contributor Author

@mthenw Done

@alexdebrie alexdebrie merged commit f673e72 into master Mar 25, 2018
@alexdebrie alexdebrie deleted the SQSProvider branch March 25, 2018 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants