UNPKG

@cloud-copilot/iam-simulate

Version:
30 lines 1.1 kB
import { RequestActionImpl } from './requestAction.js'; import { RequestPrincipalImpl } from './requestPrincipal.js'; import { ResourceRequestImpl } from './requestResource.js'; export class AwsRequestImpl { constructor(principalString, resourceIdentifier, actionString, context) { this.principalString = principalString; this.resourceIdentifier = resourceIdentifier; this.actionString = actionString; this.context = context; } get action() { return new RequestActionImpl(this.actionString); } get resource() { return new ResourceRequestImpl(this.resourceIdentifier.resource, this.resourceIdentifier.accountId); } get principal() { return new RequestPrincipalImpl(this.principalString); } contextKeyExists(key) { return this.context.contextKeyExists(key); } getContextKeyValue(key) { if (!this.contextKeyExists(key)) { throw new Error(`Invalid context key: ${key}`); } return this.context.contextKeyValue(key); } } //# sourceMappingURL=request.js.map