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
| $ curl -i \ | |
| > -H 'x-api-key: 1234' \ | |
| > 'https://pipeline-demo-pmrwyqmvha-uc.a.run.app/hello' | |
| HTTP/2 200 | |
| content-type: application/json | |
| date: Sat, 16 May 2020 21:48:45 GMT | |
| server: Google Frontend | |
| content-length: 18 | |
| alt-svc: h3-27=":443"; ma=2592000,h3-25=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43" |
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
| $ ./hash_value.py --value "1234" | |
| d404559f602eab6fd602ac7680dacbfaadd13630335e951f097af3900e9de176b6db28512f2e000b9d04fba5133e8b1c6e8df59db3a8ab9d60be4b97cc9e81db |
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
| $ curl -i \ | |
| > -H 'x-api-key: 1234' \ | |
| > 'https://pipeline-demo-pmrwyqmvha-uc.a.run.app/hello' | |
| HTTP/2 401 | |
| content-type: text/html; charset=utf-8 | |
| date: Sat, 16 May 2020 19:59:36 GMT | |
| server: Google Frontend | |
| content-length: 338 | |
| alt-svc: h3-27=":443"; ma=2592000,h3-25=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43" |
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
| $ curl -i 'https://pipeline-demo-pmrwyqmvha-uc.a.run.app/health' | |
| HTTP/2 200 | |
| content-type: text/html; charset=utf-8 | |
| date: Sat, 16 May 2020 19:56:20 GMT | |
| server: Google Frontend | |
| content-length: 13 | |
| alt-svc: h3-27=":443"; ma=2592000,h3-25=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43" | |
| It is alive! |
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
| # Use the official lightweight Python image. | |
| # https://hub.docker.com/_/python | |
| FROM python:3.7-slim | |
| # Copy local code to the container image. | |
| ENV APP_HOME /app | |
| WORKDIR $APP_HOME | |
| COPY . ./ | |
| # Install production dependencies. |
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 functools import wraps | |
| from flask import request, abort | |
| import hashlib | |
| import os | |
| def require_apikey(view_function): | |
| @wraps(view_function) | |
| def decorated_function(*args, **kwargs): | |
| API_KEY_HEADER_NAME = 'x-api-key' |
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
| steps: | |
| - name: gcr.io/cloud-builders/docker | |
| args: | |
| ["build", "-t", "gcr.io/$PROJECT_ID/${_SERVICE_NAME}:${SHORT_SHA}", "."] | |
| - name: "gcr.io/cloud-builders/docker" | |
| args: ["push", "gcr.io/$PROJECT_ID/${_SERVICE_NAME}"] | |
| - name: "gcr.io/cloud-builders/gcloud" | |
| args: |
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
| # serverless.yml | |
| service: service-name | |
| provider: aws | |
| functions: | |
| hello: | |
| handler: handler.hello | |
| vpc: | |
| securityGroupIds: | |
| - ${cf:<STACK-NAME>.PrivateLambdaSecurityGroup} |
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
| aws cloudformation delete-stack --stack-name <stack-name> |
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
| ./deploy-cfn-stack.sh \ | |
| <stack-name> \ | |
| <path-to-cfn-template-file> \ | |
| <path-to-cfn-params-file> |