com.amazonaws.services.wafv2.model.HTTPRequest Maven / Gradle / Ivy
Show all versions of aws-java-sdk-wafv2 Show documentation
/*
* Copyright 2019-2024 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;
/**
*
* Part of the response from GetSampledRequests. This is a complex type that appears as Request
in
* the response syntax. HTTPRequest
contains information about one of the web requests.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class HTTPRequest implements Serializable, Cloneable, StructuredPojo {
/**
*
* The IP address that the request originated from. If the web ACL is associated with a CloudFront distribution,
* this is the value of one of the following fields in CloudFront access logs:
*
*
* -
*
* c-ip
, if the viewer did not use an HTTP proxy or a load balancer to send the request
*
*
* -
*
* x-forwarded-for
, if the viewer did use an HTTP proxy or a load balancer to send the request
*
*
*
*/
private String clientIP;
/**
*
* The two-letter country code for the country that the request originated from. For a current list of country
* codes, see the Wikipedia entry ISO 3166-1 alpha-2.
*
*/
private String country;
/**
*
* The URI path of the request, which identifies the resource, for example, /images/daily-ad.jpg
.
*
*/
private String uRI;
/**
*
* The HTTP method specified in the sampled web request.
*
*/
private String method;
/**
*
* The HTTP version specified in the sampled web request, for example, HTTP/1.1
.
*
*/
private String hTTPVersion;
/**
*
* A complex type that contains the name and value for each header in the sampled web request.
*
*/
private java.util.List headers;
/**
*
* The IP address that the request originated from. If the web ACL is associated with a CloudFront distribution,
* this is the value of one of the following fields in CloudFront access logs:
*
*
* -
*
* c-ip
, if the viewer did not use an HTTP proxy or a load balancer to send the request
*
*
* -
*
* x-forwarded-for
, if the viewer did use an HTTP proxy or a load balancer to send the request
*
*
*
*
* @param clientIP
* The IP address that the request originated from. If the web ACL is associated with a CloudFront
* distribution, this is the value of one of the following fields in CloudFront access logs:
*
* -
*
* c-ip
, if the viewer did not use an HTTP proxy or a load balancer to send the request
*
*
* -
*
* x-forwarded-for
, if the viewer did use an HTTP proxy or a load balancer to send the request
*
*
*/
public void setClientIP(String clientIP) {
this.clientIP = clientIP;
}
/**
*
* The IP address that the request originated from. If the web ACL is associated with a CloudFront distribution,
* this is the value of one of the following fields in CloudFront access logs:
*
*
* -
*
* c-ip
, if the viewer did not use an HTTP proxy or a load balancer to send the request
*
*
* -
*
* x-forwarded-for
, if the viewer did use an HTTP proxy or a load balancer to send the request
*
*
*
*
* @return The IP address that the request originated from. If the web ACL is associated with a CloudFront
* distribution, this is the value of one of the following fields in CloudFront access logs:
*
* -
*
* c-ip
, if the viewer did not use an HTTP proxy or a load balancer to send the request
*
*
* -
*
* x-forwarded-for
, if the viewer did use an HTTP proxy or a load balancer to send the request
*
*
*/
public String getClientIP() {
return this.clientIP;
}
/**
*
* The IP address that the request originated from. If the web ACL is associated with a CloudFront distribution,
* this is the value of one of the following fields in CloudFront access logs:
*
*
* -
*
* c-ip
, if the viewer did not use an HTTP proxy or a load balancer to send the request
*
*
* -
*
* x-forwarded-for
, if the viewer did use an HTTP proxy or a load balancer to send the request
*
*
*
*
* @param clientIP
* The IP address that the request originated from. If the web ACL is associated with a CloudFront
* distribution, this is the value of one of the following fields in CloudFront access logs:
*
* -
*
* c-ip
, if the viewer did not use an HTTP proxy or a load balancer to send the request
*
*
* -
*
* x-forwarded-for
, if the viewer did use an HTTP proxy or a load balancer to send the request
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public HTTPRequest withClientIP(String clientIP) {
setClientIP(clientIP);
return this;
}
/**
*
* The two-letter country code for the country that the request originated from. For a current list of country
* codes, see the Wikipedia entry ISO 3166-1 alpha-2.
*
*
* @param country
* The two-letter country code for the country that the request originated from. For a current list of
* country codes, see the Wikipedia entry ISO
* 3166-1 alpha-2.
*/
public void setCountry(String country) {
this.country = country;
}
/**
*
* The two-letter country code for the country that the request originated from. For a current list of country
* codes, see the Wikipedia entry ISO 3166-1 alpha-2.
*
*
* @return The two-letter country code for the country that the request originated from. For a current list of
* country codes, see the Wikipedia entry ISO
* 3166-1 alpha-2.
*/
public String getCountry() {
return this.country;
}
/**
*
* The two-letter country code for the country that the request originated from. For a current list of country
* codes, see the Wikipedia entry ISO 3166-1 alpha-2.
*
*
* @param country
* The two-letter country code for the country that the request originated from. For a current list of
* country codes, see the Wikipedia entry ISO
* 3166-1 alpha-2.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public HTTPRequest withCountry(String country) {
setCountry(country);
return this;
}
/**
*
* The URI path of the request, which identifies the resource, for example, /images/daily-ad.jpg
.
*
*
* @param uRI
* The URI path of the request, which identifies the resource, for example, /images/daily-ad.jpg
* .
*/
public void setURI(String uRI) {
this.uRI = uRI;
}
/**
*
* The URI path of the request, which identifies the resource, for example, /images/daily-ad.jpg
.
*
*
* @return The URI path of the request, which identifies the resource, for example,
* /images/daily-ad.jpg
.
*/
public String getURI() {
return this.uRI;
}
/**
*
* The URI path of the request, which identifies the resource, for example, /images/daily-ad.jpg
.
*
*
* @param uRI
* The URI path of the request, which identifies the resource, for example, /images/daily-ad.jpg
* .
* @return Returns a reference to this object so that method calls can be chained together.
*/
public HTTPRequest withURI(String uRI) {
setURI(uRI);
return this;
}
/**
*
* The HTTP method specified in the sampled web request.
*
*
* @param method
* The HTTP method specified in the sampled web request.
*/
public void setMethod(String method) {
this.method = method;
}
/**
*
* The HTTP method specified in the sampled web request.
*
*
* @return The HTTP method specified in the sampled web request.
*/
public String getMethod() {
return this.method;
}
/**
*
* The HTTP method specified in the sampled web request.
*
*
* @param method
* The HTTP method specified in the sampled web request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public HTTPRequest withMethod(String method) {
setMethod(method);
return this;
}
/**
*
* The HTTP version specified in the sampled web request, for example, HTTP/1.1
.
*
*
* @param hTTPVersion
* The HTTP version specified in the sampled web request, for example, HTTP/1.1
.
*/
public void setHTTPVersion(String hTTPVersion) {
this.hTTPVersion = hTTPVersion;
}
/**
*
* The HTTP version specified in the sampled web request, for example, HTTP/1.1
.
*
*
* @return The HTTP version specified in the sampled web request, for example, HTTP/1.1
.
*/
public String getHTTPVersion() {
return this.hTTPVersion;
}
/**
*
* The HTTP version specified in the sampled web request, for example, HTTP/1.1
.
*
*
* @param hTTPVersion
* The HTTP version specified in the sampled web request, for example, HTTP/1.1
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public HTTPRequest withHTTPVersion(String hTTPVersion) {
setHTTPVersion(hTTPVersion);
return this;
}
/**
*
* A complex type that contains the name and value for each header in the sampled web request.
*
*
* @return A complex type that contains the name and value for each header in the sampled web request.
*/
public java.util.List getHeaders() {
return headers;
}
/**
*
* A complex type that contains the name and value for each header in the sampled web request.
*
*
* @param headers
* A complex type that contains the name and value for each header in the sampled web request.
*/
public void setHeaders(java.util.Collection headers) {
if (headers == null) {
this.headers = null;
return;
}
this.headers = new java.util.ArrayList(headers);
}
/**
*
* A complex type that contains the name and value for each header in the sampled web request.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setHeaders(java.util.Collection)} or {@link #withHeaders(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param headers
* A complex type that contains the name and value for each header in the sampled web request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public HTTPRequest withHeaders(HTTPHeader... headers) {
if (this.headers == null) {
setHeaders(new java.util.ArrayList(headers.length));
}
for (HTTPHeader ele : headers) {
this.headers.add(ele);
}
return this;
}
/**
*
* A complex type that contains the name and value for each header in the sampled web request.
*
*
* @param headers
* A complex type that contains the name and value for each header in the sampled web request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public HTTPRequest withHeaders(java.util.Collection headers) {
setHeaders(headers);
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 (getClientIP() != null)
sb.append("ClientIP: ").append(getClientIP()).append(",");
if (getCountry() != null)
sb.append("Country: ").append(getCountry()).append(",");
if (getURI() != null)
sb.append("URI: ").append(getURI()).append(",");
if (getMethod() != null)
sb.append("Method: ").append(getMethod()).append(",");
if (getHTTPVersion() != null)
sb.append("HTTPVersion: ").append(getHTTPVersion()).append(",");
if (getHeaders() != null)
sb.append("Headers: ").append(getHeaders());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof HTTPRequest == false)
return false;
HTTPRequest other = (HTTPRequest) obj;
if (other.getClientIP() == null ^ this.getClientIP() == null)
return false;
if (other.getClientIP() != null && other.getClientIP().equals(this.getClientIP()) == false)
return false;
if (other.getCountry() == null ^ this.getCountry() == null)
return false;
if (other.getCountry() != null && other.getCountry().equals(this.getCountry()) == false)
return false;
if (other.getURI() == null ^ this.getURI() == null)
return false;
if (other.getURI() != null && other.getURI().equals(this.getURI()) == false)
return false;
if (other.getMethod() == null ^ this.getMethod() == null)
return false;
if (other.getMethod() != null && other.getMethod().equals(this.getMethod()) == false)
return false;
if (other.getHTTPVersion() == null ^ this.getHTTPVersion() == null)
return false;
if (other.getHTTPVersion() != null && other.getHTTPVersion().equals(this.getHTTPVersion()) == false)
return false;
if (other.getHeaders() == null ^ this.getHeaders() == null)
return false;
if (other.getHeaders() != null && other.getHeaders().equals(this.getHeaders()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getClientIP() == null) ? 0 : getClientIP().hashCode());
hashCode = prime * hashCode + ((getCountry() == null) ? 0 : getCountry().hashCode());
hashCode = prime * hashCode + ((getURI() == null) ? 0 : getURI().hashCode());
hashCode = prime * hashCode + ((getMethod() == null) ? 0 : getMethod().hashCode());
hashCode = prime * hashCode + ((getHTTPVersion() == null) ? 0 : getHTTPVersion().hashCode());
hashCode = prime * hashCode + ((getHeaders() == null) ? 0 : getHeaders().hashCode());
return hashCode;
}
@Override
public HTTPRequest clone() {
try {
return (HTTPRequest) 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.HTTPRequestMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}