cartography 0.100.0rc3__py3-none-any.whl → 0.100.0rc4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cartography might be problematic. Click here for more details.
- cartography/_version.py +1 -1
- cartography/intel/aws/ec2/launch_templates.py +19 -32
- {cartography-0.100.0rc3.dist-info → cartography-0.100.0rc4.dist-info}/METADATA +1 -1
- {cartography-0.100.0rc3.dist-info → cartography-0.100.0rc4.dist-info}/RECORD +8 -8
- {cartography-0.100.0rc3.dist-info → cartography-0.100.0rc4.dist-info}/LICENSE +0 -0
- {cartography-0.100.0rc3.dist-info → cartography-0.100.0rc4.dist-info}/WHEEL +0 -0
- {cartography-0.100.0rc3.dist-info → cartography-0.100.0rc4.dist-info}/entry_points.txt +0 -0
- {cartography-0.100.0rc3.dist-info → cartography-0.100.0rc4.dist-info}/top_level.txt +0 -0
cartography/_version.py
CHANGED
|
@@ -3,7 +3,6 @@ from typing import Any
|
|
|
3
3
|
|
|
4
4
|
import boto3
|
|
5
5
|
import neo4j
|
|
6
|
-
from botocore.exceptions import ClientError
|
|
7
6
|
|
|
8
7
|
from .util import get_botocore_config
|
|
9
8
|
from cartography.client.core.tx import load
|
|
@@ -21,27 +20,29 @@ logger = logging.getLogger(__name__)
|
|
|
21
20
|
def get_launch_templates(
|
|
22
21
|
boto3_session: boto3.session.Session,
|
|
23
22
|
region: str,
|
|
24
|
-
) ->
|
|
23
|
+
) -> list[dict[str, Any]]:
|
|
25
24
|
client = boto3_session.client('ec2', region_name=region, config=get_botocore_config())
|
|
26
25
|
paginator = client.get_paginator('describe_launch_templates')
|
|
27
26
|
templates: list[dict[str, Any]] = []
|
|
28
|
-
template_versions: list[dict[str, Any]] = []
|
|
29
27
|
for page in paginator.paginate():
|
|
30
28
|
paginated_templates = page['LaunchTemplates']
|
|
31
|
-
for template in paginated_templates:
|
|
32
|
-
template_id = template['LaunchTemplateId']
|
|
33
|
-
try:
|
|
34
|
-
versions = get_launch_template_versions_by_template(boto3_session, template_id, region)
|
|
35
|
-
except ClientError as e:
|
|
36
|
-
logger.warning(
|
|
37
|
-
f"Failed to get launch template versions for {template_id}: {e}",
|
|
38
|
-
exc_info=True,
|
|
39
|
-
)
|
|
40
|
-
versions = []
|
|
41
|
-
# Using a key not defined in latest boto3 documentation
|
|
42
|
-
template_versions.extend(versions)
|
|
43
29
|
templates.extend(paginated_templates)
|
|
44
|
-
return templates
|
|
30
|
+
return templates
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@timeit
|
|
34
|
+
@aws_handle_regions
|
|
35
|
+
def get_launch_template_versions(
|
|
36
|
+
boto3_session: boto3.session.Session,
|
|
37
|
+
region: str,
|
|
38
|
+
) -> list[dict[str, Any]]:
|
|
39
|
+
client = boto3_session.client('ec2', region_name=region, config=get_botocore_config())
|
|
40
|
+
paginator = client.get_paginator('describe_launch_template_versions')
|
|
41
|
+
template_versions: list[dict[str, Any]] = []
|
|
42
|
+
for page in paginator.paginate():
|
|
43
|
+
paginated_versions = page['LaunchTemplateVersions']
|
|
44
|
+
template_versions.extend(paginated_versions)
|
|
45
|
+
return template_versions
|
|
45
46
|
|
|
46
47
|
|
|
47
48
|
def transform_launch_templates(templates: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
@@ -71,21 +72,6 @@ def load_launch_templates(
|
|
|
71
72
|
)
|
|
72
73
|
|
|
73
74
|
|
|
74
|
-
@timeit
|
|
75
|
-
@aws_handle_regions
|
|
76
|
-
def get_launch_template_versions_by_template(
|
|
77
|
-
boto3_session: boto3.session.Session,
|
|
78
|
-
template: str,
|
|
79
|
-
region: str,
|
|
80
|
-
) -> list[dict[str, Any]]:
|
|
81
|
-
client = boto3_session.client('ec2', region_name=region, config=get_botocore_config())
|
|
82
|
-
v_paginator = client.get_paginator('describe_launch_template_versions')
|
|
83
|
-
template_versions = []
|
|
84
|
-
for versions in v_paginator.paginate(LaunchTemplateId=template):
|
|
85
|
-
template_versions.extend(versions['LaunchTemplateVersions'])
|
|
86
|
-
return template_versions
|
|
87
|
-
|
|
88
|
-
|
|
89
75
|
def transform_launch_template_versions(versions: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
90
76
|
result: list[dict[str, Any]] = []
|
|
91
77
|
for version in versions:
|
|
@@ -153,7 +139,8 @@ def sync_ec2_launch_templates(
|
|
|
153
139
|
) -> None:
|
|
154
140
|
for region in regions:
|
|
155
141
|
logger.info(f"Syncing launch templates for region '{region}' in account '{current_aws_account_id}'.")
|
|
156
|
-
templates
|
|
142
|
+
templates = get_launch_templates(boto3_session, region)
|
|
143
|
+
versions = get_launch_template_versions(boto3_session, region)
|
|
157
144
|
templates = transform_launch_templates(templates)
|
|
158
145
|
load_launch_templates(neo4j_session, templates, region, current_aws_account_id, update_tag)
|
|
159
146
|
versions = transform_launch_template_versions(versions)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
cartography/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
cartography/__main__.py,sha256=JftXT_nUPkqcEh8uxCCT4n-OyHYqbldEgrDS-4ygy0U,101
|
|
3
|
-
cartography/_version.py,sha256=
|
|
3
|
+
cartography/_version.py,sha256=XNabPAacgLtT7W1DDFP4RS2MjLNRDWXmvHKjCNXBM9A,518
|
|
4
4
|
cartography/cli.py,sha256=-77DOKUQn3N-TDIi55V4RHLb3k36ZGZ64o1XgiT0qmE,33370
|
|
5
5
|
cartography/config.py,sha256=ZcadsKmooAkti9Kv0eDl8Ec1PcZDu3lWobtNaCnwY3k,11872
|
|
6
6
|
cartography/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -174,7 +174,7 @@ cartography/intel/aws/ec2/images.py,sha256=SLoxcy_PQgNomVMDMdutm0zXJCOLosiHJlN63
|
|
|
174
174
|
cartography/intel/aws/ec2/instances.py,sha256=uI8eVJmeEybS8y_T8CVKAkwxJyVDCH7sbuEJYeWGSWY,12468
|
|
175
175
|
cartography/intel/aws/ec2/internet_gateways.py,sha256=dI-4-85_3DGGZZBcY_DN6XqESx9P26S6jKok314lcnQ,2883
|
|
176
176
|
cartography/intel/aws/ec2/key_pairs.py,sha256=g4imIo_5jk8upq9J4--erg-OZXG2i3cJMe6SnNCYj9s,2635
|
|
177
|
-
cartography/intel/aws/ec2/launch_templates.py,sha256=
|
|
177
|
+
cartography/intel/aws/ec2/launch_templates.py,sha256=9s7opSzdpErDzxknAsPOXb63Cr0BJM4S-wcxFuInFXs,5346
|
|
178
178
|
cartography/intel/aws/ec2/load_balancer_v2s.py,sha256=95FfQQn740gexINIHDJizOM4OKzRtQT_y2XQMipQ5Dg,8661
|
|
179
179
|
cartography/intel/aws/ec2/load_balancers.py,sha256=1GwErzGqi3BKCARqfGJcD_r_D84rFKVy5kNMas9jAok,6756
|
|
180
180
|
cartography/intel/aws/ec2/network_acls.py,sha256=_UiOx79OxcqH0ecRjcVMglAzz5XJ4aVYLlv6dl_ism4,6809
|
|
@@ -358,9 +358,9 @@ cartography/models/snipeit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
358
358
|
cartography/models/snipeit/asset.py,sha256=FyRAaeXuZjMy0eUQcSDFcgEAF5lbLMlvqp1Tv9d3Lv4,3238
|
|
359
359
|
cartography/models/snipeit/tenant.py,sha256=p4rFnpNNuF1W5ilGBbexDaETWTwavfb38RcQGoImkQI,679
|
|
360
360
|
cartography/models/snipeit/user.py,sha256=MsB4MiCVNTH6JpESime7cOkB89autZOXQpL6Z0l7L6o,2113
|
|
361
|
-
cartography-0.100.
|
|
362
|
-
cartography-0.100.
|
|
363
|
-
cartography-0.100.
|
|
364
|
-
cartography-0.100.
|
|
365
|
-
cartography-0.100.
|
|
366
|
-
cartography-0.100.
|
|
361
|
+
cartography-0.100.0rc4.dist-info/LICENSE,sha256=kvLEBRYaQ1RvUni6y7Ti9uHeooqnjPoo6n_-0JO1ETc,11351
|
|
362
|
+
cartography-0.100.0rc4.dist-info/METADATA,sha256=Ybi85b9tT6kYixO3WY-Y5TDc1El7FmVRTG_7oWyH95g,11859
|
|
363
|
+
cartography-0.100.0rc4.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
|
364
|
+
cartography-0.100.0rc4.dist-info/entry_points.txt,sha256=GVIAWD0o0_K077qMA_k1oZU4v-M0a8GLKGJR8tZ-qH8,112
|
|
365
|
+
cartography-0.100.0rc4.dist-info/top_level.txt,sha256=BHqsNJQiI6Q72DeypC1IINQJE59SLhU4nllbQjgJi9g,12
|
|
366
|
+
cartography-0.100.0rc4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|