Skip to content

Commit

Permalink
feat(client-wafv2): Added APIs to describe managed products. The APIs…
Browse files Browse the repository at this point in the history
… retrieve information about rule groups that are managed by AWS and by AWS Marketplace sellers.
  • Loading branch information
awstools committed Jun 2, 2023
1 parent a260da1 commit 7027dce
Show file tree
Hide file tree
Showing 10 changed files with 945 additions and 23 deletions.
16 changes: 16 additions & 0 deletions clients/client-wafv2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,22 @@ DeleteWebACL

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-wafv2/classes/deletewebaclcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-wafv2/interfaces/deletewebaclcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-wafv2/interfaces/deletewebaclcommandoutput.html)

</details>
<details>
<summary>
DescribeAllManagedProducts
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-wafv2/classes/describeallmanagedproductscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-wafv2/interfaces/describeallmanagedproductscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-wafv2/interfaces/describeallmanagedproductscommandoutput.html)

</details>
<details>
<summary>
DescribeManagedProductsByVendor
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-wafv2/classes/describemanagedproductsbyvendorcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-wafv2/interfaces/describemanagedproductsbyvendorcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-wafv2/interfaces/describemanagedproductsbyvendorcommandoutput.html)

</details>
<details>
<summary>
Expand Down
46 changes: 46 additions & 0 deletions clients/client-wafv2/src/WAFV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ import {
DeleteWebACLCommandInput,
DeleteWebACLCommandOutput,
} from "./commands/DeleteWebACLCommand";
import {
DescribeAllManagedProductsCommand,
DescribeAllManagedProductsCommandInput,
DescribeAllManagedProductsCommandOutput,
} from "./commands/DescribeAllManagedProductsCommand";
import {
DescribeManagedProductsByVendorCommand,
DescribeManagedProductsByVendorCommandInput,
DescribeManagedProductsByVendorCommandOutput,
} from "./commands/DescribeManagedProductsByVendorCommand";
import {
DescribeManagedRuleGroupCommand,
DescribeManagedRuleGroupCommandInput,
Expand Down Expand Up @@ -238,6 +248,8 @@ const commands = {
DeleteRegexPatternSetCommand,
DeleteRuleGroupCommand,
DeleteWebACLCommand,
DescribeAllManagedProductsCommand,
DescribeManagedProductsByVendorCommand,
DescribeManagedRuleGroupCommand,
DisassociateWebACLCommand,
GenerateMobileSdkReleaseUrlCommand,
Expand Down Expand Up @@ -471,6 +483,40 @@ export interface WAFV2 {
cb: (err: any, data?: DeleteWebACLCommandOutput) => void
): void;

/**
* @see {@link DescribeAllManagedProductsCommand}
*/
describeAllManagedProducts(
args: DescribeAllManagedProductsCommandInput,
options?: __HttpHandlerOptions
): Promise<DescribeAllManagedProductsCommandOutput>;
describeAllManagedProducts(
args: DescribeAllManagedProductsCommandInput,
cb: (err: any, data?: DescribeAllManagedProductsCommandOutput) => void
): void;
describeAllManagedProducts(
args: DescribeAllManagedProductsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: DescribeAllManagedProductsCommandOutput) => void
): void;

/**
* @see {@link DescribeManagedProductsByVendorCommand}
*/
describeManagedProductsByVendor(
args: DescribeManagedProductsByVendorCommandInput,
options?: __HttpHandlerOptions
): Promise<DescribeManagedProductsByVendorCommandOutput>;
describeManagedProductsByVendor(
args: DescribeManagedProductsByVendorCommandInput,
cb: (err: any, data?: DescribeManagedProductsByVendorCommandOutput) => void
): void;
describeManagedProductsByVendor(
args: DescribeManagedProductsByVendorCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: DescribeManagedProductsByVendorCommandOutput) => void
): void;

/**
* @see {@link DescribeManagedRuleGroupCommand}
*/
Expand Down
12 changes: 12 additions & 0 deletions clients/client-wafv2/src/WAFV2Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ import {
} from "./commands/DeleteRegexPatternSetCommand";
import { DeleteRuleGroupCommandInput, DeleteRuleGroupCommandOutput } from "./commands/DeleteRuleGroupCommand";
import { DeleteWebACLCommandInput, DeleteWebACLCommandOutput } from "./commands/DeleteWebACLCommand";
import {
DescribeAllManagedProductsCommandInput,
DescribeAllManagedProductsCommandOutput,
} from "./commands/DescribeAllManagedProductsCommand";
import {
DescribeManagedProductsByVendorCommandInput,
DescribeManagedProductsByVendorCommandOutput,
} from "./commands/DescribeManagedProductsByVendorCommand";
import {
DescribeManagedRuleGroupCommandInput,
DescribeManagedRuleGroupCommandOutput,
Expand Down Expand Up @@ -205,6 +213,8 @@ export type ServiceInputTypes =
| DeleteRegexPatternSetCommandInput
| DeleteRuleGroupCommandInput
| DeleteWebACLCommandInput
| DescribeAllManagedProductsCommandInput
| DescribeManagedProductsByVendorCommandInput
| DescribeManagedRuleGroupCommandInput
| DisassociateWebACLCommandInput
| GenerateMobileSdkReleaseUrlCommandInput
Expand Down Expand Up @@ -261,6 +271,8 @@ export type ServiceOutputTypes =
| DeleteRegexPatternSetCommandOutput
| DeleteRuleGroupCommandOutput
| DeleteWebACLCommandOutput
| DescribeAllManagedProductsCommandOutput
| DescribeManagedProductsByVendorCommandOutput
| DescribeManagedRuleGroupCommandOutput
| DisassociateWebACLCommandOutput
| GenerateMobileSdkReleaseUrlCommandOutput
Expand Down
164 changes: 164 additions & 0 deletions clients/client-wafv2/src/commands/DescribeAllManagedProductsCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
} from "@aws-sdk/types";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
import { SerdeContext as __SerdeContext } from "@smithy/types";

import { DescribeAllManagedProductsRequest, DescribeAllManagedProductsResponse } from "../models/models_0";
import { de_DescribeAllManagedProductsCommand, se_DescribeAllManagedProductsCommand } from "../protocols/Aws_json1_1";
import { ServiceInputTypes, ServiceOutputTypes, WAFV2ClientResolvedConfig } from "../WAFV2Client";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link DescribeAllManagedProductsCommand}.
*/
export interface DescribeAllManagedProductsCommandInput extends DescribeAllManagedProductsRequest {}
/**
* @public
*
* The output of {@link DescribeAllManagedProductsCommand}.
*/
export interface DescribeAllManagedProductsCommandOutput extends DescribeAllManagedProductsResponse, __MetadataBearer {}

/**
* @public
* <p>Provides high-level information for the Amazon Web Services Managed Rules rule groups and Amazon Web Services Marketplace managed rule groups. </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { WAFV2Client, DescribeAllManagedProductsCommand } from "@aws-sdk/client-wafv2"; // ES Modules import
* // const { WAFV2Client, DescribeAllManagedProductsCommand } = require("@aws-sdk/client-wafv2"); // CommonJS import
* const client = new WAFV2Client(config);
* const input = { // DescribeAllManagedProductsRequest
* Scope: "CLOUDFRONT" || "REGIONAL", // required
* };
* const command = new DescribeAllManagedProductsCommand(input);
* const response = await client.send(command);
* // { // DescribeAllManagedProductsResponse
* // ManagedProducts: [ // ManagedProductDescriptors
* // { // ManagedProductDescriptor
* // VendorName: "STRING_VALUE",
* // ManagedRuleSetName: "STRING_VALUE",
* // ProductId: "STRING_VALUE",
* // ProductLink: "STRING_VALUE",
* // ProductTitle: "STRING_VALUE",
* // ProductDescription: "STRING_VALUE",
* // SnsTopicArn: "STRING_VALUE",
* // IsVersioningSupported: true || false,
* // IsAdvancedManagedRuleSet: true || false,
* // },
* // ],
* // };
*
* ```
*
* @param DescribeAllManagedProductsCommandInput - {@link DescribeAllManagedProductsCommandInput}
* @returns {@link DescribeAllManagedProductsCommandOutput}
* @see {@link DescribeAllManagedProductsCommandInput} for command's `input` shape.
* @see {@link DescribeAllManagedProductsCommandOutput} for command's `response` shape.
* @see {@link WAFV2ClientResolvedConfig | config} for WAFV2Client's `config` shape.
*
* @throws {@link WAFInternalErrorException} (server fault)
* <p>Your request is valid, but WAF couldn’t perform the operation because of a system
* problem. Retry your request. </p>
*
* @throws {@link WAFInvalidOperationException} (client fault)
* <p>The operation isn't valid. </p>
*
* @throws {@link WAFV2ServiceException}
* <p>Base exception class for all service exceptions from WAFV2 service.</p>
*
*/
export class DescribeAllManagedProductsCommand extends $Command<
DescribeAllManagedProductsCommandInput,
DescribeAllManagedProductsCommandOutput,
WAFV2ClientResolvedConfig
> {
// 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: DescribeAllManagedProductsCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: WAFV2ClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<DescribeAllManagedProductsCommandInput, DescribeAllManagedProductsCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, DescribeAllManagedProductsCommand.getEndpointParameterInstructions())
);

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

const { logger } = configuration;
const clientName = "WAFV2Client";
const commandName = "DescribeAllManagedProductsCommand";
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: DescribeAllManagedProductsCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return se_DescribeAllManagedProductsCommand(input, context);
}

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

// Start section: command_body_extra
// End section: command_body_extra
}
Loading

0 comments on commit 7027dce

Please sign in to comment.