reverse-diagrams 1.3.1__py3-none-any.whl → 1.3.3__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.
- {reverse_diagrams-1.3.1.dist-info → reverse_diagrams-1.3.3.dist-info}/METADATA +4 -2
- {reverse_diagrams-1.3.1.dist-info → reverse_diagrams-1.3.3.dist-info}/RECORD +8 -8
- {reverse_diagrams-1.3.1.dist-info → reverse_diagrams-1.3.3.dist-info}/WHEEL +1 -1
- src/aws/describe_identity_store.py +2 -2
- src/aws/describe_organization.py +37 -31
- src/version.py +1 -1
- {reverse_diagrams-1.3.1.dist-info → reverse_diagrams-1.3.3.dist-info}/entry_points.txt +0 -0
- {reverse_diagrams-1.3.1.dist-info → reverse_diagrams-1.3.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: reverse_diagrams
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: Continuous Documentation Tool - Documentation as Code Tool - This package create reverse diagrams based on your current state in your cloud environment using diagrams library
|
|
5
5
|
Project-URL: Homepage, https://github.com/velez94/reverse_diagrams
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/velez94/reverse_diagrams/issues
|
|
@@ -22,6 +22,7 @@ License-File: LICENSE
|
|
|
22
22
|
Classifier: Operating System :: OS Independent
|
|
23
23
|
Classifier: Programming Language :: Python :: 3
|
|
24
24
|
Requires-Python: >=3.8
|
|
25
|
+
Requires-Dist: argcomplete>=3.4.0
|
|
25
26
|
Requires-Dist: boto3>=1.26.44
|
|
26
27
|
Requires-Dist: colorama>=0.4.4
|
|
27
28
|
Requires-Dist: diagrams>=0.23.4
|
|
@@ -58,6 +59,7 @@ Description-Content-Type: text/markdown
|
|
|
58
59
|
|
|
59
60
|
This package create diagrams and help to audit your services from your shell.
|
|
60
61
|
|
|
62
|
+

|
|
61
63
|
# Requirement
|
|
62
64
|
|
|
63
65
|
AWS programmatic access using AWS CLI. [Configuring the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
src/__init__.py,sha256=lOE8TAJF_WdxgxEBxVz9t8dC3s3t2c21VWYPrzfznkE,17
|
|
2
2
|
src/reverse_diagrams.py,sha256=dVkz429-8MtDAfQFxVhchuuVrH8D-IcYyTBgRnw65cA,4208
|
|
3
|
-
src/version.py,sha256=
|
|
3
|
+
src/version.py,sha256=LtDJf1PMjrnorTQJTEoRmRf7HBHvjEaHQmMzO7fguPo,48
|
|
4
4
|
src/aws/__init__.py,sha256=lOE8TAJF_WdxgxEBxVz9t8dC3s3t2c21VWYPrzfznkE,17
|
|
5
|
-
src/aws/describe_identity_store.py,sha256=
|
|
6
|
-
src/aws/describe_organization.py,sha256=
|
|
5
|
+
src/aws/describe_identity_store.py,sha256=PJYpAXsqCeVMPfv72Q2nTuolXMnG4dah_HRuyu0hIkY,15450
|
|
6
|
+
src/aws/describe_organization.py,sha256=6154J-jnGGql_uzr5DCeSNsNEiMblkOPNq5qF1UAjEw,14268
|
|
7
7
|
src/aws/describe_sso.py,sha256=z65RnoxJDVSMPB1TRJAxi8S8-DllwmaxxXaZ4uicSzU,4915
|
|
8
8
|
src/banner/__init__.py,sha256=lOE8TAJF_WdxgxEBxVz9t8dC3s3t2c21VWYPrzfznkE,17
|
|
9
9
|
src/banner/banner.py,sha256=XREWjVLp1-PHVdfBSoADgw0LvRpYU5u7NPaUraL9Els,3893
|
|
@@ -14,8 +14,8 @@ src/reports/__init__.py,sha256=lOE8TAJF_WdxgxEBxVz9t8dC3s3t2c21VWYPrzfznkE,17
|
|
|
14
14
|
src/reports/console_view.py,sha256=1_ET53Bn_vKlLmqr0Sih5szP5kNFCQRH4A8tXJgip2Y,5832
|
|
15
15
|
src/reports/save_results.py,sha256=g-UphsQ_tfDhvNH3QNV7j68TWWvy44vbbjaNyn4KWhU,719
|
|
16
16
|
src/reports/tes.py,sha256=c6TdxhAedfHjPrqaRw0nucdCEQOM9xKsgw35IOIDdYs,17691
|
|
17
|
-
reverse_diagrams-1.3.
|
|
18
|
-
reverse_diagrams-1.3.
|
|
19
|
-
reverse_diagrams-1.3.
|
|
20
|
-
reverse_diagrams-1.3.
|
|
21
|
-
reverse_diagrams-1.3.
|
|
17
|
+
reverse_diagrams-1.3.3.dist-info/METADATA,sha256=cwkUxQkCkzZkhxGZCtK1Y4DTMAb1r93GAslbpxSi1DQ,9624
|
|
18
|
+
reverse_diagrams-1.3.3.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
19
|
+
reverse_diagrams-1.3.3.dist-info/entry_points.txt,sha256=VZNkrc7qUDbddTCH3pGd83EhUT3PHTx9MzpAk6bb6qc,63
|
|
20
|
+
reverse_diagrams-1.3.3.dist-info/licenses/LICENSE,sha256=o6nDaQ7M9xbR0L7HSJ3A-1JbBPoZro_zhVPO4-M5CAQ,571
|
|
21
|
+
reverse_diagrams-1.3.3.dist-info/RECORD,,
|
|
@@ -435,8 +435,8 @@ def graph_identity_center(diagrams_path, region, auto):
|
|
|
435
435
|
l_permissions_set_arn_name = extends_permissions_set(
|
|
436
436
|
permissions_sets=permissions_set, store_arn=store_arn, region=region
|
|
437
437
|
)
|
|
438
|
-
|
|
439
|
-
l_accounts = list_accounts(region=region)
|
|
438
|
+
org_client = client("organizations", region_name=region)
|
|
439
|
+
l_accounts = list_accounts(region=region, org_client = org_client)
|
|
440
440
|
account_assignments = extend_account_assignments(
|
|
441
441
|
accounts_list=l_accounts,
|
|
442
442
|
permissions_sets=l_permissions_set_arn_name,
|
src/aws/describe_organization.py
CHANGED
|
@@ -11,7 +11,7 @@ from ..reports.save_results import save_results
|
|
|
11
11
|
from .describe_sso import client
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def describe_organization(region):
|
|
14
|
+
def describe_organization(region, org_client):
|
|
15
15
|
"""
|
|
16
16
|
Describe the organization.
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ def describe_organization(region):
|
|
|
19
19
|
:return:
|
|
20
20
|
"""
|
|
21
21
|
print(f"{Fore.GREEN}❇️ Describe Organization {Fore.RESET}")
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
organization = org_client.describe_organization()
|
|
24
24
|
organization = organization["Organization"]
|
|
25
25
|
return organization
|
|
@@ -57,16 +57,17 @@ def list_organizational_units_pag(parent_id, region, next_token=None):
|
|
|
57
57
|
return response_iterator["OrganizationalUnits"]
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
def list_organizational_units(parent_id, region, org_units=None):
|
|
60
|
+
def list_organizational_units(parent_id, region, org_client, org_units=None):
|
|
61
61
|
"""
|
|
62
62
|
List Organizational units.
|
|
63
63
|
|
|
64
|
+
:param org_client:
|
|
64
65
|
:param parent_id:
|
|
65
66
|
:param region:
|
|
66
67
|
:param org_units:
|
|
67
68
|
:return:
|
|
68
69
|
"""
|
|
69
|
-
|
|
70
|
+
|
|
70
71
|
if org_units is None:
|
|
71
72
|
org_units = []
|
|
72
73
|
ous = org_client.list_organizational_units_for_parent(
|
|
@@ -77,9 +78,9 @@ def list_organizational_units(parent_id, region, org_units=None):
|
|
|
77
78
|
|
|
78
79
|
if len(ous) >= 20:
|
|
79
80
|
logging.info("Paginating ...")
|
|
80
|
-
add_ous = list_organizational_units_pag(
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
add_ous = list_organizational_units_pag(parent_id=parent_id,
|
|
82
|
+
region=region, next_token=ous["NextToken"]
|
|
83
|
+
)
|
|
83
84
|
for ou in add_ous:
|
|
84
85
|
ous.append(ou)
|
|
85
86
|
logging.debug(add_ous)
|
|
@@ -95,12 +96,13 @@ def list_organizational_units(parent_id, region, org_units=None):
|
|
|
95
96
|
logging.debug(ou)
|
|
96
97
|
if "Id" in ou.keys():
|
|
97
98
|
logging.debug(f"Search nested for: {ou['Name']}")
|
|
98
|
-
ous_next = list_organizational_units(
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
ous_next = list_organizational_units(parent_id=ou["Id"],
|
|
100
|
+
region=region, org_units=org_units,
|
|
101
|
+
org_client=org_client,
|
|
102
|
+
)
|
|
101
103
|
logging.debug(ous_next)
|
|
102
104
|
if len(ous_next) > 0:
|
|
103
|
-
logging.debug("Find
|
|
105
|
+
logging.debug("Find Nested")
|
|
104
106
|
|
|
105
107
|
return org_units
|
|
106
108
|
|
|
@@ -158,14 +160,15 @@ def list_accounts_pag(region, next_token: str = None):
|
|
|
158
160
|
return response["Accounts"]
|
|
159
161
|
|
|
160
162
|
|
|
161
|
-
def list_accounts(region):
|
|
163
|
+
def list_accounts(region, org_client):
|
|
162
164
|
"""
|
|
163
165
|
List accounts.
|
|
164
166
|
|
|
167
|
+
:param org_client:
|
|
165
168
|
:param region:
|
|
166
169
|
:return:
|
|
167
170
|
"""
|
|
168
|
-
|
|
171
|
+
|
|
169
172
|
accounts = org_client.list_accounts()
|
|
170
173
|
logging.info(accounts)
|
|
171
174
|
l_account = accounts["Accounts"]
|
|
@@ -180,7 +183,7 @@ def list_accounts(region):
|
|
|
180
183
|
return l_account
|
|
181
184
|
|
|
182
185
|
|
|
183
|
-
def index_accounts(list_account, region):
|
|
186
|
+
def index_accounts(list_account, region, org_client):
|
|
184
187
|
"""
|
|
185
188
|
Index accounts.
|
|
186
189
|
|
|
@@ -189,7 +192,7 @@ def index_accounts(list_account, region):
|
|
|
189
192
|
:return:
|
|
190
193
|
"""
|
|
191
194
|
accounts = []
|
|
192
|
-
|
|
195
|
+
|
|
193
196
|
for a in list_account:
|
|
194
197
|
response = org_client.list_parents(
|
|
195
198
|
ChildId=a["Id"],
|
|
@@ -243,9 +246,9 @@ def search_ou_map(map_ou: dict, ou_id, level=0, tree="."):
|
|
|
243
246
|
|
|
244
247
|
|
|
245
248
|
def init_org_complete(
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
+
root_id,
|
|
250
|
+
org,
|
|
251
|
+
list_ous,
|
|
249
252
|
):
|
|
250
253
|
"""
|
|
251
254
|
Init organization dictionary.
|
|
@@ -276,10 +279,10 @@ def init_org_complete(
|
|
|
276
279
|
|
|
277
280
|
# create organization complete map
|
|
278
281
|
def map_organizations_complete(
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
282
|
+
organizations_complete: dict,
|
|
283
|
+
list_ous,
|
|
284
|
+
llist_accounts,
|
|
285
|
+
reference_outs_list,
|
|
283
286
|
):
|
|
284
287
|
"""
|
|
285
288
|
Create complete mapper file.
|
|
@@ -307,8 +310,8 @@ def map_organizations_complete(
|
|
|
307
310
|
] = {"Id": a["Id"], "Name": a["Name"], "accounts": [], "nestedOus": {}}
|
|
308
311
|
# print(organizations_complete["organizationalUnits"][o]["nestedOus"])
|
|
309
312
|
if (
|
|
310
|
-
|
|
311
|
-
|
|
313
|
+
len(organizations_complete["organizationalUnits"][o]["nestedOus"])
|
|
314
|
+
> 0
|
|
312
315
|
):
|
|
313
316
|
new_list_ous = organizations_complete["organizationalUnits"][o][
|
|
314
317
|
"nestedOus"
|
|
@@ -326,8 +329,8 @@ def map_organizations_complete(
|
|
|
326
329
|
|
|
327
330
|
|
|
328
331
|
def plop_dict_out(
|
|
329
|
-
|
|
330
|
-
|
|
332
|
+
ous_list: list,
|
|
333
|
+
ou,
|
|
331
334
|
):
|
|
332
335
|
"""
|
|
333
336
|
Clean list.
|
|
@@ -392,8 +395,8 @@ def graph_organizations(diagrams_path, region, auto):
|
|
|
392
395
|
file_name=template_file,
|
|
393
396
|
directory_path=code_path,
|
|
394
397
|
)
|
|
395
|
-
|
|
396
|
-
organization = describe_organization(region=region)
|
|
398
|
+
org_client = client("organizations", region_name=region)
|
|
399
|
+
organization = describe_organization(region=region, org_client=org_client)
|
|
397
400
|
print(Fore.BLUE + emoji.emojize(":sparkle: Getting Organization Info" + Fore.RESET))
|
|
398
401
|
logging.debug(organization)
|
|
399
402
|
logging.debug("The Roots Info")
|
|
@@ -404,7 +407,8 @@ def graph_organizations(diagrams_path, region, auto):
|
|
|
404
407
|
Fore.BLUE + emoji.emojize(":sparkle: List Organizational Units " + Fore.RESET)
|
|
405
408
|
)
|
|
406
409
|
logging.debug("The Organizational Units list ")
|
|
407
|
-
|
|
410
|
+
|
|
411
|
+
ous = list_organizational_units(parent_id=roots[0]["Id"], region=region, org_client=org_client)
|
|
408
412
|
logging.debug(ous)
|
|
409
413
|
logging.debug("The Organizational Units list with parents info")
|
|
410
414
|
i_ous = index_ous(ous, region=region)
|
|
@@ -414,7 +418,8 @@ def graph_organizations(diagrams_path, region, auto):
|
|
|
414
418
|
Fore.BLUE
|
|
415
419
|
+ emoji.emojize(":sparkle: Getting the Account list info" + Fore.RESET)
|
|
416
420
|
)
|
|
417
|
-
|
|
421
|
+
|
|
422
|
+
l_accounts = list_accounts(region=region, org_client=org_client)
|
|
418
423
|
logging.debug(l_accounts)
|
|
419
424
|
logging.debug("The Account list with parents info")
|
|
420
425
|
|
|
@@ -425,7 +430,8 @@ def graph_organizations(diagrams_path, region, auto):
|
|
|
425
430
|
+ Fore.RESET
|
|
426
431
|
)
|
|
427
432
|
)
|
|
428
|
-
|
|
433
|
+
|
|
434
|
+
i_accounts = index_accounts(l_accounts, region=region, org_client=org_client)
|
|
429
435
|
logging.debug(i_accounts)
|
|
430
436
|
|
|
431
437
|
file_name = "organizations.json"
|
src/version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""Set version file."""
|
|
2
|
-
__version__ = "1.3.
|
|
2
|
+
__version__ = "1.3.3"
|
|
File without changes
|
|
File without changes
|