-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapping_loader.py
More file actions
58 lines (49 loc) · 2.47 KB
/
Copy pathmapping_loader.py
File metadata and controls
58 lines (49 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import csv
import os
def load_mapping(csv_file_path='mapeamento.csv'):
mapping = {}
if not os.path.exists(csv_file_path):
print(f"Arquivo {csv_file_path} não encontrado!")
return mapping
try:
with open(csv_file_path, 'r', encoding='utf-8') as file:
reader = csv.DictReader(file)
for row in reader:
pointfive_name = row.get('PointFive', '').strip()
optscale_name = row.get('OptScale', '').strip()
if pointfive_name and optscale_name:
mapping[pointfive_name] = optscale_name
print(f"Mapeamento carregado com sucesso: {len(mapping)} entradas")
return mapping
except Exception as e:
print(f"Erro ao carregar o arquivo de mapeamento: {e}")
return mapping
def get_optscale_file_mapping():
return {
'Abandoned Load Balancers': 'abandoned_load_balancers-2.json',
'Abandoned Instances': 'abandoned_instances-2.json',
'Instances for shutdown': 'instances_for_shutdown-2.json',
'Obsolete Images': 'obsolete_images-2.json',
'Abandoned Amazon S3 buckets': 's3_abandoned_buckets-2.json',
'Public S3 buckets': 's3_public_buckets.json',
'Not attached Volumes': 'not_attached_volumes.json',
'Obsolete Snapshots': 'obsolete_snapshots.json',
'Underutilized Instances': 'underutilized_instances.json',
'Underutilized RDS Instances': 'underutilized_rds_instances.json',
'Instances with Spot (Preemptible) opportunities': 'spot_opportunities.json',
'Instances with migration opportunities': 'migration_opportunities.json',
'Instances with insecure Security Groups settings': 'insecure_security_groups.json',
'Instances eligible for generation upgrade': 'generation_upgrade_opportunities.json',
'Reserved Instances opportunities': 'reserved_instances_opportunities.json',
'Obsolete IPs': 'obsolete_ips.json',
'Abandoned Kinesis Streams': 'abandoned_kinesis_streams.json',
'S3 Duplicate Finder': 's3_duplicate_finder.json',
'IAM users with unused console access': 'iam_unused_console_access.json'
}
if __name__ == "__main__":
mapping = load_mapping()
print("Primeiras 5 entradas do mapeamento:")
for i, (pointfive, optscale) in enumerate(mapping.items()):
if i >= 5:
break
print(f" {pointfive} -> {optscale}")