@cloud-copilot/iam-lens
Version:
Visibility in IAM in and across AWS accounts
49 lines • 1.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Arn = void 0;
const iam_utils_1 = require("@cloud-copilot/iam-utils");
class Arn {
arn;
parts;
constructor(arn) {
this.arn = arn;
this.parts = (0, iam_utils_1.splitArnParts)(arn);
}
get service() {
return this.parts.service;
}
get partition() {
return this.parts.partition;
}
get region() {
return this.parts.region;
}
get accountId() {
return this.parts.accountId;
}
get resourceType() {
return this.parts.resourceType;
}
get resourcePath() {
return this.parts.resourcePath;
}
get resource() {
return this.parts.resource || '';
}
get value() {
return this.arn;
}
/**
* Check
*
* @param parts
* @returns
*/
matches(parts) {
return Object.entries(parts).every(([key, value]) => {
return this.parts[key] === value;
});
}
}
exports.Arn = Arn;
//# sourceMappingURL=arn.js.map