amazonka-waf-regional-2.0: Amazon WAF Regional SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

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
ToJSON CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.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

AWSRequest CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Associated Types

type AWSResponse CreateRule #

Generic CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Associated Types

type Rep CreateRule :: Type -> Type #

Read CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Show CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

NFData CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Methods

rnf :: CreateRule -> () #

Eq CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Hashable CreateRule Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

type AWSResponse 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" "amazonka-waf-regional-2.0-83dY3vKOuQzAAW7M6EmzRI" '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))))

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 -

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

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.

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

  • 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.

  • rule :: Maybe Rule

    The Rule returned in the CreateRule response.

  • httpStatus :: Int

    The response's http status code.

Instances

Instances details
Generic CreateRuleResponse Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Associated Types

type Rep CreateRuleResponse :: Type -> Type #

Read CreateRuleResponse Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Show CreateRuleResponse Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

NFData CreateRuleResponse Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

Methods

rnf :: CreateRuleResponse -> () #

Eq CreateRuleResponse Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

type Rep CreateRuleResponse Source # 
Instance details

Defined in Amazonka.WAFRegional.CreateRule

type Rep CreateRuleResponse = D1 ('MetaData "CreateRuleResponse" "Amazonka.WAFRegional.CreateRule" "amazonka-waf-regional-2.0-83dY3vKOuQzAAW7M6EmzRI" 'False) (C1 ('MetaCons "CreateRuleResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "changeToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "rule") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Rule)) :*: 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:

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:rule:CreateRuleResponse', createRuleResponse_rule - The Rule returned in the CreateRule response.

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

Response Lenses

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.

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

The Rule returned in the CreateRule response.