Skip to content

Commit 900da98

Browse files
author
awstools
committed
feat(client-wafv2): You can now delete an API key that you've created for use with your CAPTCHA JavaScript integration API.
1 parent 93b5aca commit 900da98

File tree

8 files changed

+286
-6
lines changed

8 files changed

+286
-6
lines changed

clients/client-wafv2/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,14 @@ CreateWebACL
316316

317317
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/wafv2/command/CreateWebACLCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-wafv2/Interface/CreateWebACLCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-wafv2/Interface/CreateWebACLCommandOutput/)
318318

319+
</details>
320+
<details>
321+
<summary>
322+
DeleteAPIKey
323+
</summary>
324+
325+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/wafv2/command/DeleteAPIKeyCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-wafv2/Interface/DeleteAPIKeyCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-wafv2/Interface/DeleteAPIKeyCommandOutput/)
326+
319327
</details>
320328
<details>
321329
<summary>

clients/client-wafv2/src/WAFV2.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ import {
3333
CreateWebACLCommandInput,
3434
CreateWebACLCommandOutput,
3535
} from "./commands/CreateWebACLCommand";
36+
import {
37+
DeleteAPIKeyCommand,
38+
DeleteAPIKeyCommandInput,
39+
DeleteAPIKeyCommandOutput,
40+
} from "./commands/DeleteAPIKeyCommand";
3641
import {
3742
DeleteFirewallManagerRuleGroupsCommand,
3843
DeleteFirewallManagerRuleGroupsCommandInput,
@@ -241,6 +246,7 @@ const commands = {
241246
CreateRegexPatternSetCommand,
242247
CreateRuleGroupCommand,
243248
CreateWebACLCommand,
249+
DeleteAPIKeyCommand,
244250
DeleteFirewallManagerRuleGroupsCommand,
245251
DeleteIPSetCommand,
246252
DeleteLoggingConfigurationCommand,
@@ -379,6 +385,17 @@ export interface WAFV2 {
379385
cb: (err: any, data?: CreateWebACLCommandOutput) => void
380386
): void;
381387

388+
/**
389+
* @see {@link DeleteAPIKeyCommand}
390+
*/
391+
deleteAPIKey(args: DeleteAPIKeyCommandInput, options?: __HttpHandlerOptions): Promise<DeleteAPIKeyCommandOutput>;
392+
deleteAPIKey(args: DeleteAPIKeyCommandInput, cb: (err: any, data?: DeleteAPIKeyCommandOutput) => void): void;
393+
deleteAPIKey(
394+
args: DeleteAPIKeyCommandInput,
395+
options: __HttpHandlerOptions,
396+
cb: (err: any, data?: DeleteAPIKeyCommandOutput) => void
397+
): void;
398+
382399
/**
383400
* @see {@link DeleteFirewallManagerRuleGroupsCommand}
384401
*/

clients/client-wafv2/src/WAFV2Client.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import {
5858
} from "./commands/CreateRegexPatternSetCommand";
5959
import { CreateRuleGroupCommandInput, CreateRuleGroupCommandOutput } from "./commands/CreateRuleGroupCommand";
6060
import { CreateWebACLCommandInput, CreateWebACLCommandOutput } from "./commands/CreateWebACLCommand";
61+
import { DeleteAPIKeyCommandInput, DeleteAPIKeyCommandOutput } from "./commands/DeleteAPIKeyCommand";
6162
import {
6263
DeleteFirewallManagerRuleGroupsCommandInput,
6364
DeleteFirewallManagerRuleGroupsCommandOutput,
@@ -204,6 +205,7 @@ export type ServiceInputTypes =
204205
| CreateRegexPatternSetCommandInput
205206
| CreateRuleGroupCommandInput
206207
| CreateWebACLCommandInput
208+
| DeleteAPIKeyCommandInput
207209
| DeleteFirewallManagerRuleGroupsCommandInput
208210
| DeleteIPSetCommandInput
209211
| DeleteLoggingConfigurationCommandInput
@@ -262,6 +264,7 @@ export type ServiceOutputTypes =
262264
| CreateRegexPatternSetCommandOutput
263265
| CreateRuleGroupCommandOutput
264266
| CreateWebACLCommandOutput
267+
| DeleteAPIKeyCommandOutput
265268
| DeleteFirewallManagerRuleGroupsCommandOutput
266269
| DeleteIPSetCommandOutput
267270
| DeleteLoggingConfigurationCommandOutput
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { commonParams } from "../endpoint/EndpointParameters";
8+
import { DeleteAPIKeyRequest, DeleteAPIKeyResponse } from "../models/models_0";
9+
import { de_DeleteAPIKeyCommand, se_DeleteAPIKeyCommand } from "../protocols/Aws_json1_1";
10+
import { ServiceInputTypes, ServiceOutputTypes, WAFV2ClientResolvedConfig } from "../WAFV2Client";
11+
12+
/**
13+
* @public
14+
*/
15+
export { __MetadataBearer, $Command };
16+
/**
17+
* @public
18+
*
19+
* The input for {@link DeleteAPIKeyCommand}.
20+
*/
21+
export interface DeleteAPIKeyCommandInput extends DeleteAPIKeyRequest {}
22+
/**
23+
* @public
24+
*
25+
* The output of {@link DeleteAPIKeyCommand}.
26+
*/
27+
export interface DeleteAPIKeyCommandOutput extends DeleteAPIKeyResponse, __MetadataBearer {}
28+
29+
/**
30+
* @public
31+
* <p>Deletes the specified API key. </p>
32+
* <p>After you delete a key, it can take up to 24 hours for WAF to disallow use of the key in all regions. </p>
33+
* @example
34+
* Use a bare-bones client and the command you need to make an API call.
35+
* ```javascript
36+
* import { WAFV2Client, DeleteAPIKeyCommand } from "@aws-sdk/client-wafv2"; // ES Modules import
37+
* // const { WAFV2Client, DeleteAPIKeyCommand } = require("@aws-sdk/client-wafv2"); // CommonJS import
38+
* const client = new WAFV2Client(config);
39+
* const input = { // DeleteAPIKeyRequest
40+
* Scope: "CLOUDFRONT" || "REGIONAL", // required
41+
* APIKey: "STRING_VALUE", // required
42+
* };
43+
* const command = new DeleteAPIKeyCommand(input);
44+
* const response = await client.send(command);
45+
* // {};
46+
*
47+
* ```
48+
*
49+
* @param DeleteAPIKeyCommandInput - {@link DeleteAPIKeyCommandInput}
50+
* @returns {@link DeleteAPIKeyCommandOutput}
51+
* @see {@link DeleteAPIKeyCommandInput} for command's `input` shape.
52+
* @see {@link DeleteAPIKeyCommandOutput} for command's `response` shape.
53+
* @see {@link WAFV2ClientResolvedConfig | config} for WAFV2Client's `config` shape.
54+
*
55+
* @throws {@link WAFInternalErrorException} (server fault)
56+
* <p>Your request is valid, but WAF couldn’t perform the operation because of a system
57+
* problem. Retry your request. </p>
58+
*
59+
* @throws {@link WAFInvalidOperationException} (client fault)
60+
* <p>The operation isn't valid. </p>
61+
*
62+
* @throws {@link WAFInvalidParameterException} (client fault)
63+
* <p>The operation failed because WAF didn't recognize a parameter in the request. For
64+
* example: </p>
65+
* <ul>
66+
* <li>
67+
* <p>You specified a parameter name or value that isn't valid.</p>
68+
* </li>
69+
* <li>
70+
* <p>Your nested statement isn't valid. You might have tried to nest a statement that
71+
* can’t be nested. </p>
72+
* </li>
73+
* <li>
74+
* <p>You tried to update a <code>WebACL</code> with a <code>DefaultAction</code> that
75+
* isn't among the types available at <a>DefaultAction</a>.</p>
76+
* </li>
77+
* <li>
78+
* <p>Your request references an ARN that is malformed, or corresponds to a resource
79+
* with which a web ACL can't be associated.</p>
80+
* </li>
81+
* </ul>
82+
*
83+
* @throws {@link WAFNonexistentItemException} (client fault)
84+
* <p>WAF couldn’t perform the operation because your resource doesn't exist.
85+
* If you've just created a resource that you're using in this operation, you might
86+
* just need to wait a few minutes. It can take from a few seconds to a number of minutes
87+
* for changes to propagate. </p>
88+
*
89+
* @throws {@link WAFOptimisticLockException} (client fault)
90+
* <p>WAF couldn’t save your changes because you tried to update or delete a resource
91+
* that has changed since you last retrieved it. Get the resource again, make any changes you
92+
* need to make to the new copy, and retry your operation. </p>
93+
*
94+
* @throws {@link WAFV2ServiceException}
95+
* <p>Base exception class for all service exceptions from WAFV2 service.</p>
96+
*
97+
*/
98+
export class DeleteAPIKeyCommand extends $Command
99+
.classBuilder<
100+
DeleteAPIKeyCommandInput,
101+
DeleteAPIKeyCommandOutput,
102+
WAFV2ClientResolvedConfig,
103+
ServiceInputTypes,
104+
ServiceOutputTypes
105+
>()
106+
.ep({
107+
...commonParams,
108+
})
109+
.m(function (this: any, Command: any, cs: any, config: WAFV2ClientResolvedConfig, o: any) {
110+
return [
111+
getSerdePlugin(config, this.serialize, this.deserialize),
112+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
113+
];
114+
})
115+
.s("AWSWAF_20190729", "DeleteAPIKey", {})
116+
.n("WAFV2Client", "DeleteAPIKeyCommand")
117+
.f(void 0, void 0)
118+
.ser(se_DeleteAPIKeyCommand)
119+
.de(de_DeleteAPIKeyCommand)
120+
.build() {}

clients/client-wafv2/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export * from "./CreateIPSetCommand";
66
export * from "./CreateRegexPatternSetCommand";
77
export * from "./CreateRuleGroupCommand";
88
export * from "./CreateWebACLCommand";
9+
export * from "./DeleteAPIKeyCommand";
910
export * from "./DeleteFirewallManagerRuleGroupsCommand";
1011
export * from "./DeleteIPSetCommand";
1112
export * from "./DeleteLoggingConfigurationCommand";

clients/client-wafv2/src/models/models_0.ts

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3594,7 +3594,7 @@ export interface CreateAPIKeyRequest {
35943594
* <p>The client application domains that you want to use this API key for. </p>
35953595
* <p>Example JSON: <code>"TokenDomains": ["abc.com", "store.abc.com"]</code>
35963596
* </p>
3597-
* <p>Public suffixes aren't allowed. For example, you can't use <code>usa.gov</code> or <code>co.uk</code> as token domains.</p>
3597+
* <p>Public suffixes aren't allowed. For example, you can't use <code>gov.au</code> or <code>co.uk</code> as token domains.</p>
35983598
*/
35993599
TokenDomains: string[] | undefined;
36003600
}
@@ -4167,6 +4167,37 @@ export class WAFConfigurationWarningException extends __BaseException {
41674167
}
41684168
}
41694169

4170+
/**
4171+
* @public
4172+
*/
4173+
export interface DeleteAPIKeyRequest {
4174+
/**
4175+
* @public
4176+
* <p>Specifies whether this is for an Amazon CloudFront distribution or for a regional application. A regional application can be an Application Load Balancer (ALB), an Amazon API Gateway REST API, an AppSync GraphQL API, an Amazon Cognito user pool, an App Runner service, or an Amazon Web Services Verified Access instance. </p>
4177+
* <p>To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows: </p>
4178+
* <ul>
4179+
* <li>
4180+
* <p>CLI - Specify the Region when you use the CloudFront scope: <code>--scope=CLOUDFRONT --region=us-east-1</code>. </p>
4181+
* </li>
4182+
* <li>
4183+
* <p>API and SDKs - For all calls, use the Region endpoint us-east-1. </p>
4184+
* </li>
4185+
* </ul>
4186+
*/
4187+
Scope: Scope | undefined;
4188+
4189+
/**
4190+
* @public
4191+
* <p>The encrypted API key that you want to delete. </p>
4192+
*/
4193+
APIKey: string | undefined;
4194+
}
4195+
4196+
/**
4197+
* @public
4198+
*/
4199+
export interface DeleteAPIKeyResponse {}
4200+
41704201
/**
41714202
* @public
41724203
*/
@@ -8319,7 +8350,7 @@ export interface CreateWebACLRequest {
83198350
* <p>Specifies the domains that WAF should accept in a web request token. This enables the use of tokens across multiple protected websites. When WAF provides a token, it uses the domain of the Amazon Web Services resource that the web ACL is protecting. If you don't specify a list of token domains, WAF accepts tokens only for the domain of the protected resource. With a token domain list, WAF accepts the resource's host domain plus all domains in the token domain list, including their prefixed subdomains.</p>
83208351
* <p>Example JSON: <code>"TokenDomains": \{ "mywebsite.com", "myotherwebsite.com" \}</code>
83218352
* </p>
8322-
* <p>Public suffixes aren't allowed. For example, you can't use <code>usa.gov</code> or <code>co.uk</code> as token domains.</p>
8353+
* <p>Public suffixes aren't allowed. For example, you can't use <code>gov.au</code> or <code>co.uk</code> as token domains.</p>
83238354
*/
83248355
TokenDomains?: string[];
83258356

@@ -8602,7 +8633,7 @@ export interface UpdateWebACLRequest {
86028633
* <p>Specifies the domains that WAF should accept in a web request token. This enables the use of tokens across multiple protected websites. When WAF provides a token, it uses the domain of the Amazon Web Services resource that the web ACL is protecting. If you don't specify a list of token domains, WAF accepts tokens only for the domain of the protected resource. With a token domain list, WAF accepts the resource's host domain plus all domains in the token domain list, including their prefixed subdomains.</p>
86038634
* <p>Example JSON: <code>"TokenDomains": \{ "mywebsite.com", "myotherwebsite.com" \}</code>
86048635
* </p>
8605-
* <p>Public suffixes aren't allowed. For example, you can't use <code>usa.gov</code> or <code>co.uk</code> as token domains.</p>
8636+
* <p>Public suffixes aren't allowed. For example, you can't use <code>gov.au</code> or <code>co.uk</code> as token domains.</p>
86068637
*/
86078638
TokenDomains?: string[];
86088639

clients/client-wafv2/src/protocols/Aws_json1_1.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import {
3131
} from "../commands/CreateRegexPatternSetCommand";
3232
import { CreateRuleGroupCommandInput, CreateRuleGroupCommandOutput } from "../commands/CreateRuleGroupCommand";
3333
import { CreateWebACLCommandInput, CreateWebACLCommandOutput } from "../commands/CreateWebACLCommand";
34+
import { DeleteAPIKeyCommandInput, DeleteAPIKeyCommandOutput } from "../commands/DeleteAPIKeyCommand";
3435
import {
3536
DeleteFirewallManagerRuleGroupsCommandInput,
3637
DeleteFirewallManagerRuleGroupsCommandOutput,
@@ -192,6 +193,7 @@ import {
192193
CustomResponse,
193194
CustomResponseBody,
194195
DefaultAction,
196+
DeleteAPIKeyRequest,
195197
DeleteFirewallManagerRuleGroupsRequest,
196198
DeleteIPSetRequest,
197199
DeleteLoggingConfigurationRequest,
@@ -441,6 +443,19 @@ export const se_CreateWebACLCommand = async (
441443
return buildHttpRpcRequest(context, headers, "/", undefined, body);
442444
};
443445

446+
/**
447+
* serializeAws_json1_1DeleteAPIKeyCommand
448+
*/
449+
export const se_DeleteAPIKeyCommand = async (
450+
input: DeleteAPIKeyCommandInput,
451+
context: __SerdeContext
452+
): Promise<__HttpRequest> => {
453+
const headers: __HeaderBag = sharedHeaders("DeleteAPIKey");
454+
let body: any;
455+
body = JSON.stringify(_json(input));
456+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
457+
};
458+
444459
/**
445460
* serializeAws_json1_1DeleteFirewallManagerRuleGroupsCommand
446461
*/
@@ -1179,6 +1194,26 @@ export const de_CreateWebACLCommand = async (
11791194
return response;
11801195
};
11811196

1197+
/**
1198+
* deserializeAws_json1_1DeleteAPIKeyCommand
1199+
*/
1200+
export const de_DeleteAPIKeyCommand = async (
1201+
output: __HttpResponse,
1202+
context: __SerdeContext
1203+
): Promise<DeleteAPIKeyCommandOutput> => {
1204+
if (output.statusCode >= 300) {
1205+
return de_CommandError(output, context);
1206+
}
1207+
const data: any = await parseBody(output.body, context);
1208+
let contents: any = {};
1209+
contents = _json(data);
1210+
const response: DeleteAPIKeyCommandOutput = {
1211+
$metadata: deserializeMetadata(output),
1212+
...contents,
1213+
};
1214+
return response;
1215+
};
1216+
11821217
/**
11831218
* deserializeAws_json1_1DeleteFirewallManagerRuleGroupsCommand
11841219
*/
@@ -2617,6 +2652,8 @@ const se_CreateWebACLRequest = (input: CreateWebACLRequest, context: __SerdeCont
26172652

26182653
// se_DefaultAction omitted.
26192654

2655+
// se_DeleteAPIKeyRequest omitted.
2656+
26202657
// se_DeleteFirewallManagerRuleGroupsRequest omitted.
26212658

26222659
// se_DeleteIPSetRequest omitted.
@@ -3187,6 +3224,8 @@ const de_ByteMatchStatement = (output: any, context: __SerdeContext): ByteMatchS
31873224

31883225
// de_DefaultAction omitted.
31893226

3227+
// de_DeleteAPIKeyResponse omitted.
3228+
31903229
// de_DeleteFirewallManagerRuleGroupsResponse omitted.
31913230

31923231
// de_DeleteIPSetResponse omitted.

0 commit comments

Comments
 (0)