UNPKG

2.04 kBTypeScriptView Raw
1import { IPostProcessor, IResolvable, IResolveContext } from '@aws-cdk/core';
2import { IConstruct } from 'constructs';
3import { IPolicy } from './policy';
4export declare const LITERAL_STRING_KEY = "LiteralString";
5export declare function undefinedIfEmpty(f: () => string[]): string[];
6/**
7 * Used to generate a unique policy name based on the policy resource construct.
8 * The logical ID of the resource is a great candidate as long as it doesn't exceed
9 * 128 characters, so we take the last 128 characters (in order to make sure the hash
10 * is there).
11 */
12export declare function generatePolicyName(scope: IConstruct, logicalId: string): string;
13/**
14 * Helper class that maintains the set of attached policies for a principal.
15 */
16export declare class AttachedPolicies {
17 private policies;
18 /**
19 * Adds a policy to the list of attached policies.
20 *
21 * If this policy is already, attached, returns false.
22 * If there is another policy attached with the same name, throws an exception.
23 */
24 attach(policy: IPolicy): void;
25}
26/**
27 * Merge two dictionaries that represent IAM principals
28 *
29 * Does an in-place merge.
30 */
31export declare function mergePrincipal(target: {
32 [key: string]: string[];
33}, source: {
34 [key: string]: string[];
35}): {
36 [key: string]: string[];
37};
38/**
39 * Lazy string set token that dedupes entries
40 *
41 * Needs to operate post-resolve, because the inputs could be
42 * `[ '${Token[TOKEN.9]}', '${Token[TOKEN.10]}', '${Token[TOKEN.20]}' ]`, which
43 * still all resolve to the same string value.
44 *
45 * Needs to JSON.stringify() results because strings could resolve to literal
46 * strings but could also resolve to `{ Fn::Join: [...] }`.
47 */
48export declare class UniqueStringSet implements IResolvable, IPostProcessor {
49 private readonly fn;
50 static from(fn: () => string[]): string[];
51 readonly creationStack: string[];
52 private constructor();
53 resolve(context: IResolveContext): string[];
54 postProcess(input: any, _context: IResolveContext): any;
55 toString(): string;
56}