use serde::{Deserialize, Serialize}; /*
                                      * Service Control API
                                      *
                                      * Provides admission control and telemetry reporting for services integrated with Service Infrastructure.
                                      *
                                      * The version of the OpenAPI document: v2
                                      *
                                      * Generated by: https://openapi-generator.tech
                                      */

use crate::google_rest_apis::servicecontrol_v2::models;

/// V2HttpRequest : A common proto for logging HTTP requests. Only contains semantics defined by the HTTP specification. Product-specific logging information MUST be defined in a separate message.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct V2HttpRequest {
    /// The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted.
    #[serde(rename = "cacheFillBytes", skip_serializing_if = "Option::is_none")]
    pub cache_fill_bytes: Option<String>,
    /// Whether or not an entity was served from cache (with or without validation).
    #[serde(rename = "cacheHit", skip_serializing_if = "Option::is_none")]
    pub cache_hit: Option<bool>,
    /// Whether or not a cache lookup was attempted.
    #[serde(rename = "cacheLookup", skip_serializing_if = "Option::is_none")]
    pub cache_lookup: Option<bool>,
    /// Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if `cache_hit` is True.
    #[serde(
        rename = "cacheValidatedWithOriginServer",
        skip_serializing_if = "Option::is_none"
    )]
    pub cache_validated_with_origin_server: Option<bool>,
    /// The request processing latency on the server, from the time the request was received until the response was sent.
    #[serde(rename = "latency", skip_serializing_if = "Option::is_none")]
    pub latency: Option<String>,
    /// Protocol used for the request. Examples: \"HTTP/1.1\", \"HTTP/2\", \"websocket\"
    #[serde(rename = "protocol", skip_serializing_if = "Option::is_none")]
    pub protocol: Option<String>,
    /// The referer URL of the request, as defined in [HTTP/1.1 Header Field Definitions](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
    #[serde(rename = "referer", skip_serializing_if = "Option::is_none")]
    pub referer: Option<String>,
    /// The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: `\"192.168.1.1\"`, `\"FE80::0202:B3FF:FE1E:8329\"`.
    #[serde(rename = "remoteIp", skip_serializing_if = "Option::is_none")]
    pub remote_ip: Option<String>,
    /// The request method. Examples: `\"GET\"`, `\"HEAD\"`, `\"PUT\"`, `\"POST\"`.
    #[serde(rename = "requestMethod", skip_serializing_if = "Option::is_none")]
    pub request_method: Option<String>,
    /// The size of the HTTP request message in bytes, including the request headers and the request body.
    #[serde(rename = "requestSize", skip_serializing_if = "Option::is_none")]
    pub request_size: Option<String>,
    /// The scheme (http, https), the host name, the path, and the query portion of the URL that was requested. Example: `\"http://example.com/some/info?color=red\"`.
    #[serde(rename = "requestUrl", skip_serializing_if = "Option::is_none")]
    pub request_url: Option<String>,
    /// The size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body.
    #[serde(rename = "responseSize", skip_serializing_if = "Option::is_none")]
    pub response_size: Option<String>,
    /// The IP address (IPv4 or IPv6) of the origin server that the request was sent to.
    #[serde(rename = "serverIp", skip_serializing_if = "Option::is_none")]
    pub server_ip: Option<String>,
    /// The response code indicating the status of the response. Examples: 200, 404.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<i32>,
    /// The user agent sent by the client. Example: `\"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)\"`.
    #[serde(rename = "userAgent", skip_serializing_if = "Option::is_none")]
    pub user_agent: Option<String>,
}

impl V2HttpRequest {
    /// A common proto for logging HTTP requests. Only contains semantics defined by the HTTP specification. Product-specific logging information MUST be defined in a separate message.
    pub fn new() -> V2HttpRequest {
        V2HttpRequest {
            cache_fill_bytes: None,
            cache_hit: None,
            cache_lookup: None,
            cache_validated_with_origin_server: None,
            latency: None,
            protocol: None,
            referer: None,
            remote_ip: None,
            request_method: None,
            request_size: None,
            request_url: None,
            response_size: None,
            server_ip: None,
            status: None,
            user_agent: None,
        }
    }
}
