From 6f0caf648ea9251f51e4c1e7cbd0a88a141874d5 Mon Sep 17 00:00:00 2001 From: awstools Date: Wed, 22 May 2024 18:15:36 +0000 Subject: [PATCH] feat(client-cloudformation): Added DeletionMode FORCE_DELETE_STACK for deleting a stack that is stuck in DELETE_FAILED state due to resource deletion failure. --- .../src/commands/DeleteStackCommand.ts | 1 + .../src/commands/DescribeStacksCommand.ts | 1 + .../commands/SetTypeConfigurationCommand.ts | 3 +- .../src/models/models_0.ts | 107 +++++++++--------- .../src/models/models_1.ts | 51 +++++++++ .../src/protocols/Aws_query.ts | 9 +- .../aws-models/cloudformation.json | 33 +++++- 7 files changed, 146 insertions(+), 59 deletions(-) diff --git a/clients/client-cloudformation/src/commands/DeleteStackCommand.ts b/clients/client-cloudformation/src/commands/DeleteStackCommand.ts index 3605cac71566..ed32c28e38d3 100644 --- a/clients/client-cloudformation/src/commands/DeleteStackCommand.ts +++ b/clients/client-cloudformation/src/commands/DeleteStackCommand.ts @@ -42,6 +42,7 @@ export interface DeleteStackCommandOutput extends __MetadataBearer {} * ], * RoleARN: "STRING_VALUE", * ClientRequestToken: "STRING_VALUE", + * DeletionMode: "STANDARD" || "FORCE_DELETE_STACK", * }; * const command = new DeleteStackCommand(input); * const response = await client.send(command); diff --git a/clients/client-cloudformation/src/commands/DescribeStacksCommand.ts b/clients/client-cloudformation/src/commands/DescribeStacksCommand.ts index 815501cb832f..690e5f6cc46a 100644 --- a/clients/client-cloudformation/src/commands/DescribeStacksCommand.ts +++ b/clients/client-cloudformation/src/commands/DescribeStacksCommand.ts @@ -105,6 +105,7 @@ export interface DescribeStacksCommandOutput extends DescribeStacksOutput, __Met * // LastCheckTimestamp: new Date("TIMESTAMP"), * // }, * // RetainExceptOnCreate: true || false, + * // DeletionMode: "STANDARD" || "FORCE_DELETE_STACK", * // DetailedStatus: "CONFIGURATION_COMPLETE" || "VALIDATION_FAILED", * // }, * // ], diff --git a/clients/client-cloudformation/src/commands/SetTypeConfigurationCommand.ts b/clients/client-cloudformation/src/commands/SetTypeConfigurationCommand.ts index 1baae3cf0231..4baa50145030 100644 --- a/clients/client-cloudformation/src/commands/SetTypeConfigurationCommand.ts +++ b/clients/client-cloudformation/src/commands/SetTypeConfigurationCommand.ts @@ -6,8 +6,7 @@ import { MetadataBearer as __MetadataBearer } from "@smithy/types"; import { CloudFormationClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudFormationClient"; import { commonParams } from "../endpoint/EndpointParameters"; -import { SetTypeConfigurationInput } from "../models/models_0"; -import { SetTypeConfigurationOutput } from "../models/models_1"; +import { SetTypeConfigurationInput, SetTypeConfigurationOutput } from "../models/models_1"; import { de_SetTypeConfigurationCommand, se_SetTypeConfigurationCommand } from "../protocols/Aws_query"; /** diff --git a/clients/client-cloudformation/src/models/models_0.ts b/clients/client-cloudformation/src/models/models_0.ts index 9149d30ac571..926b1fbfd772 100644 --- a/clients/client-cloudformation/src/models/models_0.ts +++ b/clients/client-cloudformation/src/models/models_0.ts @@ -2777,7 +2777,7 @@ export interface StackSetOperationPreferences { * STRICT_FAILURE_TOLERANCE: This option dynamically lowers the concurrency level to ensure the * number of failed accounts never exceeds the value of FailureToleranceCount +1. The initial actual * concurrency is set to the lower of either the value of the MaxConcurrentCount, or the value of - * MaxConcurrentCount +1. The actual concurrency is then reduced proportionally by the number of + * FailureToleranceCount +1. The actual concurrency is then reduced proportionally by the number of * failures. This is the default behavior.

*

If failure tolerance or Maximum concurrent accounts are set to percentages, the behavior is similar.

* @@ -3446,6 +3446,20 @@ export class GeneratedTemplateNotFoundException extends __BaseException { } } +/** + * @public + * @enum + */ +export const DeletionMode = { + FORCE_DELETE_STACK: "FORCE_DELETE_STACK", + STANDARD: "STANDARD", +} as const; + +/** + * @public + */ +export type DeletionMode = (typeof DeletionMode)[keyof typeof DeletionMode]; + /** *

The input for DeleteStack action.

* @public @@ -3492,6 +3506,24 @@ export interface DeleteStackInput { * @public */ ClientRequestToken?: string; + + /** + *

Specifies the deletion mode for the stack. Possible values are:

+ * + * @public + */ + DeletionMode?: DeletionMode; } /** @@ -6188,6 +6220,24 @@ export interface Stack { */ RetainExceptOnCreate?: boolean; + /** + *

Specifies the deletion mode for the stack. Possible values are:

+ * + * @public + */ + DeletionMode?: DeletionMode; + /** *

The detailed status of the resource or stack. If CONFIGURATION_COMPLETE is present, the resource or * resource configuration phase has completed and the stabilization of the resources is in progress. The stack sets @@ -8809,8 +8859,8 @@ export interface StackInstanceResourceDriftsSummary { */ export interface ListStackInstanceResourceDriftsOutput { /** - *

A list of StackInstanceResourceDriftSummary structures that contain information about the specified - * stack instances.

+ *

A list of StackInstanceResourceDriftsSummary structures that contain information about the + * specified stack instances.

* @public */ Summaries?: StackInstanceResourceDriftsSummary[]; @@ -10941,54 +10991,3 @@ export interface SetStackPolicyInput { */ StackPolicyURL?: string; } - -/** - * @public - */ -export interface SetTypeConfigurationInput { - /** - *

The Amazon Resource Name (ARN) for the extension, in this account and Region.

- *

For public extensions, this will be the ARN assigned when you call the ActivateType API operation in this account - * and Region. For private extensions, this will be the ARN assigned when you call the RegisterType API operation in this account - * and Region.

- *

Do not include the extension versions suffix at the end of the ARN. You can set the configuration for an - * extension, but not for a specific extension version.

- * @public - */ - TypeArn?: string; - - /** - *

The configuration data for the extension, in this account and Region.

- *

The configuration data must be formatted as JSON, and validate against the schema returned in the - * ConfigurationSchema response element of DescribeType. For more information, see - * Defining - * account-level configuration data for an extension in the CloudFormation CLI User - * Guide.

- * @public - */ - Configuration: string | undefined; - - /** - *

An alias by which to refer to this extension configuration data.

- *

Conditional: Specifying a configuration alias is required when setting a configuration for a resource type - * extension.

- * @public - */ - ConfigurationAlias?: string; - - /** - *

The name of the extension.

- *

Conditional: You must specify ConfigurationArn, or Type and - * TypeName.

- * @public - */ - TypeName?: string; - - /** - *

The type of extension.

- *

Conditional: You must specify ConfigurationArn, or Type and - * TypeName.

- * @public - */ - Type?: ThirdPartyType; -} diff --git a/clients/client-cloudformation/src/models/models_1.ts b/clients/client-cloudformation/src/models/models_1.ts index e16831a649dc..323d8bf6ca56 100644 --- a/clients/client-cloudformation/src/models/models_1.ts +++ b/clients/client-cloudformation/src/models/models_1.ts @@ -20,6 +20,57 @@ import { ThirdPartyType, } from "./models_0"; +/** + * @public + */ +export interface SetTypeConfigurationInput { + /** + *

The Amazon Resource Name (ARN) for the extension, in this account and Region.

+ *

For public extensions, this will be the ARN assigned when you call the ActivateType API operation in this account + * and Region. For private extensions, this will be the ARN assigned when you call the RegisterType API operation in this account + * and Region.

+ *

Do not include the extension versions suffix at the end of the ARN. You can set the configuration for an + * extension, but not for a specific extension version.

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

The configuration data for the extension, in this account and Region.

+ *

The configuration data must be formatted as JSON, and validate against the schema returned in the + * ConfigurationSchema response element of DescribeType. For more information, see + * Defining + * account-level configuration data for an extension in the CloudFormation CLI User + * Guide.

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

An alias by which to refer to this extension configuration data.

+ *

Conditional: Specifying a configuration alias is required when setting a configuration for a resource type + * extension.

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

The name of the extension.

+ *

Conditional: You must specify ConfigurationArn, or Type and + * TypeName.

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

The type of extension.

+ *

Conditional: You must specify ConfigurationArn, or Type and + * TypeName.

+ * @public + */ + Type?: ThirdPartyType; +} + /** * @public */ diff --git a/clients/client-cloudformation/src/protocols/Aws_query.ts b/clients/client-cloudformation/src/protocols/Aws_query.ts index 818d04756a67..f0e0bfb4e740 100644 --- a/clients/client-cloudformation/src/protocols/Aws_query.ts +++ b/clients/client-cloudformation/src/protocols/Aws_query.ts @@ -419,7 +419,6 @@ import { ScannedResource, ScannedResourceIdentifier, SetStackPolicyInput, - SetTypeConfigurationInput, Stack, StackDriftInformation, StackDriftInformationSummary, @@ -472,6 +471,7 @@ import { } from "../models/models_0"; import { ResourceScanLimitExceededException, + SetTypeConfigurationInput, SetTypeConfigurationOutput, SetTypeDefaultVersionInput, SetTypeDefaultVersionOutput, @@ -4676,6 +4676,9 @@ const se_DeleteStackInput = (input: DeleteStackInput, context: __SerdeContext): if (input[_CRT] != null) { entries[_CRT] = input[_CRT]; } + if (input[_DM] != null) { + entries[_DM] = input[_DM]; + } return entries; }; @@ -9501,6 +9504,9 @@ const de_Stack = (output: any, context: __SerdeContext): Stack => { if (output[_REOC] != null) { contents[_REOC] = __parseBoolean(output[_REOC]); } + if (output[_DM] != null) { + contents[_DM] = __expectString(output[_DM]); + } if (output[_DSeta] != null) { contents[_DSeta] = __expectString(output[_DSeta]); } @@ -11135,6 +11141,7 @@ const _DDS = "DriftDetectionStatus"; const _DGT = "DeleteGeneratedTemplate"; const _DGTe = "DescribeGeneratedTemplate"; const _DI = "DriftInformation"; +const _DM = "DeletionMode"; const _DOA = "DeactivateOrganizationsAccess"; const _DOAe = "DescribeOrganizationsAccess"; const _DP = "DescribePublisher"; diff --git a/codegen/sdk-codegen/aws-models/cloudformation.json b/codegen/sdk-codegen/aws-models/cloudformation.json index 9821707e90dc..9d935a0d21b1 100644 --- a/codegen/sdk-codegen/aws-models/cloudformation.json +++ b/codegen/sdk-codegen/aws-models/cloudformation.json @@ -3417,6 +3417,12 @@ "traits": { "smithy.api#documentation": "

A unique identifier for this DeleteStack request. Specify this token if you plan to retry requests\n so that CloudFormation knows that you're not attempting to delete a stack with the same name. You might retry\n DeleteStack requests to ensure that CloudFormation successfully received them.

\n

All events initiated by a given stack operation are assigned the same client request token, which you can use to\n track operations. For example, if you execute a CreateStack operation with the token\n token1, then all the StackEvents generated by that operation will have\n ClientRequestToken set as token1.

\n

In the console, stack operations display the client request token on the Events tab. Stack operations that are\n initiated from the console use the token format Console-StackOperation-ID, which helps you\n easily identify the stack operation . For example, if you create a stack using the console, each stack event would be\n assigned the same token in the following format:\n Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002.

" } + }, + "DeletionMode": { + "target": "com.amazonaws.cloudformation#DeletionMode", + "traits": { + "smithy.api#documentation": "

Specifies the deletion mode for the stack. Possible values are:

\n " + } } }, "traits": { @@ -3579,6 +3585,23 @@ "smithy.api#output": {} } }, + "com.amazonaws.cloudformation#DeletionMode": { + "type": "enum", + "members": { + "STANDARD": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "STANDARD" + } + }, + "FORCE_DELETE_STACK": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "FORCE_DELETE_STACK" + } + } + } + }, "com.amazonaws.cloudformation#DeletionTime": { "type": "timestamp" }, @@ -7930,7 +7953,7 @@ "Summaries": { "target": "com.amazonaws.cloudformation#StackInstanceResourceDriftsSummaries", "traits": { - "smithy.api#documentation": "

A list of StackInstanceResourceDriftSummary structures that contain information about the specified\n stack instances.

" + "smithy.api#documentation": "

A list of StackInstanceResourceDriftsSummary structures that contain information about the\n specified stack instances.

" } }, "NextToken": { @@ -11501,6 +11524,12 @@ "smithy.api#documentation": "

When set to true, newly created resources are deleted when the operation rolls back. This includes\n newly created resources marked with a deletion policy of Retain.

\n

Default: false\n

" } }, + "DeletionMode": { + "target": "com.amazonaws.cloudformation#DeletionMode", + "traits": { + "smithy.api#documentation": "

Specifies the deletion mode for the stack. Possible values are:

\n " + } + }, "DetailedStatus": { "target": "com.amazonaws.cloudformation#DetailedStatus", "traits": { @@ -13115,7 +13144,7 @@ "ConcurrencyMode": { "target": "com.amazonaws.cloudformation#ConcurrencyMode", "traits": { - "smithy.api#documentation": "

Specifies how the concurrency level behaves during the operation execution.

\n " + "smithy.api#documentation": "

Specifies how the concurrency level behaves during the operation execution.

\n " } } },