#[derive(Clone, Debug, Default, PartialEq)]
pub struct BuildLog {
}
impl BuildLog {
#[cfg(feature = "api")]
pub fn read_namespaced_build_log(
name: &str,
namespace: &str,
optional: ReadNamespacedBuildLogOptional<'_>,
) -> Result<(http::Request<Vec<u8>>, fn(http::StatusCode) -> k8s_openapi::ResponseBody<ReadNamespacedBuildLogResponse>), k8s_openapi::RequestError> {
let ReadNamespacedBuildLogOptional {
container,
follow,
limit_bytes,
nowait,
pretty,
previous,
since_seconds,
tail_lines,
timestamps,
version,
} = optional;
let __url = format!("/apis/build.openshift.io/v1/namespaces/{namespace}/builds/{name}/log?",
name = k8s_openapi::percent_encoding::percent_encode(name.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
namespace = k8s_openapi::percent_encoding::percent_encode(namespace.as_bytes(), k8s_openapi::percent_encoding2::PATH_SEGMENT_ENCODE_SET),
);
let mut __query_pairs = k8s_openapi::url::form_urlencoded::Serializer::new(__url);
if let Some(container) = container {
__query_pairs.append_pair("container", container);
}
if let Some(follow) = follow {
__query_pairs.append_pair("follow", &follow.to_string());
}
if let Some(limit_bytes) = limit_bytes {
__query_pairs.append_pair("limitBytes", &limit_bytes.to_string());
}
if let Some(nowait) = nowait {
__query_pairs.append_pair("nowait", &nowait.to_string());
}
if let Some(pretty) = pretty {
__query_pairs.append_pair("pretty", pretty);
}
if let Some(previous) = previous {
__query_pairs.append_pair("previous", &previous.to_string());
}
if let Some(since_seconds) = since_seconds {
__query_pairs.append_pair("sinceSeconds", &since_seconds.to_string());
}
if let Some(tail_lines) = tail_lines {
__query_pairs.append_pair("tailLines", &tail_lines.to_string());
}
if let Some(timestamps) = timestamps {
__query_pairs.append_pair("timestamps", ×tamps.to_string());
}
if let Some(version) = version {
__query_pairs.append_pair("version", &version.to_string());
}
let __url = __query_pairs.finish();
let __request = http::Request::get(__url);
let __body = vec![];
match __request.body(__body) {
Ok(request) => Ok((request, k8s_openapi::ResponseBody::new)),
Err(err) => Err(k8s_openapi::RequestError::Http(err)),
}
}
}
#[cfg(feature = "api")]
#[derive(Clone, Copy, Debug, Default)]
pub struct ReadNamespacedBuildLogOptional<'a> {
pub container: Option<&'a str>,
pub follow: Option<bool>,
pub limit_bytes: Option<i64>,
pub nowait: Option<bool>,
pub pretty: Option<&'a str>,
pub previous: Option<bool>,
pub since_seconds: Option<i64>,
pub tail_lines: Option<i64>,
pub timestamps: Option<bool>,
pub version: Option<i64>,
}
#[cfg(feature = "api")]
#[derive(Debug)]
pub enum ReadNamespacedBuildLogResponse {
Ok(crate::api::build::v1::BuildLog),
Other(Result<Option<serde_json::Value>, serde_json::Error>),
}
#[cfg(feature = "api")]
impl k8s_openapi::Response for ReadNamespacedBuildLogResponse {
fn try_from_parts(status_code: http::StatusCode, buf: &[u8]) -> Result<(Self, usize), k8s_openapi::ResponseError> {
match status_code {
http::StatusCode::OK => {
let result = match serde_json::from_slice(buf) {
Ok(value) => value,
Err(ref err) if err.is_eof() => return Err(k8s_openapi::ResponseError::NeedMoreData),
Err(err) => return Err(k8s_openapi::ResponseError::Json(err)),
};
Ok((ReadNamespacedBuildLogResponse::Ok(result), buf.len()))
},
_ => {
let (result, read) =
if buf.is_empty() {
(Ok(None), 0)
}
else {
match serde_json::from_slice(buf) {
Ok(value) => (Ok(Some(value)), buf.len()),
Err(ref err) if err.is_eof() => return Err(k8s_openapi::ResponseError::NeedMoreData),
Err(err) => (Err(err), 0),
}
};
Ok((ReadNamespacedBuildLogResponse::Other(result), read))
},
}
}
}
impl k8s_openapi::Resource for BuildLog {
const API_VERSION: &'static str = "build.openshift.io/v1";
const GROUP: &'static str = "build.openshift.io";
const KIND: &'static str = "BuildLog";
const VERSION: &'static str = "v1";
}
impl<'de> serde::Deserialize<'de> for BuildLog {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de> {
#[allow(non_camel_case_types)]
enum Field {
Key_api_version,
Key_kind,
Other,
}
impl<'de> serde::Deserialize<'de> for Field {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de> {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
type Value = Field;
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str("field identifier")
}
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: serde::de::Error {
Ok(match v {
"apiVersion" => Field::Key_api_version,
"kind" => Field::Key_kind,
_ => Field::Other,
})
}
}
deserializer.deserialize_identifier(Visitor)
}
}
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
type Value = BuildLog;
fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(<Self::Value as k8s_openapi::Resource>::KIND)
}
fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: serde::de::MapAccess<'de> {
while let Some(key) = serde::de::MapAccess::next_key::<Field>(&mut map)? {
match key {
Field::Key_api_version => {
let value_api_version: String = serde::de::MapAccess::next_value(&mut map)?;
if value_api_version != <Self::Value as k8s_openapi::Resource>::API_VERSION {
return Err(serde::de::Error::invalid_value(serde::de::Unexpected::Str(&value_api_version), &<Self::Value as k8s_openapi::Resource>::API_VERSION));
}
},
Field::Key_kind => {
let value_kind: String = serde::de::MapAccess::next_value(&mut map)?;
if value_kind != <Self::Value as k8s_openapi::Resource>::KIND {
return Err(serde::de::Error::invalid_value(serde::de::Unexpected::Str(&value_kind), &<Self::Value as k8s_openapi::Resource>::KIND));
}
},
Field::Other => { let _: serde::de::IgnoredAny = serde::de::MapAccess::next_value(&mut map)?; },
}
}
Ok(BuildLog {
})
}
}
deserializer.deserialize_struct(
<Self as k8s_openapi::Resource>::KIND,
&[
"apiVersion",
"kind",
],
Visitor,
)
}
}
impl serde::Serialize for BuildLog {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
let mut state = serializer.serialize_struct(
<Self as k8s_openapi::Resource>::KIND,
2,
)?;
serde::ser::SerializeStruct::serialize_field(&mut state, "apiVersion", <Self as k8s_openapi::Resource>::API_VERSION)?;
serde::ser::SerializeStruct::serialize_field(&mut state, "kind", <Self as k8s_openapi::Resource>::KIND)?;
serde::ser::SerializeStruct::end(state)
}
}