Skip to content

Commit 73970c6

Browse files
committed
first commit
0 parents  commit 73970c6

File tree

665 files changed

+3293099
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

665 files changed

+3293099
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
model_inventory.csv
2+
/.venv

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# 1. Create the virtual environment
2+
python3 -m venv .venv
3+
4+
# 2. Activate it
5+
source .venv/bin/activate
6+
7+
# 3. Install all dependencies from requirements.txt
8+
pip install -r requirements.txt
9+
10+
deactivate

model_inventory.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import json
2+
import csv
3+
from pathlib import Path
4+
5+
6+
def extract_services(input_dir: Path):
7+
service_entries = []
8+
for model_file in input_dir.glob("*.json"):
9+
try:
10+
with open(model_file, "r") as f:
11+
model_data = json.load(f)
12+
13+
shapes = model_data.get("shapes", model_data)
14+
for shape_name, shape in shapes.items():
15+
if shape.get("type") == "service":
16+
traits = shape.get("traits", {})
17+
protocol = "unknown"
18+
for key in traits.keys():
19+
if key.startswith("aws.protocols#"):
20+
protocol = key
21+
break
22+
23+
service_entries.append({
24+
"filename": model_file.name,
25+
"servicename": shape_name,
26+
"protocol": protocol
27+
})
28+
except Exception as e:
29+
service_entries.append({
30+
"filename": model_file.name,
31+
"servicename": "ERROR",
32+
"protocol": str(e)
33+
})
34+
return service_entries
35+
36+
37+
def write_csv(output_file: Path, rows):
38+
with open(output_file, "w", newline="") as csvfile:
39+
writer = csv.DictWriter(csvfile, fieldnames=["filename", "servicename", "protocol"])
40+
writer.writeheader()
41+
for row in rows:
42+
writer.writerow(row)
43+
44+
45+
if __name__ == "__main__":
46+
47+
services = extract_services(Path("models"))
48+
write_csv(Path("model_inventory.csv"), services)
49+
print(f"✅ Done! {len(services)} services found.")

models/accessanalyzer.json

Lines changed: 8509 additions & 0 deletions
Large diffs are not rendered by default.

models/account.json

Lines changed: 2635 additions & 0 deletions
Large diffs are not rendered by default.

models/acm-pca.json

Lines changed: 4741 additions & 0 deletions
Large diffs are not rendered by default.

models/acm.json

Lines changed: 3711 additions & 0 deletions
Large diffs are not rendered by default.

models/amp.json

Lines changed: 5366 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)