cloudconsolelink 1.0.25__tar.gz → 2.0.0__tar.gz

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.
Files changed (22) hide show
  1. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/PKG-INFO +27 -4
  2. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/README.md +16 -0
  3. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/cloudconsolelink/__init__.py +1 -1
  4. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/cloudconsolelink/clouds/aws/__init__.py +28 -11
  5. cloudconsolelink-2.0.0/cloudconsolelink/clouds/aws/links.py +1035 -0
  6. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/cloudconsolelink.egg-info/PKG-INFO +27 -4
  7. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/cloudconsolelink.egg-info/SOURCES.txt +3 -1
  8. cloudconsolelink-2.0.0/cloudconsolelink.egg-info/requires.txt +8 -0
  9. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/setup.cfg +1 -1
  10. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/setup.py +30 -9
  11. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/tests/test_aws.py +74 -1
  12. cloudconsolelink-2.0.0/tests/test_provider_coverage.py +288 -0
  13. cloudconsolelink-1.0.25/cloudconsolelink/clouds/aws/links.py +0 -1022
  14. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/LICENSE +0 -0
  15. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/cloudconsolelink/clouds/__init__.py +0 -0
  16. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/cloudconsolelink/clouds/azure/__init__.py +0 -0
  17. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/cloudconsolelink/clouds/gcp/__init__.py +0 -0
  18. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/cloudconsolelink/clouds/gcp/links.py +0 -0
  19. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/cloudconsolelink.egg-info/dependency_links.txt +0 -0
  20. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/cloudconsolelink.egg-info/top_level.txt +0 -0
  21. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/tests/test_azure.py +0 -0
  22. {cloudconsolelink-1.0.25 → cloudconsolelink-2.0.0}/tests/test_gcp.py +0 -0
@@ -1,18 +1,24 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cloudconsolelink
3
- Version: 1.0.25
3
+ Version: 2.0.0
4
4
  Summary: Generate console links for cloud resources
5
5
  Home-page: https://github.com/Cloudanix/cloud-console-links
6
6
  Maintainer: Cloudanix
7
- Maintainer-email: ganesh@cloudanix.com
8
- License: apache2
7
+ Maintainer-email: support@cloudanix.com
8
+ License: Apache-2.0
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Intended Audience :: Developers
11
- Classifier: License :: OSI Approved :: Apache Software License
12
11
  Classifier: Natural Language :: English
13
12
  Classifier: Operating System :: OS Independent
14
13
  Description-Content-Type: text/markdown
15
14
  License-File: LICENSE
15
+ Provides-Extra: dev
16
+ Requires-Dist: pre-commit~=4.2; extra == "dev"
17
+ Requires-Dist: pytest~=8.3; extra == "dev"
18
+ Requires-Dist: pytest-cov==2.11; extra == "dev"
19
+ Requires-Dist: pytest-mock~=3.14; extra == "dev"
20
+ Requires-Dist: types-PyYAML~=6.0; extra == "dev"
21
+ Requires-Dist: types-requests~=2.32; extra == "dev"
16
22
  Dynamic: classifier
17
23
  Dynamic: description
18
24
  Dynamic: description-content-type
@@ -21,6 +27,7 @@ Dynamic: license
21
27
  Dynamic: license-file
22
28
  Dynamic: maintainer
23
29
  Dynamic: maintainer-email
30
+ Dynamic: provides-extra
24
31
  Dynamic: summary
25
32
 
26
33
  # What is cloudconsolelink?
@@ -29,6 +36,22 @@ This project for generate console links for AWS, GCP and Azure cloud resources
29
36
  # Install
30
37
  Run ```pip install cloudconsolelink``` to install our code
31
38
 
39
+ For local development, install the package with dev extras:
40
+
41
+ ```bash
42
+ pip install -e '.[dev]'
43
+ ```
44
+
45
+ Verification shortcuts:
46
+
47
+ ```bash
48
+ make test
49
+ make coverage
50
+ make test-arn
51
+ make test-aws-links
52
+ make check
53
+ ```
54
+
32
55
  # Usage
33
56
 
34
57
  ### Import Package
@@ -4,6 +4,22 @@ This project for generate console links for AWS, GCP and Azure cloud resources
4
4
  # Install
5
5
  Run ```pip install cloudconsolelink``` to install our code
6
6
 
7
+ For local development, install the package with dev extras:
8
+
9
+ ```bash
10
+ pip install -e '.[dev]'
11
+ ```
12
+
13
+ Verification shortcuts:
14
+
15
+ ```bash
16
+ make test
17
+ make coverage
18
+ make test-arn
19
+ make test-aws-links
20
+ make check
21
+ ```
22
+
7
23
  # Usage
8
24
 
9
25
  ### Import Package
@@ -1,2 +1,2 @@
1
1
  # version of the module
2
- __version__ = "1.0.25"
2
+ __version__ = "2.0.0"
@@ -18,18 +18,24 @@ def get_console(partition: str) -> str:
18
18
 
19
19
  def get_arn_string(data: Dict) -> str:
20
20
  if not data.get("resourceType", ""):
21
- return f"{data.get('prefix', '')}:{data.get('partition', '')}:{data.get('service', '')}:\
22
- {data.get('region', '')}:{data.get('account', '')}:{data.get('resource', '')}"
21
+ return (
22
+ f"{data.get('prefix', '')}:{data.get('partition', '')}:{data.get('service', '')}:"
23
+ f"{data.get('region', '')}:{data.get('account', '')}:{data.get('resource', '')}"
24
+ )
23
25
 
24
26
  elif data.get("hasPath", ""):
25
- return f"{data.get('prefix', '')}:{data.get('partition', '')}:{data.get('service', '')}:\
26
- {data.get('region', '')}:{data.get('account', '')}:{data.get('resource_type', '')}\
27
- /{data.get('resource', '')}"
27
+ return (
28
+ f"{data.get('prefix', '')}:{data.get('partition', '')}:{data.get('service', '')}:"
29
+ f"{data.get('region', '')}:{data.get('account', '')}:{data.get('resourceType', '')}"
30
+ f"/{data.get('resource', '')}"
31
+ )
28
32
 
29
33
  else:
30
- return f"{data.get('prefix', '')}:{data.get('partition', '')}:{data.get('service', '')}:\
31
- {data.get('region', '')}:{data.get('account', '')}:{data.get('resource_type', '')}:\
32
- {data.get('resource', '')}"
34
+ return (
35
+ f"{data.get('prefix', '')}:{data.get('partition', '')}:{data.get('service', '')}:"
36
+ f"{data.get('region', '')}:{data.get('account', '')}:{data.get('resourceType', '')}:"
37
+ f"{data.get('resource', '')}"
38
+ )
33
39
 
34
40
 
35
41
  def get_qualifiers(resource: str) -> list[str]:
@@ -60,8 +66,8 @@ class AWSLinker:
60
66
  }
61
67
 
62
68
  except IndexError:
63
- logger.error(f"AWS ARN {arn} is to short")
64
- raise ValueError(f"AWS ARN {arn} is to short")
69
+ logger.error(f"AWS ARN {arn} is too short")
70
+ raise ValueError(f"AWS ARN {arn} is too short")
65
71
 
66
72
  if len(tokens) > 6:
67
73
  data["resourceType"] = tokens[5]
@@ -113,8 +119,19 @@ class AWSLinker:
113
119
  # raise ValueError(f"AWS service {data['service']} resource type {data['resourceType']} not supported")
114
120
 
115
121
  else:
122
+ template_context = {
123
+ "arn": arn,
124
+ "data": data,
125
+ "get_arn_string": get_arn_string,
126
+ "get_qualifiers": get_qualifiers,
127
+ "get_resource_path": get_resource_path,
128
+ }
116
129
  data["resource"] = urllib.parse.quote(str(data["resource"]))
117
- return eval(f"f'{links[data['service']][data['resourceType']]}'").replace(
130
+ return eval(
131
+ f"f'{links[data['service']][data['resourceType']]}'",
132
+ {"__builtins__": {}},
133
+ template_context,
134
+ ).replace(
118
135
  " ",
119
136
  "",
120
137
  )