1 | import * as notifications from '@aws-cdk/aws-codestarnotifications';
|
2 | import * as events from '@aws-cdk/aws-events';
|
3 | import * as iam from '@aws-cdk/aws-iam';
|
4 | import * as s3 from '@aws-cdk/aws-s3';
|
5 | import { IResource } from '@aws-cdk/core';
|
6 | import { Artifact } from './artifact';
|
7 | import { Construct } from '@aws-cdk/core';
|
8 | export declare enum ActionCategory {
|
9 | SOURCE = "Source",
|
10 | BUILD = "Build",
|
11 | TEST = "Test",
|
12 | APPROVAL = "Approval",
|
13 | DEPLOY = "Deploy",
|
14 | INVOKE = "Invoke"
|
15 | }
|
16 | /**
|
17 | * Specifies the constraints on the number of input and output
|
18 | * artifacts an action can have.
|
19 | *
|
20 | * The constraints for each action type are documented on the
|
21 | * {@link https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html Pipeline Structure Reference} page.
|
22 | */
|
23 | export interface ActionArtifactBounds {
|
24 | readonly minInputs: number;
|
25 | readonly maxInputs: number;
|
26 | readonly minOutputs: number;
|
27 | readonly maxOutputs: number;
|
28 | }
|
29 | /**
|
30 | * The CodePipeline variables that are global,
|
31 | * not bound to a specific action.
|
32 | * This class defines a bunch of static fields that represent the different variables.
|
33 | * These can be used can be used in any action configuration.
|
34 | */
|
35 | export declare class GlobalVariables {
|
36 | /** The identifier of the current pipeline execution. */
|
37 | static readonly executionId = "#{codepipeline.PipelineExecutionId}";
|
38 | }
|
39 | export interface ActionProperties {
|
40 | readonly actionName: string;
|
41 | readonly role?: iam.IRole;
|
42 | /**
|
43 | * The AWS region the given Action resides in.
|
44 | * Note that a cross-region Pipeline requires replication buckets to function correctly.
|
45 | * You can provide their names with the {@link PipelineProps#crossRegionReplicationBuckets} property.
|
46 | * If you don't, the CodePipeline Construct will create new Stacks in your CDK app containing those buckets,
|
47 | * that you will need to `cdk deploy` before deploying the main, Pipeline-containing Stack.
|
48 | *
|
49 | * @default the Action resides in the same region as the Pipeline
|
50 | */
|
51 | readonly region?: string;
|
52 | /**
|
53 | * The account the Action is supposed to live in.
|
54 | * For Actions backed by resources,
|
55 | * this is inferred from the Stack {@link resource} is part of.
|
56 | * However, some Actions, like the CloudFormation ones,
|
57 | * are not backed by any resource, and they still might want to be cross-account.
|
58 | * In general, a concrete Action class should specify either {@link resource},
|
59 | * or {@link account} - but not both.
|
60 | */
|
61 | readonly account?: string;
|
62 | /**
|
63 | * The optional resource that is backing this Action.
|
64 | * This is used for automatically handling Actions backed by
|
65 | * resources from a different account and/or region.
|
66 | */
|
67 | readonly resource?: IResource;
|
68 | /**
|
69 | * The category of the action.
|
70 | * The category defines which action type the owner
|
71 | * (the entity that performs the action) performs.
|
72 | */
|
73 | readonly category: ActionCategory;
|
74 | /**
|
75 | * The service provider that the action calls.
|
76 | */
|
77 | readonly provider: string;
|
78 | readonly owner?: string;
|
79 | readonly version?: string;
|
80 | /**
|
81 | * The order in which AWS CodePipeline runs this action.
|
82 | * For more information, see the AWS CodePipeline User Guide.
|
83 | *
|
84 | * https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html#action-requirements
|
85 | */
|
86 | readonly runOrder?: number;
|
87 | readonly artifactBounds: ActionArtifactBounds;
|
88 | readonly inputs?: Artifact[];
|
89 | readonly outputs?: Artifact[];
|
90 | /**
|
91 | * The name of the namespace to use for variables emitted by this action.
|
92 | *
|
93 | * @default - a name will be generated, based on the stage and action names
|
94 | */
|
95 | readonly variablesNamespace?: string;
|
96 | }
|
97 | export interface ActionBindOptions {
|
98 | readonly role: iam.IRole;
|
99 | readonly bucket: s3.IBucket;
|
100 | }
|
101 | export interface ActionConfig {
|
102 | readonly configuration?: any;
|
103 | }
|
104 | /**
|
105 | * Additional options to pass to the notification rule.
|
106 | */
|
107 | export interface PipelineNotifyOnOptions extends notifications.NotificationRuleOptions {
|
108 | /**
|
109 | * A list of event types associated with this notification rule for CodePipeline Pipeline.
|
110 | * For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide.
|
111 | * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#concepts-api
|
112 | */
|
113 | readonly events: PipelineNotificationEvents[];
|
114 | }
|
115 | /**
|
116 | * A Pipeline Action.
|
117 | * If you want to implement this interface,
|
118 | * consider extending the {@link Action} class,
|
119 | * which contains some common logic.
|
120 | */
|
121 | export interface IAction {
|
122 | /**
|
123 | * The simple properties of the Action,
|
124 | * like its Owner, name, etc.
|
125 | * Note that this accessor will be called before the {@link bind} callback.
|
126 | */
|
127 | readonly actionProperties: ActionProperties;
|
128 | /**
|
129 | * The callback invoked when this Action is added to a Pipeline.
|
130 | *
|
131 | * @param scope the Construct tree scope the Action can use if it needs to create any resources
|
132 | * @param stage the {@link IStage} this Action is being added to
|
133 | * @param options additional options the Action can use,
|
134 | * like the artifact Bucket of the pipeline it's being added to
|
135 | */
|
136 | bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig;
|
137 | /**
|
138 | * Creates an Event that will be triggered whenever the state of this Action changes.
|
139 | *
|
140 | * @param name the name to use for the new Event
|
141 | * @param target the optional target for the Event
|
142 | * @param options additional options that can be used to customize the created Event
|
143 | */
|
144 | onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps): events.Rule;
|
145 | }
|
146 | /**
|
147 | * The abstract view of an AWS CodePipeline as required and used by Actions.
|
148 | * It extends {@link events.IRuleTarget},
|
149 | * so this interface can be used as a Target for CloudWatch Events.
|
150 | */
|
151 | export interface IPipeline extends IResource, notifications.INotificationRuleSource {
|
152 | /**
|
153 | * The name of the Pipeline.
|
154 | *
|
155 | * @attribute
|
156 | */
|
157 | readonly pipelineName: string;
|
158 | /**
|
159 | * The ARN of the Pipeline.
|
160 | *
|
161 | * @attribute
|
162 | */
|
163 | readonly pipelineArn: string;
|
164 | /**
|
165 | * Define an event rule triggered by this CodePipeline.
|
166 | *
|
167 | * @param id Identifier for this event handler.
|
168 | * @param options Additional options to pass to the event rule.
|
169 | */
|
170 | onEvent(id: string, options?: events.OnEventOptions): events.Rule;
|
171 | /**
|
172 | * Define an event rule triggered by the "CodePipeline Pipeline Execution
|
173 | * State Change" event emitted from this pipeline.
|
174 | *
|
175 | * @param id Identifier for this event handler.
|
176 | * @param options Additional options to pass to the event rule.
|
177 | */
|
178 | onStateChange(id: string, options?: events.OnEventOptions): events.Rule;
|
179 | /**
|
180 | * Defines a CodeStar notification rule triggered when the pipeline
|
181 | * events emitted by you specified, it very similar to `onEvent` API.
|
182 | *
|
183 | * You can also use the methods `notifyOnExecutionStateChange`, `notifyOnAnyStageStateChange`,
|
184 | * `notifyOnAnyActionStateChange` and `notifyOnAnyManualApprovalStateChange`
|
185 | * to define rules for these specific event emitted.
|
186 | *
|
187 | * @param id The id of the CodeStar notification rule
|
188 | * @param target The target to register for the CodeStar Notifications destination.
|
189 | * @param options Customization options for CodeStar notification rule
|
190 | * @returns CodeStar notification rule associated with this build project.
|
191 | */
|
192 | notifyOn(id: string, target: notifications.INotificationRuleTarget, options: PipelineNotifyOnOptions): notifications.INotificationRule;
|
193 | /**
|
194 | * Define an notification rule triggered by the set of the "Pipeline execution" events emitted from this pipeline.
|
195 | * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline
|
196 | *
|
197 | * @param id Identifier for this notification handler.
|
198 | * @param target The target to register for the CodeStar Notifications destination.
|
199 | * @param options Additional options to pass to the notification rule.
|
200 | */
|
201 | notifyOnExecutionStateChange(id: string, target: notifications.INotificationRuleTarget, options?: notifications.NotificationRuleOptions): notifications.INotificationRule;
|
202 | /**
|
203 | * Define an notification rule triggered by the set of the "Stage execution" events emitted from this pipeline.
|
204 | * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline
|
205 | *
|
206 | * @param id Identifier for this notification handler.
|
207 | * @param target The target to register for the CodeStar Notifications destination.
|
208 | * @param options Additional options to pass to the notification rule.
|
209 | */
|
210 | notifyOnAnyStageStateChange(id: string, target: notifications.INotificationRuleTarget, options?: notifications.NotificationRuleOptions): notifications.INotificationRule;
|
211 | /**
|
212 | * Define an notification rule triggered by the set of the "Action execution" events emitted from this pipeline.
|
213 | * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline
|
214 | *
|
215 | * @param id Identifier for this notification handler.
|
216 | * @param target The target to register for the CodeStar Notifications destination.
|
217 | * @param options Additional options to pass to the notification rule.
|
218 | */
|
219 | notifyOnAnyActionStateChange(id: string, target: notifications.INotificationRuleTarget, options?: notifications.NotificationRuleOptions): notifications.INotificationRule;
|
220 | /**
|
221 | * Define an notification rule triggered by the set of the "Manual approval" events emitted from this pipeline.
|
222 | * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline
|
223 | *
|
224 | * @param id Identifier for this notification handler.
|
225 | * @param target The target to register for the CodeStar Notifications destination.
|
226 | * @param options Additional options to pass to the notification rule.
|
227 | */
|
228 | notifyOnAnyManualApprovalStateChange(id: string, target: notifications.INotificationRuleTarget, options?: notifications.NotificationRuleOptions): notifications.INotificationRule;
|
229 | }
|
230 | /**
|
231 | * The abstract interface of a Pipeline Stage that is used by Actions.
|
232 | */
|
233 | export interface IStage {
|
234 | /**
|
235 | * The physical, human-readable name of this Pipeline Stage.
|
236 | */
|
237 | readonly stageName: string;
|
238 | readonly pipeline: IPipeline;
|
239 | /**
|
240 | * The actions belonging to this stage.
|
241 | */
|
242 | readonly actions: IAction[];
|
243 | addAction(action: IAction): void;
|
244 | onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps): events.Rule;
|
245 | }
|
246 | /**
|
247 | * Common properties shared by all Actions.
|
248 | */
|
249 | export interface CommonActionProps {
|
250 | /**
|
251 | * The physical, human-readable name of the Action.
|
252 | * Note that Action names must be unique within a single Stage.
|
253 | */
|
254 | readonly actionName: string;
|
255 | /**
|
256 | * The runOrder property for this Action.
|
257 | * RunOrder determines the relative order in which multiple Actions in the same Stage execute.
|
258 | *
|
259 | * @default 1
|
260 | * @see https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html
|
261 | */
|
262 | readonly runOrder?: number;
|
263 | /**
|
264 | * The name of the namespace to use for variables emitted by this action.
|
265 | *
|
266 | * @default - a name will be generated, based on the stage and action names,
|
267 | * if any of the action's variables were referenced - otherwise,
|
268 | * no namespace will be set
|
269 | */
|
270 | readonly variablesNamespace?: string;
|
271 | }
|
272 | /**
|
273 | * Common properties shared by all Actions whose {@link ActionProperties.owner} field is 'AWS'
|
274 | * (or unset, as 'AWS' is the default).
|
275 | */
|
276 | export interface CommonAwsActionProps extends CommonActionProps {
|
277 | /**
|
278 | * The Role in which context's this Action will be executing in.
|
279 | * The Pipeline's Role will assume this Role
|
280 | * (the required permissions for that will be granted automatically)
|
281 | * right before executing this Action.
|
282 | * This Action will be passed into your {@link IAction.bind}
|
283 | * method in the {@link ActionBindOptions.role} property.
|
284 | *
|
285 | * @default a new Role will be generated
|
286 | */
|
287 | readonly role?: iam.IRole;
|
288 | }
|
289 | /**
|
290 | * Low-level class for generic CodePipeline Actions implementing the {@link IAction} interface.
|
291 | * Contains some common logic that can be re-used by all {@link IAction} implementations.
|
292 | * If you're writing your own Action class,
|
293 | * feel free to extend this class.
|
294 | */
|
295 | export declare abstract class Action implements IAction {
|
296 | /**
|
297 | * This is a renamed version of the {@link IAction.actionProperties} property.
|
298 | */
|
299 | protected abstract readonly providedActionProperties: ActionProperties;
|
300 | private __actionProperties?;
|
301 | private __pipeline?;
|
302 | private __stage?;
|
303 | private __scope?;
|
304 | private readonly _namespaceToken;
|
305 | private _customerProvidedNamespace?;
|
306 | private _actualNamespace?;
|
307 | private _variableReferenced;
|
308 | protected constructor();
|
309 | get actionProperties(): ActionProperties;
|
310 | bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig;
|
311 | onStateChange(name: string, target?: events.IRuleTarget, options?: events.RuleProps): events.Rule;
|
312 | protected variableExpression(variableName: string): string;
|
313 | /**
|
314 | * This is a renamed version of the { IAction.bind} method.
|
315 | */
|
316 | protected abstract bound(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig;
|
317 | private get _pipeline();
|
318 | private get _stage();
|
319 | /**
|
320 | * Retrieves the Construct scope of this Action.
|
321 | * Only available after the Action has been added to a Stage,
|
322 | * and that Stage to a Pipeline.
|
323 | */
|
324 | private get _scope();
|
325 | }
|
326 | /**
|
327 | * The list of event types for AWS Codepipeline Pipeline
|
328 | * @see https://docs.aws.amazon.com/dtconsole/latest/userguide/concepts.html#events-ref-pipeline
|
329 | */
|
330 | export declare enum PipelineNotificationEvents {
|
331 | /**
|
332 | * Trigger notification when pipeline execution failed
|
333 | */
|
334 | PIPELINE_EXECUTION_FAILED = "codepipeline-pipeline-pipeline-execution-failed",
|
335 | /**
|
336 | * Trigger notification when pipeline execution canceled
|
337 | */
|
338 | PIPELINE_EXECUTION_CANCELED = "codepipeline-pipeline-pipeline-execution-canceled",
|
339 | /**
|
340 | * Trigger notification when pipeline execution started
|
341 | */
|
342 | PIPELINE_EXECUTION_STARTED = "codepipeline-pipeline-pipeline-execution-started",
|
343 | /**
|
344 | * Trigger notification when pipeline execution resumed
|
345 | */
|
346 | PIPELINE_EXECUTION_RESUMED = "codepipeline-pipeline-pipeline-execution-resumed",
|
347 | /**
|
348 | * Trigger notification when pipeline execution succeeded
|
349 | */
|
350 | PIPELINE_EXECUTION_SUCCEEDED = "codepipeline-pipeline-pipeline-execution-succeeded",
|
351 | /**
|
352 | * Trigger notification when pipeline execution superseded
|
353 | */
|
354 | PIPELINE_EXECUTION_SUPERSEDED = "codepipeline-pipeline-pipeline-execution-superseded",
|
355 | /**
|
356 | * Trigger notification when pipeline stage execution started
|
357 | */
|
358 | STAGE_EXECUTION_STARTED = "codepipeline-pipeline-stage-execution-started",
|
359 | /**
|
360 | * Trigger notification when pipeline stage execution succeeded
|
361 | */
|
362 | STAGE_EXECUTION_SUCCEEDED = "codepipeline-pipeline-stage-execution-succeeded",
|
363 | /**
|
364 | * Trigger notification when pipeline stage execution resumed
|
365 | */
|
366 | STAGE_EXECUTION_RESUMED = "codepipeline-pipeline-stage-execution-resumed",
|
367 | /**
|
368 | * Trigger notification when pipeline stage execution canceled
|
369 | */
|
370 | STAGE_EXECUTION_CANCELED = "codepipeline-pipeline-stage-execution-canceled",
|
371 | /**
|
372 | * Trigger notification when pipeline stage execution failed
|
373 | */
|
374 | STAGE_EXECUTION_FAILED = "codepipeline-pipeline-stage-execution-failed",
|
375 | /**
|
376 | * Trigger notification when pipeline action execution succeeded
|
377 | */
|
378 | ACTION_EXECUTION_SUCCEEDED = "codepipeline-pipeline-action-execution-succeeded",
|
379 | /**
|
380 | * Trigger notification when pipeline action execution failed
|
381 | */
|
382 | ACTION_EXECUTION_FAILED = "codepipeline-pipeline-action-execution-failed",
|
383 | /**
|
384 | * Trigger notification when pipeline action execution canceled
|
385 | */
|
386 | ACTION_EXECUTION_CANCELED = "codepipeline-pipeline-action-execution-canceled",
|
387 | /**
|
388 | * Trigger notification when pipeline action execution started
|
389 | */
|
390 | ACTION_EXECUTION_STARTED = "codepipeline-pipeline-action-execution-started",
|
391 | /**
|
392 | * Trigger notification when pipeline manual approval failed
|
393 | */
|
394 | MANUAL_APPROVAL_FAILED = "codepipeline-pipeline-manual-approval-failed",
|
395 | /**
|
396 | * Trigger notification when pipeline manual approval needed
|
397 | */
|
398 | MANUAL_APPROVAL_NEEDED = "codepipeline-pipeline-manual-approval-needed",
|
399 | /**
|
400 | * Trigger notification when pipeline manual approval succeeded
|
401 | */
|
402 | MANUAL_APPROVAL_SUCCEEDED = "codepipeline-pipeline-manual-approval-succeeded"
|
403 | }
|