UNPKG

4.32 kBTypeScriptView Raw
1import * as cxschema from '@aws-cdk/cloud-assembly-schema';
2import { DockerImageAssetLocation, DockerImageAssetSource, FileAssetLocation, FileAssetSource } from '../assets';
3import { ISynthesisSession } from '../construct-compat';
4import { Stack } from '../stack';
5import { IStackSynthesizer } from './types';
6/**
7 * Base class for implementing an IStackSynthesizer
8 *
9 * This class needs to exist to provide public surface area for external
10 * implementations of stack synthesizers. The protected methods give
11 * access to functions that are otherwise @_internal to the framework
12 * and could not be accessed by external implementors.
13 */
14export declare abstract class StackSynthesizer implements IStackSynthesizer {
15 /**
16 * Bind to the stack this environment is going to be used on
17 *
18 * Must be called before any of the other methods are called.
19 */
20 abstract bind(stack: Stack): void;
21 /**
22 * Register a File Asset
23 *
24 * Returns the parameters that can be used to refer to the asset inside the template.
25 */
26 abstract addFileAsset(asset: FileAssetSource): FileAssetLocation;
27 /**
28 * Register a Docker Image Asset
29 *
30 * Returns the parameters that can be used to refer to the asset inside the template.
31 */
32 abstract addDockerImageAsset(asset: DockerImageAssetSource): DockerImageAssetLocation;
33 /**
34 * Synthesize the associated stack to the session
35 */
36 abstract synthesize(session: ISynthesisSession): void;
37 /**
38 * Have the stack write out its template
39 */
40 protected synthesizeStackTemplate(stack: Stack, session: ISynthesisSession): void;
41 /**
42 * Write the stack artifact to the session
43 *
44 * Use default settings to add a CloudFormationStackArtifact artifact to
45 * the given synthesis session.
46 */
47 protected emitStackArtifact(stack: Stack, session: ISynthesisSession, options?: SynthesizeStackArtifactOptions): void;
48}
49/**
50 * Stack artifact options
51 *
52 * A subset of `cxschema.AwsCloudFormationStackProperties` of optional settings that need to be
53 * configurable by synthesizers, plus `additionalDependencies`.
54 */
55export interface SynthesizeStackArtifactOptions {
56 /**
57 * Identifiers of additional dependencies
58 *
59 * @default - No additional dependencies
60 */
61 readonly additionalDependencies?: string[];
62 /**
63 * Values for CloudFormation stack parameters that should be passed when the stack is deployed.
64 *
65 * @default - No parameters
66 */
67 readonly parameters?: {
68 [id: string]: string;
69 };
70 /**
71 * The role that needs to be assumed to deploy the stack
72 *
73 * @default - No role is assumed (current credentials are used)
74 */
75 readonly assumeRoleArn?: string;
76 /**
77 * The externalID to use with the assumeRoleArn
78 *
79 * @default - No externalID is used
80 */
81 readonly assumeRoleExternalId?: string;
82 /**
83 * The role that is passed to CloudFormation to execute the change set
84 *
85 * @default - No role is passed (currently assumed role/credentials are used)
86 */
87 readonly cloudFormationExecutionRoleArn?: string;
88 /**
89 * The role to use to look up values from the target AWS account
90 *
91 * @default - None
92 */
93 readonly lookupRole?: cxschema.BootstrapRole;
94 /**
95 * If the stack template has already been included in the asset manifest, its asset URL
96 *
97 * @default - Not uploaded yet, upload just before deploying
98 */
99 readonly stackTemplateAssetObjectUrl?: string;
100 /**
101 * Version of bootstrap stack required to deploy this stack
102 *
103 * @default - No bootstrap stack required
104 */
105 readonly requiresBootstrapStackVersion?: number;
106 /**
107 * SSM parameter where the bootstrap stack version number can be found
108 *
109 * Only used if `requiresBootstrapStackVersion` is set.
110 *
111 * - If this value is not set, the bootstrap stack name must be known at
112 * deployment time so the stack version can be looked up from the stack
113 * outputs.
114 * - If this value is set, the bootstrap stack can have any name because
115 * we won't need to look it up.
116 *
117 * @default - Bootstrap stack version number looked up
118 */
119 readonly bootstrapStackVersionSsmParameter?: string;
120}