libZSservicesZSamazonka-waf-regionalZSamazonka-waf-regional
Copyright(c) 2013-2021 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone

Amazonka.WAFRegional.CreateRule

Description

This is AWS WAF Classic documentation. For more information, see AWS WAF Classic in the developer guide.

For the latest version of AWS WAF, use the AWS WAFV2 API and see the AWS WAF Developer Guide. With the latest version, AWS WAF has a single set of endpoints for regional and global use.

Creates a Rule, which contains the IPSet objects, ByteMatchSet objects, and other predicates that identify the requests that you want to block. If you add more than one predicate to a Rule, a request must match all of the specifications to be allowed or blocked. For example, suppose that you add the following to a Rule:

  • An IPSet that matches the IP address 192.0.2.44/32
  • A ByteMatchSet that matches BadBot in the User-Agent header

You then add the Rule to a WebACL and specify that you want to blocks requests that satisfy the Rule. For a request to be blocked, it must come from the IP address 192.0.2.44 and the User-Agent header in the request must contain the value BadBot.

To create and configure a Rule, perform the following steps:

  1. Create and update the predicates that you want to include in the Rule. For more information, see CreateByteMatchSet, CreateIPSet, and CreateSqlInjectionMatchSet.
  2. Use GetChangeToken to get the change token that you provide in the ChangeToken parameter of a CreateRule request.
  3. Submit a CreateRule request.
  4. Use GetChangeToken to get the change token that you provide in the ChangeToken parameter of an UpdateRule request.
  5. Submit an UpdateRule request to specify the predicates that you want to include in the Rule.
  6. Create and update a WebACL that contains the Rule. For more information, see CreateWebACL.

For more information about how to use the AWS WAF API to allow or block HTTP requests, see the AWS WAF Developer Guide.

Synopsis

Creating a Request

data CreateRule Source #

See: newCreateRule smart constructor.

Constructors

CreateRule' 

Fields

  • tags :: Maybe (NonEmpty Tag)
     
  • name :: Text

    A friendly name or description of the Rule. You can't change the name of a Rule after you create it.

  • metricName :: Text

    A friendly name or description for the metrics for this Rule. The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name of the metric after you create the Rule.

  • changeToken :: Text

    The value returned by the most recent call to GetChangeToken.

Instances

Instances details
Eq CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Read CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Show CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Generic CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Associated Types

type Rep CreateRule :: Type -> Type #

NFData CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Methods

rnf :: CreateRule -> () #

Hashable CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

ToJSON CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

AWSRequest CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Associated Types

type AWSResponse CreateRule #

ToHeaders CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Methods

toHeaders :: CreateRule -> [Header] #

ToPath CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

ToQuery CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

type Rep CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

type Rep CreateRule = D1 ('MetaData "CreateRule" "Amazonka.WAFRegional.CreateRule" "libZSservicesZSamazonka-waf-regionalZSamazonka-waf-regional" 'False) (C1 ('MetaCons "CreateRule'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "tags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (NonEmpty Tag))) :*: S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "metricName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "changeToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))))
type AWSResponse CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

newCreateRule Source #

Create a value of CreateRule with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:tags:CreateRule', createRule_tags -

$sel:name:CreateRule', createRule_name - A friendly name or description of the Rule. You can't change the name of a Rule after you create it.

$sel:metricName:CreateRule', createRule_metricName - A friendly name or description for the metrics for this Rule. The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name of the metric after you create the Rule.

$sel:changeToken:CreateRule', createRule_changeToken - The value returned by the most recent call to GetChangeToken.

Request Lenses

createRule_name :: Lens' CreateRule Text Source #

A friendly name or description of the Rule. You can't change the name of a Rule after you create it.

createRule_metricName :: Lens' CreateRule Text Source #

A friendly name or description for the metrics for this Rule. The name can contain only alphanumeric characters (A-Z, a-z, 0-9), with maximum length 128 and minimum length one. It can't contain whitespace or metric names reserved for AWS WAF, including "All" and "Default_Action." You can't change the name of the metric after you create the Rule.

createRule_changeToken :: Lens' CreateRule Text Source #

The value returned by the most recent call to GetChangeToken.

Destructuring the Response

data CreateRuleResponse Source #

See: newCreateRuleResponse smart constructor.

Constructors

CreateRuleResponse' 

Fields

  • rule :: Maybe Rule

    The Rule returned in the CreateRule response.

  • changeToken :: Maybe Text

    The ChangeToken that you used to submit the CreateRule request. You can also use this value to query the status of the request. For more information, see GetChangeTokenStatus.

  • httpStatus :: Int

    The response's http status code.

Instances

Instances details
Eq CreateRuleResponse Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Read CreateRuleResponse Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Show CreateRuleResponse Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Generic CreateRuleResponse Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Associated Types

type Rep CreateRuleResponse :: Type -> Type #

NFData CreateRuleResponse Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Methods

rnf :: CreateRuleResponse -> () #

type Rep CreateRuleResponse Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

type Rep CreateRuleResponse = D1 ('MetaData "CreateRuleResponse" "Amazonka.WAFRegional.CreateRule" "libZSservicesZSamazonka-waf-regionalZSamazonka-waf-regional" 'False) (C1 ('MetaCons "CreateRuleResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "rule") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Rule)) :*: (S1 ('MetaSel ('Just "changeToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))))

newCreateRuleResponse Source #

Create a value of CreateRuleResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:rule:CreateRuleResponse', createRuleResponse_rule - The Rule returned in the CreateRule response.

$sel:changeToken:CreateRule', createRuleResponse_changeToken - The ChangeToken that you used to submit the CreateRule request. You can also use this value to query the status of the request. For more information, see GetChangeTokenStatus.

$sel:httpStatus:CreateRuleResponse', createRuleResponse_httpStatus - The response's http status code.

Response Lenses

createRuleResponse_rule :: Lens' CreateRuleResponse (Maybe Rule) Source #

The Rule returned in the CreateRule response.

createRuleResponse_changeToken :: Lens' CreateRuleResponse (Maybe Text) Source #

The ChangeToken that you used to submit the CreateRule request. You can also use this value to query the status of the request. For more information, see GetChangeTokenStatus.