From bc52557451020993cbbef567f785355c6b443e37 Mon Sep 17 00:00:00 2001 From: Thomas Winsnes Date: Mon, 5 Feb 2024 12:49:31 +1100 Subject: [PATCH 01/10] Added template for CloudFront distribrutions --- link2aws.js | 4 +++- testcases/aws.json | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/link2aws.js b/link2aws.js index 6e81bbc..d218623 100644 --- a/link2aws.js +++ b/link2aws.js @@ -53,6 +53,8 @@ class ARN { throw Error("Bad number of tokens"); } + console.log(this); + this._linkTemplates = this._getLinkTemplates(); } @@ -228,7 +230,7 @@ class ARN { "stackset": null, }, "cloudfront": { // Amazon CloudFront - "distribution": null, + "distribution": () => `https://console.aws.amazon.com/cloudfront/v4/home#/distributions/${this.resource}`, "origin-access-identity": null, "streaming-distribution": null, }, diff --git a/testcases/aws.json b/testcases/aws.json index a92d630..a21b407 100644 --- a/testcases/aws.json +++ b/testcases/aws.json @@ -51,5 +51,6 @@ "arn:aws:amplify:sa-east-1:384862141196:apps/aaaaaaaaa/branches/master/jobs/00000001810": "https://sa-east-1.console.aws.amazon.com/amplify/home?region=sa-east-1#/aaaaaaaaa/master/1810", "arn:aws:amplify:sa-east-1:384862141196:apps/test-null-path": null, - "arn:aws:codepipeline:us-east-1:115131055398:my-pipeline": "https://us-east-1.console.aws.amazon.com/codesuite/codepipeline/pipelines/my-pipeline/view?region=us-east-1" + "arn:aws:codepipeline:us-east-1:115131055398:my-pipeline": "https://us-east-1.console.aws.amazon.com/codesuite/codepipeline/pipelines/my-pipeline/view?region=us-east-1", + "arn:aws:cloudfront::123456789012:distribution/E2YDLZ26QPSF11": "https://console.aws.amazon.com/cloudfront/v4/home#/distributions/E2YDLZ26QPSF11" } \ No newline at end of file From 66dc753b6d223487869fc5d221d471b463aa6590 Mon Sep 17 00:00:00 2001 From: Thomas Winsnes Date: Mon, 5 Feb 2024 13:21:53 +1100 Subject: [PATCH 02/10] Added template for autoscaling groups --- link2aws.js | 5 ++++- testcases/aws.json | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/link2aws.js b/link2aws.js index d218623..b93a385 100644 --- a/link2aws.js +++ b/link2aws.js @@ -189,7 +189,10 @@ class ARN { "workgroup": null, }, "autoscaling": { // Amazon EC2 Auto Scaling - "autoScalingGroup": null, + "autoScalingGroup": () => { + const groupName = this.resource.split('/')[1]; + return `https://${this.region}.console.aws.amazon.com/ec2/home?region=${this.region}#AutoScalingGroupDetails:id=${groupName};view=details` + }, "launchConfiguration": null, }, "aws-marketplace": { // AWS Marketplace Catalog diff --git a/testcases/aws.json b/testcases/aws.json index a21b407..19463b7 100644 --- a/testcases/aws.json +++ b/testcases/aws.json @@ -52,5 +52,8 @@ "arn:aws:amplify:sa-east-1:384862141196:apps/test-null-path": null, "arn:aws:codepipeline:us-east-1:115131055398:my-pipeline": "https://us-east-1.console.aws.amazon.com/codesuite/codepipeline/pipelines/my-pipeline/view?region=us-east-1", - "arn:aws:cloudfront::123456789012:distribution/E2YDLZ26QPSF11": "https://console.aws.amazon.com/cloudfront/v4/home#/distributions/E2YDLZ26QPSF11" + + "arn:aws:cloudfront::123456789012:distribution/E2YDLZ26QPSF11": "https://console.aws.amazon.com/cloudfront/v4/home#/distributions/E2YDLZ26QPSF11", + + "arn:aws:autoscaling:us-east-1:123456789012:autoScalingGroup:034d7396-90f3-r8si-88f5-ff1dcc0eb80e:autoScalingGroupName/test": "https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#AutoScalingGroupDetails:id=test;view=details" } \ No newline at end of file From 73fc254860a4cf607e32d616c18614e156542a39 Mon Sep 17 00:00:00 2001 From: Thomas Winsnes Date: Mon, 5 Feb 2024 13:42:51 +1100 Subject: [PATCH 03/10] Added templates for global and regional WAFv2 --- link2aws.js | 10 +++++++++- testcases/aws.json | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/link2aws.js b/link2aws.js index b93a385..81ee009 100644 --- a/link2aws.js +++ b/link2aws.js @@ -1049,7 +1049,15 @@ class ARN { "webacl": null, "xssmatchset": null, }, - "wafv2": { // AWS WAF V2 + "wafv2": { // AWS WAF V2 + "global": () => { + const resource = this.resource.replace("webacl/", ""); + return `https://console.aws.amazon.com/wafv2/homev2/web-acl/${resource}/overview?region=global` + }, + "regional": () => { + const resource = this.resource.replace("webacl/", ""); + return `https://console.aws.amazon.com/wafv2/homev2/web-acl/${resource}/overview?region=${this.region}` + } }, "wellarchitected": { // AWS Well-Architected Tool "workload": null, diff --git a/testcases/aws.json b/testcases/aws.json index 19463b7..15f7561 100644 --- a/testcases/aws.json +++ b/testcases/aws.json @@ -55,5 +55,8 @@ "arn:aws:cloudfront::123456789012:distribution/E2YDLZ26QPSF11": "https://console.aws.amazon.com/cloudfront/v4/home#/distributions/E2YDLZ26QPSF11", - "arn:aws:autoscaling:us-east-1:123456789012:autoScalingGroup:034d7396-90f3-r8si-88f5-ff1dcc0eb80e:autoScalingGroupName/test": "https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#AutoScalingGroupDetails:id=test;view=details" + "arn:aws:autoscaling:us-east-1:123456789012:autoScalingGroup:034d7396-90f3-r8si-88f5-ff1dcc0eb80e:autoScalingGroupName/test": "https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#AutoScalingGroupDetails:id=test;view=details", + + "arn:aws:wafv2:us-east-1:123456789012:global/webacl/test/f8234ecc-8990-4e63-b25a-ec36764b7701": "https://console.aws.amazon.com/wafv2/homev2/web-acl/test/f8234ecc-8990-4e63-b25a-ec36764b7701/overview?region=global", + "arn:aws:wafv2:us-east-1:123456789012:regional/webacl/test/0089db7f-b629-4ba6-bdad-8b2f3ec31c86": "https://console.aws.amazon.com/wafv2/homev2/web-acl/test/0089db7f-b629-4ba6-bdad-8b2f3ec31c86/overview?region=us-east-1" } \ No newline at end of file From 859dfa2be7c3ef3ec9f91128e0aac48436f5ef58 Mon Sep 17 00:00:00 2001 From: Thomas Winsnes Date: Mon, 5 Feb 2024 13:49:49 +1100 Subject: [PATCH 04/10] Added template for sns topics --- link2aws.js | 2 ++ testcases/aws.json | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/link2aws.js b/link2aws.js index 81ee009..1ecedb5 100644 --- a/link2aws.js +++ b/link2aws.js @@ -12,6 +12,7 @@ class ARN { } // arn:partition:service:region:account-id:... + this.arn = text; this.prefix = tokens[0]; this.partition = tokens[1]; this.service = tokens[2]; @@ -974,6 +975,7 @@ class ARN { "": null, }, "sns": { // Amazon SNS + "": () => `https://${this.console}/sns/v3/home?region=${this.region}#/topic/${this.arn}`, }, "sqs": { // Amazon SQS "": () => `https://${this.region}.${this.console}/sqs/v2/home?region=${this.region}#/queues/https%3A%2F%2Fsqs.${this.region}.amazonaws.com%2F${this.account}%2F${this.resource}` diff --git a/testcases/aws.json b/testcases/aws.json index 15f7561..c012d9e 100644 --- a/testcases/aws.json +++ b/testcases/aws.json @@ -58,5 +58,7 @@ "arn:aws:autoscaling:us-east-1:123456789012:autoScalingGroup:034d7396-90f3-r8si-88f5-ff1dcc0eb80e:autoScalingGroupName/test": "https://us-east-1.console.aws.amazon.com/ec2/home?region=us-east-1#AutoScalingGroupDetails:id=test;view=details", "arn:aws:wafv2:us-east-1:123456789012:global/webacl/test/f8234ecc-8990-4e63-b25a-ec36764b7701": "https://console.aws.amazon.com/wafv2/homev2/web-acl/test/f8234ecc-8990-4e63-b25a-ec36764b7701/overview?region=global", - "arn:aws:wafv2:us-east-1:123456789012:regional/webacl/test/0089db7f-b629-4ba6-bdad-8b2f3ec31c86": "https://console.aws.amazon.com/wafv2/homev2/web-acl/test/0089db7f-b629-4ba6-bdad-8b2f3ec31c86/overview?region=us-east-1" + "arn:aws:wafv2:us-east-1:123456789012:regional/webacl/test/0089db7f-b629-4ba6-bdad-8b2f3ec31c86": "https://console.aws.amazon.com/wafv2/homev2/web-acl/test/0089db7f-b629-4ba6-bdad-8b2f3ec31c86/overview?region=us-east-1", + + "arn:aws:sns:us-east-1:123456789012:sns-topic": "https://console.aws.amazon.com/sns/v3/home?region=us-east-1#/topic/arn:aws:sns:us-east-1:123456789012:sns-topic" } \ No newline at end of file From 8e0629ebd7628a0e11860e60ff989a15dff42ecd Mon Sep 17 00:00:00 2001 From: Thomas Winsnes Date: Mon, 5 Feb 2024 15:13:54 +1100 Subject: [PATCH 05/10] Added templates for rds cluster, instance, option group, snapshot and subnet groups --- link2aws.js | 10 +++++----- testcases/aws.json | 8 +++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/link2aws.js b/link2aws.js index 1ecedb5..0bce6c9 100644 --- a/link2aws.js +++ b/link2aws.js @@ -831,19 +831,19 @@ class ARN { "resource-share-invitation": null, }, "rds": { // Amazon RDS - "cluster": null, + "cluster": () => `https://console.aws.amazon.com/rds/home?region=${this.region}#database:id=${this.resource};is-cluster=true`, "cluster-endpoint": null, "cluster-pg": null, "cluster-snapshot": null, - "db": null, + "db": () => `https://console.aws.amazon.com/rds/home?region=${this.region}#database:id=${this.resource}`, "db-proxy": null, "es": null, - "og": null, + "og": () => `https://console.aws.amazon.com/rds/home?region=${this.region}#option-group-details:option-group-name=${this.resource}`, "pg": null, "ri": null, "secgrp": null, - "snapshot": null, - "subgrp": null, + "snapshot": () => `https://console.aws.amazon.com/rds/home?region=${this.region}#db-snapshot:id=${this.resource}`, + "subgrp": () => `https://console.aws.amazon.com/rds/home?region=${this.region}#db-subnet-group:id=${this.resource}`, "target": null, "target-group": null, }, diff --git a/testcases/aws.json b/testcases/aws.json index c012d9e..0c39a4c 100644 --- a/testcases/aws.json +++ b/testcases/aws.json @@ -60,5 +60,11 @@ "arn:aws:wafv2:us-east-1:123456789012:global/webacl/test/f8234ecc-8990-4e63-b25a-ec36764b7701": "https://console.aws.amazon.com/wafv2/homev2/web-acl/test/f8234ecc-8990-4e63-b25a-ec36764b7701/overview?region=global", "arn:aws:wafv2:us-east-1:123456789012:regional/webacl/test/0089db7f-b629-4ba6-bdad-8b2f3ec31c86": "https://console.aws.amazon.com/wafv2/homev2/web-acl/test/0089db7f-b629-4ba6-bdad-8b2f3ec31c86/overview?region=us-east-1", - "arn:aws:sns:us-east-1:123456789012:sns-topic": "https://console.aws.amazon.com/sns/v3/home?region=us-east-1#/topic/arn:aws:sns:us-east-1:123456789012:sns-topic" + "arn:aws:sns:us-east-1:123456789012:sns-topic": "https://console.aws.amazon.com/sns/v3/home?region=us-east-1#/topic/arn:aws:sns:us-east-1:123456789012:sns-topic", + + "arn:aws:rds:us-east-1:123456789012:db:test-db": "https://console.aws.amazon.com/rds/home?region=us-east-1#database:id=test-db", + "arn:aws:rds:us-east-1:123456789012:snapshot:rds:test-db-2024-02-04-22-12": "https://console.aws.amazon.com/rds/home?region=us-east-1#db-snapshot:id=rds:test-db-2024-02-04-22-12", + "arn:aws:rds:us-east-1:123456789012:subgrp:test-db": "https://console.aws.amazon.com/rds/home?region=us-east-1#db-subnet-group:id=test-db", + "arn:aws:rds:us-east-1:123456789012:og:test-db": "https://console.aws.amazon.com/rds/home?region=us-east-1#option-group-details:option-group-name=test-db", + "arn:aws:rds:us-east-1:123456789012:cluster:test-cluster": "https://console.aws.amazon.com/rds/home?region=us-east-1#database:id=test-cluster;is-cluster=true" } \ No newline at end of file From b2187c6e42f776a8b654bc4521575286a4740728 Mon Sep 17 00:00:00 2001 From: Thomas Winsnes Date: Mon, 5 Feb 2024 15:20:00 +1100 Subject: [PATCH 06/10] Added template for aws kms keys --- link2aws.js | 2 +- testcases/aws.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/link2aws.js b/link2aws.js index 0bce6c9..46354b9 100644 --- a/link2aws.js +++ b/link2aws.js @@ -666,7 +666,7 @@ class ARN { }, "kms": { // AWS Key Management Service "alias": null, - "key": null, + "key": () => `https://console.aws.amazon.com/kms/home?region=${this.region}#/kms/keys/${this.resource}`, }, "lambda": { // AWS Lambda "event-source-mapping": null, diff --git a/testcases/aws.json b/testcases/aws.json index 0c39a4c..61c06e5 100644 --- a/testcases/aws.json +++ b/testcases/aws.json @@ -66,5 +66,7 @@ "arn:aws:rds:us-east-1:123456789012:snapshot:rds:test-db-2024-02-04-22-12": "https://console.aws.amazon.com/rds/home?region=us-east-1#db-snapshot:id=rds:test-db-2024-02-04-22-12", "arn:aws:rds:us-east-1:123456789012:subgrp:test-db": "https://console.aws.amazon.com/rds/home?region=us-east-1#db-subnet-group:id=test-db", "arn:aws:rds:us-east-1:123456789012:og:test-db": "https://console.aws.amazon.com/rds/home?region=us-east-1#option-group-details:option-group-name=test-db", - "arn:aws:rds:us-east-1:123456789012:cluster:test-cluster": "https://console.aws.amazon.com/rds/home?region=us-east-1#database:id=test-cluster;is-cluster=true" + "arn:aws:rds:us-east-1:123456789012:cluster:test-cluster": "https://console.aws.amazon.com/rds/home?region=us-east-1#database:id=test-cluster;is-cluster=true", + + "arn:aws:kms:us-east-1:123456789012:key/4bd42b4b-af95-4698-b685-58d3296890fe": "https://console.aws.amazon.com/kms/home?region=us-east-1#/kms/keys/4bd42b4b-af95-4698-b685-58d3296890fe" } \ No newline at end of file From 9925eb1a6a048087272f8512952c36e550a6b7f5 Mon Sep 17 00:00:00 2001 From: Thomas Winsnes Date: Mon, 5 Feb 2024 15:30:27 +1100 Subject: [PATCH 07/10] Added tempalte for EKS cluster and workernode group --- link2aws.js | 9 +++++++-- testcases/aws.json | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/link2aws.js b/link2aws.js index 46354b9..78ef076 100644 --- a/link2aws.js +++ b/link2aws.js @@ -455,9 +455,14 @@ class ARN { "task-set": null, }, "eks": { // Amazon Elastic Container Service for Kubernetes - "cluster": null, + "cluster": () => `https://console.aws.amazon.com/eks/home?region=${this.region}#/clusters/${this.resource}`, "fargateprofile": null, - "nodegroup": null, + "nodegroup": () => { + const arr = this.resource.split('/'); + const clusterName = arr[0]; + const nodegroupName = arr[1]; + return `https://console.aws.amazon.com/eks/home?region=${this.region}#/clusters/${clusterName}/nodegroups/${nodegroupName}` + }, }, "elastic-inference": { // Amazon Elastic Inference "elastic-inference-accelerator": null, diff --git a/testcases/aws.json b/testcases/aws.json index 61c06e5..1d324a0 100644 --- a/testcases/aws.json +++ b/testcases/aws.json @@ -68,5 +68,8 @@ "arn:aws:rds:us-east-1:123456789012:og:test-db": "https://console.aws.amazon.com/rds/home?region=us-east-1#option-group-details:option-group-name=test-db", "arn:aws:rds:us-east-1:123456789012:cluster:test-cluster": "https://console.aws.amazon.com/rds/home?region=us-east-1#database:id=test-cluster;is-cluster=true", - "arn:aws:kms:us-east-1:123456789012:key/4bd42b4b-af95-4698-b685-58d3296890fe": "https://console.aws.amazon.com/kms/home?region=us-east-1#/kms/keys/4bd42b4b-af95-4698-b685-58d3296890fe" + "arn:aws:kms:us-east-1:123456789012:key/4bd42b4b-af95-4698-b685-58d3296890fe": "https://console.aws.amazon.com/kms/home?region=us-east-1#/kms/keys/4bd42b4b-af95-4698-b685-58d3296890fe", + + "arn:aws:eks:us-east-1:123456789012:cluster/test-cluster": "https://console.aws.amazon.com/eks/home?region=us-east-1#/clusters/test-cluster", + "arn:aws:eks:us-east-1:123456789012:nodegroup/test-cluster/test-workers/a2c51527-da50-031f-1130-c5d5d77be06c": "https://console.aws.amazon.com/eks/home?region=us-east-1#/clusters/test-cluster/nodegroups/test-workers" } \ No newline at end of file From f7dd36b84a85b8d70722bc6e4f1e5eb35b33f4e1 Mon Sep 17 00:00:00 2001 From: Thomas Winsnes Date: Mon, 5 Feb 2024 15:35:33 +1100 Subject: [PATCH 08/10] Added template for backup vault --- link2aws.js | 2 +- testcases/aws.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/link2aws.js b/link2aws.js index 78ef076..ae8a708 100644 --- a/link2aws.js +++ b/link2aws.js @@ -200,7 +200,7 @@ class ARN { }, "backup": { // AWS Backup "backup-plan": null, - "backup-vault": null, + "backup-vault": () => `https://console.aws.amazon.com/backup/home?region=${this.region}#/backupvaults/details/${this.resource}`, }, "batch": { // AWS Batch "job-definition": null, diff --git a/testcases/aws.json b/testcases/aws.json index 1d324a0..39fe5e4 100644 --- a/testcases/aws.json +++ b/testcases/aws.json @@ -71,5 +71,7 @@ "arn:aws:kms:us-east-1:123456789012:key/4bd42b4b-af95-4698-b685-58d3296890fe": "https://console.aws.amazon.com/kms/home?region=us-east-1#/kms/keys/4bd42b4b-af95-4698-b685-58d3296890fe", "arn:aws:eks:us-east-1:123456789012:cluster/test-cluster": "https://console.aws.amazon.com/eks/home?region=us-east-1#/clusters/test-cluster", - "arn:aws:eks:us-east-1:123456789012:nodegroup/test-cluster/test-workers/a2c51527-da50-031f-1130-c5d5d77be06c": "https://console.aws.amazon.com/eks/home?region=us-east-1#/clusters/test-cluster/nodegroups/test-workers" + "arn:aws:eks:us-east-1:123456789012:nodegroup/test-cluster/test-workers/a2c51527-da50-031f-1130-c5d5d77be06c": "https://console.aws.amazon.com/eks/home?region=us-east-1#/clusters/test-cluster/nodegroups/test-workers", + + "arn:aws:backup:us-east-1:123456789012:backup-vault:backups-primary": "https://console.aws.amazon.com/backup/home?region=us-east-1#/backupvaults/details/backups-primary" } \ No newline at end of file From 6f4e1b96fb1ca4ce92656e62a13c0e4b225d8e58 Mon Sep 17 00:00:00 2001 From: Thomas Winsnes Date: Mon, 5 Feb 2024 15:38:42 +1100 Subject: [PATCH 09/10] Added template for kinesis delivery stream --- link2aws.js | 2 +- testcases/aws.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/link2aws.js b/link2aws.js index ae8a708..92d5fa5 100644 --- a/link2aws.js +++ b/link2aws.js @@ -505,7 +505,7 @@ class ARN { "execute-api": { // Amazon API Gateway }, "firehose": { // Amazon Kinesis Firehose - "deliverystream": null, + "deliverystream": () => `https://console.aws.amazon.com/firehose/home?region=${this.region}#/details/${this.resource}/monitoring`, }, "fms": { // AWS Firewall Manager "policy": null, diff --git a/testcases/aws.json b/testcases/aws.json index 39fe5e4..1f95c71 100644 --- a/testcases/aws.json +++ b/testcases/aws.json @@ -73,5 +73,7 @@ "arn:aws:eks:us-east-1:123456789012:cluster/test-cluster": "https://console.aws.amazon.com/eks/home?region=us-east-1#/clusters/test-cluster", "arn:aws:eks:us-east-1:123456789012:nodegroup/test-cluster/test-workers/a2c51527-da50-031f-1130-c5d5d77be06c": "https://console.aws.amazon.com/eks/home?region=us-east-1#/clusters/test-cluster/nodegroups/test-workers", - "arn:aws:backup:us-east-1:123456789012:backup-vault:backups-primary": "https://console.aws.amazon.com/backup/home?region=us-east-1#/backupvaults/details/backups-primary" + "arn:aws:backup:us-east-1:123456789012:backup-vault:backups-primary": "https://console.aws.amazon.com/backup/home?region=us-east-1#/backupvaults/details/backups-primary", + + "arn:aws:firehose:us-east-1:123456789012:deliverystream/test-stream": "https://console.aws.amazon.com/firehose/home?region=us-east-1#/details/test-stream/monitoring" } \ No newline at end of file From 79626cfedae70942062ab7c885587cf4918032ef Mon Sep 17 00:00:00 2001 From: Thomas Winsnes Date: Mon, 5 Feb 2024 16:36:44 +1100 Subject: [PATCH 10/10] Fixed up issues pointed out in code reivew --- link2aws.js | 30 ++++++++++++++---------------- test/test.js | 4 ++++ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/link2aws.js b/link2aws.js index 92d5fa5..5e0b774 100644 --- a/link2aws.js +++ b/link2aws.js @@ -54,8 +54,6 @@ class ARN { throw Error("Bad number of tokens"); } - console.log(this); - this._linkTemplates = this._getLinkTemplates(); } @@ -192,7 +190,7 @@ class ARN { "autoscaling": { // Amazon EC2 Auto Scaling "autoScalingGroup": () => { const groupName = this.resource.split('/')[1]; - return `https://${this.region}.console.aws.amazon.com/ec2/home?region=${this.region}#AutoScalingGroupDetails:id=${groupName};view=details` + return `https://${this.region}.${this.console}/ec2/home?region=${this.region}#AutoScalingGroupDetails:id=${groupName};view=details` }, "launchConfiguration": null, }, @@ -200,7 +198,7 @@ class ARN { }, "backup": { // AWS Backup "backup-plan": null, - "backup-vault": () => `https://console.aws.amazon.com/backup/home?region=${this.region}#/backupvaults/details/${this.resource}`, + "backup-vault": () => `https://${this.console}/backup/home?region=${this.region}#/backupvaults/details/${this.resource}`, }, "batch": { // AWS Batch "job-definition": null, @@ -234,7 +232,7 @@ class ARN { "stackset": null, }, "cloudfront": { // Amazon CloudFront - "distribution": () => `https://console.aws.amazon.com/cloudfront/v4/home#/distributions/${this.resource}`, + "distribution": () => `https://${this.console}/cloudfront/v4/home#/distributions/${this.resource}`, "origin-access-identity": null, "streaming-distribution": null, }, @@ -455,13 +453,13 @@ class ARN { "task-set": null, }, "eks": { // Amazon Elastic Container Service for Kubernetes - "cluster": () => `https://console.aws.amazon.com/eks/home?region=${this.region}#/clusters/${this.resource}`, + "cluster": () => `https://${this.console}/eks/home?region=${this.region}#/clusters/${this.resource}`, "fargateprofile": null, "nodegroup": () => { const arr = this.resource.split('/'); const clusterName = arr[0]; const nodegroupName = arr[1]; - return `https://console.aws.amazon.com/eks/home?region=${this.region}#/clusters/${clusterName}/nodegroups/${nodegroupName}` + return `https://${this.console}/eks/home?region=${this.region}#/clusters/${clusterName}/nodegroups/${nodegroupName}` }, }, "elastic-inference": { // Amazon Elastic Inference @@ -505,7 +503,7 @@ class ARN { "execute-api": { // Amazon API Gateway }, "firehose": { // Amazon Kinesis Firehose - "deliverystream": () => `https://console.aws.amazon.com/firehose/home?region=${this.region}#/details/${this.resource}/monitoring`, + "deliverystream": () => `https://${this.console}/firehose/home?region=${this.region}#/details/${this.resource}/monitoring`, }, "fms": { // AWS Firewall Manager "policy": null, @@ -671,7 +669,7 @@ class ARN { }, "kms": { // AWS Key Management Service "alias": null, - "key": () => `https://console.aws.amazon.com/kms/home?region=${this.region}#/kms/keys/${this.resource}`, + "key": () => `https://${this.console}/kms/home?region=${this.region}#/kms/keys/${this.resource}`, }, "lambda": { // AWS Lambda "event-source-mapping": null, @@ -836,19 +834,19 @@ class ARN { "resource-share-invitation": null, }, "rds": { // Amazon RDS - "cluster": () => `https://console.aws.amazon.com/rds/home?region=${this.region}#database:id=${this.resource};is-cluster=true`, + "cluster": () => `https://${this.console}/rds/home?region=${this.region}#database:id=${this.resource};is-cluster=true`, "cluster-endpoint": null, "cluster-pg": null, "cluster-snapshot": null, - "db": () => `https://console.aws.amazon.com/rds/home?region=${this.region}#database:id=${this.resource}`, + "db": () => `https://${this.console}/rds/home?region=${this.region}#database:id=${this.resource}`, "db-proxy": null, "es": null, - "og": () => `https://console.aws.amazon.com/rds/home?region=${this.region}#option-group-details:option-group-name=${this.resource}`, + "og": () => `https://${this.console}/rds/home?region=${this.region}#option-group-details:option-group-name=${this.resource}`, "pg": null, "ri": null, "secgrp": null, - "snapshot": () => `https://console.aws.amazon.com/rds/home?region=${this.region}#db-snapshot:id=${this.resource}`, - "subgrp": () => `https://console.aws.amazon.com/rds/home?region=${this.region}#db-subnet-group:id=${this.resource}`, + "snapshot": () => `https://${this.console}/rds/home?region=${this.region}#db-snapshot:id=${this.resource}`, + "subgrp": () => `https://${this.console}/rds/home?region=${this.region}#db-subnet-group:id=${this.resource}`, "target": null, "target-group": null, }, @@ -1059,11 +1057,11 @@ class ARN { "wafv2": { // AWS WAF V2 "global": () => { const resource = this.resource.replace("webacl/", ""); - return `https://console.aws.amazon.com/wafv2/homev2/web-acl/${resource}/overview?region=global` + return `https://${this.console}/wafv2/homev2/web-acl/${resource}/overview?region=global` }, "regional": () => { const resource = this.resource.replace("webacl/", ""); - return `https://console.aws.amazon.com/wafv2/homev2/web-acl/${resource}/overview?region=${this.region}` + return `https://${this.console}/wafv2/homev2/web-acl/${resource}/overview?region=${this.region}` } }, "wellarchitected": { // AWS Well-Architected Tool diff --git a/test/test.js b/test/test.js index 464055d..aba2db9 100644 --- a/test/test.js +++ b/test/test.js @@ -13,6 +13,7 @@ describe('main.ARN', function () { it('should tokenize ARNs without resource-type', function () { var arn = new main.ARN('arn:partition:service:region:account-id:resource-id'); + assert.equal(arn.arn, 'arn:partition:service:region:account-id:resource-id'); assert.equal(arn.prefix, 'arn'); assert.equal(arn.partition, 'partition'); assert.equal(arn.service, 'service'); @@ -24,6 +25,7 @@ describe('main.ARN', function () { it('should tokenize ARNs with resource-type/resource-id', function () { var arn = new main.ARN('arn:partition:service:region:account-id:resource-type/resource-id'); + assert.equal(arn.arn, 'arn:partition:service:region:account-id:resource-type/resource-id') assert.equal(arn.prefix, 'arn'); assert.equal(arn.partition, 'partition'); assert.equal(arn.service, 'service'); @@ -35,6 +37,7 @@ describe('main.ARN', function () { it('should tokenize ARNs with resource-type:resource-id', function () { var arn = new main.ARN('arn:partition:service:region:account-id:resource-type:resource-id'); + assert.equal(arn.arn, 'arn:partition:service:region:account-id:resource-type:resource-id'); assert.equal(arn.prefix, 'arn'); assert.equal(arn.partition, 'partition'); assert.equal(arn.service, 'service'); @@ -47,6 +50,7 @@ describe('main.ARN', function () { it('should tokenize ARNs with resource-type:resource-id-qualifier-1:qualifier-2:qualifier-3', function () { var arn = new main.ARN('arn:partition:service:region:account-id:resource-type:resource-id-qualifier-1:qualifier-2:qualifier-3'); + assert.equal(arn.arn, 'arn:partition:service:region:account-id:resource-type:resource-id-qualifier-1:qualifier-2:qualifier-3'); assert.equal(arn.prefix, 'arn'); assert.equal(arn.partition, 'partition'); assert.equal(arn.service, 'service');