/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.wafv2.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
* A rule statement to match against labels that have been added to the web request by rules that have already run in * the web ACL. *
** The label match statement provides the label or namespace string to search for. The label string can represent a part * or all of the fully qualified label name that had been added to the web request. Fully qualified labels have a * prefix, optional namespaces, and label name. The prefix identifies the rule group or web ACL context of the rule that * added the label. If you do not provide the fully qualified name in your label match string, WAF performs the search * for labels that were added in the same context as the label match statement. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class LabelMatchStatement implements Serializable, Cloneable, StructuredPojo { /** ** Specify whether you want to match using the label name or just the namespace. *
*/ private String scope; /** *
* The string to match against. The setting you provide for this depends on the match statement's Scope
* setting:
*
* If the Scope
indicates LABEL
, then this specification must include the name and can
* include any number of preceding namespace specifications and prefix up to providing the fully qualified label
* name.
*
* If the Scope
indicates NAMESPACE
, then this specification can include any number of
* contiguous namespace strings, and can include the entire label namespace prefix from the rule group or web ACL
* where the label originates.
*
* Labels are case sensitive and components of a label must be separated by colon, for example
* NS1:NS2:name
.
*
* Specify whether you want to match using the label name or just the namespace. *
* * @param scope * Specify whether you want to match using the label name or just the namespace. * @see LabelMatchScope */ public void setScope(String scope) { this.scope = scope; } /** ** Specify whether you want to match using the label name or just the namespace. *
* * @return Specify whether you want to match using the label name or just the namespace. * @see LabelMatchScope */ public String getScope() { return this.scope; } /** ** Specify whether you want to match using the label name or just the namespace. *
* * @param scope * Specify whether you want to match using the label name or just the namespace. * @return Returns a reference to this object so that method calls can be chained together. * @see LabelMatchScope */ public LabelMatchStatement withScope(String scope) { setScope(scope); return this; } /** ** Specify whether you want to match using the label name or just the namespace. *
* * @param scope * Specify whether you want to match using the label name or just the namespace. * @return Returns a reference to this object so that method calls can be chained together. * @see LabelMatchScope */ public LabelMatchStatement withScope(LabelMatchScope scope) { this.scope = scope.toString(); return this; } /** *
* The string to match against. The setting you provide for this depends on the match statement's Scope
* setting:
*
* If the Scope
indicates LABEL
, then this specification must include the name and can
* include any number of preceding namespace specifications and prefix up to providing the fully qualified label
* name.
*
* If the Scope
indicates NAMESPACE
, then this specification can include any number of
* contiguous namespace strings, and can include the entire label namespace prefix from the rule group or web ACL
* where the label originates.
*
* Labels are case sensitive and components of a label must be separated by colon, for example
* NS1:NS2:name
.
*
Scope
setting:
*
* If the Scope
indicates LABEL
, then this specification must include the name and
* can include any number of preceding namespace specifications and prefix up to providing the fully
* qualified label name.
*
* If the Scope
indicates NAMESPACE
, then this specification can include any number
* of contiguous namespace strings, and can include the entire label namespace prefix from the rule group or
* web ACL where the label originates.
*
* Labels are case sensitive and components of a label must be separated by colon, for example
* NS1:NS2:name
.
*/
public void setKey(String key) {
this.key = key;
}
/**
*
* The string to match against. The setting you provide for this depends on the match statement's Scope
* setting:
*
* If the Scope
indicates LABEL
, then this specification must include the name and can
* include any number of preceding namespace specifications and prefix up to providing the fully qualified label
* name.
*
* If the Scope
indicates NAMESPACE
, then this specification can include any number of
* contiguous namespace strings, and can include the entire label namespace prefix from the rule group or web ACL
* where the label originates.
*
* Labels are case sensitive and components of a label must be separated by colon, for example
* NS1:NS2:name
.
*
Scope
setting:
*
* If the Scope
indicates LABEL
, then this specification must include the name and
* can include any number of preceding namespace specifications and prefix up to providing the fully
* qualified label name.
*
* If the Scope
indicates NAMESPACE
, then this specification can include any
* number of contiguous namespace strings, and can include the entire label namespace prefix from the rule
* group or web ACL where the label originates.
*
* Labels are case sensitive and components of a label must be separated by colon, for example
* NS1:NS2:name
.
*/
public String getKey() {
return this.key;
}
/**
*
* The string to match against. The setting you provide for this depends on the match statement's Scope
* setting:
*
* If the Scope
indicates LABEL
, then this specification must include the name and can
* include any number of preceding namespace specifications and prefix up to providing the fully qualified label
* name.
*
* If the Scope
indicates NAMESPACE
, then this specification can include any number of
* contiguous namespace strings, and can include the entire label namespace prefix from the rule group or web ACL
* where the label originates.
*
* Labels are case sensitive and components of a label must be separated by colon, for example
* NS1:NS2:name
.
*
Scope
setting:
*
* If the Scope
indicates LABEL
, then this specification must include the name and
* can include any number of preceding namespace specifications and prefix up to providing the fully
* qualified label name.
*
* If the Scope
indicates NAMESPACE
, then this specification can include any number
* of contiguous namespace strings, and can include the entire label namespace prefix from the rule group or
* web ACL where the label originates.
*
* Labels are case sensitive and components of a label must be separated by colon, for example
* NS1:NS2:name
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public LabelMatchStatement withKey(String key) {
setKey(key);
return this;
}
/**
* 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.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getScope() != null)
sb.append("Scope: ").append(getScope()).append(",");
if (getKey() != null)
sb.append("Key: ").append(getKey());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof LabelMatchStatement == false)
return false;
LabelMatchStatement other = (LabelMatchStatement) obj;
if (other.getScope() == null ^ this.getScope() == null)
return false;
if (other.getScope() != null && other.getScope().equals(this.getScope()) == false)
return false;
if (other.getKey() == null ^ this.getKey() == null)
return false;
if (other.getKey() != null && other.getKey().equals(this.getKey()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getScope() == null) ? 0 : getScope().hashCode());
hashCode = prime * hashCode + ((getKey() == null) ? 0 : getKey().hashCode());
return hashCode;
}
@Override
public LabelMatchStatement clone() {
try {
return (LabelMatchStatement) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.wafv2.model.transform.LabelMatchStatementMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}