@cloud-copilot/iam-simulate
Version:
Simulate evaluation of AWS IAM policies
56 lines • 1.85 kB
TypeScript
import { ContextKey, RequestContext } from '../requestContext.js';
import { RequestAction } from './requestAction.js';
import { RequestPrincipal } from './requestPrincipal.js';
import { RequestResource } from './requestResource.js';
/**
* A request to be evaluated by the policy engine
*/
export interface AwsRequest {
principal: RequestPrincipal;
/**
* The action to be performed
*/
action: RequestAction;
/**
* The resource to be acted upon
*/
resource: RequestResource;
/**
* The context of the request
*/
context: RequestContext;
/**
* Checks to see if a context key is valid for the request and
* exists in the context
*
* @param key the key to check for existence
* @returns true if the key is valid for the request and exists in the request context.
*/
contextKeyExists(key: string): boolean;
/**
* Gets the value of a context key, if it is valid for the request and exist, otherwise throws an error
* @param key the key to get the value of
*
* @returns the value of the context key
*/
getContextKeyValue(key: string): ContextKey;
}
export declare class AwsRequestImpl implements AwsRequest {
readonly principalString: string;
readonly resourceIdentifier: {
resource: string;
accountId: string;
};
readonly actionString: string;
readonly context: RequestContext;
constructor(principalString: string, resourceIdentifier: {
resource: string;
accountId: string;
}, actionString: string, context: RequestContext);
get action(): RequestAction;
get resource(): RequestResource;
get principal(): RequestPrincipal;
contextKeyExists(key: string): boolean;
getContextKeyValue(key: string): ContextKey;
}
//# sourceMappingURL=request.d.ts.map