All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.waf.model.HTTPRequest Maven / Gradle / Ivy

/*
 * Copyright 2010-2016 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.waf.model;

import java.io.Serializable;

/**
 * 

* The response from a GetSampledRequests request includes an * HTTPRequest complex type that appears as Request in * the response syntax. HTTPRequest contains information about one * of the web requests that were returned by GetSampledRequests. *

*/ public class HTTPRequest implements Serializable, Cloneable { /** *

* The IP address that the request originated from. If the * WebACL 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 part of a web request that identifies the resource, for example, * /images/daily-ad.jpg. *

*/ private String uRI; /** *

* The HTTP method specified in the sampled web request. CloudFront supports * the following methods: DELETE, GET, * HEAD, OPTIONS, PATCH, * POST, and PUT. *

*/ 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 two values for each header in the sampled * web request: the name of the header and the value of the header. *

*/ private java.util.List headers; /** *

* The IP address that the request originated from. If the * WebACL 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 * WebACL 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 * WebACL 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 * WebACL 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 * WebACL 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 * WebACL 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 part of a web request that identifies the resource, for example, * /images/daily-ad.jpg. *

        * * @param uRI * The part of a web request that identifies the resource, for * example, /images/daily-ad.jpg. */ public void setURI(String uRI) { this.uRI = uRI; } /** *

        * The part of a web request that identifies the resource, for example, * /images/daily-ad.jpg. *

        * * @return The part of a web request that identifies the resource, for * example, /images/daily-ad.jpg. */ public String getURI() { return this.uRI; } /** *

        * The part of a web request that identifies the resource, for example, * /images/daily-ad.jpg. *

        * * @param uRI * The part of a web request that 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. CloudFront supports * the following methods: DELETE, GET, * HEAD, OPTIONS, PATCH, * POST, and PUT. *

        * * @param method * The HTTP method specified in the sampled web request. CloudFront * supports the following methods: DELETE, * GET, HEAD, OPTIONS, * PATCH, POST, and PUT. */ public void setMethod(String method) { this.method = method; } /** *

        * The HTTP method specified in the sampled web request. CloudFront supports * the following methods: DELETE, GET, * HEAD, OPTIONS, PATCH, * POST, and PUT. *

        * * @return The HTTP method specified in the sampled web request. CloudFront * supports the following methods: DELETE, * GET, HEAD, OPTIONS, * PATCH, POST, and PUT. */ public String getMethod() { return this.method; } /** *

        * The HTTP method specified in the sampled web request. CloudFront supports * the following methods: DELETE, GET, * HEAD, OPTIONS, PATCH, * POST, and PUT. *

        * * @param method * The HTTP method specified in the sampled web request. CloudFront * supports the following methods: DELETE, * GET, HEAD, OPTIONS, * PATCH, POST, and PUT. * @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 two values for each header in the sampled * web request: the name of the header and the value of the header. *

        * * @return A complex type that contains two values for each header in the * sampled web request: the name of the header and the value of the * header. */ public java.util.List getHeaders() { return headers; } /** *

        * A complex type that contains two values for each header in the sampled * web request: the name of the header and the value of the header. *

        * * @param headers * A complex type that contains two values for each header in the * sampled web request: the name of the header and the value of the * header. */ 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 two values for each header in the sampled * web request: the name of the header and the value of the header. *

        *

        * 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 two values for each header in the * sampled web request: the name of the header and the value of the * header. * @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 two values for each header in the sampled * web request: the name of the header and the value of the header. *

        * * @param headers * A complex type that contains two values for each header in the * sampled web request: the name of the header and the value of the * header. * @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; useful for testing and * debugging. * * @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: " + getClientIP() + ","); if (getCountry() != null) sb.append("Country: " + getCountry() + ","); if (getURI() != null) sb.append("URI: " + getURI() + ","); if (getMethod() != null) sb.append("Method: " + getMethod() + ","); if (getHTTPVersion() != null) sb.append("HTTPVersion: " + getHTTPVersion() + ","); if (getHeaders() != null) sb.append("Headers: " + 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); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy