Skip to content

Commit

Permalink
feat(client-ssm-incidents): Introduces new APIs ListIncidentFindings …
Browse files Browse the repository at this point in the history
…and BatchGetIncidentFindings to use findings related to an incident.
  • Loading branch information
awstools committed Nov 16, 2023
1 parent e1f639f commit a0cc50f
Show file tree
Hide file tree
Showing 12 changed files with 1,764 additions and 241 deletions.
16 changes: 16 additions & 0 deletions clients/client-ssm-incidents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,14 @@ see LICENSE for more information.

## Client Commands (Operations List)

<details>
<summary>
BatchGetIncidentFindings
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ssm-incidents/classes/batchgetincidentfindingscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ssm-incidents/interfaces/batchgetincidentfindingscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ssm-incidents/interfaces/batchgetincidentfindingscommandoutput.html)

</details>
<details>
<summary>
CreateReplicationSet
Expand Down Expand Up @@ -313,6 +321,14 @@ GetTimelineEvent

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ssm-incidents/classes/gettimelineeventcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ssm-incidents/interfaces/gettimelineeventcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ssm-incidents/interfaces/gettimelineeventcommandoutput.html)

</details>
<details>
<summary>
ListIncidentFindings
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ssm-incidents/classes/listincidentfindingscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ssm-incidents/interfaces/listincidentfindingscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-ssm-incidents/interfaces/listincidentfindingscommandoutput.html)

</details>
<details>
<summary>
Expand Down
46 changes: 46 additions & 0 deletions clients/client-ssm-incidents/src/SSMIncidents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
import { createAggregatedClient } from "@smithy/smithy-client";
import { HttpHandlerOptions as __HttpHandlerOptions } from "@smithy/types";

import {
BatchGetIncidentFindingsCommand,
BatchGetIncidentFindingsCommandInput,
BatchGetIncidentFindingsCommandOutput,
} from "./commands/BatchGetIncidentFindingsCommand";
import {
CreateReplicationSetCommand,
CreateReplicationSetCommandInput,
Expand Down Expand Up @@ -67,6 +72,11 @@ import {
GetTimelineEventCommandInput,
GetTimelineEventCommandOutput,
} from "./commands/GetTimelineEventCommand";
import {
ListIncidentFindingsCommand,
ListIncidentFindingsCommandInput,
ListIncidentFindingsCommandOutput,
} from "./commands/ListIncidentFindingsCommand";
import {
ListIncidentRecordsCommand,
ListIncidentRecordsCommandInput,
Expand Down Expand Up @@ -146,6 +156,7 @@ import {
import { SSMIncidentsClient, SSMIncidentsClientConfig } from "./SSMIncidentsClient";

const commands = {
BatchGetIncidentFindingsCommand,
CreateReplicationSetCommand,
CreateResponsePlanCommand,
CreateTimelineEventCommand,
Expand All @@ -159,6 +170,7 @@ const commands = {
GetResourcePoliciesCommand,
GetResponsePlanCommand,
GetTimelineEventCommand,
ListIncidentFindingsCommand,
ListIncidentRecordsCommand,
ListRelatedItemsCommand,
ListReplicationSetsCommand,
Expand All @@ -178,6 +190,23 @@ const commands = {
};

export interface SSMIncidents {
/**
* @see {@link BatchGetIncidentFindingsCommand}
*/
batchGetIncidentFindings(
args: BatchGetIncidentFindingsCommandInput,
options?: __HttpHandlerOptions
): Promise<BatchGetIncidentFindingsCommandOutput>;
batchGetIncidentFindings(
args: BatchGetIncidentFindingsCommandInput,
cb: (err: any, data?: BatchGetIncidentFindingsCommandOutput) => void
): void;
batchGetIncidentFindings(
args: BatchGetIncidentFindingsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: BatchGetIncidentFindingsCommandOutput) => void
): void;

/**
* @see {@link CreateReplicationSetCommand}
*/
Expand Down Expand Up @@ -396,6 +425,23 @@ export interface SSMIncidents {
cb: (err: any, data?: GetTimelineEventCommandOutput) => void
): void;

/**
* @see {@link ListIncidentFindingsCommand}
*/
listIncidentFindings(
args: ListIncidentFindingsCommandInput,
options?: __HttpHandlerOptions
): Promise<ListIncidentFindingsCommandOutput>;
listIncidentFindings(
args: ListIncidentFindingsCommandInput,
cb: (err: any, data?: ListIncidentFindingsCommandOutput) => void
): void;
listIncidentFindings(
args: ListIncidentFindingsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListIncidentFindingsCommandOutput) => void
): void;

/**
* @see {@link ListIncidentRecordsCommand}
*/
Expand Down
12 changes: 12 additions & 0 deletions clients/client-ssm-incidents/src/SSMIncidentsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ import {
UserAgent as __UserAgent,
} from "@smithy/types";

import {
BatchGetIncidentFindingsCommandInput,
BatchGetIncidentFindingsCommandOutput,
} from "./commands/BatchGetIncidentFindingsCommand";
import {
CreateReplicationSetCommandInput,
CreateReplicationSetCommandOutput,
Expand Down Expand Up @@ -84,6 +88,10 @@ import {
} from "./commands/GetResourcePoliciesCommand";
import { GetResponsePlanCommandInput, GetResponsePlanCommandOutput } from "./commands/GetResponsePlanCommand";
import { GetTimelineEventCommandInput, GetTimelineEventCommandOutput } from "./commands/GetTimelineEventCommand";
import {
ListIncidentFindingsCommandInput,
ListIncidentFindingsCommandOutput,
} from "./commands/ListIncidentFindingsCommand";
import {
ListIncidentRecordsCommandInput,
ListIncidentRecordsCommandOutput,
Expand Down Expand Up @@ -136,6 +144,7 @@ export { __Client };
* @public
*/
export type ServiceInputTypes =
| BatchGetIncidentFindingsCommandInput
| CreateReplicationSetCommandInput
| CreateResponsePlanCommandInput
| CreateTimelineEventCommandInput
Expand All @@ -149,6 +158,7 @@ export type ServiceInputTypes =
| GetResourcePoliciesCommandInput
| GetResponsePlanCommandInput
| GetTimelineEventCommandInput
| ListIncidentFindingsCommandInput
| ListIncidentRecordsCommandInput
| ListRelatedItemsCommandInput
| ListReplicationSetsCommandInput
Expand All @@ -170,6 +180,7 @@ export type ServiceInputTypes =
* @public
*/
export type ServiceOutputTypes =
| BatchGetIncidentFindingsCommandOutput
| CreateReplicationSetCommandOutput
| CreateResponsePlanCommandOutput
| CreateTimelineEventCommandOutput
Expand All @@ -183,6 +194,7 @@ export type ServiceOutputTypes =
| GetResourcePoliciesCommandOutput
| GetResponsePlanCommandOutput
| GetTimelineEventCommandOutput
| ListIncidentFindingsCommandOutput
| ListIncidentRecordsCommandOutput
| ListRelatedItemsCommandOutput
| ListReplicationSetsCommandOutput
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
// 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,
SMITHY_CONTEXT_KEY,
} from "@smithy/types";

import { BatchGetIncidentFindingsInput, BatchGetIncidentFindingsOutput } from "../models/models_0";
import { de_BatchGetIncidentFindingsCommand, se_BatchGetIncidentFindingsCommand } from "../protocols/Aws_restJson1";
import { ServiceInputTypes, ServiceOutputTypes, SSMIncidentsClientResolvedConfig } from "../SSMIncidentsClient";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link BatchGetIncidentFindingsCommand}.
*/
export interface BatchGetIncidentFindingsCommandInput extends BatchGetIncidentFindingsInput {}
/**
* @public
*
* The output of {@link BatchGetIncidentFindingsCommand}.
*/
export interface BatchGetIncidentFindingsCommandOutput extends BatchGetIncidentFindingsOutput, __MetadataBearer {}

/**
* @public
* <p>Retrieves details about all specified findings for an incident, including descriptive details about each finding. A finding
* represents a recent application environment change made by an CodeDeploy
* deployment or an CloudFormation stack creation or update that can be investigated as a
* potential cause of the incident.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { SSMIncidentsClient, BatchGetIncidentFindingsCommand } from "@aws-sdk/client-ssm-incidents"; // ES Modules import
* // const { SSMIncidentsClient, BatchGetIncidentFindingsCommand } = require("@aws-sdk/client-ssm-incidents"); // CommonJS import
* const client = new SSMIncidentsClient(config);
* const input = { // BatchGetIncidentFindingsInput
* incidentRecordArn: "STRING_VALUE", // required
* findingIds: [ // FindingIdList // required
* "STRING_VALUE",
* ],
* };
* const command = new BatchGetIncidentFindingsCommand(input);
* const response = await client.send(command);
* // { // BatchGetIncidentFindingsOutput
* // findings: [ // FindingList // required
* // { // Finding
* // id: "STRING_VALUE", // required
* // creationTime: new Date("TIMESTAMP"), // required
* // lastModifiedTime: new Date("TIMESTAMP"), // required
* // details: { // FindingDetails Union: only one key present
* // codeDeployDeployment: { // CodeDeployDeployment
* // startTime: new Date("TIMESTAMP"), // required
* // endTime: new Date("TIMESTAMP"),
* // deploymentGroupArn: "STRING_VALUE", // required
* // deploymentId: "STRING_VALUE", // required
* // },
* // cloudFormationStackUpdate: { // CloudFormationStackUpdate
* // startTime: new Date("TIMESTAMP"), // required
* // endTime: new Date("TIMESTAMP"),
* // stackArn: "STRING_VALUE", // required
* // },
* // },
* // },
* // ],
* // errors: [ // BatchGetIncidentFindingsErrorList // required
* // { // BatchGetIncidentFindingsError
* // findingId: "STRING_VALUE", // required
* // code: "STRING_VALUE", // required
* // message: "STRING_VALUE", // required
* // },
* // ],
* // };
*
* ```
*
* @param BatchGetIncidentFindingsCommandInput - {@link BatchGetIncidentFindingsCommandInput}
* @returns {@link BatchGetIncidentFindingsCommandOutput}
* @see {@link BatchGetIncidentFindingsCommandInput} for command's `input` shape.
* @see {@link BatchGetIncidentFindingsCommandOutput} for command's `response` shape.
* @see {@link SSMIncidentsClientResolvedConfig | config} for SSMIncidentsClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>You don't have sufficient access to perform this operation.</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>The request processing has failed because of an unknown error, exception or
* failure.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>Request references a resource which doesn't exist. </p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The request was denied due to request throttling.</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input fails to satisfy the constraints specified by an Amazon Web Services
* service.</p>
*
* @throws {@link SSMIncidentsServiceException}
* <p>Base exception class for all service exceptions from SSMIncidents service.</p>
*
*/
export class BatchGetIncidentFindingsCommand extends $Command<
BatchGetIncidentFindingsCommandInput,
BatchGetIncidentFindingsCommandOutput,
SSMIncidentsClientResolvedConfig
> {
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: BatchGetIncidentFindingsCommandInput) {
super();
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: SSMIncidentsClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<BatchGetIncidentFindingsCommandInput, BatchGetIncidentFindingsCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, BatchGetIncidentFindingsCommand.getEndpointParameterInstructions())
);

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

const { logger } = configuration;
const clientName = "SSMIncidentsClient";
const commandName = "BatchGetIncidentFindingsCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (_: any) => _,
outputFilterSensitiveLog: (_: any) => _,
[SMITHY_CONTEXT_KEY]: {
service: "SSMIncidents",
operation: "BatchGetIncidentFindings",
},
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

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

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

0 comments on commit a0cc50f

Please sign in to comment.