cloudconsolelink 1.0.21__tar.gz → 1.0.23__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 (19) hide show
  1. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/PKG-INFO +1 -1
  2. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/cloudconsolelink/__init__.py +1 -1
  3. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/cloudconsolelink/clouds/aws/__init__.py +2 -0
  4. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/cloudconsolelink/clouds/aws/links.py +3 -3
  5. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/cloudconsolelink.egg-info/PKG-INFO +1 -1
  6. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/cloudconsolelink.egg-info/SOURCES.txt +4 -1
  7. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/setup.py +1 -1
  8. cloudconsolelink-1.0.23/tests/test_aws.py +128 -0
  9. cloudconsolelink-1.0.23/tests/test_azure.py +37 -0
  10. cloudconsolelink-1.0.23/tests/test_gcp.py +30 -0
  11. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/LICENSE +0 -0
  12. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/README.md +0 -0
  13. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/cloudconsolelink/clouds/__init__.py +0 -0
  14. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/cloudconsolelink/clouds/azure/__init__.py +0 -0
  15. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/cloudconsolelink/clouds/gcp/__init__.py +0 -0
  16. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/cloudconsolelink/clouds/gcp/links.py +0 -0
  17. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/cloudconsolelink.egg-info/dependency_links.txt +0 -0
  18. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/cloudconsolelink.egg-info/top_level.txt +0 -0
  19. {cloudconsolelink-1.0.21 → cloudconsolelink-1.0.23}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloudconsolelink
3
- Version: 1.0.21
3
+ Version: 1.0.23
4
4
  Summary: Generate console links for cloud resources
5
5
  Home-page: https://github.com/Cloudanix/cloud-console-links
6
6
  Maintainer: Cloudanix
@@ -1,2 +1,2 @@
1
1
  # version of the module
2
- __version__ = '1.0.21'
2
+ __version__ = '1.0.23'
@@ -2,6 +2,7 @@ import logging
2
2
  from typing import Dict
3
3
 
4
4
  from .links import get_links
5
+ import urllib.parse
5
6
 
6
7
  logger = logging.getLogger(__name__)
7
8
 
@@ -103,4 +104,5 @@ class AWSLinker:
103
104
  # raise ValueError(f"AWS service {data['service']} resource type {data['resourceType']} not supported")
104
105
 
105
106
  else:
107
+ data['resource'] = urllib.parse.quote(data['resource'])
106
108
  return eval(f"f'{links[data['service']][data['resourceType']]}'").replace(" ", "")
@@ -338,7 +338,7 @@ def get_links() -> Dict:
338
338
  "transit-gateway-attachment": None,
339
339
  "transit-gateway-multicast-domain": None,
340
340
  "transit-gateway-route-table": None,
341
- "volume": 'https://u{data.get("region", "")}.{data.get("console", "")}/ec2\
341
+ "volume": 'https://{data.get("region", "")}.{data.get("console", "")}/ec2\
342
342
  /home?region={data.get("region", "")}#VolumeDetails:volumeId={data.get("resource", "")}',
343
343
  "vpc": 'https://{data.get("region", "")}.{data.get("console", "")}/vpc/home?region=\
344
344
  {data.get("region", "")}#VpcDetails:VpcId={data.get("resource", "")}',
@@ -390,7 +390,7 @@ def get_links() -> Dict:
390
390
  },
391
391
  "elasticfilesystem": { # Amazon Elastic File System
392
392
  "access-point": None,
393
- "file-system": 'https://https://{data.get("region", "")}.{data.get("console", "")}/efs/home?region={data.get("region", "")}#/file-systems/{data.get("resource", "")}',
393
+ "file-system": 'https://{data.get("region", "")}.{data.get("console", "")}/efs/home?region={data.get("region", "")}#/file-systems/{data.get("resource", "")}',
394
394
  },
395
395
  "elasticloadbalancing": { # AWS WAF V2
396
396
  "listener": None,
@@ -630,7 +630,7 @@ def get_links() -> Dict:
630
630
  "StaticIp": None,
631
631
  },
632
632
  "logs": { # Amazon CloudWatch Logs
633
- "log-group": 'https://https://{data.get("region", "")}.{data.get("console", "")}/cloudwatch/home?region={data.get("region", "")}#logsV2:log-groups/log-group/{data.get("resource", "")}',
633
+ "log-group": 'https://{data.get("region", "")}.{data.get("console", "")}/cloudwatch/home?region={data.get("region", "")}#logsV2:log-groups/log-group/{data.get("resource", "")}',
634
634
  },
635
635
  "machinelearning": { # Amazon Machine Learning
636
636
  "batchprediction": None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloudconsolelink
3
- Version: 1.0.21
3
+ Version: 1.0.23
4
4
  Summary: Generate console links for cloud resources
5
5
  Home-page: https://github.com/Cloudanix/cloud-console-links
6
6
  Maintainer: Cloudanix
@@ -12,4 +12,7 @@ cloudconsolelink/clouds/aws/__init__.py
12
12
  cloudconsolelink/clouds/aws/links.py
13
13
  cloudconsolelink/clouds/azure/__init__.py
14
14
  cloudconsolelink/clouds/gcp/__init__.py
15
- cloudconsolelink/clouds/gcp/links.py
15
+ cloudconsolelink/clouds/gcp/links.py
16
+ tests/test_aws.py
17
+ tests/test_azure.py
18
+ tests/test_gcp.py
@@ -4,7 +4,7 @@ with open("README.md") as fh:
4
4
  long_description = fh.read()
5
5
 
6
6
  # version of the module
7
- __version__ = '1.0.21'
7
+ __version__ = '1.0.23'
8
8
 
9
9
 
10
10
  setuptools.setup(
@@ -0,0 +1,128 @@
1
+ from cloudconsolelink.clouds.aws import AWSLinker
2
+
3
+ aws = AWSLinker()
4
+
5
+
6
+ def test_aws_ec2_instance():
7
+ arn = "arn:aws:ec2:us-east1:1234567890:instance/instance1"
8
+ expected_link = "https://us-east1.console.aws.amazon.com/ec2/v2/\
9
+ home?region=us-east1#InstanceDetails:instanceId=instance1"
10
+
11
+ out_link = aws.get_console_link(arn=arn)
12
+
13
+ assert out_link == expected_link.replace(" ", "")
14
+
15
+
16
+ def test_aws_ecr_repository():
17
+ arn = "arn:aws:ecr:us-east1:1234567890:repository/repo1"
18
+ expected_link = "https://us-east1.console.aws.amazon.com/ecr/repositories/repo1\
19
+ ?region=us-east1"
20
+
21
+ out_link = aws.get_console_link(arn=arn)
22
+
23
+ assert out_link == expected_link.replace(" ", "")
24
+
25
+
26
+ def test_aws_eks_cluster():
27
+ arn = "arn:aws:eks:us-east-2:1234567890:cluster/testing-cluster"
28
+ expected_link = "https://us-east-2.console.aws.amazon.com/eks/home?region=\
29
+ us-east-2#/clusters/testing-cluster"
30
+
31
+ out_link = aws.get_console_link(arn=arn)
32
+
33
+ assert out_link == expected_link.replace(" ", "")
34
+
35
+
36
+ def test_aws_rds_db_instance():
37
+ arn = "arn:aws:rds:us-east-2:123456789012:db:my-mysql-instance-1"
38
+ expected_link = "https://us-east-2.console.aws.amazon.com/rds/home?region=\
39
+ us-east-2#database:id=my-mysql-instance-1;is-cluster=false"
40
+
41
+ out_link = aws.get_console_link(arn=arn)
42
+
43
+ assert out_link == expected_link.replace(" ", "")
44
+
45
+
46
+ def test_aws_redshift_cluster():
47
+ arn = "arn:aws:redshift:us-east-2:123456789012:cluster:my-mysql-instance-1"
48
+ expected_link = "https://us-east-2.console.aws.amazon.com/redshiftv2/home?region=\
49
+ us-east-2#cluster-details?cluster=my-mysql-instance-1"
50
+
51
+ out_link = aws.get_console_link(arn=arn)
52
+
53
+ assert out_link == expected_link.replace(" ", "")
54
+
55
+
56
+ def test_aws_cloudwatch_alerm():
57
+ arn = "arn:aws:cloudwatch:us-east-2:123456789012:alarm:AlarmName-123"
58
+ expected_link = 'https://us-east-2.console.aws.amazon.com/cloudwatch/home?region=us-east-2#alarmsV2:alarm/AlarmName-123?'
59
+ out_link = aws.get_console_link(arn=arn)
60
+
61
+ assert out_link == expected_link.replace(" ", "")
62
+
63
+
64
+ def test_aws_cloudformation_stack():
65
+ arn = "arn:aws:cloudformation:us-east-2:123456789012:stack/stackName-123/stack123"
66
+ expected_link = 'https://us-east-2.console.aws.amazon.com/cloudformation/home?region=us-east-2\
67
+ #/stacks/stackinfo?stackId=arn:aws:cloudformation:us-east-2:123456789012:stack/stackName-123/stack123&# filteringStatus=active&filteringText=&viewNested=true&hideStacks=false'
68
+
69
+ out_link = aws.get_console_link(arn=arn)
70
+ print(out_link)
71
+ assert out_link == expected_link.replace(" ", "")
72
+
73
+
74
+ def test_aws_cloudtrail_trail():
75
+ arn = "arn:aws:cloudtrail:us-east-2:123456789012:trail/TrailName-123"
76
+ expected_link = 'https://us-east-2.console.aws.amazon.com/cloudtrail/home?region=us-east-2\
77
+ #/trails/arn:aws:cloudtrail:us-east-2:123456789012:trail/TrailName-123'
78
+
79
+ out_link = aws.get_console_link(arn=arn)
80
+ print(out_link)
81
+ assert out_link == expected_link.replace(" ", "")
82
+
83
+
84
+ def test_aws_cloudwatch_alerm():
85
+ arn = "arn:aws:cloudwatch:us-east-2:123456789012:alarm/c"
86
+ expected_link = 'https://us-east-2.console.aws.amazon.com/cloudwatch/home?region=us-east-2\
87
+ #alarmsV2:alarm/c?'
88
+
89
+ out_link = aws.get_console_link(arn=arn)
90
+ print(out_link)
91
+ assert out_link == expected_link.replace(" ", "")
92
+
93
+
94
+ def test_aws_event_eventbus():
95
+ arn = "arn:aws:events:us-east-2:123456789012:event-bus/EventBusName-123"
96
+ expected_link = 'https://us-east-2.console.aws.amazon.com/events/home?region=us-east-2#/eventbus/EventBusName-123'
97
+
98
+ out_link = aws.get_console_link(arn=arn)
99
+ print(out_link)
100
+ assert out_link == expected_link.replace(" ", "")
101
+
102
+
103
+ def test_aws_cloudwatch_loggroup():
104
+ arn = "arn:aws:logs:us-east-2:123456789012:log-group/LogGroupName-123"
105
+ expected_link = 'https://https://us-east-2.console.aws.amazon.com/cloudwatch/home?region=us-east-2#logsV2:log-groups/log-group/LogGroupName-123'
106
+
107
+ out_link = aws.get_console_link(arn=arn)
108
+ print(out_link)
109
+ assert out_link == expected_link.replace(" ", "")
110
+
111
+
112
+ def test_aws_ses_identity():
113
+ arn = "arn:aws:ses:us-east-2:123456789012:identity/IdentityName-123"
114
+ expected_link = 'https://us-east-2.console.aws.amazon.com/ses/home?region=us-east-2\
115
+ #/verified-identities/IdentityName-123'
116
+
117
+ out_link = aws.get_console_link(arn=arn)
118
+ print(out_link)
119
+ assert out_link == expected_link.replace(" ", "")
120
+
121
+
122
+ def test_aws_sns_topic():
123
+ arn = "arn:aws:sns:us-east-2:123456789012:TopicName-123"
124
+ expected_link = 'https://us-east-2.console.aws.amazon.com/sns/v3/home?region=us-east-2#/topic/arn:aws:sns:us-east-2:123456789012:TopicName-123'
125
+
126
+ out_link = aws.get_console_link(arn=arn)
127
+ print(out_link)
128
+ assert out_link == expected_link.replace(" ", "")
@@ -0,0 +1,37 @@
1
+ from cloudconsolelink.clouds.azure import AzureLinker
2
+
3
+ azure = AzureLinker()
4
+
5
+
6
+ def test_azure_iam():
7
+
8
+ id = "1234567890"
9
+ iam_entity_type = "user"
10
+ expected_link = "https://portal.azure.com/#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/\
11
+ Profile/userId/1234567890"
12
+
13
+ out_link = azure.get_console_link(id=id, iam_entity_type=iam_entity_type)
14
+
15
+ assert out_link == expected_link.replace(" ", "")
16
+
17
+
18
+ def test_azure_management():
19
+
20
+ id = "/subscriptions/5592e8dc/resourceGroups/testgroup"
21
+ primary_ad_domain_name = "QA123.onmicrosoft.com"
22
+ expected_link = "https://portal.azure.com/#@QA123.onmicrosoft.com/resource/subscriptions/\
23
+ 5592e8dc/resourceGroups/testgroup/overview"
24
+
25
+ out_link = azure.get_console_link(id=id, primary_ad_domain_name=primary_ad_domain_name)
26
+
27
+ assert out_link == expected_link.replace(" ", "")
28
+
29
+ def test_azure_key_vault_key():
30
+
31
+ id = 'https://demovault.vault.azure.net/keys/demokey'
32
+ primary_ad_domain_name = "QA123.onmicrosoft.com"
33
+ expected_link ='https://portal.azure.com/#@QA123.onmicrosoft.com/asset/Microsoft_Azure_KeyVault/Key/https://demovault.vault.azure.net/keys/demokey'
34
+
35
+ out_link = azure.get_console_link(id=id, primary_ad_domain_name=primary_ad_domain_name)
36
+
37
+ assert out_link == expected_link.replace(" ", "")
@@ -0,0 +1,30 @@
1
+ from cloudconsolelink.clouds.gcp import GCPLinker
2
+
3
+ gcp = GCPLinker()
4
+
5
+
6
+ def test_storage_bucket():
7
+
8
+ bucket_name = "xyz"
9
+ resource_name = "storage_bucket"
10
+ expected_link = "https://console.cloud.google.com/storage/browser/xyz"
11
+
12
+ out_link = gcp.get_console_link(bucket_name=bucket_name, resource_name=resource_name)
13
+
14
+ assert out_link == expected_link
15
+
16
+
17
+ def test_compute_instance():
18
+ instance_name = "xyz"
19
+ project_id = "12345"
20
+ zone = "us-east-1"
21
+ resource_name = "compute_instance"
22
+ expected_link = "https://console.cloud.google.com/compute/instancesDetail/zones/\
23
+ us-east-1/instances/xyz?project=12345&tab=details"
24
+
25
+ out_link = gcp.get_console_link(
26
+ instance_name=instance_name,
27
+ resource_name=resource_name, project_id=project_id, zone=zone,
28
+ )
29
+
30
+ assert out_link == expected_link.replace(" ", "")