Skip to content

Commit

Permalink
feat(client-cloudformation): This release supports filtering by DRIFT…
Browse files Browse the repository at this point in the history
…_STATUS for existing API ListStackInstances and adds support for a new API ListStackInstanceResourceDrifts. Customers can now view resource drift information from their StackSet management accounts.
  • Loading branch information
awstools committed Jul 24, 2023
1 parent 7057459 commit 457b697
Show file tree
Hide file tree
Showing 9 changed files with 999 additions and 194 deletions.
8 changes: 8 additions & 0 deletions clients/client-cloudformation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,14 @@ ListImports

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cloudformation/classes/listimportscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cloudformation/interfaces/listimportscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cloudformation/interfaces/listimportscommandoutput.html)

</details>
<details>
<summary>
ListStackInstanceResourceDrifts
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cloudformation/classes/liststackinstanceresourcedriftscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cloudformation/interfaces/liststackinstanceresourcedriftscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cloudformation/interfaces/liststackinstanceresourcedriftscommandoutput.html)

</details>
<details>
<summary>
Expand Down
23 changes: 23 additions & 0 deletions clients/client-cloudformation/src/CloudFormation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ import {
} from "./commands/ListChangeSetsCommand";
import { ListExportsCommand, ListExportsCommandInput, ListExportsCommandOutput } from "./commands/ListExportsCommand";
import { ListImportsCommand, ListImportsCommandInput, ListImportsCommandOutput } from "./commands/ListImportsCommand";
import {
ListStackInstanceResourceDriftsCommand,
ListStackInstanceResourceDriftsCommandInput,
ListStackInstanceResourceDriftsCommandOutput,
} from "./commands/ListStackInstanceResourceDriftsCommand";
import {
ListStackInstancesCommand,
ListStackInstancesCommandInput,
Expand Down Expand Up @@ -354,6 +359,7 @@ const commands = {
ListChangeSetsCommand,
ListExportsCommand,
ListImportsCommand,
ListStackInstanceResourceDriftsCommand,
ListStackInstancesCommand,
ListStackResourcesCommand,
ListStacksCommand,
Expand Down Expand Up @@ -1061,6 +1067,23 @@ export interface CloudFormation {
cb: (err: any, data?: ListImportsCommandOutput) => void
): void;

/**
* @see {@link ListStackInstanceResourceDriftsCommand}
*/
listStackInstanceResourceDrifts(
args: ListStackInstanceResourceDriftsCommandInput,
options?: __HttpHandlerOptions
): Promise<ListStackInstanceResourceDriftsCommandOutput>;
listStackInstanceResourceDrifts(
args: ListStackInstanceResourceDriftsCommandInput,
cb: (err: any, data?: ListStackInstanceResourceDriftsCommandOutput) => void
): void;
listStackInstanceResourceDrifts(
args: ListStackInstanceResourceDriftsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListStackInstanceResourceDriftsCommandOutput) => void
): void;

/**
* @see {@link ListStackInstancesCommand}
*/
Expand Down
6 changes: 6 additions & 0 deletions clients/client-cloudformation/src/CloudFormationClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ import {
import { ListChangeSetsCommandInput, ListChangeSetsCommandOutput } from "./commands/ListChangeSetsCommand";
import { ListExportsCommandInput, ListExportsCommandOutput } from "./commands/ListExportsCommand";
import { ListImportsCommandInput, ListImportsCommandOutput } from "./commands/ListImportsCommand";
import {
ListStackInstanceResourceDriftsCommandInput,
ListStackInstanceResourceDriftsCommandOutput,
} from "./commands/ListStackInstanceResourceDriftsCommand";
import { ListStackInstancesCommandInput, ListStackInstancesCommandOutput } from "./commands/ListStackInstancesCommand";
import { ListStackResourcesCommandInput, ListStackResourcesCommandOutput } from "./commands/ListStackResourcesCommand";
import { ListStacksCommandInput, ListStacksCommandOutput } from "./commands/ListStacksCommand";
Expand Down Expand Up @@ -266,6 +270,7 @@ export type ServiceInputTypes =
| ListChangeSetsCommandInput
| ListExportsCommandInput
| ListImportsCommandInput
| ListStackInstanceResourceDriftsCommandInput
| ListStackInstancesCommandInput
| ListStackResourcesCommandInput
| ListStackSetOperationResultsCommandInput
Expand Down Expand Up @@ -340,6 +345,7 @@ export type ServiceOutputTypes =
| ListChangeSetsCommandOutput
| ListExportsCommandOutput
| ListImportsCommandOutput
| ListStackInstanceResourceDriftsCommandOutput
| ListStackInstancesCommandOutput
| ListStackResourcesCommandOutput
| ListStackSetOperationResultsCommandOutput
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
import { Command as $Command } from "@smithy/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@smithy/types";

import { CloudFormationClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudFormationClient";
import { ListStackInstanceResourceDriftsInput, ListStackInstanceResourceDriftsOutput } from "../models/models_0";
import {
de_ListStackInstanceResourceDriftsCommand,
se_ListStackInstanceResourceDriftsCommand,
} from "../protocols/Aws_query";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link ListStackInstanceResourceDriftsCommand}.
*/
export interface ListStackInstanceResourceDriftsCommandInput extends ListStackInstanceResourceDriftsInput {}
/**
* @public
*
* The output of {@link ListStackInstanceResourceDriftsCommand}.
*/
export interface ListStackInstanceResourceDriftsCommandOutput
extends ListStackInstanceResourceDriftsOutput,
__MetadataBearer {}

/**
* @public
* <p>Returns drift information for resources in a stack instance.</p>
* <note>
* <p>
* <code>ListStackInstanceResourceDrifts</code> returns drift information for the most
* recent drift detection operation. If an operation is in progress, it may only return
* partial results.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { CloudFormationClient, ListStackInstanceResourceDriftsCommand } from "@aws-sdk/client-cloudformation"; // ES Modules import
* // const { CloudFormationClient, ListStackInstanceResourceDriftsCommand } = require("@aws-sdk/client-cloudformation"); // CommonJS import
* const client = new CloudFormationClient(config);
* const input = { // ListStackInstanceResourceDriftsInput
* StackSetName: "STRING_VALUE", // required
* NextToken: "STRING_VALUE",
* MaxResults: Number("int"),
* StackInstanceResourceDriftStatuses: [ // StackResourceDriftStatusFilters
* "IN_SYNC" || "MODIFIED" || "DELETED" || "NOT_CHECKED",
* ],
* StackInstanceAccount: "STRING_VALUE", // required
* StackInstanceRegion: "STRING_VALUE", // required
* OperationId: "STRING_VALUE", // required
* CallAs: "SELF" || "DELEGATED_ADMIN",
* };
* const command = new ListStackInstanceResourceDriftsCommand(input);
* const response = await client.send(command);
* // { // ListStackInstanceResourceDriftsOutput
* // Summaries: [ // StackInstanceResourceDriftsSummaries
* // { // StackInstanceResourceDriftsSummary
* // StackId: "STRING_VALUE", // required
* // LogicalResourceId: "STRING_VALUE", // required
* // PhysicalResourceId: "STRING_VALUE",
* // PhysicalResourceIdContext: [ // PhysicalResourceIdContext
* // { // PhysicalResourceIdContextKeyValuePair
* // Key: "STRING_VALUE", // required
* // Value: "STRING_VALUE", // required
* // },
* // ],
* // ResourceType: "STRING_VALUE", // required
* // PropertyDifferences: [ // PropertyDifferences
* // { // PropertyDifference
* // PropertyPath: "STRING_VALUE", // required
* // ExpectedValue: "STRING_VALUE", // required
* // ActualValue: "STRING_VALUE", // required
* // DifferenceType: "ADD" || "REMOVE" || "NOT_EQUAL", // required
* // },
* // ],
* // StackResourceDriftStatus: "IN_SYNC" || "MODIFIED" || "DELETED" || "NOT_CHECKED", // required
* // Timestamp: new Date("TIMESTAMP"), // required
* // },
* // ],
* // NextToken: "STRING_VALUE",
* // };
*
* ```
*
* @param ListStackInstanceResourceDriftsCommandInput - {@link ListStackInstanceResourceDriftsCommandInput}
* @returns {@link ListStackInstanceResourceDriftsCommandOutput}
* @see {@link ListStackInstanceResourceDriftsCommandInput} for command's `input` shape.
* @see {@link ListStackInstanceResourceDriftsCommandOutput} for command's `response` shape.
* @see {@link CloudFormationClientResolvedConfig | config} for CloudFormationClient's `config` shape.
*
* @throws {@link OperationNotFoundException} (client fault)
* <p>The specified ID refers to an operation that doesn't exist.</p>
*
* @throws {@link StackInstanceNotFoundException} (client fault)
* <p>The specified stack instance doesn't exist.</p>
*
* @throws {@link StackSetNotFoundException} (client fault)
* <p>The specified stack set doesn't exist.</p>
*
* @throws {@link CloudFormationServiceException}
* <p>Base exception class for all service exceptions from CloudFormation service.</p>
*
*/
export class ListStackInstanceResourceDriftsCommand extends $Command<
ListStackInstanceResourceDriftsCommandInput,
ListStackInstanceResourceDriftsCommandOutput,
CloudFormationClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

public static getEndpointParameterInstructions(): EndpointParameterInstructions {
return {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
}

/**
* @public
*/
constructor(readonly input: ListStackInstanceResourceDriftsCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: CloudFormationClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<ListStackInstanceResourceDriftsCommandInput, ListStackInstanceResourceDriftsCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, ListStackInstanceResourceDriftsCommand.getEndpointParameterInstructions())
);

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "CloudFormationClient";
const commandName = "ListStackInstanceResourceDriftsCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (_: any) => _,
outputFilterSensitiveLog: (_: any) => _,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

/**
* @internal
*/
private serialize(
input: ListStackInstanceResourceDriftsCommandInput,
context: __SerdeContext
): Promise<__HttpRequest> {
return se_ListStackInstanceResourceDriftsCommand(input, context);
}

/**
* @internal
*/
private deserialize(
output: __HttpResponse,
context: __SerdeContext
): Promise<ListStackInstanceResourceDriftsCommandOutput> {
return de_ListStackInstanceResourceDriftsCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface ListStackInstancesCommandOutput extends ListStackInstancesOutpu
* MaxResults: Number("int"),
* Filters: [ // StackInstanceFilters
* { // StackInstanceFilter
* Name: "DETAILED_STATUS" || "LAST_OPERATION_ID",
* Name: "DETAILED_STATUS" || "LAST_OPERATION_ID" || "DRIFT_STATUS",
* Values: "STRING_VALUE",
* },
* ],
Expand Down
1 change: 1 addition & 0 deletions clients/client-cloudformation/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export * from "./ImportStacksToStackSetCommand";
export * from "./ListChangeSetsCommand";
export * from "./ListExportsCommand";
export * from "./ListImportsCommand";
export * from "./ListStackInstanceResourceDriftsCommand";
export * from "./ListStackInstancesCommand";
export * from "./ListStackResourcesCommand";
export * from "./ListStackSetOperationResultsCommand";
Expand Down

0 comments on commit 457b697

Please sign in to comment.