This shows how to convert a basic REST ApiGateway template to its equivalent HTTP ApiGatewayV2.
The original code before refactoring to ApiGatewayV2 comes from this article
Replace MY_PROFILE, MY_REGION and MY_STACK_NAME
| #!/usr/bin/env python3 | |
| """ | |
| Provides a simple Python wrapper for invoking an API Gateway endpoint using IAM signed requests. | |
| Example: | |
| python3 apigateway-invoke.py GET \ | |
| https://xxxxxxxxxx.execute-api.us-east-1.amazonaws.com/default/MethodName | jq . | |
| """ | |
| try: |
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| ) | |
| func main() { | |
| // can handle symbolic link, but will no follow the link |
| #================================================CKA EXAM CHEATSHEET KUBECTL==============================================# | |
| commands for manage cluster, troubleshooting, debug etc... | |
| #=========================================================================================================================# | |
| useful resources: https://github.com/ascode-com/wiki/tree/main/certified-kubernetes-administrator | |
| alias ll='ls -l' | |
| alias kcr='kubectl create' |
| use std::fmt::Display; | |
| trait Pipe:Sized { | |
| fn pipe<F,R>(self, f:F) -> R | |
| where | |
| F: FnOnce(Self) -> R; | |
| fn pipe_ref<F,R>(&self, f:F) -> R | |
| where | |
| F: FnOnce(&Self) -> R; | |
| fn pipe_mut<'a, F,R>(&'a mut self, f:F) -> R |
| """ | |
| A micro event loop library implementation from scratch. | |
| This library provides a minimal but feature-complete asynchronous event loop | |
| implementation for educational purposes. It demonstrates the core concepts of | |
| asynchronous programming including: | |
| - Task scheduling and management | |
| - I/O multiplexing with non-blocking sockets | |
| - Timeouts and sleep functionality |
| #!/usr/bin/env python | |
| import json, sys | |
| from urllib.request import urlopen | |
| def green(str): return f'\033[92m{str}\033[0m' | |
| def orange(str): return f'\033[38;5;214m{str}\033[0m' | |
| def red(str): return f'\033[91m{str}\033[0m' | |
| def yellow(str): return f'\033[93m{str}\033[0m' |
This shows how to convert a basic REST ApiGateway template to its equivalent HTTP ApiGatewayV2.
The original code before refactoring to ApiGatewayV2 comes from this article
Replace MY_PROFILE, MY_REGION and MY_STACK_NAME
export DOCKER_REGISTRY_SERVER=https://index.docker.io/v1/
export DOCKER_USER=Type your dockerhub username, same as when you `docker login`
export DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
export DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`
export SECRETNAME=acmeorg
| FROM ubuntu:trusty | |
| RUN \ | |
| apt-get update \ | |
| && apt-get -y install gettext-base \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| ENV VALUE=foo | |
| ENV VALUE1=boo | |
| COPY config.txt source_config.txt |
| # Delete all files in the workspace | |
| rm -rf * | |
| # Create a directory for the job definitions | |
| mkdir -p $BUILD_ID/jobs | |
| # Copy global configuration files into the workspace | |
| cp $JENKINS_HOME/*.xml $BUILD_ID/ | |
| # Copy keys and secrets into the workspace | |
| cp $JENKINS_HOME/identity.key.enc $BUILD_ID/ |