link2aws 1.0.8 → 1.0.10

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 (2) hide show
  1. package/link2aws.js +8 -3
  2. package/package.json +1 -1
package/link2aws.js CHANGED
@@ -74,6 +74,11 @@ class ARN {
74
74
  return this.resource.split(':');
75
75
  }
76
76
 
77
+ get pathAllButLast() {
78
+ // Example: "aws-service-role/support.amazonaws.com/AWSServiceRoleForSupport" -> "aws-service-role/support.amazonaws.com"
79
+ return this.resource.substr(0, this.resource.lastIndexOf('/'));
80
+ }
81
+
77
82
  get pathLast() {
78
83
  // Example: "aws-service-role/support.amazonaws.com/AWSServiceRoleForSupport" -> "AWSServiceRoleForSupport"
79
84
  return this.resource.substr(this.resource.lastIndexOf('/') + 1, this.resource.length);
@@ -412,10 +417,10 @@ class ARN {
412
417
  "repository": null,
413
418
  },
414
419
  "ecs": { // Amazon Elastic Container Service
415
- "cluster": null,
420
+ "cluster": () => `https://${this.region}.${this.console}/ecs/home?region=${this.region}#/clusters/${this.resource}`,
416
421
  "container-instance": null,
417
422
  "service": null,
418
- "task": null,
423
+ "task": () => `https://${this.region}.${this.console}/ecs/home?region=${this.region}#/clusters/${this.pathAllButLast}/tasks/${this.pathLast}`,
419
424
  "task-definition": null,
420
425
  "task-set": null,
421
426
  },
@@ -664,7 +669,7 @@ class ARN {
664
669
  "StaticIp": null,
665
670
  },
666
671
  "logs": { // Amazon CloudWatch Logs
667
- "log-group": null,
672
+ "log-group": () => `https://${this.region}.${this.console}/cloudwatch/home?region=${this.region}#logsV2:log-groups/log-group/${this.resource.replace(/:\*$/, "").replace(/#/g, "$2523").replace(/[/]/g, "$252F")}`,
668
673
  },
669
674
  "machinelearning": { // Amazon Machine Learning
670
675
  "batchprediction": null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "link2aws",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Convert ARN (Amazon Resource Name) to AWS Console link",
5
5
  "main": "link2aws.js",
6
6
  "directories": {