cloudconsolelink 1.0.24__tar.gz → 1.0.25__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.
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/PKG-INFO +11 -2
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/cloudconsolelink/__init__.py +1 -1
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/cloudconsolelink/clouds/aws/__init__.py +32 -20
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/cloudconsolelink/clouds/aws/links.py +14 -18
- cloudconsolelink-1.0.25/cloudconsolelink/clouds/azure/__init__.py +52 -0
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/cloudconsolelink/clouds/gcp/__init__.py +1 -2
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/cloudconsolelink/clouds/gcp/links.py +308 -105
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/cloudconsolelink.egg-info/PKG-INFO +11 -2
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/setup.py +3 -14
- cloudconsolelink-1.0.24/cloudconsolelink/clouds/azure/__init__.py +0 -45
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/LICENSE +0 -0
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/README.md +0 -0
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/cloudconsolelink/clouds/__init__.py +0 -0
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/cloudconsolelink.egg-info/SOURCES.txt +0 -0
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/cloudconsolelink.egg-info/dependency_links.txt +0 -0
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/cloudconsolelink.egg-info/top_level.txt +0 -0
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/setup.cfg +0 -0
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/tests/test_aws.py +0 -0
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/tests/test_azure.py +0 -0
- {cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/tests/test_gcp.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: cloudconsolelink
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.25
|
|
4
4
|
Summary: Generate console links for cloud resources
|
|
5
5
|
Home-page: https://github.com/Cloudanix/cloud-console-links
|
|
6
6
|
Maintainer: Cloudanix
|
|
@@ -13,6 +13,15 @@ Classifier: Natural Language :: English
|
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
License-File: LICENSE
|
|
16
|
+
Dynamic: classifier
|
|
17
|
+
Dynamic: description
|
|
18
|
+
Dynamic: description-content-type
|
|
19
|
+
Dynamic: home-page
|
|
20
|
+
Dynamic: license
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
Dynamic: maintainer
|
|
23
|
+
Dynamic: maintainer-email
|
|
24
|
+
Dynamic: summary
|
|
16
25
|
|
|
17
26
|
# What is cloudconsolelink?
|
|
18
27
|
This project for generate console links for AWS, GCP and Azure cloud resources
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# version of the module
|
|
2
|
-
__version__ =
|
|
2
|
+
__version__ = "1.0.25"
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import urllib.parse
|
|
2
3
|
from typing import Dict
|
|
3
4
|
|
|
4
5
|
from .links import get_links
|
|
5
|
-
import urllib.parse
|
|
6
6
|
|
|
7
7
|
logger = logging.getLogger(__name__)
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def get_console(partition: str) -> str:
|
|
11
11
|
consoles = {
|
|
12
|
-
"aws":
|
|
13
|
-
"aws-us-gov":
|
|
14
|
-
"aws-cn":
|
|
12
|
+
"aws": "console.aws.amazon.com",
|
|
13
|
+
"aws-us-gov": "console.amazonaws-us-gov.com",
|
|
14
|
+
"aws-cn": "console.amazonaws.cn",
|
|
15
15
|
}
|
|
16
|
-
return consoles.get(partition,
|
|
16
|
+
return consoles.get(partition, "")
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def get_arn_string(data: Dict) -> str:
|
|
20
|
-
if not data.get(
|
|
20
|
+
if not data.get("resourceType", ""):
|
|
21
21
|
return f"{data.get('prefix', '')}:{data.get('partition', '')}:{data.get('service', '')}:\
|
|
22
22
|
{data.get('region', '')}:{data.get('account', '')}:{data.get('resource', '')}"
|
|
23
23
|
|
|
24
|
-
elif data.get(
|
|
24
|
+
elif data.get("hasPath", ""):
|
|
25
25
|
return f"{data.get('prefix', '')}:{data.get('partition', '')}:{data.get('service', '')}:\
|
|
26
26
|
{data.get('region', '')}:{data.get('account', '')}:{data.get('resource_type', '')}\
|
|
27
27
|
/{data.get('resource', '')}"
|
|
@@ -32,7 +32,7 @@ def get_arn_string(data: Dict) -> str:
|
|
|
32
32
|
{data.get('resource', '')}"
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
def get_qualifiers(resource: str) -> str:
|
|
35
|
+
def get_qualifiers(resource: str) -> list[str]:
|
|
36
36
|
return resource.split(":")
|
|
37
37
|
|
|
38
38
|
|
|
@@ -42,18 +42,21 @@ def get_resource_path(resource: str) -> str:
|
|
|
42
42
|
|
|
43
43
|
class AWSLinker:
|
|
44
44
|
def get_console_link(self, arn: str) -> str:
|
|
45
|
-
logger.
|
|
45
|
+
logger.debug(f"Start Process for AWS ARN: {arn}")
|
|
46
46
|
arn = arn.strip()
|
|
47
47
|
firstTokens = arn.split(":")
|
|
48
48
|
tokens = firstTokens[:7]
|
|
49
49
|
|
|
50
50
|
try:
|
|
51
|
-
data = {
|
|
51
|
+
data: dict[str, str | bool] = {
|
|
52
52
|
"prefix": tokens[0],
|
|
53
53
|
"partition": tokens[1],
|
|
54
54
|
"service": tokens[2],
|
|
55
55
|
"region": tokens[3],
|
|
56
56
|
"account": tokens[4],
|
|
57
|
+
"resourceType": "",
|
|
58
|
+
"resource": "",
|
|
59
|
+
"hasPath": False,
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
except IndexError:
|
|
@@ -66,8 +69,8 @@ class AWSLinker:
|
|
|
66
69
|
data["hasPath"] = False
|
|
67
70
|
|
|
68
71
|
elif len(tokens) > 5 and tokens[5].count("/") > 0:
|
|
69
|
-
data["resourceType"] = tokens[5][:tokens[5].index("/")]
|
|
70
|
-
data["resource"] = tokens[5][tokens[5].index("/") + 1:]
|
|
72
|
+
data["resourceType"] = tokens[5][: tokens[5].index("/")]
|
|
73
|
+
data["resource"] = tokens[5][tokens[5].index("/") + 1 :]
|
|
71
74
|
data["hasPath"] = True
|
|
72
75
|
|
|
73
76
|
elif len(tokens) > 5 and tokens[5].count("/") == 0:
|
|
@@ -79,15 +82,19 @@ class AWSLinker:
|
|
|
79
82
|
logger.error(f"Invalid AWS ARN {arn}")
|
|
80
83
|
raise ValueError(f"Invalid AWS ARN {arn}")
|
|
81
84
|
|
|
82
|
-
console = get_console(data.get(
|
|
85
|
+
console = get_console(str(data.get("partition", "")))
|
|
83
86
|
if not console:
|
|
84
|
-
logger.error(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
logger.error(
|
|
88
|
+
f"AWS ARN {arn} has invalid partition (Valid Partitions: aws, aws-us-gov, aws-cn)",
|
|
89
|
+
)
|
|
90
|
+
raise ValueError(
|
|
91
|
+
f"AWS ARN {arn} has invalid partition (Valid Partitions: aws, aws-us-gov, aws-cn)",
|
|
92
|
+
)
|
|
93
|
+
data["console"] = console
|
|
87
94
|
|
|
88
95
|
links = get_links()
|
|
89
96
|
|
|
90
|
-
if data[
|
|
97
|
+
if data["prefix"] != "arn":
|
|
91
98
|
logger.error(f"Invalid AWS ARN {arn}")
|
|
92
99
|
raise ValueError(f"Invalid AWS ARN {arn}")
|
|
93
100
|
|
|
@@ -96,7 +103,9 @@ class AWSLinker:
|
|
|
96
103
|
raise ValueError(f"AWS service {data['service']} unknown")
|
|
97
104
|
|
|
98
105
|
elif not links.get(data["service"], {}).get(data["resourceType"], None):
|
|
99
|
-
logger.error(
|
|
106
|
+
logger.error(
|
|
107
|
+
f"AWS service {data['service']} resource type {data['resourceType']} not supported",
|
|
108
|
+
)
|
|
100
109
|
|
|
101
110
|
# If resource type does not exist, take the user to service home page
|
|
102
111
|
return f"https://console.aws.amazon.com/{data['service']}"
|
|
@@ -104,5 +113,8 @@ class AWSLinker:
|
|
|
104
113
|
# raise ValueError(f"AWS service {data['service']} resource type {data['resourceType']} not supported")
|
|
105
114
|
|
|
106
115
|
else:
|
|
107
|
-
data[
|
|
108
|
-
return eval(f"f'{links[data['service']][data['resourceType']]}'").replace(
|
|
116
|
+
data["resource"] = urllib.parse.quote(str(data["resource"]))
|
|
117
|
+
return eval(f"f'{links[data['service']][data['resourceType']]}'").replace(
|
|
118
|
+
" ",
|
|
119
|
+
"",
|
|
120
|
+
)
|
|
@@ -41,7 +41,7 @@ def get_links() -> Dict:
|
|
|
41
41
|
"certificate": 'https://{data.get("region", "")}.{data.get("console", "")}/apigateway/home?region={data.get("region", "")}\
|
|
42
42
|
#/{data.get("resource", "")}/resources/',
|
|
43
43
|
"resource": 'https://{data.get("region", "")}.{data.get("console", "")}/apigateway/home?region={data.get("region", "")}\
|
|
44
|
-
#/{data.get("resource", "")}/resources/'
|
|
44
|
+
#/{data.get("resource", "")}/resources/',
|
|
45
45
|
},
|
|
46
46
|
"appconfig": { # AWS AppConfig
|
|
47
47
|
"application": None,
|
|
@@ -118,8 +118,7 @@ def get_links() -> Dict:
|
|
|
118
118
|
"stackset": None,
|
|
119
119
|
},
|
|
120
120
|
"cloudfront": { # Amazon CloudFront
|
|
121
|
-
"distribution": 'https://{data.get("
|
|
122
|
-
home?region={data.get("region", "")}#/{data.get("resource", "")}',
|
|
121
|
+
"distribution": 'https://{data.get("console", "")}/cloudfront/v4/home#/{data.get("resource", "")}',
|
|
123
122
|
"origin-access-identity": None,
|
|
124
123
|
"streaming-distribution": None,
|
|
125
124
|
},
|
|
@@ -133,7 +132,6 @@ def get_links() -> Dict:
|
|
|
133
132
|
"cloudtrail": { # AWS CloudTrail
|
|
134
133
|
"trail": 'https://{data.get("console", "")}/cloudtrail/home?region={data.get("region", "")}#/trails/\
|
|
135
134
|
{data.get("resource", "")}',
|
|
136
|
-
|
|
137
135
|
},
|
|
138
136
|
"cloudwatch": { # Amazon CloudWatch
|
|
139
137
|
"alarm": 'https://{data.get("region", "")}.{data.get("console", "")}/cloudwatch/home?region={data.get("region", "")}#alarmsV2:alarm/{data.get("resource", "")}?',
|
|
@@ -145,7 +143,7 @@ def get_links() -> Dict:
|
|
|
145
143
|
"dashboard": None,
|
|
146
144
|
"insight-rule": None,
|
|
147
145
|
"event-bus": 'https://{data.get("region", "")}.{data.get("console", "")}/cloudwatch/home?region={data.get("region", "")}#eventbuses:',
|
|
148
|
-
"rule": 'https://{data.get("region", "")}.{data.get("console", "")}/cloudwatch/home?region=u{data.get("region", "")}#rules:'
|
|
146
|
+
"rule": 'https://{data.get("region", "")}.{data.get("console", "")}/cloudwatch/home?region=u{data.get("region", "")}#rules:',
|
|
149
147
|
},
|
|
150
148
|
"codeartifact": { # AWS CodeArtifact
|
|
151
149
|
"domain": None,
|
|
@@ -208,7 +206,6 @@ def get_links() -> Dict:
|
|
|
208
206
|
"organization-config-rule": None,
|
|
209
207
|
"organization-conformance-pack": None,
|
|
210
208
|
"remediation-configuration": None,
|
|
211
|
-
|
|
212
209
|
},
|
|
213
210
|
"connect": { # Amazon Connect
|
|
214
211
|
"instance": None,
|
|
@@ -293,7 +290,7 @@ def get_links() -> Dict:
|
|
|
293
290
|
"table": 'https://{data.get("region", "")}.{data.get("console", "")}/dynamodbv2/home?region=\
|
|
294
291
|
{data.get("region", "")}#table?name={data.get("resource", "")}',
|
|
295
292
|
"secondary_indexes": 'https://{data.get("region", "")}.{data.get("console", "")}/dynamodbv2/\
|
|
296
|
-
home?region=us-east-1#table?initialTagKey=&name={data.get("resource", "")}&tab=indexes'
|
|
293
|
+
home?region=us-east-1#table?initialTagKey=&name={data.get("resource", "")}&tab=indexes',
|
|
297
294
|
},
|
|
298
295
|
"ec2": { # AWS Systems Manager
|
|
299
296
|
"capacity-reservation": None,
|
|
@@ -353,14 +350,13 @@ def get_links() -> Dict:
|
|
|
353
350
|
"beanstalk_environment": 'https://{data.get("region", "")}.{data.get("console", "")}/elasticbeanstalk/\
|
|
354
351
|
home?region={data.get("region", "")}#/environment/dashboard?environmentId={data.get("resource", "")}',
|
|
355
352
|
"loadbalancer": 'https://{data.get("region", "")}.{data.get("console", "")}/ec2/\
|
|
356
|
-
home?region=u{data.get("region", "")}#LoadBalancers:search={data.get("resource", "")};sort=loadBalancerName'
|
|
357
|
-
|
|
353
|
+
home?region=u{data.get("region", "")}#LoadBalancers:search={data.get("resource", "")};sort=loadBalancerName',
|
|
358
354
|
},
|
|
359
355
|
"ecr": { # Amazon Elastic Container Registry
|
|
360
356
|
"repository": 'https://{data.get("region", "")}.{data.get("console", "")}/ecr/repositories/{data.get\
|
|
361
357
|
("resource", "")}?region={data.get("region", "")}',
|
|
362
358
|
"image": 'https://{data.get("region", "")}.{data.get("console", "")}/ecr/repositories/{data.get\
|
|
363
|
-
("resource", "")}?region={data.get("region", "")}'
|
|
359
|
+
("resource", "")}?region={data.get("region", "")}',
|
|
364
360
|
},
|
|
365
361
|
"ecs": { # Amazon Elastic Container Service
|
|
366
362
|
"cluster": None,
|
|
@@ -412,7 +408,7 @@ def get_links() -> Dict:
|
|
|
412
408
|
"domain": 'https://{data.get("region", "")}.{data.get("console", "")}/esv3/\
|
|
413
409
|
home?region={data.get("region", "")}#opensearch/domains/{data.get("resource", "")}',
|
|
414
410
|
"reserved_instance": 'https://{data.get("region", "")}.{data.get("console", "")}/esv3/\
|
|
415
|
-
home?region={data.get("region", "")}#opensearch/reserved-instances'
|
|
411
|
+
home?region={data.get("region", "")}#opensearch/reserved-instances',
|
|
416
412
|
},
|
|
417
413
|
"events": { # Amazon EventBridge
|
|
418
414
|
"event-bus": 'https://{data.get("region", "")}.{data.get("console", "")}/events/home?region={data.get("region", "")}#/eventbus/{data.get("resource", "")}',
|
|
@@ -510,7 +506,7 @@ def get_links() -> Dict:
|
|
|
510
506
|
"sms-mfa": None,
|
|
511
507
|
"user": 'https://{data.get("console", "")}/iam/home?#/users/{data.get("resource", "")}',
|
|
512
508
|
"access_keys": 'https://{data.get("console", "")}/iam/home#/users/{data.get("resource", "")}?section=security_credentials',
|
|
513
|
-
"policy_statement": 'https://{data.get("console", "")}/iam/home?#/policies/{get_arn_string(data)}'
|
|
509
|
+
"policy_statement": 'https://{data.get("console", "")}/iam/home?#/policies/{get_arn_string(data)}',
|
|
514
510
|
},
|
|
515
511
|
"imagebuilder": { # Amazon EC2 Image Builder
|
|
516
512
|
"component": None,
|
|
@@ -602,7 +598,7 @@ def get_links() -> Dict:
|
|
|
602
598
|
"alias": 'https://{data.get("region", "")}.{data.get("console", "")}/lambda/\
|
|
603
599
|
home?region={data.get("region", "")}#/functions/{data.get("resource", "")}?tab=aliases',
|
|
604
600
|
"layer": 'https://{data.get("region", "")}.{data.get("console", "")}/lambda/home?region=\
|
|
605
|
-
{data.get("region", "")}#/functions/{data.get("resource", "")}'
|
|
601
|
+
{data.get("region", "")}#/functions/{data.get("resource", "")}',
|
|
606
602
|
},
|
|
607
603
|
"lex": { # Amazon Lex
|
|
608
604
|
"bot": None,
|
|
@@ -802,7 +798,7 @@ def get_links() -> Dict:
|
|
|
802
798
|
"snapshotschedule": None,
|
|
803
799
|
"subnetgroup": None,
|
|
804
800
|
"reserved-node": 'https://{data.get("region", "")}.{data.get("console", "")}/redshiftv2\
|
|
805
|
-
/home?region={data.get("region", "")}#reserved-nodes'
|
|
801
|
+
/home?region={data.get("region", "")}#reserved-nodes',
|
|
806
802
|
},
|
|
807
803
|
"rekognition": { # Amazon Rekognition
|
|
808
804
|
"collection": None,
|
|
@@ -832,7 +828,7 @@ def get_links() -> Dict:
|
|
|
832
828
|
{data.get("resource", "")}',
|
|
833
829
|
"trafficpolicyinstance": 'https://{data.get("console", "")}/route53/trafficflow/home#/\
|
|
834
830
|
modify-records/edit/{data.get("resource", "")}',
|
|
835
|
-
"domains": 'https://{data.get("region", "")}.{data.get("console", "")}/route53/home#DomainListing:'
|
|
831
|
+
"domains": 'https://{data.get("region", "")}.{data.get("console", "")}/route53/home#DomainListing:',
|
|
836
832
|
},
|
|
837
833
|
"route53resolver": { # Amazon Route 53 Resolver
|
|
838
834
|
"resolver-endpoint": None,
|
|
@@ -840,8 +836,8 @@ def get_links() -> Dict:
|
|
|
840
836
|
},
|
|
841
837
|
"s3": { # Amazon S3
|
|
842
838
|
"": 'https://s3.{data.get("console", "")}/s3/buckets/{data.get("resource", "")}',
|
|
843
|
-
|
|
844
|
-
|
|
839
|
+
"accesspoint": None,
|
|
840
|
+
"job": None,
|
|
845
841
|
},
|
|
846
842
|
"sagemaker": { # Amazon SageMaker
|
|
847
843
|
"algorithm": None,
|
|
@@ -918,7 +914,7 @@ def get_links() -> Dict:
|
|
|
918
914
|
},
|
|
919
915
|
"sns": { # Amazon SNS
|
|
920
916
|
"topic": 'https://{data.get("region", "")}.{data.get("console", "")}/sns/v3/home?region={data.get("region", "")}#/topic/{arn}',
|
|
921
|
-
"subscription": 'https://{data.get("region", "")}.{data.get("console", "")}/sns/v3/home?region={data.get("region", "")}#/subscription/{arn}'
|
|
917
|
+
"subscription": 'https://{data.get("region", "")}.{data.get("console", "")}/sns/v3/home?region={data.get("region", "")}#/subscription/{arn}',
|
|
922
918
|
},
|
|
923
919
|
"sqs": { # Amazon SQS
|
|
924
920
|
"": 'https://{data.get("region", "")}.{data.get("console", "")}/sqs/v2/home?region=\
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
logger = logging.getLogger(__name__)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AzureLinker:
|
|
8
|
+
def get_console_link(
|
|
9
|
+
self,
|
|
10
|
+
id: str,
|
|
11
|
+
app_id: str = "",
|
|
12
|
+
primary_ad_domain_name: str = "",
|
|
13
|
+
iam_entity_type: str = "",
|
|
14
|
+
) -> str:
|
|
15
|
+
if not primary_ad_domain_name and not iam_entity_type:
|
|
16
|
+
logger.error(
|
|
17
|
+
"For IAM entity required `iam_entity_type` and for other entity required `primary_ad_domain_name`",
|
|
18
|
+
)
|
|
19
|
+
raise ValueError("Invalid parameters provided")
|
|
20
|
+
iam_entities = {
|
|
21
|
+
"user": "https://portal.azure.com/#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/Profile/userId/{id}",
|
|
22
|
+
"group": "https://portal.azure.com/#blade/Microsoft_AAD_IAM/GroupDetailsMenuBlade/Overview/groupId/{id}",
|
|
23
|
+
"application": "https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade\
|
|
24
|
+
/Overview/appId/{id}",
|
|
25
|
+
"role": "https://portal.azure.com/#@{primary_ad_domain_name}/resource{id}/roles",
|
|
26
|
+
"service_principal": "https://portal.azure.com/#view/Microsoft_AAD_IAM/ManagedAppMenuBlade/~/Properties/\
|
|
27
|
+
objectId/{id}/appId/{app_id}/preferredSingleSignOnMode~/null",
|
|
28
|
+
"domain": "https://portal.azure.com/#view/Microsoft_AAD_IAM/DomainPropertiesBladeV2/domainName/{id}",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if iam_entity_type and id and iam_entities.get(iam_entity_type):
|
|
32
|
+
if iam_entity_type == "role" and primary_ad_domain_name:
|
|
33
|
+
return eval(f"f'{iam_entities[iam_entity_type]}'").replace(" ", "")
|
|
34
|
+
elif iam_entity_type == "service_principal" and app_id:
|
|
35
|
+
return eval(f"f'{iam_entities[iam_entity_type]}'").replace(" ", "")
|
|
36
|
+
else:
|
|
37
|
+
return eval(f"f'{iam_entities[iam_entity_type]}'").replace(" ", "")
|
|
38
|
+
|
|
39
|
+
elif primary_ad_domain_name and id:
|
|
40
|
+
if id.startswith("https"):
|
|
41
|
+
if "/keys/" in id:
|
|
42
|
+
return f"https://portal.azure.com/#@{primary_ad_domain_name}/asset/Microsoft_Azure_KeyVault/Key/{id}"
|
|
43
|
+
elif "/secrets/" in id:
|
|
44
|
+
return f"https://portal.azure.com/#@{primary_ad_domain_name}/asset/Microsoft_Azure_KeyVault/Secret/{id}"
|
|
45
|
+
elif "/certificates/" in id:
|
|
46
|
+
return f"https://portal.azure.com/#@{primary_ad_domain_name}/asset/Microsoft_Azure_KeyVault/Certificate/{id}"
|
|
47
|
+
|
|
48
|
+
return f"https://portal.azure.com/#@{primary_ad_domain_name}/resource{id}/overview"
|
|
49
|
+
|
|
50
|
+
else:
|
|
51
|
+
logger.error("entity id required")
|
|
52
|
+
raise ValueError("Invalid parameters provided")
|
|
@@ -50,7 +50,6 @@ def build_kwargs(
|
|
|
50
50
|
dns_policy_name=None,
|
|
51
51
|
api_key_id=None,
|
|
52
52
|
subscription_id=None,
|
|
53
|
-
|
|
54
53
|
) -> Dict:
|
|
55
54
|
return {
|
|
56
55
|
"resource_name": resource_name,
|
|
@@ -257,7 +256,7 @@ class GCPLinker:
|
|
|
257
256
|
|
|
258
257
|
resources_list = list(resources.keys())
|
|
259
258
|
if resource_name in resources_list:
|
|
260
|
-
return resources[resource_name](**param).replace(" ", "")
|
|
259
|
+
return resources[resource_name](**param).replace(" ", "") # type: ignore
|
|
261
260
|
|
|
262
261
|
logger.error(f"Invalid resource_name - {resource_name}")
|
|
263
262
|
raise ValueError("Invalid parameters provided")
|
|
@@ -8,401 +8,604 @@ class Resource:
|
|
|
8
8
|
def storage_bucket(self, bucket_name: str, **keward) -> str:
|
|
9
9
|
if bucket_name:
|
|
10
10
|
return f"https://console.cloud.google.com/storage/browser/{bucket_name}"
|
|
11
|
-
logger.error(
|
|
11
|
+
logger.error("bucket_name required")
|
|
12
12
|
raise ValueError("Invalid parameters provided")
|
|
13
13
|
|
|
14
|
-
def compute_instance(
|
|
14
|
+
def compute_instance(
|
|
15
|
+
self,
|
|
16
|
+
instance_name: str,
|
|
17
|
+
project_id: str,
|
|
18
|
+
zone: str,
|
|
19
|
+
**keward,
|
|
20
|
+
):
|
|
15
21
|
if instance_name and zone and project_id:
|
|
16
|
-
return
|
|
22
|
+
return (
|
|
23
|
+
f"https://console.cloud.google.com/compute/instancesDetail/zones/{zone}/\
|
|
17
24
|
instances/{instance_name}?project={project_id}&tab=details"
|
|
18
|
-
|
|
25
|
+
)
|
|
26
|
+
logger.error("instance_name and zone and project_id required")
|
|
19
27
|
raise ValueError("Invalid parameters provided")
|
|
20
28
|
|
|
21
|
-
def compute_instance_vpc_network(
|
|
29
|
+
def compute_instance_vpc_network(
|
|
30
|
+
self,
|
|
31
|
+
project_id: str,
|
|
32
|
+
network_name: str,
|
|
33
|
+
**keward,
|
|
34
|
+
):
|
|
22
35
|
if network_name and project_id:
|
|
23
36
|
return f"https://console.cloud.google.com/networking/networks/details/\
|
|
24
37
|
{network_name}?project={project_id}&cloudshell=false&pageTab=SUBNETS"
|
|
25
|
-
logger.error(
|
|
38
|
+
logger.error("network_name and project_id required")
|
|
26
39
|
raise ValueError("Invalid parameters provided")
|
|
27
40
|
|
|
28
|
-
def compute_instance_vpc_network_subnet(
|
|
41
|
+
def compute_instance_vpc_network_subnet(
|
|
42
|
+
self,
|
|
43
|
+
project_id: str,
|
|
44
|
+
region: str,
|
|
45
|
+
subnet_name: str,
|
|
46
|
+
**keward,
|
|
47
|
+
):
|
|
29
48
|
if region and project_id and subnet_name:
|
|
30
49
|
return f"https://console.cloud.google.com/networking/subnetworks/details/\
|
|
31
50
|
{region}/{subnet_name}?project={project_id}"
|
|
32
|
-
logger.error(
|
|
51
|
+
logger.error("region and project_id and subnet_name required")
|
|
33
52
|
raise ValueError("Invalid parameters provided")
|
|
34
53
|
|
|
35
|
-
def compute_instance_disk(
|
|
54
|
+
def compute_instance_disk(
|
|
55
|
+
self,
|
|
56
|
+
project_id: str,
|
|
57
|
+
zone: str,
|
|
58
|
+
disk_name: str,
|
|
59
|
+
**keward,
|
|
60
|
+
):
|
|
36
61
|
if zone and project_id and disk_name:
|
|
37
|
-
return
|
|
62
|
+
return (
|
|
63
|
+
f"https://console.cloud.google.com/compute/disksDetail/zones/{zone}/disks/\
|
|
38
64
|
{disk_name}?project={project_id}"
|
|
39
|
-
|
|
65
|
+
)
|
|
66
|
+
logger.error("zone and project_id and disk_name required")
|
|
40
67
|
raise ValueError("Invalid parameters provided")
|
|
41
68
|
|
|
42
69
|
def compute_firewall_rule(self, project_id: str, rule_name: str, **keward):
|
|
43
70
|
if project_id and rule_name:
|
|
44
71
|
return f"https://console.cloud.google.com/networking/firewalls/details/\
|
|
45
72
|
{rule_name}?project={project_id}"
|
|
46
|
-
logger.error(
|
|
73
|
+
logger.error("project_id and rule_name required")
|
|
47
74
|
raise ValueError("Invalid parameters provided")
|
|
48
75
|
|
|
49
|
-
def compute_forwarding_rule(
|
|
76
|
+
def compute_forwarding_rule(
|
|
77
|
+
self,
|
|
78
|
+
project_id: str,
|
|
79
|
+
rule_name: str,
|
|
80
|
+
region: str,
|
|
81
|
+
**keward,
|
|
82
|
+
):
|
|
50
83
|
if project_id and rule_name and region:
|
|
51
84
|
return f"https://console.cloud.google.com/net-services/loadbalancing/advanced/\
|
|
52
85
|
forwardingRules/details/regions/{region}/forwardingRules/{rule_name}?project={project_id}"
|
|
53
|
-
logger.error(
|
|
86
|
+
logger.error("project_id and rule_name and region required")
|
|
54
87
|
raise ValueError("Invalid parameters provided")
|
|
55
88
|
|
|
56
89
|
def api(self, project_id: str, managed_service_name: str, api_name: str, **keward):
|
|
57
90
|
if project_id and managed_service_name and api_name:
|
|
58
|
-
return
|
|
91
|
+
return (
|
|
92
|
+
f"https://console.cloud.google.com/api-gateway/api/{api_name}/servicename/\
|
|
59
93
|
{managed_service_name}/overview?cloudshell=false&project={project_id}"
|
|
60
|
-
|
|
94
|
+
)
|
|
95
|
+
logger.error("project_id and managed_service_name and api_name required")
|
|
61
96
|
raise ValueError("Invalid parameters provided")
|
|
62
97
|
|
|
63
98
|
def api_config(
|
|
64
|
-
self,
|
|
65
|
-
|
|
99
|
+
self,
|
|
100
|
+
project_id: str,
|
|
101
|
+
managed_service_name: str,
|
|
102
|
+
api_name: str,
|
|
103
|
+
api_config_name: str,
|
|
104
|
+
api_configuration_id: str,
|
|
105
|
+
**keward,
|
|
66
106
|
):
|
|
67
|
-
if
|
|
107
|
+
if (
|
|
108
|
+
project_id
|
|
109
|
+
and managed_service_name
|
|
110
|
+
and api_name
|
|
111
|
+
and api_config_name
|
|
112
|
+
and api_configuration_id
|
|
113
|
+
):
|
|
68
114
|
return f"https://console.cloud.google.com/api-gateway/api/{api_name}/servicename/\
|
|
69
115
|
{managed_service_name}/configs/{api_config_name}/rollout/{api_configuration_id}/\
|
|
70
116
|
details?project={project_id}"
|
|
71
117
|
logger.error(
|
|
72
|
-
|
|
118
|
+
"project_id and managed_service_name and api_name and api_config_name and api_configuration_id required",
|
|
73
119
|
)
|
|
74
120
|
raise ValueError("Invalid parameters provided")
|
|
75
121
|
|
|
76
|
-
def api_gateway(
|
|
122
|
+
def api_gateway(
|
|
123
|
+
self,
|
|
124
|
+
project_id: str,
|
|
125
|
+
region: str,
|
|
126
|
+
api_gateway_name: str,
|
|
127
|
+
**keward,
|
|
128
|
+
):
|
|
77
129
|
if project_id and region and api_gateway_name:
|
|
78
130
|
return f"https://console.cloud.google.com/api-gateway/gateway/{api_gateway_name}/\
|
|
79
131
|
location/{region}?project={project_id}"
|
|
80
|
-
logger.error(
|
|
132
|
+
logger.error("project_id and region and api_gateway_name required")
|
|
81
133
|
raise ValueError("Invalid parameters provided")
|
|
82
134
|
|
|
83
|
-
def big_table_instance(
|
|
135
|
+
def big_table_instance(
|
|
136
|
+
self,
|
|
137
|
+
project_id: str,
|
|
138
|
+
bigtable_instance_name: str,
|
|
139
|
+
**keward,
|
|
140
|
+
):
|
|
84
141
|
if project_id and bigtable_instance_name:
|
|
85
142
|
return f"https://console.cloud.google.com/bigtable/instances/{bigtable_instance_name}/\
|
|
86
143
|
overview?project={project_id}"
|
|
87
|
-
logger.error(
|
|
144
|
+
logger.error("project_id and bigtable_instance_name required")
|
|
88
145
|
raise ValueError("Invalid parameters provided")
|
|
89
146
|
|
|
90
|
-
def big_table_cluster(
|
|
147
|
+
def big_table_cluster(
|
|
148
|
+
self,
|
|
149
|
+
project_id: str,
|
|
150
|
+
bigtable_instance_name: str,
|
|
151
|
+
bigtable_cluster_id: str,
|
|
152
|
+
**keward,
|
|
153
|
+
):
|
|
91
154
|
if project_id and bigtable_instance_name and bigtable_cluster_id:
|
|
92
155
|
return f"https://console.cloud.google.com/bigtable/instances/{bigtable_instance_name}/\
|
|
93
156
|
clusters/{bigtable_cluster_id}?project={project_id}"
|
|
94
|
-
logger.error(
|
|
157
|
+
logger.error(
|
|
158
|
+
"project_id and bigtable_instance_name and bigtable_cluster_id required",
|
|
159
|
+
)
|
|
95
160
|
raise ValueError("Invalid parameters provided")
|
|
96
161
|
|
|
97
|
-
def big_table(
|
|
162
|
+
def big_table(
|
|
163
|
+
self,
|
|
164
|
+
project_id: str,
|
|
165
|
+
bigtable_instance_name: str,
|
|
166
|
+
bigtable_table_id: str,
|
|
167
|
+
**keward,
|
|
168
|
+
):
|
|
98
169
|
if project_id and bigtable_instance_name and bigtable_table_id:
|
|
99
170
|
return f"https://console.cloud.google.com/bigtable/instances/{bigtable_instance_name}/tables/\
|
|
100
171
|
{bigtable_table_id}/overview?project={project_id}"
|
|
101
|
-
logger.error(
|
|
172
|
+
logger.error(
|
|
173
|
+
"project_id and bigtable_instance_name and bigtable_table_id required",
|
|
174
|
+
)
|
|
102
175
|
raise ValueError("Invalid parameters provided")
|
|
103
176
|
|
|
104
|
-
def big_table_backup(
|
|
177
|
+
def big_table_backup(
|
|
178
|
+
self,
|
|
179
|
+
project_id: str,
|
|
180
|
+
bigtable_instance_name: str,
|
|
181
|
+
bigtable_table_id: str,
|
|
182
|
+
**keward,
|
|
183
|
+
):
|
|
105
184
|
if project_id and bigtable_instance_name and bigtable_table_id:
|
|
106
185
|
return f"https://console.cloud.google.com/bigtable/instances/{bigtable_instance_name}/\
|
|
107
186
|
backups;tableId={bigtable_table_id}?project={project_id}"
|
|
108
|
-
logger.error(
|
|
187
|
+
logger.error(
|
|
188
|
+
"project_id and bigtable_instance_name and bigtable_table_id required",
|
|
189
|
+
)
|
|
109
190
|
raise ValueError("Invalid parameters provided")
|
|
110
191
|
|
|
111
|
-
def cloud_function(
|
|
192
|
+
def cloud_function(
|
|
193
|
+
self,
|
|
194
|
+
project_id: str,
|
|
195
|
+
cloud_function_name: str,
|
|
196
|
+
region: str,
|
|
197
|
+
**keward,
|
|
198
|
+
):
|
|
112
199
|
if project_id and cloud_function_name and region:
|
|
113
200
|
return f"https://console.cloud.google.com/functions/details/{region}/\
|
|
114
201
|
{cloud_function_name}?project={project_id}"
|
|
115
|
-
logger.error(
|
|
202
|
+
logger.error("project_id and cloud_function_name and region required")
|
|
116
203
|
raise ValueError("Invalid parameters provided")
|
|
117
204
|
|
|
118
|
-
def kms_key_ring(
|
|
205
|
+
def kms_key_ring(
|
|
206
|
+
self,
|
|
207
|
+
project_id: str,
|
|
208
|
+
kms_key_ring_name: str,
|
|
209
|
+
region: str,
|
|
210
|
+
**keward,
|
|
211
|
+
):
|
|
119
212
|
if project_id and kms_key_ring_name and region:
|
|
120
|
-
return
|
|
213
|
+
return (
|
|
214
|
+
f"https://console.cloud.google.com/security/kms/keyring/manage/{region}/\
|
|
121
215
|
{kms_key_ring_name}/key?project={project_id}"
|
|
122
|
-
|
|
216
|
+
)
|
|
217
|
+
logger.error("project_id and kms_key_ring_name and region required")
|
|
123
218
|
raise ValueError("Invalid parameters provided")
|
|
124
219
|
|
|
125
|
-
def kms_key(
|
|
220
|
+
def kms_key(
|
|
221
|
+
self,
|
|
222
|
+
project_id: str,
|
|
223
|
+
kms_key_ring_name: str,
|
|
224
|
+
region: str,
|
|
225
|
+
kms_key_name: str,
|
|
226
|
+
**keward,
|
|
227
|
+
):
|
|
126
228
|
if project_id and kms_key_ring_name and region and kms_key_name:
|
|
127
229
|
return f"https://console.cloud.google.com/security/kms/key/manage/{region}/\
|
|
128
230
|
{kms_key_ring_name}/{kms_key_name}?project={project_id}"
|
|
129
|
-
logger.error(
|
|
231
|
+
logger.error(
|
|
232
|
+
"project_id and kms_key_ring_name and region and kms_key_name required",
|
|
233
|
+
)
|
|
130
234
|
raise ValueError("Invalid parameters provided")
|
|
131
235
|
|
|
132
236
|
def dns_zone(self, project_id: str, dns_zone_name: str, **keward):
|
|
133
237
|
if project_id and dns_zone_name:
|
|
134
238
|
return f"https://console.cloud.google.com/net-services/dns/zones/{dns_zone_name}/\
|
|
135
239
|
details?project={project_id}"
|
|
136
|
-
logger.error(
|
|
240
|
+
logger.error("project_id and dns_zone_name required")
|
|
137
241
|
raise ValueError("Invalid parameters provided")
|
|
138
242
|
|
|
139
243
|
def dns_resource_record_set(
|
|
140
|
-
self,
|
|
141
|
-
|
|
244
|
+
self,
|
|
245
|
+
project_id: str,
|
|
246
|
+
dns_zone_name: str,
|
|
247
|
+
dns_rrset_name: str,
|
|
248
|
+
dns_type: str,
|
|
249
|
+
**keward,
|
|
142
250
|
):
|
|
143
251
|
if project_id and dns_zone_name and dns_rrset_name and dns_type:
|
|
144
252
|
return f"https://console.cloud.google.com/net-services/dns/zones/{dns_zone_name}/\
|
|
145
253
|
rrsets/{dns_rrset_name}/{dns_type}/view?project={project_id}"
|
|
146
|
-
logger.error(
|
|
254
|
+
logger.error(
|
|
255
|
+
"project_id and dns_zone_name and dns_rrset_name and dns_type required",
|
|
256
|
+
)
|
|
147
257
|
raise ValueError("Invalid parameters provided")
|
|
148
258
|
|
|
149
259
|
def gke_cluster(self, project_id: str, zone: str, gke_cluster_name: str, **keward):
|
|
150
260
|
if project_id and zone and gke_cluster_name:
|
|
151
|
-
return
|
|
261
|
+
return (
|
|
262
|
+
f"https://console.cloud.google.com/kubernetes/clusters/details/{zone}/\
|
|
152
263
|
{gke_cluster_name}/details?project={project_id}"
|
|
153
|
-
|
|
264
|
+
)
|
|
265
|
+
logger.error("project_id and zone and gke_cluster_name required")
|
|
154
266
|
raise ValueError("Invalid parameters provided")
|
|
155
267
|
|
|
156
268
|
def sql_instance(self, project_id: str, sql_instance_name: str, **keward):
|
|
157
269
|
if project_id and sql_instance_name:
|
|
158
|
-
return
|
|
270
|
+
return (
|
|
271
|
+
f"https://console.cloud.google.com/sql/instances/{sql_instance_name}/\
|
|
159
272
|
overview?project={project_id}"
|
|
160
|
-
|
|
273
|
+
)
|
|
274
|
+
logger.error("project_id and sql_instance_name required")
|
|
161
275
|
raise ValueError("Invalid parameters provided")
|
|
162
276
|
|
|
163
277
|
def sql_user(self, project_id: str, sql_instance_name: str, **keward):
|
|
164
278
|
if project_id and sql_instance_name:
|
|
165
|
-
return
|
|
279
|
+
return (
|
|
280
|
+
f"https://console.cloud.google.com/sql/instances/{sql_instance_name}/\
|
|
166
281
|
users?project={project_id}"
|
|
167
|
-
|
|
282
|
+
)
|
|
283
|
+
logger.error("project_id and sql_instance_name required")
|
|
168
284
|
raise ValueError("Invalid parameters provided")
|
|
169
285
|
|
|
170
|
-
def service_account(
|
|
286
|
+
def service_account(
|
|
287
|
+
self,
|
|
288
|
+
project_id: str,
|
|
289
|
+
service_account_unique_id: str,
|
|
290
|
+
**keward,
|
|
291
|
+
):
|
|
171
292
|
if project_id and service_account_unique_id:
|
|
172
|
-
return
|
|
293
|
+
return (
|
|
294
|
+
f"https://console.cloud.google.com/iam-admin/serviceaccounts/details/\
|
|
173
295
|
{service_account_unique_id}?project={project_id}"
|
|
174
|
-
|
|
296
|
+
)
|
|
297
|
+
logger.error("project_id and service_account_unique_id required")
|
|
175
298
|
raise ValueError("Invalid parameters provided")
|
|
176
299
|
|
|
177
|
-
def service_account_key(
|
|
300
|
+
def service_account_key(
|
|
301
|
+
self,
|
|
302
|
+
project_id: str,
|
|
303
|
+
service_account_unique_id: str,
|
|
304
|
+
**keward,
|
|
305
|
+
):
|
|
178
306
|
if project_id and service_account_unique_id:
|
|
179
|
-
return
|
|
307
|
+
return (
|
|
308
|
+
f"https://console.cloud.google.com/iam-admin/serviceaccounts/details/\
|
|
180
309
|
{service_account_unique_id}/keys?project={project_id}"
|
|
181
|
-
|
|
310
|
+
)
|
|
311
|
+
logger.error("project_id and service_account_unique_id required")
|
|
182
312
|
raise ValueError("Invalid parameters provided")
|
|
183
313
|
|
|
184
314
|
def iam_role(self, project_id: str, role_id: str, **keward):
|
|
185
315
|
if project_id and role_id:
|
|
186
316
|
role_id = role_id.replace("/", "<")
|
|
187
317
|
return f"https://console.cloud.google.com/iam-admin/roles/details/{role_id}?project={project_id}"
|
|
188
|
-
logger.error(
|
|
318
|
+
logger.error("project_id and role_id required")
|
|
189
319
|
raise ValueError("Invalid parameters provided")
|
|
190
320
|
|
|
191
321
|
def iam_group(self, project_id: str, **keward):
|
|
192
322
|
if project_id:
|
|
193
323
|
return f"https://console.cloud.google.com/projectselector2/\
|
|
194
324
|
iam-admin/groups?orgonly=true&project={project_id}&supportedpurview=organizationId"
|
|
195
|
-
logger.error(
|
|
325
|
+
logger.error("group_unique_id and organization_id required")
|
|
196
326
|
raise ValueError("Invalid parameters provided")
|
|
197
327
|
|
|
198
328
|
def iam_user(self, project_id: str, **keward):
|
|
199
329
|
if project_id:
|
|
200
330
|
return f"https://console.cloud.google.com/iam-admin/iam?orgonly=true&project={project_id}&\
|
|
201
331
|
supportedpurview=organizationId"
|
|
202
|
-
logger.error(
|
|
332
|
+
logger.error("project_id required")
|
|
203
333
|
raise ValueError("Invalid parameters provided")
|
|
204
334
|
|
|
205
|
-
def firestore_collection(
|
|
335
|
+
def firestore_collection(
|
|
336
|
+
self,
|
|
337
|
+
project_id: str,
|
|
338
|
+
firestore_collection_name: str,
|
|
339
|
+
**keward,
|
|
340
|
+
):
|
|
206
341
|
if project_id and firestore_collection_name:
|
|
207
342
|
return f"https://console.cloud.google.com/firestore/data/{firestore_collection_name}?project={project_id}"
|
|
208
|
-
logger.error(
|
|
343
|
+
logger.error("project_id and firestore_collection_name required")
|
|
209
344
|
raise ValueError("Invalid parameters provided")
|
|
210
345
|
|
|
211
|
-
def cloud_run_revision(
|
|
346
|
+
def cloud_run_revision(
|
|
347
|
+
self,
|
|
348
|
+
project_id: str,
|
|
349
|
+
cloud_run_service_name: str,
|
|
350
|
+
region: str,
|
|
351
|
+
**keward,
|
|
352
|
+
):
|
|
212
353
|
if project_id and cloud_run_service_name and region:
|
|
213
354
|
return f"https://console.cloud.google.com/run/detail/{region}/{cloud_run_service_name}/\
|
|
214
355
|
revisions?project={project_id}"
|
|
215
|
-
logger.error(
|
|
356
|
+
logger.error("project_id and cloud_run_service_name and region required")
|
|
216
357
|
raise ValueError("Invalid parameters provided")
|
|
217
358
|
|
|
218
|
-
def cloud_run_service(
|
|
359
|
+
def cloud_run_service(
|
|
360
|
+
self,
|
|
361
|
+
project_id: str,
|
|
362
|
+
cloud_run_service_name: str,
|
|
363
|
+
region: str,
|
|
364
|
+
**keward,
|
|
365
|
+
):
|
|
219
366
|
if project_id and cloud_run_service_name and region:
|
|
220
367
|
return f"https://console.cloud.google.com/run/detail/{region}/{cloud_run_service_name}/\
|
|
221
368
|
general?project={project_id}"
|
|
222
|
-
logger.error(
|
|
369
|
+
logger.error("project_id and cloud_run_service_name and region required")
|
|
223
370
|
raise ValueError("Invalid parameters provided")
|
|
224
371
|
|
|
225
372
|
def cloud_pubsub_topic(self, project_id: str, topic_id: str, **keward):
|
|
226
373
|
if project_id and topic_id:
|
|
227
|
-
return
|
|
374
|
+
return (
|
|
375
|
+
f"https://console.cloud.google.com/cloudpubsub/topic/detail/{topic_id}?\
|
|
228
376
|
project={project_id}"
|
|
229
|
-
|
|
377
|
+
)
|
|
378
|
+
logger.error("project_id and topic_id is required")
|
|
230
379
|
raise ValueError("Invalid parameters provided")
|
|
231
380
|
|
|
232
381
|
def cloud_logging_metric(self, project_id: str, **keward):
|
|
233
382
|
if project_id:
|
|
234
383
|
return f"https://console.cloud.google.com/logs/metrics?project={project_id}"
|
|
235
|
-
logger.error(
|
|
384
|
+
logger.error("project_id is required ")
|
|
236
385
|
raise ValueError("Invalid parameters provided")
|
|
237
386
|
|
|
238
|
-
def dataproc_cluster(
|
|
387
|
+
def dataproc_cluster(
|
|
388
|
+
self,
|
|
389
|
+
project_id: str,
|
|
390
|
+
dataproc_cluster_name: str,
|
|
391
|
+
region: str,
|
|
392
|
+
**keward,
|
|
393
|
+
):
|
|
239
394
|
if project_id and dataproc_cluster_name and region:
|
|
240
395
|
return f"https://console.cloud.google.com/dataproc/clusters/{dataproc_cluster_name}/\
|
|
241
396
|
monitoring?region={region}&project={project_id}"
|
|
242
|
-
logger.error(
|
|
397
|
+
logger.error("project_id and dataproc_cluster_name and region required")
|
|
243
398
|
raise ValueError("Invalid parameters provided")
|
|
244
399
|
|
|
245
400
|
def cloud_logging_sink(self, project_id: str, **keward):
|
|
246
|
-
if project_id
|
|
401
|
+
if project_id:
|
|
247
402
|
return f"https://console.cloud.google.com/logs/router?project={project_id}"
|
|
248
|
-
logger.error(
|
|
403
|
+
logger.error("project_id required")
|
|
249
404
|
raise ValueError("Invalid parameters provided")
|
|
250
405
|
|
|
251
406
|
def cloud_monitoring_notification_channels(self, project_id: str, **keward):
|
|
252
407
|
if project_id:
|
|
253
408
|
return f"https://console.cloud.google.com/monitoring/alerting/notifications?project={project_id}"
|
|
254
|
-
logger.error(
|
|
409
|
+
logger.error("project_id required")
|
|
255
410
|
raise ValueError("Invalid parameters provided")
|
|
256
411
|
|
|
257
|
-
def cloud_monitoring_uptimecheck_config(
|
|
412
|
+
def cloud_monitoring_uptimecheck_config(
|
|
413
|
+
self,
|
|
414
|
+
project_id: str,
|
|
415
|
+
uptimecheck_config_name: str,
|
|
416
|
+
**keward,
|
|
417
|
+
):
|
|
258
418
|
if project_id and uptimecheck_config_name:
|
|
259
|
-
config_id = uptimecheck_config_name.split(
|
|
419
|
+
config_id = uptimecheck_config_name.split("/")[-1]
|
|
260
420
|
return f"https://console.cloud.google.com/monitoring/uptime/{config_id}?project={project_id}"
|
|
261
|
-
logger.error(
|
|
421
|
+
logger.error("project_id and cloud_monitoring_uptimecheck_config_name required")
|
|
262
422
|
raise ValueError("Invalid parameters provided")
|
|
263
423
|
|
|
264
|
-
def cloud_monitoring_alert_policy(
|
|
424
|
+
def cloud_monitoring_alert_policy(
|
|
425
|
+
self,
|
|
426
|
+
project_id: str,
|
|
427
|
+
alert_policy_name: str,
|
|
428
|
+
**keward,
|
|
429
|
+
):
|
|
265
430
|
if project_id and alert_policy_name:
|
|
266
|
-
policy_id = alert_policy_name.split(
|
|
431
|
+
policy_id = alert_policy_name.split("/")[-1]
|
|
267
432
|
return f"https://console.cloud.google.com/monitoring/alerting/policies/{policy_id}?project={project_id}"
|
|
268
|
-
logger.error(
|
|
433
|
+
logger.error("project_id and cloud_monitoring_alert_policy_name required")
|
|
269
434
|
raise ValueError("Invalid parameters provided")
|
|
270
435
|
|
|
271
|
-
def global_instance_group(
|
|
436
|
+
def global_instance_group(
|
|
437
|
+
self,
|
|
438
|
+
project_id: str,
|
|
439
|
+
instance_group_name: str,
|
|
440
|
+
zone: str,
|
|
441
|
+
**keward,
|
|
442
|
+
):
|
|
272
443
|
if project_id and instance_group_name and zone:
|
|
273
444
|
return f"https://console.cloud.google.com/compute/instanceGroups/\
|
|
274
445
|
details/{zone}/{instance_group_name}?project={project_id}"
|
|
275
|
-
logger.error(
|
|
446
|
+
logger.error("project_id and zone and instance_group_name required")
|
|
276
447
|
raise ValueError("Invalid parameters provided")
|
|
277
448
|
|
|
278
|
-
def regional_instance_group(
|
|
449
|
+
def regional_instance_group(
|
|
450
|
+
self,
|
|
451
|
+
project_id: str,
|
|
452
|
+
instance_group_name: str,
|
|
453
|
+
region: str,
|
|
454
|
+
**keward,
|
|
455
|
+
):
|
|
279
456
|
if project_id and instance_group_name and region:
|
|
280
457
|
return f"https://console.cloud.google.com/compute/instanceGroups/\
|
|
281
458
|
details/{region}/{instance_group_name}?project={project_id}"
|
|
282
|
-
logger.error(
|
|
459
|
+
logger.error("project_id and region and instance_group_name required")
|
|
283
460
|
raise ValueError("Invalid parameters provided")
|
|
284
461
|
|
|
285
|
-
def regional_health_check(
|
|
462
|
+
def regional_health_check(
|
|
463
|
+
self,
|
|
464
|
+
project_id: str,
|
|
465
|
+
health_check_name: str,
|
|
466
|
+
region: str,
|
|
467
|
+
**keward,
|
|
468
|
+
):
|
|
286
469
|
if project_id and health_check_name and region:
|
|
287
470
|
return f"https://console.cloud.google.com/compute/healthChecks/details/\
|
|
288
471
|
regions/{region}/{health_check_name}?project={project_id}"
|
|
289
|
-
logger.error(
|
|
472
|
+
logger.error("project_id and region and health_check_name required")
|
|
290
473
|
raise ValueError("Invalid parameters provided")
|
|
291
474
|
|
|
292
475
|
def global_health_check(self, project_id: str, health_check_name: str, **keward):
|
|
293
476
|
if project_id and health_check_name:
|
|
294
477
|
return f"https://console.cloud.google.com/compute/healthChecks\
|
|
295
478
|
/details/{health_check_name}?project={project_id}"
|
|
296
|
-
logger.error(
|
|
479
|
+
logger.error("project_id and health_check_name required")
|
|
297
480
|
raise ValueError("Invalid parameters provided")
|
|
298
481
|
|
|
299
|
-
def regional_backend_service(
|
|
482
|
+
def regional_backend_service(
|
|
483
|
+
self,
|
|
484
|
+
project_id: str,
|
|
485
|
+
backend_service_name: str,
|
|
486
|
+
region: str,
|
|
487
|
+
**keward,
|
|
488
|
+
):
|
|
300
489
|
if project_id and backend_service_name and region:
|
|
301
|
-
return
|
|
490
|
+
return (
|
|
491
|
+
f"https://console.cloud.google.com/net-services/loadbalancing/advanced/regionBackendServices\
|
|
302
492
|
/details/{region}/{backend_service_name}?project={project_id}"
|
|
303
|
-
|
|
493
|
+
)
|
|
494
|
+
logger.error("project_id and region and backend_service_name required")
|
|
304
495
|
raise ValueError("Invalid parameters provided")
|
|
305
496
|
|
|
306
|
-
def global_backend_service(
|
|
497
|
+
def global_backend_service(
|
|
498
|
+
self,
|
|
499
|
+
project_id: str,
|
|
500
|
+
backend_service_name: str,
|
|
501
|
+
**keward,
|
|
502
|
+
):
|
|
307
503
|
if project_id and backend_service_name:
|
|
308
504
|
return f"https://console.cloud.google.com/net-services/loadbalancing\
|
|
309
505
|
/advanced/backendServices/details/{backend_service_name}?project={project_id}"
|
|
310
|
-
logger.error(
|
|
506
|
+
logger.error("project_id and backend_service_name required")
|
|
311
507
|
raise ValueError("Invalid parameters provided")
|
|
312
508
|
|
|
313
509
|
def ssl_policy(self, project_id: str, ssl_policy_name: str, **keward):
|
|
314
510
|
if project_id and ssl_policy_name:
|
|
315
511
|
return f"https://console.cloud.google.com/net-security/\
|
|
316
512
|
sslpolicies/details/{ssl_policy_name}?project={project_id}"
|
|
317
|
-
logger.error(
|
|
513
|
+
logger.error("project_id and ssl_policy_name required")
|
|
318
514
|
raise ValueError("Invalid parameters provided")
|
|
319
515
|
|
|
320
516
|
def backend_bucket(self, project_id: str, backend_bucket_name: str, **keward):
|
|
321
517
|
if project_id and backend_bucket_name:
|
|
322
|
-
return
|
|
518
|
+
return (
|
|
519
|
+
f"https://console.cloud.google.com/net-services/loadbalancing/advanced\
|
|
323
520
|
/backendBuckets/details/{backend_bucket_name}?project={project_id}"
|
|
324
|
-
|
|
521
|
+
)
|
|
522
|
+
logger.error("project_id and backend_bucket_name required")
|
|
325
523
|
raise ValueError("Invalid parameters provided")
|
|
326
524
|
|
|
327
525
|
def dns_policy(self, project_id: str, dns_policy_name: str, **keward):
|
|
328
526
|
if project_id and dns_policy_name:
|
|
329
527
|
return f"https://console.cloud.google.com/net-services/\
|
|
330
528
|
dns/policies/{dns_policy_name}/view?project={project_id}"
|
|
331
|
-
logger.error(
|
|
529
|
+
logger.error("project_id and dns_policy_name required")
|
|
332
530
|
raise ValueError("Invalid parameters provided")
|
|
333
531
|
|
|
334
532
|
def api_key(self, project_id: str, api_key_id: str, **keward):
|
|
335
533
|
if project_id and api_key_id:
|
|
336
534
|
return f"https://console.cloud.google.com/apis/credentials/\
|
|
337
535
|
key/{api_key_id}?project={project_id}"
|
|
338
|
-
logger.error(
|
|
536
|
+
logger.error("project_id and api_key_id required")
|
|
339
537
|
raise ValueError("Invalid parameters provided")
|
|
340
538
|
|
|
341
539
|
def firestore_index(self, project_id: str, **keward):
|
|
342
540
|
if project_id:
|
|
343
541
|
return f"https://console.cloud.google.com/firestore/indexes/\
|
|
344
542
|
composite?project={project_id}"
|
|
345
|
-
logger.error(
|
|
543
|
+
logger.error("project_id required")
|
|
346
544
|
raise ValueError("Invalid parameters provided")
|
|
347
545
|
|
|
348
|
-
def cloud_pubsub_subscription(
|
|
546
|
+
def cloud_pubsub_subscription(
|
|
547
|
+
self,
|
|
548
|
+
project_id: str,
|
|
549
|
+
subscription_id: str,
|
|
550
|
+
**keward,
|
|
551
|
+
):
|
|
349
552
|
if project_id and subscription_id:
|
|
350
553
|
return f"https://console.cloud.google.com/cloudpubsub/subscription/\
|
|
351
554
|
detail/{subscription_id}?project={project_id}"
|
|
352
|
-
logger.error(
|
|
555
|
+
logger.error("project_id and subscription_name required")
|
|
353
556
|
raise ValueError("Invalid parameters provided")
|
|
354
557
|
|
|
355
558
|
def cloudrun_domain(self, project_id: str, **keward):
|
|
356
559
|
if project_id:
|
|
357
560
|
return f"https://console.cloud.google.com/run/domains?project={project_id}"
|
|
358
|
-
logger.error(
|
|
561
|
+
logger.error("project_id required")
|
|
359
562
|
raise ValueError("Invalid parameters provided")
|
|
360
563
|
|
|
361
564
|
def iam_domain(self, project_id: str, **keward):
|
|
362
565
|
if project_id:
|
|
363
566
|
return f"https://console.cloud.google.com/iam-admin/\
|
|
364
567
|
iam?orgonly=true&project={project_id}&supportedpurview=organizationId"
|
|
365
|
-
logger.error(
|
|
568
|
+
logger.error("project_id required")
|
|
366
569
|
raise ValueError("Invalid parameters provided")
|
|
367
570
|
|
|
368
571
|
def bigquery_home(self, project_id: str, **keward):
|
|
369
572
|
if project_id:
|
|
370
573
|
return f"https://console.cloud.google.com/bigquery?referrer=search&project={project_id}"
|
|
371
|
-
logger.error(
|
|
574
|
+
logger.error("project_id required")
|
|
372
575
|
raise ValueError("Invalid parameters provided")
|
|
373
576
|
|
|
374
577
|
def cdn_home(self, project_id: str, **keward):
|
|
375
578
|
if project_id:
|
|
376
579
|
return f"https://console.cloud.google.com/net-services/cdn/list?project={project_id}"
|
|
377
|
-
logger.error(
|
|
580
|
+
logger.error("project_id required")
|
|
378
581
|
raise ValueError("Invalid parameters provided")
|
|
379
582
|
|
|
380
583
|
def dns_home(self, project_id: str, **keward):
|
|
381
584
|
if project_id:
|
|
382
585
|
return f"https://console.cloud.google.com/net-services/dns/zones?project={project_id}"
|
|
383
|
-
logger.error(
|
|
586
|
+
logger.error("project_id required")
|
|
384
587
|
raise ValueError("Invalid parameters provided")
|
|
385
588
|
|
|
386
589
|
def load_balancer_home(self, project_id: str, **keward):
|
|
387
590
|
if project_id:
|
|
388
591
|
return f"https://console.cloud.google.com/net-services/loadbalancing/list/loadBalancers?project={project_id}"
|
|
389
|
-
logger.error(
|
|
592
|
+
logger.error("project_id required")
|
|
390
593
|
raise ValueError("Invalid parameters provided")
|
|
391
594
|
|
|
392
595
|
def vpc_home(self, project_id: str, **keward):
|
|
393
596
|
if project_id:
|
|
394
597
|
return f"https://console.cloud.google.com/networking/networks/list?project={project_id}"
|
|
395
|
-
logger.error(
|
|
598
|
+
logger.error("project_id required")
|
|
396
599
|
raise ValueError("Invalid parameters provided")
|
|
397
600
|
|
|
398
601
|
def apigateway_home(self, project_id: str, **keward):
|
|
399
602
|
if project_id:
|
|
400
603
|
return f"https://console.cloud.google.com/api-gateway/api?referrer=search&project={project_id}"
|
|
401
|
-
logger.error(
|
|
604
|
+
logger.error("project_id required")
|
|
402
605
|
raise ValueError("Invalid parameters provided")
|
|
403
606
|
|
|
404
607
|
def cloudrun_home(self, project_id: str, **keward):
|
|
405
608
|
if project_id:
|
|
406
609
|
return f"https://console.cloud.google.com/run?referrer=search&project={project_id}"
|
|
407
|
-
logger.error(
|
|
610
|
+
logger.error("project_id required")
|
|
408
611
|
raise ValueError("Invalid parameters provided")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: cloudconsolelink
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.25
|
|
4
4
|
Summary: Generate console links for cloud resources
|
|
5
5
|
Home-page: https://github.com/Cloudanix/cloud-console-links
|
|
6
6
|
Maintainer: Cloudanix
|
|
@@ -13,6 +13,15 @@ Classifier: Natural Language :: English
|
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
License-File: LICENSE
|
|
16
|
+
Dynamic: classifier
|
|
17
|
+
Dynamic: description
|
|
18
|
+
Dynamic: description-content-type
|
|
19
|
+
Dynamic: home-page
|
|
20
|
+
Dynamic: license
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
Dynamic: maintainer
|
|
23
|
+
Dynamic: maintainer-email
|
|
24
|
+
Dynamic: summary
|
|
16
25
|
|
|
17
26
|
# What is cloudconsolelink?
|
|
18
27
|
This project for generate console links for AWS, GCP and Azure cloud resources
|
|
@@ -4,39 +4,28 @@ with open("README.md") as fh:
|
|
|
4
4
|
long_description = fh.read()
|
|
5
5
|
|
|
6
6
|
# version of the module
|
|
7
|
-
__version__ =
|
|
7
|
+
__version__ = "1.0.25"
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
setuptools.setup(
|
|
11
11
|
# Here is the module name.
|
|
12
12
|
name="cloudconsolelink",
|
|
13
|
-
|
|
14
13
|
# version of the module
|
|
15
14
|
version=__version__,
|
|
16
|
-
|
|
17
15
|
# Name of Maintainer
|
|
18
16
|
maintainer="Cloudanix",
|
|
19
|
-
|
|
20
17
|
# Maintainer Email address
|
|
21
18
|
maintainer_email="ganesh@cloudanix.com",
|
|
22
|
-
|
|
23
19
|
# Small Description about module
|
|
24
20
|
description="Generate console links for cloud resources",
|
|
25
|
-
|
|
26
21
|
long_description=long_description,
|
|
27
|
-
|
|
28
22
|
# Specifying that we are using markdown file for description
|
|
29
23
|
long_description_content_type="text/markdown",
|
|
30
|
-
|
|
31
24
|
# Any link to reach this module, if you have any webpage or github profile
|
|
32
25
|
url="https://github.com/Cloudanix/cloud-console-links",
|
|
33
|
-
|
|
34
|
-
license='apache2',
|
|
35
|
-
|
|
26
|
+
license="apache2",
|
|
36
27
|
install_requires=[],
|
|
37
|
-
|
|
38
|
-
packages=setuptools.find_packages(exclude=['tests*']),
|
|
39
|
-
|
|
28
|
+
packages=setuptools.find_packages(exclude=["tests*"]),
|
|
40
29
|
# classifiers like program is suitable for python3, just leave as it is.
|
|
41
30
|
classifiers=[
|
|
42
31
|
"Programming Language :: Python :: 3",
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
logger = logging.getLogger(__name__)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class AzureLinker:
|
|
8
|
-
def get_console_link(self, id: str, app_id: str = None, primary_ad_domain_name: str = None, iam_entity_type: str = None) -> str:
|
|
9
|
-
if not primary_ad_domain_name and not iam_entity_type:
|
|
10
|
-
logger.error("For IAM entity required `iam_entity_type` and for other entity required\
|
|
11
|
-
`primary_ad_domain_name`")
|
|
12
|
-
raise ValueError("Invalid parameters provided")
|
|
13
|
-
iam_entities = {
|
|
14
|
-
"user": 'https://portal.azure.com/#blade/Microsoft_AAD_IAM/UserDetailsMenuBlade/Profile/userId/{id}',
|
|
15
|
-
"group": 'https://portal.azure.com/#blade/Microsoft_AAD_IAM/GroupDetailsMenuBlade/Overview/groupId/{id}',
|
|
16
|
-
"application": 'https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade\
|
|
17
|
-
/Overview/appId/{id}',
|
|
18
|
-
"role": 'https://portal.azure.com/#@{primary_ad_domain_name}/resource{id}/roles',
|
|
19
|
-
"service_principal": 'https://portal.azure.com/#view/Microsoft_AAD_IAM/ManagedAppMenuBlade/~/Properties/\
|
|
20
|
-
objectId/{id}/appId/{app_id}/preferredSingleSignOnMode~/null',
|
|
21
|
-
"domain": 'https://portal.azure.com/#view/Microsoft_AAD_IAM/DomainPropertiesBladeV2/domainName/{id}'
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if iam_entity_type and id and iam_entities.get(iam_entity_type, None):
|
|
25
|
-
if iam_entity_type == 'role' and primary_ad_domain_name:
|
|
26
|
-
return eval(f"f'{iam_entities[iam_entity_type]}'").replace(" ", "")
|
|
27
|
-
elif iam_entity_type == 'service_principal' and app_id:
|
|
28
|
-
return eval(f"f'{iam_entities[iam_entity_type]}'").replace(" ", "")
|
|
29
|
-
else:
|
|
30
|
-
return eval(f"f'{iam_entities[iam_entity_type]}'").replace(" ", "")
|
|
31
|
-
|
|
32
|
-
elif primary_ad_domain_name and id:
|
|
33
|
-
if id.startswith('https'):
|
|
34
|
-
if '/keys/' in id:
|
|
35
|
-
return f"https://portal.azure.com/#@{primary_ad_domain_name}/asset/Microsoft_Azure_KeyVault/Key/{id}"
|
|
36
|
-
elif '/secrets/' in id:
|
|
37
|
-
return f"https://portal.azure.com/#@{primary_ad_domain_name}/asset/Microsoft_Azure_KeyVault/Secret/{id}"
|
|
38
|
-
elif '/certificates/' in id:
|
|
39
|
-
return f"https://portal.azure.com/#@{primary_ad_domain_name}/asset/Microsoft_Azure_KeyVault/Certificate/{id}"
|
|
40
|
-
|
|
41
|
-
return f"https://portal.azure.com/#@{primary_ad_domain_name}/resource{id}/overview"
|
|
42
|
-
|
|
43
|
-
else:
|
|
44
|
-
logger.error('entity id required')
|
|
45
|
-
raise ValueError("Invalid parameters provided")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cloudconsolelink-1.0.24 → cloudconsolelink-1.0.25}/cloudconsolelink.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|