API health-check dashboad (go/python)

simple-golang-docker

apitest/apiendpoints.csv 内に書かれたAPIエンドポイント(URI)に対して、GETリクエストを送信し、レスポンスのヘッダからステータスコードのみを抽出する。

Sample

Input

apitest/apiendpoints.csv

id,name,description,uri
1,google,www.google.com,http://www.google.com/
2,yahoo,www.yahoo.co.jp,https://www.yahoo.co.jp/
3,bing,www.bing.com,https://www.bing.com/

Output

# go run apitest/main.go
Status: 200 http://www.google.com/
Status: 200 https://www.yahoo.co.jp/
Status: 200 https://www.bing.com/

Directories

.
├── README.md
├── build
│   └── Dockerfile
├── cmd
│   ├── apitest
│   │   ├── apiendpoints.csv
│   │   ├── example.csv
│   │   └── main.go
│   ├── example.csv
│   ├── go.mod
│   └── go.sum
└── docker-compose.yml

How to use (初回実行手順)

①コンテナ外部で実行

# コンテナイメージのビルド
$ docker-compose build

# コンテナイメージの確認
$ docker images | grep simple_golang_docker

# コンテナ起動
$ docker-compose up -d

# コンテナステータス確認
$ docker-compose ps

# 作成したコンテナに直接アクセス
# (aplineベースのimageのcontainerの場合 /bin/bash ではなく /bin/ash を利用する)
$ docker exec -it simple_golang_docker /bin/ash 

②コンテナ内で実行

go.mod の初期化(不要かも)

go mod init

go.mod の更新を行い、 go.sum も生成する

go mod tidy

③コンテナの外部から実行

# 作成したファイルの実行
$ docker-compose exec simple_golang_docker go run hello/main.go

API実行時jのパラメータ

  • ヘッダ情報などを記載するならばcsvではなくてYAMLなどの方が良いかも

csv読み込み時のファイルのパス

go run を実行するディレクトリが、ファイル実行時のcurrent directoryになる。 すなわち、

csvtest
┝ file.csv
┗ main.go

のような構成の場合、 go csvtest/main.go 実行時にcsvファイルを読み込む場合のパスはcsvtest/file.csv となり、 csvtestディレクトリ内で go run main.go 実行時にcsvファイルを読み込む場合file.csvとなる。

References

Similar Resources

The NVD API is an unofficial Go wrapper around the NVD API.

NVD API The NVD API is an unofficial Go wrapper around the NVD API. Supports: CVE CPE How to use The following shows how to basically use the wrapper

Jan 7, 2023

go-whatsapp-rest-API is a Go library for the WhatsApp web which use Swagger as api interface

go-whatsapp-rest-API go-whatsapp-rest-API is a Go library for the WhatsApp web which use Swagger as api interface Multi-devices (MD) Support. This ver

Dec 15, 2022

A Wrapper Client for Google Spreadsheet API (Sheets API)

Senmai A Wrapper Client for Google Spreadsheet API (Sheets API) PREPARATION Service Account and Key File Create a service account on Google Cloud Plat

Nov 5, 2021

💾 Wolke API is the API behind Wolke image storage and processing aswell as user management

💾 Wolke API Wolke API is the API behind Wolke image storage and processing aswell as user management Deploying To deploy Wolke Bot you'll need podman

Dec 21, 2021

Upcoming mobiles api (UpMob API)

upcoming_mobiles_api (UpMob API) UpMob API scraps 91mobiles.com to get devices i

Dec 21, 2021

Arweave-api - Arweave API implementation in golang

Arweave API Go implementation of the Arweave API Todo A list of endpoints that a

Jan 16, 2022

Api-product - A basic REST-ish API that allows you to perform CRUD operations for Products

Description A basic REST-ish API that allows you to perform CRUD operations for

Jan 3, 2022

Contact-api - API for websites I have designed that have to send unauthenticated email

contact https://aws.amazon.com/premiumsupport/knowledge-center/custom-headers-ap

Apr 11, 2022

Triangula-api-server - API server for processing images with Triangula

Triangula API server Minimalistic API server that calculates and serves artistic

Jan 10, 2022
It's so many regular expression forms are difficult to understand, such as perl, python, grep awk

Introduction Jamie Zawinski: Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. It

Mar 31, 2022
Periodically collect data about my Twitter account and check in to github to preserve an audit trail.

Twitter audit trail backup This repository backs up my follower list, following list, blocked accounts list and muted accounts list periodically using

Dec 28, 2022
External app to check and cache the latest block from DMO nodes

checkblock External app to check and cache the latest block from DMO nodes. This

Dec 22, 2021
Package to check if the email used during signup or registration process is a Disposable Email Address ( DEA ).

Table of contents Disposable Email Address ( DEA ) checker How does dea works ? Requirements Installation Usage Reference Future plans FAQs What are D

Apr 28, 2023
Simple-Weather-API - Simple weather api app created using golang and Open Weather API key
Simple-Weather-API - Simple weather api app created using golang and Open Weather API key

Simple Weather API Simple weather api app created using golang and Open Weather

Feb 6, 2022
Go library for accessing the MyAnimeList API: http://myanimelist.net/modules.php?go=api

go-myanimelist go-myanimelist is a Go client library for accessing the MyAnimeList API. Project Status The MyAnimeList API has been stable for years a

Sep 28, 2022
Go client for the YNAB API. Unofficial. It covers 100% of the resources made available by the YNAB API.

YNAB API Go Library This is an UNOFFICIAL Go client for the YNAB API. It covers 100% of the resources made available by the YNAB API. Installation go

Oct 6, 2022
An API client for the Notion API implemented in Golang

An API client for the Notion API implemented in Golang

Dec 30, 2022
lambda-go-api-proxy makes it easy to port APIs written with Go frameworks such as Gin to AWS Lambda and Amazon API Gateway.

aws-lambda-go-api-proxy makes it easy to run Golang APIs written with frameworks such as Gin with AWS Lambda and Amazon API Gateway.

Jan 6, 2023
A API scanner written in GOLANG to scan files recursively and look for API keys and IDs.

GO FIND APIS _____ ____ ______ _____ _ _ _____ _____ _____ _____ / ____|/ __ \ | ____|_ _| \ | | __ \ /\ | __ \_

Oct 25, 2021