Skip to content

Commit 2233a61

Browse files
authored
Merge pull request #66 from dleavitt/secretsmanager
Add secretsmanager
2 parents 13202af + 4980e53 commit 2233a61

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

link2aws.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,14 @@ class ARN {
978978
"domain": null,
979979
},
980980
"secretsmanager": { // AWS Secrets Manager
981-
"secret": null,
981+
"secret": () => {
982+
const arnSuffix = /-\w{6}$/;
983+
if (!arnSuffix.test(this.resource)) {
984+
throw Error(`Secret ARN for "${this.resource}" appears invalid, should end with ${arnSuffix}`);
985+
}
986+
const name = this.resource.replace(arnSuffix, "");
987+
return `https://${this.region}.${this.console}/${this.service}/${this.resource_type}?name=${name}`;
988+
},
982989
},
983990
"securityhub": { // AWS Security Hub
984991
"hub": null,

testcases/aws-negative.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@
3838
"arn:aws:ec2:us-ea st-1:123456789012:instance/asdf",
3939
"arn:aws:ec2:us-ea*st-1:123456789012:instance/asdf",
4040
"arn:aws:ec2:us-ea#st-1:123456789012:instance/asdf",
41-
"arn:aws:ec2:us-ea\\st-1:123456789012:instance/asdf"
41+
"arn:aws:ec2:us-ea\\st-1:123456789012:instance/asdf",
42+
"arn:aws:secretsmanager:us-west-2:123456789012:secret:MySecret9A3F29-adf"
4243
]

testcases/aws.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"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",
8787

8888
"arn:aws:codeconnections:us-west-2:384862141196:connection/f8234ecc-8990-4e63-b25a-ec36764b7701": "https://us-west-2.console.aws.amazon.com/codesuite/settings/384862141196/us-west-2/codeconnections/connections/f8234ecc-8990-4e63-b25a-ec36764b7701",
89-
"arn:aws:codestar-connections:us-west-2:384862141196:connection/f8234ecc-8990-4e63-b25a-ec36764b7701": "https://us-west-2.console.aws.amazon.com/codesuite/settings/384862141196/us-west-2/codestar-connections/connections/f8234ecc-8990-4e63-b25a-ec36764b7701"
89+
"arn:aws:codestar-connections:us-west-2:384862141196:connection/f8234ecc-8990-4e63-b25a-ec36764b7701": "https://us-west-2.console.aws.amazon.com/codesuite/settings/384862141196/us-west-2/codestar-connections/connections/f8234ecc-8990-4e63-b25a-ec36764b7701",
9090

91+
"arn:aws:secretsmanager:us-west-2:123456789012:secret:MySecret9A3F29-vdHtS43BP1i1-knwb3S": "https://us-west-2.console.aws.amazon.com/secretsmanager/secret?name=MySecret9A3F29-vdHtS43BP1i1"
9192
}

0 commit comments

Comments
 (0)