Skip to content

Commit

Permalink
Merge pull request #66 from dleavitt/secretsmanager
Browse files Browse the repository at this point in the history
Add secretsmanager
  • Loading branch information
fxkr authored Aug 29, 2024
2 parents 13202af + 4980e53 commit 2233a61
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 8 additions & 1 deletion link2aws.js
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,14 @@ class ARN {
"domain": null,
},
"secretsmanager": { // AWS Secrets Manager
"secret": null,
"secret": () => {
const arnSuffix = /-\w{6}$/;
if (!arnSuffix.test(this.resource)) {
throw Error(`Secret ARN for "${this.resource}" appears invalid, should end with ${arnSuffix}`);
}
const name = this.resource.replace(arnSuffix, "");
return `https://${this.region}.${this.console}/${this.service}/${this.resource_type}?name=${name}`;
},
},
"securityhub": { // AWS Security Hub
"hub": null,
Expand Down
3 changes: 2 additions & 1 deletion testcases/aws-negative.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@
"arn:aws:ec2:us-ea st-1:123456789012:instance/asdf",
"arn:aws:ec2:us-ea*st-1:123456789012:instance/asdf",
"arn:aws:ec2:us-ea#st-1:123456789012:instance/asdf",
"arn:aws:ec2:us-ea\\st-1:123456789012:instance/asdf"
"arn:aws:ec2:us-ea\\st-1:123456789012:instance/asdf",
"arn:aws:secretsmanager:us-west-2:123456789012:secret:MySecret9A3F29-adf"
]
3 changes: 2 additions & 1 deletion testcases/aws.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"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",

"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",
"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"
"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",

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

0 comments on commit 2233a61

Please sign in to comment.