Skip to content

Commit

Permalink
feat(client-cloudformation): Specify desired CloudFormation behavior …
Browse files Browse the repository at this point in the history
…in the event of ChangeSet execution failure using the CreateChangeSet OnStackFailure parameter
  • Loading branch information
awstools committed Jun 19, 2023
1 parent 880a917 commit a02f0d7
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export interface CreateChangeSetCommandOutput extends CreateChangeSetOutput, __M
* },
* ],
* IncludeNestedStacks: true || false,
* OnStackFailure: "DO_NOTHING" || "ROLLBACK" || "DELETE",
* };
* const command = new CreateChangeSetCommand(input);
* const response = await client.send(command);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export interface DescribeChangeSetCommandOutput extends DescribeChangeSetOutput,
* // IncludeNestedStacks: true || false,
* // ParentChangeSetId: "STRING_VALUE",
* // RootChangeSetId: "STRING_VALUE",
* // OnStackFailure: "DO_NOTHING" || "ROLLBACK" || "DELETE",
* // };
*
* ```
Expand Down
89 changes: 88 additions & 1 deletion clients/client-cloudformation/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,21 @@ export interface ContinueUpdateRollbackInput {
*/
export interface ContinueUpdateRollbackOutput {}

/**
* @public
* @enum
*/
export const OnStackFailure = {
DELETE: "DELETE",
DO_NOTHING: "DO_NOTHING",
ROLLBACK: "ROLLBACK",
} as const;

/**
* @public
*/
export type OnStackFailure = (typeof OnStackFailure)[keyof typeof OnStackFailure];

/**
* @public
* <p>The Parameter data type.</p>
Expand Down Expand Up @@ -1762,6 +1777,36 @@ export interface CreateChangeSetInput {
* set to <code>False</code>. To include nested sets in a change set, specify <code>True</code>.</p>
*/
IncludeNestedStacks?: boolean;

/**
* <p>Determines what action will be taken if stack creation fails. If this parameter is specified, the
* <code>DisableRollback</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html">ExecuteChangeSet</a> API operation must not
* be specified. This must be one of these values:</p>
* <ul>
* <li>
* <p>
* <code>DELETE</code> - Deletes the change set if the stack creation fails. This is only valid when the
* <code>ChangeSetType</code> parameter is set to <code>CREATE</code>. If the deletion of the stack fails, the status
* of the stack is <code>DELETE_FAILED</code>.</p>
* </li>
* <li>
* <p>
* <code>DO_NOTHING</code> - if the stack creation fails, do nothing. This is equivalent to specifying
* <code>true</code> for the <code>DisableRollback</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html">ExecuteChangeSet</a> API
* operation.</p>
* </li>
* <li>
* <p>
* <code>ROLLBACK</code> - if the stack creation fails, roll back the stack. This is equivalent to specifying
* <code>false</code> for the <code>DisableRollback</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html">ExecuteChangeSet</a> API
* operation.</p>
* </li>
* </ul>
* <p>For nested stacks, when the <code>OnStackFailure</code> parameter is set to <code>DELETE</code> for the change
* set for the parent stack, any failure in a child stack will cause the parent stack creation to fail and all stacks to
* be deleted.</p>
*/
OnStackFailure?: OnStackFailure | string;
}

/**
Expand Down Expand Up @@ -3219,6 +3264,33 @@ export interface DescribeChangeSetOutput {
* <p>Specifies the change set ID of the root change set in the current nested change set hierarchy.</p>
*/
RootChangeSetId?: string;

/**
* <p>Determines what action will be taken if stack creation fails. When this parameter is specified, the
* <code>DisableRollback</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html">ExecuteChangeSet</a> API operation must not
* be specified. This must be one of these values:</p>
* <ul>
* <li>
* <p>
* <code>DELETE</code> - Deletes the change set if the stack creation fails. This is only valid when the
* <code>ChangeSetType</code> parameter is set to <code>CREATE</code>. If the deletion of the stack fails, the status
* of the stack is <code>DELETE_FAILED</code>.</p>
* </li>
* <li>
* <p>
* <code>DO_NOTHING</code> - if the stack creation fails, do nothing. This is equivalent to specifying
* <code>true</code> for the <code>DisableRollback</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html">ExecuteChangeSet</a> API
* operation.</p>
* </li>
* <li>
* <p>
* <code>ROLLBACK</code> - if the stack creation fails, roll back the stack. This is equivalent to specifying
* <code>false</code> for the <code>DisableRollback</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html">ExecuteChangeSet</a> API
* operation.</p>
* </li>
* </ul>
*/
OnStackFailure?: OnStackFailure | string;
}

/**
Expand Down Expand Up @@ -5998,7 +6070,22 @@ export interface ExecuteChangeSetInput {
ClientRequestToken?: string;

/**
* <p>Preserves the state of previously provisioned resources when an operation fails.</p>
* <p>Preserves the state of previously provisioned resources when an operation
* fails. This parameter can't be specified when
* the <code>OnStackFailure</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html">CreateChangeSet</a> API operation was
* specified.</p>
* <ul>
* <li>
* <p>
* <code>True</code> - if the stack creation fails, do nothing. This is equivalent to specifying
* <code>DO_NOTHING</code> for the <code>OnStackFailure</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html">CreateChangeSet</a> API operation.</p>
* </li>
* <li>
* <p>
* <code>False</code> - if the stack creation fails, roll back the stack. This is equivalent to specifying
* <code>ROLLBACK</code> for the <code>OnStackFailure</code> parameter to the <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html">CreateChangeSet</a> API operation.</p>
* </li>
* </ul>
* <p>Default: <code>True</code>
* </p>
*/
Expand Down
8 changes: 7 additions & 1 deletion clients/client-cloudformation/src/protocols/Aws_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5392,6 +5392,9 @@ const se_CreateChangeSetInput = (input: CreateChangeSetInput, context: __SerdeCo
if (input.IncludeNestedStacks != null) {
entries["IncludeNestedStacks"] = input.IncludeNestedStacks;
}
if (input.OnStackFailure != null) {
entries["OnStackFailure"] = input.OnStackFailure;
}
return entries;
};

Expand Down Expand Up @@ -8281,6 +8284,9 @@ const de_DescribeChangeSetOutput = (output: any, context: __SerdeContext): Descr
if (output["RootChangeSetId"] !== undefined) {
contents.RootChangeSetId = __expectString(output["RootChangeSetId"]);
}
if (output["OnStackFailure"] !== undefined) {
contents.OnStackFailure = __expectString(output["OnStackFailure"]);
}
return contents;
};

Expand Down Expand Up @@ -11113,7 +11119,7 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
ignoreDeclaration: true,
parseTagValue: false,
trimValues: false,
tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined),
tagValueProcessor: (_: any, val: any) => (val.trim() === "" && val.includes("\n") ? "" : undefined),
});
parser.addEntity("#xD", "\r");
parser.addEntity("#10", "\n");
Expand Down
37 changes: 36 additions & 1 deletion codegen/sdk-codegen/aws-models/cloudformation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2543,6 +2543,12 @@
"traits": {
"smithy.api#documentation": "<p>Creates a change set for the all nested stacks specified in the template. The default behavior of this action is\n set to <code>False</code>. To include nested sets in a change set, specify <code>True</code>.</p>"
}
},
"OnStackFailure": {
"target": "com.amazonaws.cloudformation#OnStackFailure",
"traits": {
"smithy.api#documentation": "<p>Determines what action will be taken if stack creation fails. If this parameter is specified, the\n <code>DisableRollback</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html\">ExecuteChangeSet</a> API operation must not\n be specified. This must be one of these values:</p>\n <ul>\n <li>\n <p>\n <code>DELETE</code> - Deletes the change set if the stack creation fails. This is only valid when the\n <code>ChangeSetType</code> parameter is set to <code>CREATE</code>. If the deletion of the stack fails, the status\n of the stack is <code>DELETE_FAILED</code>.</p>\n </li>\n <li>\n <p>\n <code>DO_NOTHING</code> - if the stack creation fails, do nothing. This is equivalent to specifying\n <code>true</code> for the <code>DisableRollback</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html\">ExecuteChangeSet</a> API\n operation.</p>\n </li>\n <li>\n <p>\n <code>ROLLBACK</code> - if the stack creation fails, roll back the stack. This is equivalent to specifying\n <code>false</code> for the <code>DisableRollback</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html\">ExecuteChangeSet</a> API\n operation.</p>\n </li>\n </ul>\n <p>For nested stacks, when the <code>OnStackFailure</code> parameter is set to <code>DELETE</code> for the change\n set for the parent stack, any failure in a child stack will cause the parent stack creation to fail and all stacks to\n be deleted.</p>"
}
}
},
"traits": {
Expand Down Expand Up @@ -3785,6 +3791,12 @@
"traits": {
"smithy.api#documentation": "<p>Specifies the change set ID of the root change set in the current nested change set hierarchy.</p>"
}
},
"OnStackFailure": {
"target": "com.amazonaws.cloudformation#OnStackFailure",
"traits": {
"smithy.api#documentation": "<p>Determines what action will be taken if stack creation fails. When this parameter is specified, the\n <code>DisableRollback</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html\">ExecuteChangeSet</a> API operation must not\n be specified. This must be one of these values:</p>\n <ul>\n <li>\n <p>\n <code>DELETE</code> - Deletes the change set if the stack creation fails. This is only valid when the\n <code>ChangeSetType</code> parameter is set to <code>CREATE</code>. If the deletion of the stack fails, the status\n of the stack is <code>DELETE_FAILED</code>.</p>\n </li>\n <li>\n <p>\n <code>DO_NOTHING</code> - if the stack creation fails, do nothing. This is equivalent to specifying\n <code>true</code> for the <code>DisableRollback</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html\">ExecuteChangeSet</a> API\n operation.</p>\n </li>\n <li>\n <p>\n <code>ROLLBACK</code> - if the stack creation fails, roll back the stack. This is equivalent to specifying\n <code>false</code> for the <code>DisableRollback</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_ExecuteChangeSet.html\">ExecuteChangeSet</a> API\n operation.</p>\n </li>\n </ul>"
}
}
},
"traits": {
Expand Down Expand Up @@ -5507,7 +5519,7 @@
"DisableRollback": {
"target": "com.amazonaws.cloudformation#DisableRollback",
"traits": {
"smithy.api#documentation": "<p>Preserves the state of previously provisioned resources when an operation fails.</p>\n <p>Default: <code>True</code>\n </p>"
"smithy.api#documentation": "<p>Preserves the state of previously provisioned resources when an operation\n fails. This parameter can't be specified when\n the <code>OnStackFailure</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html\">CreateChangeSet</a> API operation was\n specified.</p>\n <ul>\n <li>\n <p>\n <code>True</code> - if the stack creation fails, do nothing. This is equivalent to specifying\n <code>DO_NOTHING</code> for the <code>OnStackFailure</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html\">CreateChangeSet</a> API operation.</p>\n </li>\n <li>\n <p>\n <code>False</code> - if the stack creation fails, roll back the stack. This is equivalent to specifying\n <code>ROLLBACK</code> for the <code>OnStackFailure</code> parameter to the <a href=\"https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html\">CreateChangeSet</a> API operation.</p>\n </li>\n </ul>\n <p>Default: <code>True</code>\n </p>"
}
}
},
Expand Down Expand Up @@ -7471,6 +7483,29 @@
}
}
},
"com.amazonaws.cloudformation#OnStackFailure": {
"type": "enum",
"members": {
"DO_NOTHING": {
"target": "smithy.api#Unit",
"traits": {
"smithy.api#enumValue": "DO_NOTHING"
}
},
"ROLLBACK": {
"target": "smithy.api#Unit",
"traits": {
"smithy.api#enumValue": "ROLLBACK"
}
},
"DELETE": {
"target": "smithy.api#Unit",
"traits": {
"smithy.api#enumValue": "DELETE"
}
}
}
},
"com.amazonaws.cloudformation#OperationIdAlreadyExistsException": {
"type": "structure",
"members": {
Expand Down

0 comments on commit a02f0d7

Please sign in to comment.