Some checks failed
Run Check Script / check (pull_request) Failing after 35s
288 lines
7.8 KiB
Rust
288 lines
7.8 KiB
Rust
use k8s_openapi::apimachinery::pkg::apis::meta::v1::{ListMeta, ObjectMeta, Time};
|
|
use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
|
|
use k8s_openapi::{NamespaceResourceScope, Resource};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct LocalObjectReference {
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub name: Option<String>,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct Route {
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub api_version: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub kind: Option<String>,
|
|
pub metadata: ObjectMeta,
|
|
|
|
pub spec: RouteSpec,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub status: Option<RouteStatus>,
|
|
}
|
|
|
|
impl Resource for Route {
|
|
const API_VERSION: &'static str = "route.openshift.io/v1";
|
|
const GROUP: &'static str = "route.openshift.io";
|
|
const VERSION: &'static str = "v1";
|
|
const KIND: &'static str = "Route";
|
|
const URL_PATH_SEGMENT: &'static str = "routes";
|
|
type Scope = NamespaceResourceScope;
|
|
}
|
|
|
|
impl k8s_openapi::Metadata for Route {
|
|
type Ty = ObjectMeta;
|
|
|
|
fn metadata(&self) -> &Self::Ty {
|
|
&self.metadata
|
|
}
|
|
|
|
fn metadata_mut(&mut self) -> &mut Self::Ty {
|
|
&mut self.metadata
|
|
}
|
|
}
|
|
|
|
impl Default for Route {
|
|
fn default() -> Self {
|
|
Route {
|
|
api_version: Some("route.openshift.io/v1".to_string()),
|
|
kind: Some("Route".to_string()),
|
|
metadata: ObjectMeta::default(),
|
|
spec: RouteSpec::default(),
|
|
status: None,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct RouteList {
|
|
pub metadata: ListMeta,
|
|
pub items: Vec<Route>,
|
|
}
|
|
|
|
impl Default for RouteList {
|
|
fn default() -> Self {
|
|
Self {
|
|
metadata: ListMeta::default(),
|
|
items: Vec::new(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Resource for RouteList {
|
|
const API_VERSION: &'static str = "route.openshift.io/v1";
|
|
const GROUP: &'static str = "route.openshift.io";
|
|
const VERSION: &'static str = "v1";
|
|
const KIND: &'static str = "RouteList";
|
|
const URL_PATH_SEGMENT: &'static str = "routes";
|
|
type Scope = NamespaceResourceScope;
|
|
}
|
|
|
|
impl k8s_openapi::Metadata for RouteList {
|
|
type Ty = ListMeta;
|
|
|
|
fn metadata(&self) -> &Self::Ty {
|
|
&self.metadata
|
|
}
|
|
|
|
fn metadata_mut(&mut self) -> &mut Self::Ty {
|
|
&mut self.metadata
|
|
}
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct RouteSpec {
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub alternate_backends: Option<Vec<RouteTargetReference>>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub host: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub http_headers: Option<RouteHTTPHeaders>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub path: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub port: Option<RoutePort>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub subdomain: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub tls: Option<TLSConfig>,
|
|
|
|
pub to: RouteTargetReference,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub wildcard_policy: Option<String>,
|
|
}
|
|
impl Default for RouteSpec {
|
|
fn default() -> RouteSpec {
|
|
RouteSpec {
|
|
alternate_backends: None,
|
|
host: None,
|
|
http_headers: None,
|
|
path: None,
|
|
port: None,
|
|
subdomain: None,
|
|
tls: None,
|
|
to: RouteTargetReference::default(),
|
|
wildcard_policy: None,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct RouteTargetReference {
|
|
pub kind: String,
|
|
pub name: String,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub weight: Option<i32>,
|
|
}
|
|
impl Default for RouteTargetReference {
|
|
fn default() -> RouteTargetReference {
|
|
RouteTargetReference {
|
|
kind: String::default(),
|
|
name: String::default(),
|
|
weight: None,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct RoutePort {
|
|
pub target_port: u16,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct TLSConfig {
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub ca_certificate: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub certificate: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub destination_ca_certificate: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub external_certificate: Option<LocalObjectReference>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub insecure_edge_termination_policy: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub key: Option<String>,
|
|
|
|
pub termination: String,
|
|
}
|
|
|
|
impl Default for TLSConfig {
|
|
fn default() -> Self {
|
|
Self {
|
|
ca_certificate: None,
|
|
certificate: None,
|
|
destination_ca_certificate: None,
|
|
external_certificate: None,
|
|
insecure_edge_termination_policy: None,
|
|
key: None,
|
|
termination: "edge".to_string(),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct RouteStatus {
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub ingress: Option<Vec<RouteIngress>>,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct RouteIngress {
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub host: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub router_canonical_hostname: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub router_name: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub wildcard_policy: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub conditions: Option<Vec<RouteIngressCondition>>,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct RouteIngressCondition {
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub last_transition_time: Option<Time>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub message: Option<String>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub reason: Option<String>,
|
|
|
|
pub status: String,
|
|
#[serde(rename = "type")]
|
|
pub condition_type: String,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct RouteHTTPHeader {
|
|
pub name: String,
|
|
pub action: RouteHTTPHeaderActionUnion,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct RouteHTTPHeaderActionUnion {
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub set: Option<RouteSetHTTPHeader>,
|
|
|
|
#[serde(rename = "type")]
|
|
pub action_type: String,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct RouteSetHTTPHeader {
|
|
pub value: String,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug, Default)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct RouteHTTPHeaderActions {
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub request: Option<Vec<RouteHTTPHeader>>,
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub response: Option<Vec<RouteHTTPHeader>>,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Clone, Debug)]
|
|
#[serde(rename_all = "camelCase")]
|
|
pub struct RouteHTTPHeaders {
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub actions: Option<RouteHTTPHeaderActions>,
|
|
}
|