Class GeoMatchStatement
- java.lang.Object
-
- software.amazon.awssdk.services.wafv2.model.GeoMatchStatement
-
- All Implemented Interfaces:
Serializable,SdkPojo,ToCopyableBuilder<GeoMatchStatement.Builder,GeoMatchStatement>
@Generated("software.amazon.awssdk:codegen") public final class GeoMatchStatement extends Object implements SdkPojo, Serializable, ToCopyableBuilder<GeoMatchStatement.Builder,GeoMatchStatement>
A rule statement that labels web requests by country and region and that matches against web requests based on country code. A geo match rule labels every request that it inspects regardless of whether it finds a match.
-
To manage requests only by country, you can use this statement by itself and specify the countries that you want to match against in the
CountryCodesarray. -
Otherwise, configure your geo match rule with Count action so that it only labels requests. Then, add one or more label match rules to run after the geo match rule and configure them to match against the geographic labels and handle the requests as needed.
WAF labels requests using the alpha-2 country and region codes from the International Organization for Standardization (ISO) 3166 standard. WAF determines the codes using either the IP address in the web request origin or, if you specify it, the address in the geo match
ForwardedIPConfig.If you use the web request origin, the label formats are
awswaf:clientip:geo:region:<ISO country code>-<ISO region code>andawswaf:clientip:geo:country:<ISO country code>.If you use a forwarded IP address, the label formats are
awswaf:forwardedip:geo:region:<ISO country code>-<ISO region code>andawswaf:forwardedip:geo:country:<ISO country code>.For additional details, see Geographic match rule statement in the WAF Developer Guide.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceGeoMatchStatement.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GeoMatchStatement.Builderbuilder()List<CountryCode>countryCodes()An array of two-character country codes that you want to match against, for example,[ "US", "CN" ], from the alpha-2 country ISO codes of the ISO 3166 international standard.List<String>countryCodesAsStrings()An array of two-character country codes that you want to match against, for example,[ "US", "CN" ], from the alpha-2 country ISO codes of the ISO 3166 international standard.booleanequals(Object obj)booleanequalsBySdkFields(Object obj)ForwardedIPConfigforwardedIPConfig()The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that's reported by the web request origin.<T> Optional<T>getValueForField(String fieldName, Class<T> clazz)booleanhasCountryCodes()For responses, this returns true if the service returned a value for the CountryCodes property.inthashCode()List<SdkField<?>>sdkFields()static Class<? extends GeoMatchStatement.Builder>serializableBuilderClass()GeoMatchStatement.BuildertoBuilder()StringtoString()Returns a string representation of this object.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.utils.builder.ToCopyableBuilder
copy
-
-
-
-
Method Detail
-
countryCodes
public final List<CountryCode> countryCodes()
An array of two-character country codes that you want to match against, for example,
[ "US", "CN" ], from the alpha-2 country ISO codes of the ISO 3166 international standard.When you use a geo match statement just for the region and country labels that it adds to requests, you still have to supply a country code for the rule to evaluate. In this case, you configure the rule to only count matching requests, but it will still generate logging and count metrics for any matches. You can reduce the logging and metrics that the rule produces by specifying a country that's unlikely to be a source of traffic to your site.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the
hasCountryCodes()method.- Returns:
- An array of two-character country codes that you want to match against, for example,
[ "US", "CN" ], from the alpha-2 country ISO codes of the ISO 3166 international standard.When you use a geo match statement just for the region and country labels that it adds to requests, you still have to supply a country code for the rule to evaluate. In this case, you configure the rule to only count matching requests, but it will still generate logging and count metrics for any matches. You can reduce the logging and metrics that the rule produces by specifying a country that's unlikely to be a source of traffic to your site.
-
hasCountryCodes
public final boolean hasCountryCodes()
For responses, this returns true if the service returned a value for the CountryCodes property. This DOES NOT check that the value is non-empty (for which, you should check theisEmpty()method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
-
countryCodesAsStrings
public final List<String> countryCodesAsStrings()
An array of two-character country codes that you want to match against, for example,
[ "US", "CN" ], from the alpha-2 country ISO codes of the ISO 3166 international standard.When you use a geo match statement just for the region and country labels that it adds to requests, you still have to supply a country code for the rule to evaluate. In this case, you configure the rule to only count matching requests, but it will still generate logging and count metrics for any matches. You can reduce the logging and metrics that the rule produces by specifying a country that's unlikely to be a source of traffic to your site.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the
hasCountryCodes()method.- Returns:
- An array of two-character country codes that you want to match against, for example,
[ "US", "CN" ], from the alpha-2 country ISO codes of the ISO 3166 international standard.When you use a geo match statement just for the region and country labels that it adds to requests, you still have to supply a country code for the rule to evaluate. In this case, you configure the rule to only count matching requests, but it will still generate logging and count metrics for any matches. You can reduce the logging and metrics that the rule produces by specifying a country that's unlikely to be a source of traffic to your site.
-
forwardedIPConfig
public final ForwardedIPConfig forwardedIPConfig()
The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP address that's reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify any header name.
If the specified header isn't present in the request, WAF doesn't apply the rule to the web request at all.
- Returns:
- The configuration for inspecting IP addresses in an HTTP header that you specify, instead of using the IP
address that's reported by the web request origin. Commonly, this is the X-Forwarded-For (XFF) header,
but you can specify any header name.
If the specified header isn't present in the request, WAF doesn't apply the rule to the web request at all.
-
toBuilder
public GeoMatchStatement.Builder toBuilder()
- Specified by:
toBuilderin interfaceToCopyableBuilder<GeoMatchStatement.Builder,GeoMatchStatement>
-
builder
public static GeoMatchStatement.Builder builder()
-
serializableBuilderClass
public static Class<? extends GeoMatchStatement.Builder> serializableBuilderClass()
-
equalsBySdkFields
public final boolean equalsBySdkFields(Object obj)
- Specified by:
equalsBySdkFieldsin interfaceSdkPojo
-
toString
public final String toString()
Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be redacted from this string using a placeholder value.
-
-