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

commonMain.aws.sdk.kotlin.services.waf.model.HttpRequest.kt Maven / Gradle / Ivy

There is a newer version: 1.3.76
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.waf.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * This is **AWS WAF Classic** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide.
 *
 * **For the latest version of AWS WAF**, use the AWS WAFV2 API and see the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With the latest version, AWS WAF has a single set of endpoints for regional and global use.
 *
 * 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 private constructor(builder: Builder) {
    /**
     * 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 val clientIp: kotlin.String? = builder.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](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
     */
    public val country: kotlin.String? = builder.country
    /**
     * 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 val headers: List? = builder.headers
    /**
     * The HTTP version specified in the sampled web request, for example, `HTTP/1.1`.
     */
    public val httpVersion: kotlin.String? = builder.httpVersion
    /**
     * The HTTP method specified in the sampled web request. CloudFront supports the following methods: `DELETE`, `GET`, `HEAD`, `OPTIONS`, `PATCH`, `POST`, and `PUT`.
     */
    public val method: kotlin.String? = builder.method
    /**
     * The part of a web request that identifies the resource, for example, `/images/daily-ad.jpg`.
     */
    public val uri: kotlin.String? = builder.uri

    public companion object {
        public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.waf.model.HttpRequest = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("HttpRequest(")
        append("clientIp=$clientIp,")
        append("country=$country,")
        append("headers=$headers,")
        append("httpVersion=$httpVersion,")
        append("method=$method,")
        append("uri=$uri")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = clientIp?.hashCode() ?: 0
        result = 31 * result + (country?.hashCode() ?: 0)
        result = 31 * result + (headers?.hashCode() ?: 0)
        result = 31 * result + (httpVersion?.hashCode() ?: 0)
        result = 31 * result + (method?.hashCode() ?: 0)
        result = 31 * result + (uri?.hashCode() ?: 0)
        return result
    }

    override fun equals(other: kotlin.Any?): kotlin.Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false

        other as HttpRequest

        if (clientIp != other.clientIp) return false
        if (country != other.country) return false
        if (headers != other.headers) return false
        if (httpVersion != other.httpVersion) return false
        if (method != other.method) return false
        if (uri != other.uri) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.waf.model.HttpRequest = Builder(this).apply(block).build()

    @SdkDsl
    public class Builder {
        /**
         * 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 var clientIp: kotlin.String? = null
        /**
         * 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](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
         */
        public var country: kotlin.String? = null
        /**
         * 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 var headers: List? = null
        /**
         * The HTTP version specified in the sampled web request, for example, `HTTP/1.1`.
         */
        public var httpVersion: kotlin.String? = null
        /**
         * The HTTP method specified in the sampled web request. CloudFront supports the following methods: `DELETE`, `GET`, `HEAD`, `OPTIONS`, `PATCH`, `POST`, and `PUT`.
         */
        public var method: kotlin.String? = null
        /**
         * The part of a web request that identifies the resource, for example, `/images/daily-ad.jpg`.
         */
        public var uri: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.waf.model.HttpRequest) : this() {
            this.clientIp = x.clientIp
            this.country = x.country
            this.headers = x.headers
            this.httpVersion = x.httpVersion
            this.method = x.method
            this.uri = x.uri
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.waf.model.HttpRequest = HttpRequest(this)

        internal fun correctErrors(): Builder {
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy