Using IAM to authorize requests to AWS
Construct a custom authorizer class
import boto3| --- | |
| AWSTemplateFormatVersion: "2010-09-09" | |
| Description: Serverless Slackbot | |
| Parameters: | |
| ApiBasePath: | |
| Description: Slack app REST API base path | |
| Type: String | |
| Default: "" | |
| DomainCertificateArn: |
| Homebrew build logs for terraform on macOS 14 | |
| Build date: 2023-11-13 09:57:36 |
| Homebrew build logs for aws-sam-cli on macOS 14 | |
| Build date: 2023-10-18 11:31:07 |
| <defs> | |
| <style type="text/css"> | |
| @import url('https://fonts.googleapis.com/css2?family=Ubuntu'); | |
| .label { font-family: "Ubuntu", monospace; font-size: 12px; } | |
| </style> | |
| </defs> |
| require 'net/http' | |
| require 'aws-sdk-core' | |
| ## | |
| # Example usage: | |
| # uri = URI 'https://events.ksr.io/fizz/buzz' | |
| # req = Net::HTTP::Post.new(uri, 'content-type' => 'application/json') | |
| # Aws::HTTP.start(uri.host, uri.port, use_ssl: true) do |http| | |
| # http.request(req, { fizz: 'buzz' }.to_json) |
| class Hash | |
| def to_dynamodb | |
| self.map { |k,v| [ k.to_s, self.to_dynamodb_item(v) ] }.to_h | |
| end | |
| def from_dynamodb | |
| self.map { |k,v| [ k.to_s, self.from_dynamodb_item(v) ] }.to_h | |
| end | |
| private |
| #!/bin/sh | |
| # .git/hooks/commit-msg | |
| chksum="$( printf "%s" "$(< $1)" | sha256sum )" | |
| amulet="\e[5;1;48mYOU HAVE FOUND %s AMULET\e[0m\n" | |
| if grep 8888888888 > /dev/null <<< $chksum ; then | |
| printf "$amulet" "AN IMPOSSIBLE" | |
| elif grep 888888888 > /dev/null <<< $chksum ; then | |
| printf "$amulet" "A MYTHIC" | |
| elif grep 88888888 > /dev/null <<< $chksum ; then | |
| printf "$amulet" "A LEGENDARY" |
| #!/bin/bash | |
| rainbow_base_colors() { | |
| for y in {0..1} ; do | |
| for x in {0..7} ; do | |
| c=$(( $x + (8 * $y) )) | |
| tput $t $c | |
| printf " %3s " $c | |
| done | |
| printf '\e[0m\n' |
| import json | |
| import logging | |
| import os | |
| import sys | |
| class SuppressFilter(logging.Filter): | |
| def __init__(self, logger): | |
| self.logger = logger |