#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate bytes;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate wkt;
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HttpRequest {
pub request_method: std::string::String,
pub request_url: std::string::String,
pub request_size: i64,
pub status: i32,
pub response_size: i64,
pub user_agent: std::string::String,
pub remote_ip: std::string::String,
pub server_ip: std::string::String,
pub referer: std::string::String,
pub latency: std::option::Option<wkt::Duration>,
pub cache_lookup: bool,
pub cache_hit: bool,
pub cache_validated_with_origin_server: bool,
pub cache_fill_bytes: i64,
pub protocol: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl HttpRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_request_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_method = v.into();
self
}
pub fn set_request_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_url = v.into();
self
}
pub fn set_request_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.request_size = v.into();
self
}
pub fn set_status<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.status = v.into();
self
}
pub fn set_response_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.response_size = v.into();
self
}
pub fn set_user_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.user_agent = v.into();
self
}
pub fn set_remote_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.remote_ip = v.into();
self
}
pub fn set_server_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.server_ip = v.into();
self
}
pub fn set_referer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.referer = v.into();
self
}
pub fn set_latency<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.latency = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_latency<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.latency = v.map(|x| x.into());
self
}
pub fn set_cache_lookup<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.cache_lookup = v.into();
self
}
pub fn set_cache_hit<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.cache_hit = v.into();
self
}
pub fn set_cache_validated_with_origin_server<T: std::convert::Into<bool>>(
mut self,
v: T,
) -> Self {
self.cache_validated_with_origin_server = v.into();
self
}
pub fn set_cache_fill_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.cache_fill_bytes = v.into();
self
}
pub fn set_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.protocol = v.into();
self
}
}
impl wkt::message::Message for HttpRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.logging.type.HttpRequest"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum LogSeverity {
Default,
Debug,
Info,
Notice,
Warning,
Error,
Critical,
Alert,
Emergency,
UnknownValue(log_severity::UnknownValue),
}
#[doc(hidden)]
pub mod log_severity {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl LogSeverity {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Default => std::option::Option::Some(0),
Self::Debug => std::option::Option::Some(100),
Self::Info => std::option::Option::Some(200),
Self::Notice => std::option::Option::Some(300),
Self::Warning => std::option::Option::Some(400),
Self::Error => std::option::Option::Some(500),
Self::Critical => std::option::Option::Some(600),
Self::Alert => std::option::Option::Some(700),
Self::Emergency => std::option::Option::Some(800),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Default => std::option::Option::Some("DEFAULT"),
Self::Debug => std::option::Option::Some("DEBUG"),
Self::Info => std::option::Option::Some("INFO"),
Self::Notice => std::option::Option::Some("NOTICE"),
Self::Warning => std::option::Option::Some("WARNING"),
Self::Error => std::option::Option::Some("ERROR"),
Self::Critical => std::option::Option::Some("CRITICAL"),
Self::Alert => std::option::Option::Some("ALERT"),
Self::Emergency => std::option::Option::Some("EMERGENCY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for LogSeverity {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for LogSeverity {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for LogSeverity {
fn from(value: i32) -> Self {
match value {
0 => Self::Default,
100 => Self::Debug,
200 => Self::Info,
300 => Self::Notice,
400 => Self::Warning,
500 => Self::Error,
600 => Self::Critical,
700 => Self::Alert,
800 => Self::Emergency,
_ => Self::UnknownValue(log_severity::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for LogSeverity {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DEFAULT" => Self::Default,
"DEBUG" => Self::Debug,
"INFO" => Self::Info,
"NOTICE" => Self::Notice,
"WARNING" => Self::Warning,
"ERROR" => Self::Error,
"CRITICAL" => Self::Critical,
"ALERT" => Self::Alert,
"EMERGENCY" => Self::Emergency,
_ => Self::UnknownValue(log_severity::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for LogSeverity {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Default => serializer.serialize_i32(0),
Self::Debug => serializer.serialize_i32(100),
Self::Info => serializer.serialize_i32(200),
Self::Notice => serializer.serialize_i32(300),
Self::Warning => serializer.serialize_i32(400),
Self::Error => serializer.serialize_i32(500),
Self::Critical => serializer.serialize_i32(600),
Self::Alert => serializer.serialize_i32(700),
Self::Emergency => serializer.serialize_i32(800),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for LogSeverity {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<LogSeverity>::new(
".google.logging.type.LogSeverity",
))
}
}