This file contains 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
https://medium.com/@janvithakkar.583/implementing-serverless-api-with-amazon-api-gateway-lambda-function-and-amazon-cognito-user-pool-92ff44cc4949 | |
https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-invoke-api-integrated-with-cognito-user-pool.html | |
Call the API with Cognito Credentials: | |
After integrating the user pool, users will need to sign in to Cognito and obtain a JSON Web Token (JWT). | |
When making API requests, users will include the JWT token in the "Authorization" header with the format "Bearer <token>". | |
API Gateway will validate the token with Cognito and grant access based on the user's permissions. |
This file contains 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
template(name="json-template" | |
type="list") { | |
constant(value="{") | |
constant(value="\"@timestamp\":\"") property(name="timereported" dateFormat="rfc3339") | |
constant(value="\",\"@version\":\"1") | |
constant(value="\",\"message\":\"") property(name="msg" format="json") | |
constant(value="\",\"sysloghost\":\"") property(name="hostname") | |
constant(value="\",\"severity\":\"") property(name="syslogseverity-text") | |
constant(value="\",\"facility\":\"") property(name="syslogfacility-text") | |
constant(value="\",\"programname\":\"") property(name="programname") |
This file contains 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 kubernetes import client, config | |
import requests,sys | |
# list all PVCs in a namespace | |
def list_all_pvc(env, namespace): | |
config.load_kube_config(config_file='~/.kube/config', context=env) | |
v1 = client.CoreV1Api() | |
pvc_list = v1.list_namespaced_persistent_volume_claim(namespace) | |
return pvc_list |
This file contains 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
Name | Value | Long_name | Desc | MenuPath | |
---|---|---|---|---|---|
EX010101 | 2 | AF TREBLE GAIN | 0 | RadioSetting->ModeSSB | |
EX010102 | 1 | AF MIDDLE TONE GAIN | 0 | RadioSetting->ModeSSB | |
EX010103 | 0 | AF BASS GAIN | 0 | RadioSetting->ModeSSB | |
EX010104 | 20 msec | AGC FAST DELAY | 0 | RadioSetting->ModeSSB | |
EX010105 | 1000 msec | AGC MID DELAY | 0 | RadioSetting->ModeSSB | |
EX010106 | 3220 msec | AGC SLOW DELAY | 0 | RadioSetting->ModeSSB | |
EX010107 | 100Hz | LCUT FREQ | 0 | RadioSetting->ModeSSB | |
EX010108 | 6dB/oct | LCUT SLOP | 0 | RadioSetting->ModeSSB | |
EX010109 | 3000Hz | HCUT FREQ | 0 | RadioSetting->ModeSSB |
This file contains 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
import sys | |
import time | |
from prometheus_client import start_http_server, Gauge | |
import requests,json | |
nbu_api_endpoint = "https://bank.gov.ua/NBUStatService/v1/statdirectory/exchange?json" | |
date = time.strftime("%Y-%m-%d") | |
for item in json.loads(requests.get(nbu_api_endpoint).text): | |
globals()[item['cc']] = Gauge(item['cc'], "currency rate ", ["date","currency_name"]) | |
globals()[item['cc']].labels(date = time.strftime("%Y-%m-%d"), currency_name = item['cc']).set(item['rate']) |
This file contains 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
import boto3,os,shutil,re | |
session = boto3.session.Session(profile_name='default') | |
iam = session.client('iam') | |
def list_policy_arns(): | |
policy_arns = [] | |
paginator = iam.get_paginator('list_policies') | |
for response in paginator.paginate(Scope='Local'): | |
for policy in response['Policies']: | |
policy_arns.append(policy['Arn']) |
This file contains 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
import boto3,re,datetime | |
import argparse | |
parser = argparse.ArgumentParser(description='List Glue databases and tables') | |
parser.add_argument('--timestamps_show', help='show timestams fro Last usage, update and create tables',required=True) | |
parser.add_argument('--locations_show', help='show Locations of specified table',required=True) | |
parser.add_argument('--glue_database_regex', help='regex for filtering databases',required=False) | |
parser.add_argument('--glue_table_regex', help='regex for filtering tables',required=False) | |
args = parser.parse_args() |
This file contains 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 github import Github | |
import re,logging | |
from subprocess import call | |
token="ghp_###########" | |
g = Github(base_url="https://code.some.organization/api/v3", login_or_token=token) | |
regexp = ['regular-expression-*'] | |
user = g.get_user() |
This file contains 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
import boto3 | |
import datetime | |
client = boto3.client('acm',region_name='eu-central-1') | |
def list_certificates(): | |
response = client.list_certificates() | |
return response['CertificateSummaryList'] | |
def get_certificate_details(certificate_arn): |
This file contains 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
import boto3 | |
client = boto3.client('iam') | |
paginator = client.get_paginator('list_roles') | |
for page in paginator.paginate(): | |
for listed_role in page['Roles']: | |
role_name = listed_role['RoleName'] | |
role = client.get_role(RoleName=role_name)['Role'] | |
last_used = role.get('RoleLastUsed', {}).get('LastUsedDate') |
NewerOlder