Files
aws-inventory/aws-apigw.py
T

30 lines
639 B
Python
Executable File

#!/usr/bin/env python3
r"""
Documentation
License: This program is released under the MIT License
"""
# Imports
import boto3
from openpyxl import load_workbook
# Main function
def main() -> None:
# Open spreadsheet and add a sheet
wb = load_workbook('aws-inventory.xlsx')
ws = wb.create_sheet("ApiGateway")
client = boto3.client('apigateway')
response = client.get_rest_apis()
ws.append(["RestAPIName","Scope"])
for i in response['items']:
ws.append([i["name"], i["endpointConfiguration"]["types"][0]])
wb.save('aws-inventory.xlsx')
# Call main function
if __name__ == '__main__':
main()