@cloud-copilot/iam-lens
Version:
Visibility in IAM in and across AWS accounts
43 lines • 934 B
JavaScript
import { splitArnParts } from '@cloud-copilot/iam-utils';
export class Arn {
constructor(arn) {
this.arn = arn;
this.parts = 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;
});
}
}
//# sourceMappingURL=arn.js.map