Ricordanza
1/31/2018 - 9:43 AM

Trusted Advisor check list

Trusted Advisor check list

# encoding:utf-8
## for python 3.6.x

import boto3
from boto3.session import Session
import json
import re

TAG = re.compile(r"<[^>]*?>")
DELIM="|"
LANGUAGE="ja"

def main():
    s = Session(region_name="us-east-1")

    support = s.client("support")
    response = support.describe_trusted_advisor_checks(
        language=LANGUAGE
    )

    advisor = {}

    if "checks" in response:
        for check in response["checks"]:
            if not check["category"] in advisor:
                advisor[check["category"]] = []
            check["delim"] = DELIM
            check["description"] = TAG.sub("", re.sub("\n", "", check["description"]))
            advisor[check["category"]].append(check)

    for key in advisor.keys():
        print("## " + key)
        print("| ID | 名称 | 説明 |")
        print("| ------------- | ------------- | ------------- |")
        for check in advisor[key]:
            print("{delim}{id}{delim}{name}{delim}{description}{delim}".format(**check))
        print("")

if __name__ == '__main__':
    main()