AWS SDK for Go (PILOT)
API Reference

PREVIEW DOCUMENTATION - This is a preview of a new format for the AWS SDK for Go API Reference documentation. For the current AWS SDK for Go API Reference, see https://docs.aws.amazon.com/sdk-for-go/api/.

We welcome your feedback on this new version of the documentation. Send your comments to aws-sdkdocs-feedback@amazon.com.

Rule

import "github.com/aws/aws-sdk-go/service/waf"

type Rule struct { MetricName *string `type:"string"` Name *string `min:"1" type:"string"` Predicates []*Predicate `type:"list" required:"true"` RuleId *string `min:"1" type:"string" required:"true"` }

A combination of ByteMatchSet, IPSet, and/or SqlInjectionMatchSet objects that identify the web requests that you want to allow, block, or count. For example, you might create a Rule that includes the following predicates:

  • An IPSet that causes AWS WAF to search for web requests that originate from the IP address 192.0.2.44

  • A ByteMatchSet that causes AWS WAF to search for web requests for which the value of the User-Agent header is BadBot.

To match the settings in this Rule, a request must originate from 192.0.2.44 AND include a User-Agent header for which the value is BadBot.

MetricName

Type: *string

A friendly name or description for the metrics for this Rule. The name can contain only alphanumeric characters (A-Z, a-z, 0-9); the name can't contain whitespace. You can't change MetricName after you create the Rule.

Name

Type: *string

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

Predicates

Specifies the ByteMatchSet, IPSet, SqlInjectionMatchSet, XssMatchSet, RegexMatchSet, GeoMatchSet, and SizeConstraintSet objects that you want to add to a Rule and, for each object, indicates whether you want to negate the settings, for example, requests that do NOT originate from the IP address 192.0.2.44.

RuleId

Type: *string

A unique identifier for a Rule. You use RuleId to get more information about a Rule (see GetRule), update a Rule (see UpdateRule), insert a Rule into a WebACL or delete a one from a WebACL (see UpdateWebACL), or delete a Rule from AWS WAF (see DeleteRule).

RuleId is returned by CreateRule and by ListRules.

RuleId is a required field

Method

GoString

func (s Rule) GoString() string

GoString returns the string representation

SetMetricName

func (s *Rule) SetMetricName(v string) *Rule

SetMetricName sets the MetricName field's value.

SetName

func (s *Rule) SetName(v string) *Rule

SetName sets the Name field's value.

SetPredicates

func (s *Rule) SetPredicates(v []*Predicate) *Rule

SetPredicates sets the Predicates field's value.

SetRuleId

func (s *Rule) SetRuleId(v string) *Rule

SetRuleId sets the RuleId field's value.

String

func (s Rule) String() string

String returns the string representation

On this page: