gpt4 book ai didi

amazon-web-services - aws-cdk 文档中的 **wafv2.CfnWebACL** 接口(interface)签名与 ***waf2. generated.d.ts*** 文件中生成的签名不同

转载 作者:行者123 更新时间:2023-12-03 07:33:25 25 4
gpt4 key购买 nike

import * as wafv2 from "aws-cdk-lib/aws-wafv2";
const wafAclCloudFront = new wafv2.CfnWebACL(scope,id,props)

上面的构造函数签名

CfnWebACL.constructor(scope: constructs.Construct,id: string,props: CfnWebACLProps)

其中 CfnWebACLProps 的定义如下所示,根据 https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_waf.CfnWebACLProps.html

 const cfnWebACLProps: waf.CfnWebACLProps = {
defaultAction: {
type: 'type',
},
metricName: 'metricName',
name: 'name',

// the properties below are optional
rules: [{
priority: 123,
ruleId: 'ruleId',

// the properties below are optional
action: {
type: 'type',
},
}],
};

但是在我的全局 waf2. generated.d.ts 文件中,我看到:

export interface CfnWebACLProps {
/**
* The action to perform if none of the `Rules` contained in the `WebACL` match.
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-webacl.html#cfn-wafv2-webacl-defaultaction
*/
readonly defaultAction: CfnWebACL.DefaultActionProperty | cdk.IResolvable;
/**
* 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, or an AWS AppSync GraphQL API. Valid Values are `CLOUDFRONT` and `REGIONAL` .
*
* > For `CLOUDFRONT` , you must create your WAFv2 resources in the US East (N. Virginia) Region, `us-east-1` .
*
* For information about how to define the association of the web ACL with your resource, see `WebACLAssociation` .
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-webacl.html#cfn-wafv2-webacl-scope
*/
readonly scope: string;
/**
* Defines and enables Amazon CloudWatch metrics and web request sample collection.
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-webacl.html#cfn-wafv2-webacl-visibilityconfig
*/
readonly visibilityConfig: CfnWebACL.VisibilityConfigProperty | cdk.IResolvable;
/**
* Specifies how AWS WAF should handle `CAPTCHA` evaluations for rules that don't have their own `CaptchaConfig` settings. If you don't specify this, AWS WAF uses its default settings for `CaptchaConfig` .
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-webacl.html#cfn-wafv2-webacl-captchaconfig
*/
readonly captchaConfig?: CfnWebACL.CaptchaConfigProperty | cdk.IResolvable;
/**
* A map of custom response keys and content bodies. When you create a rule with a block action, you can send a custom response to the web request. You define these for the web ACL, and then use them in the rules and default actions that you define in the web ACL.
*
* For information about customizing web requests and responses, see [Customizing web requests and responses in AWS WAF](https://docs.aws.amazon.com/waf/latest/developerguide/waf-custom-request-response.html) in the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html) .
*
* For information about the limits on count and size for custom request and response settings, see [AWS WAF quotas](https://docs.aws.amazon.com/waf/latest/developerguide/limits.html) in the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html) .
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-webacl.html#cfn-wafv2-webacl-customresponsebodies
*/
readonly customResponseBodies?: {
[key: string]: (CfnWebACL.CustomResponseBodyProperty | cdk.IResolvable);
} | cdk.IResolvable;
/**
* A description of the web ACL that helps with identification.
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-webacl.html#cfn-wafv2-webacl-description
*/
readonly description?: string;
/**
* The name of the web ACL. You cannot change the name of a web ACL after you create it.
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-webacl.html#cfn-wafv2-webacl-name
*/
readonly name?: string;
/**
* The rule statements used to identify the web requests that you want to allow, block, or count. Each rule includes one top-level statement that AWS WAF uses to identify matching web requests, and parameters that govern how AWS WAF handles them.
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-webacl.html#cfn-wafv2-webacl-rules
*/
readonly rules?: Array<CfnWebACL.RuleProperty | cdk.IResolvable> | cdk.IResolvable;
/**
* Key:value pairs associated with an AWS resource. The key:value pair can be anything you define. Typically, the tag key represents a category (such as "environment") and the tag value represents a specific value within that category (such as "test," "development," or "production"). You can add up to 50 tags to each AWS resource.
*
* > To modify tags on existing resources, use the AWS WAF APIs or command line interface. With AWS CloudFormation , you can only add tags to AWS WAF resources during resource creation.
*
* @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-webacl.html#cfn-wafv2-webacl-tags
*/
readonly tags?: cdk.CfnTag[];
}

为什么接口(interface) CfnWebACLProps 不同

最佳答案

因为问题中的文档链接引用的是 aws-waf,而您使用的是 aws-wafv2,这是不同的。 Hereaws-wafv2 中关于 CfnWebACLProps 的文档,它与您看到的生成代码相匹配。

关于amazon-web-services - aws-cdk 文档中的 **wafv2.CfnWebACL** 接口(interface)签名与 ***waf2. generated.d.ts*** 文件中生成的签名不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73556826/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com