This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from .server import app | |
| def test_validates_book_no_genre(): | |
| book = { | |
| "title": "Cat In The Hat", | |
| "genre": "Historical Fiction" | |
| } | |
| result = app.test_client().post( | |
| "/book", | |
| json=book, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @app.route('/book', methods=['POST']) | |
| def create_book(): | |
| data = request.get_json() | |
| if not ("title" in data and "author" in data and "genre" in data): | |
| return {"message": "\"title\", \"author\", and \"genre\" are required fields"}, 400 | |
| library[data['title']] = data | |
| return library[data['title']], 201 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import ( | |
| Flask, | |
| request | |
| ) | |
| app = Flask(__name__) | |
| library = {} | |
| @app.route('/book', methods=['POST']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AWSTemplateFormatVersion: '2010-09-09' | |
| Transform: AWS::Serverless-2016-10-31 | |
| Description: | | |
| This stack holds resources for the primary data pipeline that feeds the my-org event datalake. All user related events runthrough this into Glue. | |
| Parameters: | |
| S3EndpointUrl: | |
| Description: 'Endpoint with which to hit AWS S3. Defaults to usw2.' | |
| Type: 'String' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Pipe: | |
| Type: AWS::Pipes::Pipe | |
| Properties: | |
| Name: kinesis-to-eventbridge | |
| Description: 'Pipe to connect Kinesis stream to EventBridge event bus' | |
| RoleArn: !GetAtt PipeRole.Arn | |
| Source: !Sub arn:aws:kinesis:us-west-2:${AWS::AccountId}:stream/my-org-app-event-stream-${Environment} | |
| SourceParameters: | |
| FilterCriteria: | |
| Filters: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_cognito_identity_pool" "users" { | |
| identity_pool_name = "users_identity_pool" | |
| allow_unauthenticated_identities = true | |
| allow_classic_flow = true | |
| cognito_identity_providers { | |
| client_id = aws_cognito_user_pool_client.users.id | |
| provider_name = "cognito-idp.${var.region}.amazonaws.com/${aws_cognito_user_pool.users.id}" | |
| server_side_token_check = false | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Action": [ | |
| "mobiletargeting:UpdateEndpoint", | |
| "mobiletargeting:PutEvents" | |
| ], | |
| "Resource": "arn:aws:mobiletargeting:*:${ACCOUNT_ID}:apps/<your pinpoint app ID>*" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Principal": { | |
| "Federated": "cognito-identity.amazonaws.com" | |
| }, | |
| "Action": [ | |
| "sts:AssumeRoleWithWebIdentity", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Action": [ | |
| "kinesis:PutRecords", | |
| "kinesis:DescribeStream" | |
| ], | |
| "Resource": "arn:aws:kinesis:us-west-2:${ACCOUNT_ID}:stream/org-name-app-event-stream-dev" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Action": [ | |
| "sts:AssumeRole" | |
| ], | |
| "Principal": { | |
| "Service": "pinpoint.amazonaws.com" |
NewerOlder