link2aws 1.0.13 → 1.0.15

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 +22 -8
  2. package/package.json +1 -1
package/link2aws.js CHANGED
@@ -17,12 +17,21 @@ class ARN {
17
17
  this.service = tokens[2];
18
18
  this.region = tokens[3];
19
19
  this.account = tokens[4];
20
+ this.resource_revision = '';
20
21
 
21
22
  // ...:resource-type:resource-id (resource-id can contain colons!)
22
23
  if (typeof (tokens[6]) != 'undefined') {
23
- this.resource_type = tokens[5];
24
- this.resource = tokens[6];
25
- this.hasPath = false;
24
+ if (tokens[5].indexOf('/') > 0) {
25
+ this.resource_type = tokens[5].slice(0, tokens[5].indexOf('/'));
26
+ this.resource = tokens[5].slice(tokens[5].indexOf('/') + 1, tokens[5].length);
27
+ this.resource_revision = tokens[6]
28
+ this.hasPath = true;
29
+ }
30
+ else{
31
+ this.resource_type = tokens[5];
32
+ this.resource = tokens[6];
33
+ this.hasPath = false;
34
+ }
26
35
  }
27
36
 
28
37
  // ...:resource-type/resource-id (resource-id can contain slashes!)
@@ -51,7 +60,12 @@ class ARN {
51
60
  if (!this.resource_type) {
52
61
  return `${this.prefix}:${this.partition}:${this.service}:${this.region}:${this.account}:${this.resource}`;
53
62
  } else if (this.hasPath) {
54
- return `${this.prefix}:${this.partition}:${this.service}:${this.region}:${this.account}:${this.resource_type}/${this.resource}`
63
+ if (this.resource_revision != '') {
64
+ return `${this.prefix}:${this.partition}:${this.service}:${this.region}:${this.account}:${this.resource_type}/${this.resource}:${this.resource_revision}`
65
+ }
66
+ else {
67
+ return `${this.prefix}:${this.partition}:${this.service}:${this.region}:${this.account}:${this.resource_type}/${this.resource}`
68
+ }
55
69
  } else {
56
70
  return `${this.prefix}:${this.partition}:${this.service}:${this.region}:${this.account}:${this.resource_type}:${this.resource}`
57
71
  }
@@ -427,11 +441,11 @@ class ARN {
427
441
  "repository": null,
428
442
  },
429
443
  "ecs": { // Amazon Elastic Container Service
430
- "cluster": () => `https://${this.region}.${this.console}/ecs/home?region=${this.region}#/clusters/${this.resource}`,
444
+ "cluster": () => `https://${this.region}.${this.console}/ecs/v2/clusters/${this.resource}?region=${this.region}`,
431
445
  "container-instance": null,
432
- "service": () => `https://${this.region}.${this.console}/ecs/home?region=${this.region}#/clusters/${this.pathAllButLast}/services/${this.pathLast}/details`,
433
- "task": () => `https://${this.region}.${this.console}/ecs/home?region=${this.region}#/clusters/${this.pathAllButLast}/tasks/${this.pathLast}`,
434
- "task-definition": null,
446
+ "service": () => `https://${this.region}.${this.console}/ecs/v2/clusters/${this.pathAllButLast}/services/${this.pathLast}?region=${this.region}`,
447
+ "task": () => `https://${this.region}.${this.console}/ecs/v2/clusters/${this.pathAllButLast}/tasks/${this.pathLast}?region=${this.region}`,
448
+ "task-definition": () => `https://${this.region}.${this.console}/ecs/v2/task-definitions/${this.resource}/${this.resource_revision}?region=${this.region}`,
435
449
  "task-set": null,
436
450
  },
437
451
  "eks": { // Amazon Elastic Container Service for Kubernetes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "link2aws",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "Convert ARN (Amazon Resource Name) to AWS Console link",
5
5
  "main": "link2aws.js",
6
6
  "directories": {