Skip to content

Commit

Permalink
feat(client-inspector2): This release adds 1 new API: BatchGetFinding…
Browse files Browse the repository at this point in the history
…Details to retrieve enhanced vulnerability intelligence details for findings.
  • Loading branch information
awstools committed Jul 31, 2023
1 parent 2c2d3db commit 322a599
Show file tree
Hide file tree
Showing 9 changed files with 1,038 additions and 232 deletions.
8 changes: 8 additions & 0 deletions clients/client-inspector2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ BatchGetCodeSnippet

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-inspector2/classes/batchgetcodesnippetcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-inspector2/interfaces/batchgetcodesnippetcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-inspector2/interfaces/batchgetcodesnippetcommandoutput.html)

</details>
<details>
<summary>
BatchGetFindingDetails
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-inspector2/classes/batchgetfindingdetailscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-inspector2/interfaces/batchgetfindingdetailscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-inspector2/interfaces/batchgetfindingdetailscommandoutput.html)

</details>
<details>
<summary>
Expand Down
23 changes: 23 additions & 0 deletions clients/client-inspector2/src/Inspector2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ import {
BatchGetCodeSnippetCommandInput,
BatchGetCodeSnippetCommandOutput,
} from "./commands/BatchGetCodeSnippetCommand";
import {
BatchGetFindingDetailsCommand,
BatchGetFindingDetailsCommandInput,
BatchGetFindingDetailsCommandOutput,
} from "./commands/BatchGetFindingDetailsCommand";
import {
BatchGetFreeTrialInfoCommand,
BatchGetFreeTrialInfoCommandInput,
Expand Down Expand Up @@ -209,6 +214,7 @@ const commands = {
AssociateMemberCommand,
BatchGetAccountStatusCommand,
BatchGetCodeSnippetCommand,
BatchGetFindingDetailsCommand,
BatchGetFreeTrialInfoCommand,
BatchGetMemberEc2DeepInspectionStatusCommand,
BatchUpdateMemberEc2DeepInspectionStatusCommand,
Expand Down Expand Up @@ -302,6 +308,23 @@ export interface Inspector2 {
cb: (err: any, data?: BatchGetCodeSnippetCommandOutput) => void
): void;

/**
* @see {@link BatchGetFindingDetailsCommand}
*/
batchGetFindingDetails(
args: BatchGetFindingDetailsCommandInput,
options?: __HttpHandlerOptions
): Promise<BatchGetFindingDetailsCommandOutput>;
batchGetFindingDetails(
args: BatchGetFindingDetailsCommandInput,
cb: (err: any, data?: BatchGetFindingDetailsCommandOutput) => void
): void;
batchGetFindingDetails(
args: BatchGetFindingDetailsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: BatchGetFindingDetailsCommandOutput) => void
): void;

/**
* @see {@link BatchGetFreeTrialInfoCommand}
*/
Expand Down
6 changes: 6 additions & 0 deletions clients/client-inspector2/src/Inspector2Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ import {
BatchGetCodeSnippetCommandInput,
BatchGetCodeSnippetCommandOutput,
} from "./commands/BatchGetCodeSnippetCommand";
import {
BatchGetFindingDetailsCommandInput,
BatchGetFindingDetailsCommandOutput,
} from "./commands/BatchGetFindingDetailsCommand";
import {
BatchGetFreeTrialInfoCommandInput,
BatchGetFreeTrialInfoCommandOutput,
Expand Down Expand Up @@ -183,6 +187,7 @@ export type ServiceInputTypes =
| AssociateMemberCommandInput
| BatchGetAccountStatusCommandInput
| BatchGetCodeSnippetCommandInput
| BatchGetFindingDetailsCommandInput
| BatchGetFreeTrialInfoCommandInput
| BatchGetMemberEc2DeepInspectionStatusCommandInput
| BatchUpdateMemberEc2DeepInspectionStatusCommandInput
Expand Down Expand Up @@ -233,6 +238,7 @@ export type ServiceOutputTypes =
| AssociateMemberCommandOutput
| BatchGetAccountStatusCommandOutput
| BatchGetCodeSnippetCommandOutput
| BatchGetFindingDetailsCommandOutput
| BatchGetFreeTrialInfoCommandOutput
| BatchGetMemberEc2DeepInspectionStatusCommandOutput
| BatchUpdateMemberEc2DeepInspectionStatusCommandOutput
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
// 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 { Inspector2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../Inspector2Client";
import { BatchGetFindingDetailsRequest, BatchGetFindingDetailsResponse } from "../models/models_0";
import { de_BatchGetFindingDetailsCommand, se_BatchGetFindingDetailsCommand } from "../protocols/Aws_restJson1";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link BatchGetFindingDetailsCommand}.
*/
export interface BatchGetFindingDetailsCommandInput extends BatchGetFindingDetailsRequest {}
/**
* @public
*
* The output of {@link BatchGetFindingDetailsCommand}.
*/
export interface BatchGetFindingDetailsCommandOutput extends BatchGetFindingDetailsResponse, __MetadataBearer {}

/**
* @public
* <p>Gets vulnerability details for findings.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { Inspector2Client, BatchGetFindingDetailsCommand } from "@aws-sdk/client-inspector2"; // ES Modules import
* // const { Inspector2Client, BatchGetFindingDetailsCommand } = require("@aws-sdk/client-inspector2"); // CommonJS import
* const client = new Inspector2Client(config);
* const input = { // BatchGetFindingDetailsRequest
* findingArns: [ // FindingArnList // required
* "STRING_VALUE",
* ],
* };
* const command = new BatchGetFindingDetailsCommand(input);
* const response = await client.send(command);
* // { // BatchGetFindingDetailsResponse
* // findingDetails: [ // FindingDetails
* // { // FindingDetail
* // findingArn: "STRING_VALUE",
* // cisaData: { // CisaData
* // dateAdded: new Date("TIMESTAMP"),
* // dateDue: new Date("TIMESTAMP"),
* // action: "STRING_VALUE",
* // },
* // riskScore: Number("int"),
* // evidences: [ // EvidenceList
* // { // Evidence
* // evidenceRule: "STRING_VALUE",
* // evidenceDetail: "STRING_VALUE",
* // severity: "STRING_VALUE",
* // },
* // ],
* // ttps: [ // Ttps
* // "STRING_VALUE",
* // ],
* // tools: [ // Tools
* // "STRING_VALUE",
* // ],
* // exploitObserved: { // ExploitObserved
* // lastSeen: new Date("TIMESTAMP"),
* // firstSeen: new Date("TIMESTAMP"),
* // },
* // referenceUrls: [ // VulnerabilityReferenceUrls
* // "STRING_VALUE",
* // ],
* // cwes: [ // Cwes
* // "STRING_VALUE",
* // ],
* // epssScore: Number("double"),
* // },
* // ],
* // errors: [ // FindingDetailsErrorList
* // { // FindingDetailsError
* // findingArn: "STRING_VALUE", // required
* // errorCode: "STRING_VALUE", // required
* // errorMessage: "STRING_VALUE", // required
* // },
* // ],
* // };
*
* ```
*
* @param BatchGetFindingDetailsCommandInput - {@link BatchGetFindingDetailsCommandInput}
* @returns {@link BatchGetFindingDetailsCommandOutput}
* @see {@link BatchGetFindingDetailsCommandInput} for command's `input` shape.
* @see {@link BatchGetFindingDetailsCommandOutput} for command's `response` shape.
* @see {@link Inspector2ClientResolvedConfig | config} for Inspector2Client's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>You do not have sufficient access to perform this action.</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>The request has failed due to an internal failure of the Amazon Inspector service.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The limit on the number of requests per second was exceeded.</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The request has failed validation due to missing required fields or having invalid
* inputs.</p>
*
* @throws {@link Inspector2ServiceException}
* <p>Base exception class for all service exceptions from Inspector2 service.</p>
*
*/
export class BatchGetFindingDetailsCommand extends $Command<
BatchGetFindingDetailsCommandInput,
BatchGetFindingDetailsCommandOutput,
Inspector2ClientResolvedConfig
> {
// 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: BatchGetFindingDetailsCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: Inspector2ClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<BatchGetFindingDetailsCommandInput, BatchGetFindingDetailsCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, BatchGetFindingDetailsCommand.getEndpointParameterInstructions())
);

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

const { logger } = configuration;
const clientName = "Inspector2Client";
const commandName = "BatchGetFindingDetailsCommand";
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: BatchGetFindingDetailsCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return se_BatchGetFindingDetailsCommand(input, context);
}

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

// Start section: command_body_extra
// End section: command_body_extra
}
1 change: 1 addition & 0 deletions clients/client-inspector2/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
export * from "./AssociateMemberCommand";
export * from "./BatchGetAccountStatusCommand";
export * from "./BatchGetCodeSnippetCommand";
export * from "./BatchGetFindingDetailsCommand";
export * from "./BatchGetFreeTrialInfoCommand";
export * from "./BatchGetMemberEc2DeepInspectionStatusCommand";
export * from "./BatchUpdateMemberEc2DeepInspectionStatusCommand";
Expand Down
2 changes: 1 addition & 1 deletion clients/client-inspector2/src/endpoint/ruleset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ m={[r]:"booleanEquals",[s]:[true,{[r]:"getAttr",[s]:[{[t]:e},"supportsDualStack"
n=[i],
o=[j],
p=[{[t]:"Region"}];
const _data={version:"1.0",parameters:{Region:f,UseDualStack:g,UseFIPS:g,Endpoint:f},rules:[{conditions:[{[r]:a,[s]:[h]}],type:b,rules:[{conditions:n,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:c},{type:b,rules:[{conditions:o,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:c},{endpoint:{url:h,properties:k,headers:k},type:d}]}]},{type:b,rules:[{conditions:[{[r]:a,[s]:p}],type:b,rules:[{conditions:[{[r]:"aws.partition",[s]:p,assign:e}],type:b,rules:[{conditions:[i,j],type:b,rules:[{conditions:[l,m],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://inspector2-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:c}]},{conditions:n,type:b,rules:[{conditions:[l],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://inspector2-fips.{Region}.{PartitionResult#dnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"FIPS is enabled but this partition does not support FIPS",type:c}]},{conditions:o,type:b,rules:[{conditions:[m],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://inspector2.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"DualStack is enabled but this partition does not support DualStack",type:c}]},{type:b,rules:[{endpoint:{url:"https://inspector2.{Region}.{PartitionResult#dnsSuffix}",properties:k,headers:k},type:d}]}]}]},{error:"Invalid Configuration: Missing Region",type:c}]}]};
const _data={version:"1.0",parameters:{Region:f,UseDualStack:g,UseFIPS:g,Endpoint:f},rules:[{conditions:[{[r]:a,[s]:[h]}],type:b,rules:[{conditions:n,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:c},{conditions:o,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:c},{endpoint:{url:h,properties:k,headers:k},type:d}]},{conditions:[{[r]:a,[s]:p}],type:b,rules:[{conditions:[{[r]:"aws.partition",[s]:p,assign:e}],type:b,rules:[{conditions:[i,j],type:b,rules:[{conditions:[l,m],type:b,rules:[{endpoint:{url:"https://inspector2-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:k,headers:k},type:d}]},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:c}]},{conditions:n,type:b,rules:[{conditions:[l],type:b,rules:[{endpoint:{url:"https://inspector2-fips.{Region}.{PartitionResult#dnsSuffix}",properties:k,headers:k},type:d}]},{error:"FIPS is enabled but this partition does not support FIPS",type:c}]},{conditions:o,type:b,rules:[{conditions:[m],type:b,rules:[{endpoint:{url:"https://inspector2.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:k,headers:k},type:d}]},{error:"DualStack is enabled but this partition does not support DualStack",type:c}]},{endpoint:{url:"https://inspector2.{Region}.{PartitionResult#dnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"Invalid Configuration: Missing Region",type:c}]};
export const ruleSet: RuleSetObject = _data;
Loading

0 comments on commit 322a599

Please sign in to comment.