@cloud-copilot/iam-simulate
Version:
Simulate evaluation of AWS IAM policies
38 lines • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AwsRequestImpl = void 0;
const requestAction_js_1 = require("./requestAction.js");
const requestPrincipal_js_1 = require("./requestPrincipal.js");
const requestResource_js_1 = require("./requestResource.js");
class AwsRequestImpl {
principalString;
resourceIdentifier;
actionString;
context;
constructor(principalString, resourceIdentifier, actionString, context) {
this.principalString = principalString;
this.resourceIdentifier = resourceIdentifier;
this.actionString = actionString;
this.context = context;
}
get action() {
return new requestAction_js_1.RequestActionImpl(this.actionString);
}
get resource() {
return new requestResource_js_1.ResourceRequestImpl(this.resourceIdentifier.resource, this.resourceIdentifier.accountId);
}
get principal() {
return new requestPrincipal_js_1.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);
}
}
exports.AwsRequestImpl = AwsRequestImpl;
//# sourceMappingURL=request.js.map