feat: porting shell scripts to python
This commit is contained in:
+5
-2
@@ -7,6 +7,8 @@ License: This program is released under the MIT License
|
||||
|
||||
# Imports
|
||||
import boto3
|
||||
import concurrent.futures
|
||||
|
||||
|
||||
def getRegions(all_regions=False):
|
||||
ec2 = boto3.client('ec2')
|
||||
@@ -22,8 +24,9 @@ def printResources(region_name: str):
|
||||
# Main function
|
||||
def main() -> None:
|
||||
print("logGroupName,retentionInDays,storedBytes,region")
|
||||
for r in getRegions():
|
||||
printResources(r)
|
||||
with concurrent.futures.ProcessPoolExecutor(max_workers=6) as executor:
|
||||
futures = [executor.submit(printResources, region_name=r) for r in getRegions()]
|
||||
results = [future.result() for future in concurrent.futures.wait(futures).done]
|
||||
|
||||
# Call main function
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user