diff --git a/clients/client-codepipeline/README.md b/clients/client-codepipeline/README.md index 7f02e94f1024..35afb9a1bf7c 100644 --- a/clients/client-codepipeline/README.md +++ b/clients/client-codepipeline/README.md @@ -660,6 +660,14 @@ RetryStageExecution [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/codepipeline/command/RetryStageExecutionCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codepipeline/Interface/RetryStageExecutionCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codepipeline/Interface/RetryStageExecutionCommandOutput/) + +
+ +RollbackStage + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/codepipeline/command/RollbackStageCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codepipeline/Interface/RollbackStageCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codepipeline/Interface/RollbackStageCommandOutput/) +
diff --git a/clients/client-codepipeline/src/CodePipeline.ts b/clients/client-codepipeline/src/CodePipeline.ts index b04255419fe8..85f74a62d267 100644 --- a/clients/client-codepipeline/src/CodePipeline.ts +++ b/clients/client-codepipeline/src/CodePipeline.ts @@ -156,6 +156,11 @@ import { RetryStageExecutionCommandInput, RetryStageExecutionCommandOutput, } from "./commands/RetryStageExecutionCommand"; +import { + RollbackStageCommand, + RollbackStageCommandInput, + RollbackStageCommandOutput, +} from "./commands/RollbackStageCommand"; import { StartPipelineExecutionCommand, StartPipelineExecutionCommandInput, @@ -217,6 +222,7 @@ const commands = { PutWebhookCommand, RegisterWebhookWithThirdPartyCommand, RetryStageExecutionCommand, + RollbackStageCommand, StartPipelineExecutionCommand, StopPipelineExecutionCommand, TagResourceCommand, @@ -732,6 +738,17 @@ export interface CodePipeline { cb: (err: any, data?: RetryStageExecutionCommandOutput) => void ): void; + /** + * @see {@link RollbackStageCommand} + */ + rollbackStage(args: RollbackStageCommandInput, options?: __HttpHandlerOptions): Promise; + rollbackStage(args: RollbackStageCommandInput, cb: (err: any, data?: RollbackStageCommandOutput) => void): void; + rollbackStage( + args: RollbackStageCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: RollbackStageCommandOutput) => void + ): void; + /** * @see {@link StartPipelineExecutionCommand} */ diff --git a/clients/client-codepipeline/src/CodePipelineClient.ts b/clients/client-codepipeline/src/CodePipelineClient.ts index 52ee00d45f5c..3c4a02120d2f 100644 --- a/clients/client-codepipeline/src/CodePipelineClient.ts +++ b/clients/client-codepipeline/src/CodePipelineClient.ts @@ -140,6 +140,7 @@ import { RetryStageExecutionCommandInput, RetryStageExecutionCommandOutput, } from "./commands/RetryStageExecutionCommand"; +import { RollbackStageCommandInput, RollbackStageCommandOutput } from "./commands/RollbackStageCommand"; import { StartPipelineExecutionCommandInput, StartPipelineExecutionCommandOutput, @@ -200,6 +201,7 @@ export type ServiceInputTypes = | PutWebhookCommandInput | RegisterWebhookWithThirdPartyCommandInput | RetryStageExecutionCommandInput + | RollbackStageCommandInput | StartPipelineExecutionCommandInput | StopPipelineExecutionCommandInput | TagResourceCommandInput @@ -244,6 +246,7 @@ export type ServiceOutputTypes = | PutWebhookCommandOutput | RegisterWebhookWithThirdPartyCommandOutput | RetryStageExecutionCommandOutput + | RollbackStageCommandOutput | StartPipelineExecutionCommandOutput | StopPipelineExecutionCommandOutput | TagResourceCommandOutput diff --git a/clients/client-codepipeline/src/commands/CreatePipelineCommand.ts b/clients/client-codepipeline/src/commands/CreatePipelineCommand.ts index 24012250054c..aeac29767c9d 100644 --- a/clients/client-codepipeline/src/commands/CreatePipelineCommand.ts +++ b/clients/client-codepipeline/src/commands/CreatePipelineCommand.ts @@ -100,6 +100,9 @@ export interface CreatePipelineCommandOutput extends CreatePipelineOutput, __Met * timeoutInMinutes: Number("int"), * }, * ], + * onFailure: { // FailureConditions + * result: "ROLLBACK", + * }, * }, * ], * version: Number("int"), @@ -241,6 +244,9 @@ export interface CreatePipelineCommandOutput extends CreatePipelineOutput, __Met * // timeoutInMinutes: Number("int"), * // }, * // ], + * // onFailure: { // FailureConditions + * // result: "ROLLBACK", + * // }, * // }, * // ], * // version: Number("int"), diff --git a/clients/client-codepipeline/src/commands/GetPipelineCommand.ts b/clients/client-codepipeline/src/commands/GetPipelineCommand.ts index 9bb37e2c9526..189784f11d15 100644 --- a/clients/client-codepipeline/src/commands/GetPipelineCommand.ts +++ b/clients/client-codepipeline/src/commands/GetPipelineCommand.ts @@ -102,6 +102,9 @@ export interface GetPipelineCommandOutput extends GetPipelineOutput, __MetadataB * // timeoutInMinutes: Number("int"), * // }, * // ], + * // onFailure: { // FailureConditions + * // result: "ROLLBACK", + * // }, * // }, * // ], * // version: Number("int"), diff --git a/clients/client-codepipeline/src/commands/GetPipelineExecutionCommand.ts b/clients/client-codepipeline/src/commands/GetPipelineExecutionCommand.ts index b5584ffca974..e866bf347015 100644 --- a/clients/client-codepipeline/src/commands/GetPipelineExecutionCommand.ts +++ b/clients/client-codepipeline/src/commands/GetPipelineExecutionCommand.ts @@ -66,10 +66,14 @@ export interface GetPipelineExecutionCommandOutput extends GetPipelineExecutionO * // }, * // ], * // trigger: { // ExecutionTrigger - * // triggerType: "CreatePipeline" || "StartPipelineExecution" || "PollForSourceChanges" || "Webhook" || "CloudWatchEvent" || "PutActionRevision" || "WebhookV2", + * // triggerType: "CreatePipeline" || "StartPipelineExecution" || "PollForSourceChanges" || "Webhook" || "CloudWatchEvent" || "PutActionRevision" || "WebhookV2" || "ManualRollback" || "AutomatedRollback", * // triggerDetail: "STRING_VALUE", * // }, * // executionMode: "QUEUED" || "SUPERSEDED" || "PARALLEL", + * // executionType: "STANDARD" || "ROLLBACK", + * // rollbackMetadata: { // PipelineRollbackMetadata + * // rollbackTargetPipelineExecutionId: "STRING_VALUE", + * // }, * // }, * // }; * diff --git a/clients/client-codepipeline/src/commands/GetPipelineStateCommand.ts b/clients/client-codepipeline/src/commands/GetPipelineStateCommand.ts index 1706566a4c25..7092ff824881 100644 --- a/clients/client-codepipeline/src/commands/GetPipelineStateCommand.ts +++ b/clients/client-codepipeline/src/commands/GetPipelineStateCommand.ts @@ -54,11 +54,13 @@ export interface GetPipelineStateCommandOutput extends GetPipelineStateOutput, _ * // inboundExecution: { // StageExecution * // pipelineExecutionId: "STRING_VALUE", // required * // status: "Cancelled" || "InProgress" || "Failed" || "Stopped" || "Stopping" || "Succeeded", // required + * // type: "STANDARD" || "ROLLBACK", * // }, * // inboundExecutions: [ // StageExecutionList * // { * // pipelineExecutionId: "STRING_VALUE", // required * // status: "Cancelled" || "InProgress" || "Failed" || "Stopped" || "Stopping" || "Succeeded", // required + * // type: "STANDARD" || "ROLLBACK", * // }, * // ], * // inboundTransitionState: { // TransitionState @@ -97,6 +99,7 @@ export interface GetPipelineStateCommandOutput extends GetPipelineStateOutput, _ * // latestExecution: { * // pipelineExecutionId: "STRING_VALUE", // required * // status: "Cancelled" || "InProgress" || "Failed" || "Stopped" || "Stopping" || "Succeeded", // required + * // type: "STANDARD" || "ROLLBACK", * // }, * // }, * // ], diff --git a/clients/client-codepipeline/src/commands/ListPipelineExecutionsCommand.ts b/clients/client-codepipeline/src/commands/ListPipelineExecutionsCommand.ts index 1f426dc1ec30..5a40e7d5f585 100644 --- a/clients/client-codepipeline/src/commands/ListPipelineExecutionsCommand.ts +++ b/clients/client-codepipeline/src/commands/ListPipelineExecutionsCommand.ts @@ -37,6 +37,11 @@ export interface ListPipelineExecutionsCommandOutput extends ListPipelineExecuti * const input = { // ListPipelineExecutionsInput * pipelineName: "STRING_VALUE", // required * maxResults: Number("int"), + * filter: { // PipelineExecutionFilter + * succeededInStage: { // SucceededInStageFilter + * stageName: "STRING_VALUE", + * }, + * }, * nextToken: "STRING_VALUE", * }; * const command = new ListPipelineExecutionsCommand(input); @@ -46,6 +51,7 @@ export interface ListPipelineExecutionsCommandOutput extends ListPipelineExecuti * // { // PipelineExecutionSummary * // pipelineExecutionId: "STRING_VALUE", * // status: "Cancelled" || "InProgress" || "Stopped" || "Stopping" || "Succeeded" || "Superseded" || "Failed", + * // statusSummary: "STRING_VALUE", * // startTime: new Date("TIMESTAMP"), * // lastUpdateTime: new Date("TIMESTAMP"), * // sourceRevisions: [ // SourceRevisionList @@ -57,13 +63,17 @@ export interface ListPipelineExecutionsCommandOutput extends ListPipelineExecuti * // }, * // ], * // trigger: { // ExecutionTrigger - * // triggerType: "CreatePipeline" || "StartPipelineExecution" || "PollForSourceChanges" || "Webhook" || "CloudWatchEvent" || "PutActionRevision" || "WebhookV2", + * // triggerType: "CreatePipeline" || "StartPipelineExecution" || "PollForSourceChanges" || "Webhook" || "CloudWatchEvent" || "PutActionRevision" || "WebhookV2" || "ManualRollback" || "AutomatedRollback", * // triggerDetail: "STRING_VALUE", * // }, * // stopTrigger: { // StopExecutionTrigger * // reason: "STRING_VALUE", * // }, * // executionMode: "QUEUED" || "SUPERSEDED" || "PARALLEL", + * // executionType: "STANDARD" || "ROLLBACK", + * // rollbackMetadata: { // PipelineRollbackMetadata + * // rollbackTargetPipelineExecutionId: "STRING_VALUE", + * // }, * // }, * // ], * // nextToken: "STRING_VALUE", diff --git a/clients/client-codepipeline/src/commands/RollbackStageCommand.ts b/clients/client-codepipeline/src/commands/RollbackStageCommand.ts new file mode 100644 index 000000000000..d7857be94415 --- /dev/null +++ b/clients/client-codepipeline/src/commands/RollbackStageCommand.ts @@ -0,0 +1,108 @@ +// smithy-typescript generated code +import { getEndpointPlugin } from "@smithy/middleware-endpoint"; +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { Command as $Command } from "@smithy/smithy-client"; +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; + +import { CodePipelineClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CodePipelineClient"; +import { commonParams } from "../endpoint/EndpointParameters"; +import { RollbackStageInput, RollbackStageOutput } from "../models/models_0"; +import { de_RollbackStageCommand, se_RollbackStageCommand } from "../protocols/Aws_json1_1"; + +/** + * @public + */ +export { __MetadataBearer, $Command }; +/** + * @public + * + * The input for {@link RollbackStageCommand}. + */ +export interface RollbackStageCommandInput extends RollbackStageInput {} +/** + * @public + * + * The output of {@link RollbackStageCommand}. + */ +export interface RollbackStageCommandOutput extends RollbackStageOutput, __MetadataBearer {} + +/** + *

Rolls back a stage execution.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { CodePipelineClient, RollbackStageCommand } from "@aws-sdk/client-codepipeline"; // ES Modules import + * // const { CodePipelineClient, RollbackStageCommand } = require("@aws-sdk/client-codepipeline"); // CommonJS import + * const client = new CodePipelineClient(config); + * const input = { // RollbackStageInput + * pipelineName: "STRING_VALUE", // required + * stageName: "STRING_VALUE", // required + * targetPipelineExecutionId: "STRING_VALUE", // required + * }; + * const command = new RollbackStageCommand(input); + * const response = await client.send(command); + * // { // RollbackStageOutput + * // pipelineExecutionId: "STRING_VALUE", // required + * // }; + * + * ``` + * + * @param RollbackStageCommandInput - {@link RollbackStageCommandInput} + * @returns {@link RollbackStageCommandOutput} + * @see {@link RollbackStageCommandInput} for command's `input` shape. + * @see {@link RollbackStageCommandOutput} for command's `response` shape. + * @see {@link CodePipelineClientResolvedConfig | config} for CodePipelineClient's `config` shape. + * + * @throws {@link ConflictException} (client fault) + *

Your request cannot be handled because the pipeline is busy handling ongoing + * activities. Try again later.

+ * + * @throws {@link PipelineExecutionNotFoundException} (client fault) + *

The pipeline execution was specified in an invalid format or cannot be found, or an + * execution ID does not belong to the specified pipeline.

+ * + * @throws {@link PipelineExecutionOutdatedException} (client fault) + *

The specified pipeline execution is outdated and cannot be used as a target pipeline execution for rollback.

+ * + * @throws {@link PipelineNotFoundException} (client fault) + *

The pipeline was specified in an invalid format or cannot be found.

+ * + * @throws {@link StageNotFoundException} (client fault) + *

The stage was specified in an invalid format or cannot be found.

+ * + * @throws {@link UnableToRollbackStageException} (client fault) + *

Unable to roll back the stage. The cause might be if the pipeline version has changed + * since the target pipeline execution was deployed, the stage is currently running, or an + * incorrect target pipeline execution ID was provided.

+ * + * @throws {@link ValidationException} (client fault) + *

The validation was specified in an invalid format.

+ * + * @throws {@link CodePipelineServiceException} + *

Base exception class for all service exceptions from CodePipeline service.

+ * + * @public + */ +export class RollbackStageCommand extends $Command + .classBuilder< + RollbackStageCommandInput, + RollbackStageCommandOutput, + CodePipelineClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep({ + ...commonParams, + }) + .m(function (this: any, Command: any, cs: any, config: CodePipelineClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("CodePipeline_20150709", "RollbackStage", {}) + .n("CodePipelineClient", "RollbackStageCommand") + .f(void 0, void 0) + .ser(se_RollbackStageCommand) + .de(de_RollbackStageCommand) + .build() {} diff --git a/clients/client-codepipeline/src/commands/UpdatePipelineCommand.ts b/clients/client-codepipeline/src/commands/UpdatePipelineCommand.ts index 01c41eb21b39..aacd466a62ee 100644 --- a/clients/client-codepipeline/src/commands/UpdatePipelineCommand.ts +++ b/clients/client-codepipeline/src/commands/UpdatePipelineCommand.ts @@ -97,6 +97,9 @@ export interface UpdatePipelineCommandOutput extends UpdatePipelineOutput, __Met * timeoutInMinutes: Number("int"), * }, * ], + * onFailure: { // FailureConditions + * result: "ROLLBACK", + * }, * }, * ], * version: Number("int"), @@ -232,6 +235,9 @@ export interface UpdatePipelineCommandOutput extends UpdatePipelineOutput, __Met * // timeoutInMinutes: Number("int"), * // }, * // ], + * // onFailure: { // FailureConditions + * // result: "ROLLBACK", + * // }, * // }, * // ], * // version: Number("int"), diff --git a/clients/client-codepipeline/src/commands/index.ts b/clients/client-codepipeline/src/commands/index.ts index 16ee896ff1d4..90b51e1559a3 100644 --- a/clients/client-codepipeline/src/commands/index.ts +++ b/clients/client-codepipeline/src/commands/index.ts @@ -32,6 +32,7 @@ export * from "./PutThirdPartyJobSuccessResultCommand"; export * from "./PutWebhookCommand"; export * from "./RegisterWebhookWithThirdPartyCommand"; export * from "./RetryStageExecutionCommand"; +export * from "./RollbackStageCommand"; export * from "./StartPipelineExecutionCommand"; export * from "./StopPipelineExecutionCommand"; export * from "./TagResourceCommand"; diff --git a/clients/client-codepipeline/src/models/models_0.ts b/clients/client-codepipeline/src/models/models_0.ts index 55b07654c6a3..8e7ff2997d69 100644 --- a/clients/client-codepipeline/src/models/models_0.ts +++ b/clients/client-codepipeline/src/models/models_0.ts @@ -1985,6 +1985,31 @@ export const PipelineType = { */ export type PipelineType = (typeof PipelineType)[keyof typeof PipelineType]; +/** + * @public + * @enum + */ +export const Result = { + ROLLBACK: "ROLLBACK", +} as const; + +/** + * @public + */ +export type Result = (typeof Result)[keyof typeof Result]; + +/** + *

The configuration that specifies the result, such as rollback, to occur upon stage failure.

+ * @public + */ +export interface FailureConditions { + /** + *

The specified result for when the failure conditions are met, such as rolling back the stage.

+ * @public + */ + result?: Result; +} + /** *

Represents information about a stage and its definition.

* @public @@ -2007,6 +2032,12 @@ export interface StageDeclaration { * @public */ actions: ActionDeclaration[] | undefined; + + /** + *

The method to use when a stage has not completed successfully. For example, configuring this field for rollback will roll back a failed stage automatically to the last successful pipeline execution in the stage.

+ * @public + */ + onFailure?: FailureConditions; } /** @@ -3073,6 +3104,32 @@ export interface GetPipelineExecutionInput { pipelineExecutionId: string | undefined; } +/** + * @public + * @enum + */ +export const ExecutionType = { + ROLLBACK: "ROLLBACK", + STANDARD: "STANDARD", +} as const; + +/** + * @public + */ +export type ExecutionType = (typeof ExecutionType)[keyof typeof ExecutionType]; + +/** + *

The metadata for the stage execution to be rolled back.

+ * @public + */ +export interface PipelineRollbackMetadata { + /** + *

The pipeline execution ID to which the stage will be rolled back.

+ * @public + */ + rollbackTargetPipelineExecutionId?: string; +} + /** * @public * @enum @@ -3097,8 +3154,10 @@ export type PipelineExecutionStatus = (typeof PipelineExecutionStatus)[keyof typ * @enum */ export const TriggerType = { + AutomatedRollback: "AutomatedRollback", CloudWatchEvent: "CloudWatchEvent", CreatePipeline: "CreatePipeline", + ManualRollback: "ManualRollback", PollForSourceChanges: "PollForSourceChanges", PutActionRevision: "PutActionRevision", StartPipelineExecution: "StartPipelineExecution", @@ -3239,6 +3298,18 @@ export interface PipelineExecution { * @public */ executionMode?: ExecutionMode; + + /** + *

The type of the pipeline execution.

+ * @public + */ + executionType?: ExecutionType; + + /** + *

The metadata about the execution pertaining to stage rollback.

+ * @public + */ + rollbackMetadata?: PipelineRollbackMetadata; } /** @@ -3325,6 +3396,12 @@ export interface StageExecution { * @public */ status: StageExecutionStatus | undefined; + + /** + *

The type of pipeline execution for the stage, such as a rollback pipeline execution.

+ * @public + */ + type?: ExecutionType; } /** @@ -3713,6 +3790,32 @@ export interface ListActionTypesOutput { nextToken?: string; } +/** + *

Filter for pipeline executions that have successfully completed the stage in the current pipeline version.

+ * @public + */ +export interface SucceededInStageFilter { + /** + *

The name of the stage for filtering for pipeline executions where the stage was successful in the current pipeline + * version.

+ * @public + */ + stageName?: string; +} + +/** + *

The pipeline execution to filter on.

+ * @public + */ +export interface PipelineExecutionFilter { + /** + *

Filter for pipeline executions where the stage was successful in the current pipeline + * version.

+ * @public + */ + succeededInStage?: SucceededInStageFilter; +} + /** *

Represents the input of a ListPipelineExecutions action.

* @public @@ -3734,6 +3837,12 @@ export interface ListPipelineExecutionsInput { */ maxResults?: number; + /** + *

The pipeline execution to filter on.

+ * @public + */ + filter?: PipelineExecutionFilter; + /** *

The token that was returned from the previous ListPipelineExecutions * call, which can be used to return the next set of pipeline executions in the @@ -3834,6 +3943,12 @@ export interface PipelineExecutionSummary { */ status?: PipelineExecutionStatus; + /** + *

Status summary for the pipeline.

+ * @public + */ + statusSummary?: string; + /** *

The date and time when the pipeline execution began, in timestamp format.

* @public @@ -3873,6 +3988,18 @@ export interface PipelineExecutionSummary { * @public */ executionMode?: ExecutionMode; + + /** + *

Type of the pipeline execution.

+ * @public + */ + executionType?: ExecutionType; + + /** + *

The metadata for the stage execution to be rolled back.

+ * @public + */ + rollbackMetadata?: PipelineRollbackMetadata; } /** @@ -5035,6 +5162,83 @@ export class StageNotRetryableException extends __BaseException { } } +/** + *

The specified pipeline execution is outdated and cannot be used as a target pipeline execution for rollback.

+ * @public + */ +export class PipelineExecutionOutdatedException extends __BaseException { + readonly name: "PipelineExecutionOutdatedException" = "PipelineExecutionOutdatedException"; + readonly $fault: "client" = "client"; + /** + * @internal + */ + constructor(opts: __ExceptionOptionType) { + super({ + name: "PipelineExecutionOutdatedException", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, PipelineExecutionOutdatedException.prototype); + } +} + +/** + * @public + */ +export interface RollbackStageInput { + /** + *

The name of the pipeline for which the stage will be rolled back.

+ * @public + */ + pipelineName: string | undefined; + + /** + *

The name of the stage in the pipeline to be rolled back.

+ * @public + */ + stageName: string | undefined; + + /** + *

The pipeline execution ID for the stage to be rolled back to.

+ * @public + */ + targetPipelineExecutionId: string | undefined; +} + +/** + * @public + */ +export interface RollbackStageOutput { + /** + *

The execution ID of the pipeline execution for the stage that has been rolled + * back.

+ * @public + */ + pipelineExecutionId: string | undefined; +} + +/** + *

Unable to roll back the stage. The cause might be if the pipeline version has changed + * since the target pipeline execution was deployed, the stage is currently running, or an + * incorrect target pipeline execution ID was provided.

+ * @public + */ +export class UnableToRollbackStageException extends __BaseException { + readonly name: "UnableToRollbackStageException" = "UnableToRollbackStageException"; + readonly $fault: "client" = "client"; + /** + * @internal + */ + constructor(opts: __ExceptionOptionType) { + super({ + name: "UnableToRollbackStageException", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, UnableToRollbackStageException.prototype); + } +} + /** *

The pipeline has reached the limit for concurrent pipeline executions.

* @public diff --git a/clients/client-codepipeline/src/protocols/Aws_json1_1.ts b/clients/client-codepipeline/src/protocols/Aws_json1_1.ts index 5104bf66c6c0..402b83d6a2d1 100644 --- a/clients/client-codepipeline/src/protocols/Aws_json1_1.ts +++ b/clients/client-codepipeline/src/protocols/Aws_json1_1.ts @@ -109,6 +109,7 @@ import { RetryStageExecutionCommandInput, RetryStageExecutionCommandOutput, } from "../commands/RetryStageExecutionCommand"; +import { RollbackStageCommandInput, RollbackStageCommandOutput } from "../commands/RollbackStageCommand"; import { StartPipelineExecutionCommandInput, StartPipelineExecutionCommandOutput, @@ -165,6 +166,7 @@ import { EncryptionKey, ExecutionDetails, ExecutorConfiguration, + FailureConditions, FailureDetails, GetActionTypeInput, GetJobDetailsInput, @@ -218,8 +220,10 @@ import { OutputVariablesSizeExceededException, PipelineDeclaration, PipelineExecution, + PipelineExecutionFilter, PipelineExecutionNotFoundException, PipelineExecutionNotStoppableException, + PipelineExecutionOutdatedException, PipelineExecutionSummary, PipelineMetadata, PipelineNameInUseException, @@ -244,6 +248,7 @@ import { RequestFailedException, ResourceNotFoundException, RetryStageExecutionInput, + RollbackStageInput, SourceRevisionOverride, StageDeclaration, StageNotFoundException, @@ -251,10 +256,12 @@ import { StageState, StartPipelineExecutionInput, StopPipelineExecutionInput, + SucceededInStageFilter, Tag, TagResourceInput, TooManyTagsException, TransitionState, + UnableToRollbackStageException, UntagResourceInput, UpdateActionTypeInput, UpdatePipelineInput, @@ -694,6 +701,19 @@ export const se_RetryStageExecutionCommand = async ( return buildHttpRpcRequest(context, headers, "/", undefined, body); }; +/** + * serializeAws_json1_1RollbackStageCommand + */ +export const se_RollbackStageCommand = async ( + input: RollbackStageCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = sharedHeaders("RollbackStage"); + let body: any; + body = JSON.stringify(_json(input)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + /** * serializeAws_json1_1StartPipelineExecutionCommand */ @@ -1408,6 +1428,26 @@ export const de_RetryStageExecutionCommand = async ( return response; }; +/** + * deserializeAws_json1_1RollbackStageCommand + */ +export const de_RollbackStageCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return de_CommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = _json(data); + const response: RollbackStageCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return response; +}; + /** * deserializeAws_json1_1StartPipelineExecutionCommand */ @@ -1634,6 +1674,12 @@ const de_CommandError = async (output: __HttpResponse, context: __SerdeContext): case "StageNotRetryableException": case "com.amazonaws.codepipeline#StageNotRetryableException": throw await de_StageNotRetryableExceptionRes(parsedOutput, context); + case "PipelineExecutionOutdatedException": + case "com.amazonaws.codepipeline#PipelineExecutionOutdatedException": + throw await de_PipelineExecutionOutdatedExceptionRes(parsedOutput, context); + case "UnableToRollbackStageException": + case "com.amazonaws.codepipeline#UnableToRollbackStageException": + throw await de_UnableToRollbackStageExceptionRes(parsedOutput, context); case "ConcurrentPipelineExecutionsLimitExceededException": case "com.amazonaws.codepipeline#ConcurrentPipelineExecutionsLimitExceededException": throw await de_ConcurrentPipelineExecutionsLimitExceededExceptionRes(parsedOutput, context); @@ -2079,6 +2125,22 @@ const de_PipelineExecutionNotStoppableExceptionRes = async ( return __decorateServiceException(exception, body); }; +/** + * deserializeAws_json1_1PipelineExecutionOutdatedExceptionRes + */ +const de_PipelineExecutionOutdatedExceptionRes = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = _json(body); + const exception = new PipelineExecutionOutdatedException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }); + return __decorateServiceException(exception, body); +}; + /** * deserializeAws_json1_1PipelineNameInUseExceptionRes */ @@ -2207,6 +2269,22 @@ const de_TooManyTagsExceptionRes = async ( return __decorateServiceException(exception, body); }; +/** + * deserializeAws_json1_1UnableToRollbackStageExceptionRes + */ +const de_UnableToRollbackStageExceptionRes = async ( + parsedOutput: any, + context: __SerdeContext +): Promise => { + const body = parsedOutput.body; + const deserialized: any = _json(body); + const exception = new UnableToRollbackStageException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }); + return __decorateServiceException(exception, body); +}; + /** * deserializeAws_json1_1ValidationExceptionRes */ @@ -2327,6 +2405,8 @@ const se_CurrentRevision = (input: CurrentRevision, context: __SerdeContext): an // se_ExecutorConfiguration omitted. +// se_FailureConditions omitted. + // se_FailureDetails omitted. // se_GetActionTypeInput omitted. @@ -2395,6 +2475,8 @@ const se_CurrentRevision = (input: CurrentRevision, context: __SerdeContext): an // se_PipelineDeclaration omitted. +// se_PipelineExecutionFilter omitted. + // se_PipelineStageDeclarationList omitted. // se_PipelineTriggerDeclaration omitted. @@ -2472,6 +2554,8 @@ const se_PutThirdPartyJobSuccessResultInput = ( // se_RetryStageExecutionInput omitted. +// se_RollbackStageInput omitted. + // se_SourceRevisionOverride omitted. // se_SourceRevisionOverrideList omitted. @@ -2496,6 +2580,8 @@ const se_StartPipelineExecutionInput = (input: StartPipelineExecutionInput, cont // se_StopPipelineExecutionInput omitted. +// se_SucceededInStageFilter omitted. + // se_Tag omitted. // se_TagKeyList omitted. @@ -2727,6 +2813,8 @@ const de_ArtifactRevisionList = (output: any, context: __SerdeContext): Artifact // de_ExecutorConfiguration omitted. +// de_FailureConditions omitted. + // de_GetActionTypeOutput omitted. // de_GetJobDetailsOutput omitted. @@ -2917,9 +3005,11 @@ const de_PipelineExecution = (output: any, context: __SerdeContext): PipelineExe return take(output, { artifactRevisions: (_: any) => de_ArtifactRevisionList(_, context), executionMode: __expectString, + executionType: __expectString, pipelineExecutionId: __expectString, pipelineName: __expectString, pipelineVersion: __expectInt32, + rollbackMetadata: _json, status: __expectString, statusSummary: __expectString, trigger: _json, @@ -2931,17 +3021,22 @@ const de_PipelineExecution = (output: any, context: __SerdeContext): PipelineExe // de_PipelineExecutionNotStoppableException omitted. +// de_PipelineExecutionOutdatedException omitted. + /** * deserializeAws_json1_1PipelineExecutionSummary */ const de_PipelineExecutionSummary = (output: any, context: __SerdeContext): PipelineExecutionSummary => { return take(output, { executionMode: __expectString, + executionType: __expectString, lastUpdateTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), pipelineExecutionId: __expectString, + rollbackMetadata: _json, sourceRevisions: _json, startTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), status: __expectString, + statusSummary: __expectString, stopTrigger: _json, trigger: _json, }) as any; @@ -2987,6 +3082,8 @@ const de_PipelineMetadata = (output: any, context: __SerdeContext): PipelineMeta // de_PipelineNotFoundException omitted. +// de_PipelineRollbackMetadata omitted. + // de_PipelineStageDeclarationList omitted. /** @@ -3055,6 +3152,8 @@ const de_PutWebhookOutput = (output: any, context: __SerdeContext): PutWebhookOu // de_RetryStageExecutionOutput omitted. +// de_RollbackStageOutput omitted. + // de_S3ArtifactLocation omitted. // de_S3Location omitted. @@ -3139,6 +3238,8 @@ const de_TransitionState = (output: any, context: __SerdeContext): TransitionSta }) as any; }; +// de_UnableToRollbackStageException omitted. + // de_UntagResourceOutput omitted. // de_UpdatePipelineOutput omitted. diff --git a/codegen/sdk-codegen/aws-models/codepipeline.json b/codegen/sdk-codegen/aws-models/codepipeline.json index acb236e96ec3..91eb0e9618ff 100644 --- a/codegen/sdk-codegen/aws-models/codepipeline.json +++ b/codegen/sdk-codegen/aws-models/codepipeline.json @@ -1858,6 +1858,9 @@ { "target": "com.amazonaws.codepipeline#RetryStageExecution" }, + { + "target": "com.amazonaws.codepipeline#RollbackStage" + }, { "target": "com.amazonaws.codepipeline#StartPipelineExecution" }, @@ -3584,6 +3587,23 @@ "smithy.api#documentation": "

The interaction or event that started a pipeline execution.

" } }, + "com.amazonaws.codepipeline#ExecutionType": { + "type": "enum", + "members": { + "STANDARD": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "STANDARD" + } + }, + "ROLLBACK": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ROLLBACK" + } + } + } + }, "com.amazonaws.codepipeline#ExecutorConfiguration": { "type": "structure", "members": { @@ -3627,6 +3647,20 @@ "com.amazonaws.codepipeline#ExternalExecutionSummary": { "type": "string" }, + "com.amazonaws.codepipeline#FailureConditions": { + "type": "structure", + "members": { + "result": { + "target": "com.amazonaws.codepipeline#Result", + "traits": { + "smithy.api#documentation": "

The specified result for when the failure conditions are met, such as rolling back the stage.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The configuration that specifies the result, such as rollback, to occur upon stage failure.

" + } + }, "com.amazonaws.codepipeline#FailureDetails": { "type": "structure", "members": { @@ -5072,6 +5106,12 @@ "smithy.api#documentation": "

The maximum number of results to return in a single call. To retrieve the remaining\n results, make another call with the returned nextToken value. Pipeline history is\n limited to the most recent 12 months, based on pipeline execution start times. Default\n value is 100.

" } }, + "filter": { + "target": "com.amazonaws.codepipeline#PipelineExecutionFilter", + "traits": { + "smithy.api#documentation": "

The pipeline execution to filter on.

" + } + }, "nextToken": { "target": "com.amazonaws.codepipeline#NextToken", "traits": { @@ -5715,12 +5755,38 @@ "traits": { "smithy.api#documentation": "

The method that the pipeline will use to handle multiple executions. The default\n mode is SUPERSEDED.

" } + }, + "executionType": { + "target": "com.amazonaws.codepipeline#ExecutionType", + "traits": { + "smithy.api#documentation": "

The type of the pipeline execution.

" + } + }, + "rollbackMetadata": { + "target": "com.amazonaws.codepipeline#PipelineRollbackMetadata", + "traits": { + "smithy.api#documentation": "

The metadata about the execution pertaining to stage rollback.

" + } } }, "traits": { "smithy.api#documentation": "

Represents information about an execution of a pipeline.

" } }, + "com.amazonaws.codepipeline#PipelineExecutionFilter": { + "type": "structure", + "members": { + "succeededInStage": { + "target": "com.amazonaws.codepipeline#SucceededInStageFilter", + "traits": { + "smithy.api#documentation": "

Filter for pipeline executions where the stage was successful in the current pipeline\n version.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The pipeline execution to filter on.

" + } + }, "com.amazonaws.codepipeline#PipelineExecutionId": { "type": "string", "traits": { @@ -5754,6 +5820,18 @@ "smithy.api#error": "client" } }, + "com.amazonaws.codepipeline#PipelineExecutionOutdatedException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.codepipeline#Message" + } + }, + "traits": { + "smithy.api#documentation": "

The specified pipeline execution is outdated and cannot be used as a target pipeline execution for rollback.

", + "smithy.api#error": "client" + } + }, "com.amazonaws.codepipeline#PipelineExecutionStatus": { "type": "enum", "members": { @@ -5819,6 +5897,12 @@ "smithy.api#documentation": "

The status of the pipeline execution.

\n
    \n
  • \n

    InProgress: The pipeline execution is currently running.

    \n
  • \n
  • \n

    Stopped: The pipeline execution was manually stopped. For more information,\n see Stopped Executions.

    \n
  • \n
  • \n

    Stopping: The pipeline execution received a request to be manually stopped.\n Depending on the selected stop mode, the execution is either completing or\n abandoning in-progress actions. For more information, see Stopped Executions.

    \n
  • \n
  • \n

    Succeeded: The pipeline execution was completed successfully.

    \n
  • \n
  • \n

    Superseded: While this pipeline execution was waiting for the next stage to\n be completed, a newer pipeline execution advanced and continued through the\n pipeline instead. For more information, see Superseded Executions.

    \n
  • \n
  • \n

    Failed: The pipeline execution was not completed successfully.

    \n
  • \n
" } }, + "statusSummary": { + "target": "com.amazonaws.codepipeline#PipelineExecutionStatusSummary", + "traits": { + "smithy.api#documentation": "

Status summary for the pipeline.

" + } + }, "startTime": { "target": "com.amazonaws.codepipeline#Timestamp", "traits": { @@ -5854,6 +5938,18 @@ "traits": { "smithy.api#documentation": "

The method that the pipeline will use to handle multiple executions. The default\n mode is SUPERSEDED.

" } + }, + "executionType": { + "target": "com.amazonaws.codepipeline#ExecutionType", + "traits": { + "smithy.api#documentation": "

Type of the pipeline execution.

" + } + }, + "rollbackMetadata": { + "target": "com.amazonaws.codepipeline#PipelineRollbackMetadata", + "traits": { + "smithy.api#documentation": "

The metadata for the stage execution to be rolled back.

" + } } }, "traits": { @@ -5944,6 +6040,20 @@ "smithy.api#error": "client" } }, + "com.amazonaws.codepipeline#PipelineRollbackMetadata": { + "type": "structure", + "members": { + "rollbackTargetPipelineExecutionId": { + "target": "com.amazonaws.codepipeline#PipelineExecutionId", + "traits": { + "smithy.api#documentation": "

The pipeline execution ID to which the stage will be rolled back.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

The metadata for the stage execution to be rolled back.

" + } + }, "com.amazonaws.codepipeline#PipelineStageDeclarationList": { "type": "list", "member": { @@ -6952,6 +7062,17 @@ "smithy.api#error": "client" } }, + "com.amazonaws.codepipeline#Result": { + "type": "enum", + "members": { + "ROLLBACK": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ROLLBACK" + } + } + } + }, "com.amazonaws.codepipeline#RetryStageExecution": { "type": "operation", "input": { @@ -7073,6 +7194,85 @@ "smithy.api#pattern": "^arn:aws(-[\\w]+)*:iam::[0-9]{12}:role/" } }, + "com.amazonaws.codepipeline#RollbackStage": { + "type": "operation", + "input": { + "target": "com.amazonaws.codepipeline#RollbackStageInput" + }, + "output": { + "target": "com.amazonaws.codepipeline#RollbackStageOutput" + }, + "errors": [ + { + "target": "com.amazonaws.codepipeline#ConflictException" + }, + { + "target": "com.amazonaws.codepipeline#PipelineExecutionNotFoundException" + }, + { + "target": "com.amazonaws.codepipeline#PipelineExecutionOutdatedException" + }, + { + "target": "com.amazonaws.codepipeline#PipelineNotFoundException" + }, + { + "target": "com.amazonaws.codepipeline#StageNotFoundException" + }, + { + "target": "com.amazonaws.codepipeline#UnableToRollbackStageException" + }, + { + "target": "com.amazonaws.codepipeline#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

Rolls back a stage execution.

" + } + }, + "com.amazonaws.codepipeline#RollbackStageInput": { + "type": "structure", + "members": { + "pipelineName": { + "target": "com.amazonaws.codepipeline#PipelineName", + "traits": { + "smithy.api#documentation": "

The name of the pipeline for which the stage will be rolled back.

", + "smithy.api#required": {} + } + }, + "stageName": { + "target": "com.amazonaws.codepipeline#StageName", + "traits": { + "smithy.api#documentation": "

The name of the stage in the pipeline to be rolled back.

", + "smithy.api#required": {} + } + }, + "targetPipelineExecutionId": { + "target": "com.amazonaws.codepipeline#PipelineExecutionId", + "traits": { + "smithy.api#documentation": "

The pipeline execution ID for the stage to be rolled back to.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.codepipeline#RollbackStageOutput": { + "type": "structure", + "members": { + "pipelineExecutionId": { + "target": "com.amazonaws.codepipeline#PipelineExecutionId", + "traits": { + "smithy.api#documentation": "

The execution ID of the pipeline execution for the stage that has been rolled\n back.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.codepipeline#S3ArtifactLocation": { "type": "structure", "members": { @@ -7311,6 +7511,12 @@ "smithy.api#documentation": "

The actions included in a stage.

", "smithy.api#required": {} } + }, + "onFailure": { + "target": "com.amazonaws.codepipeline#FailureConditions", + "traits": { + "smithy.api#documentation": "

The method to use when a stage has not completed successfully. For example, configuring this field for rollback will roll back a failed stage automatically to the last successful pipeline execution in the stage.

" + } } }, "traits": { @@ -7333,6 +7539,12 @@ "smithy.api#documentation": "

The status of the stage, or for a completed stage, the last status of the\n stage.

\n \n

A status of cancelled means that the pipeline’s definition was updated before the\n stage execution could be completed.

\n
", "smithy.api#required": {} } + }, + "type": { + "target": "com.amazonaws.codepipeline#ExecutionType", + "traits": { + "smithy.api#documentation": "

The type of pipeline execution for the stage, such as a rollback pipeline execution.

" + } } }, "traits": { @@ -7704,6 +7916,20 @@ "com.amazonaws.codepipeline#String": { "type": "string" }, + "com.amazonaws.codepipeline#SucceededInStageFilter": { + "type": "structure", + "members": { + "stageName": { + "target": "com.amazonaws.codepipeline#StageName", + "traits": { + "smithy.api#documentation": "

The name of the stage for filtering for pipeline executions where the stage was successful in the current pipeline\n version.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Filter for pipeline executions that have successfully completed the stage in the current pipeline version.

" + } + }, "com.amazonaws.codepipeline#Tag": { "type": "structure", "members": { @@ -8038,9 +8264,33 @@ "traits": { "smithy.api#enumValue": "WebhookV2" } + }, + "ManualRollback": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "ManualRollback" + } + }, + "AutomatedRollback": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "AutomatedRollback" + } } } }, + "com.amazonaws.codepipeline#UnableToRollbackStageException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.codepipeline#String" + } + }, + "traits": { + "smithy.api#documentation": "

Unable to roll back the stage. The cause might be if the pipeline version has changed\n since the target pipeline execution was deployed, the stage is currently running, or an\n incorrect target pipeline execution ID was provided.

", + "smithy.api#error": "client" + } + }, "com.amazonaws.codepipeline#UntagResource": { "type": "operation", "input": {