Struct ConversionResponse

Source
pub struct ConversionResponse {
    pub types: Option<TypeMeta>,
    pub uid: String,
    pub result: Status,
    pub converted_objects: Vec<Value>,
}
Expand description

Part of ConversionReview which is set on output (i.e. generated by conversion webhook)

Fields§

§types: Option<TypeMeta>

TypeMeta of the ConversionReview this response was derived from

This field is copied from the corresponding ConversionRequest. It is not part of the Kubernetes API, it’s consumed only by kube.

§uid: String

Copy of .request.uid

§result: Status

Outcome of the conversion operation

Success: all objects were successfully converted Failure: at least one object could not be converted. It is recommended that conversion fails as rare as possible.

§converted_objects: Vec<Value>

Converted objects

This field should contain objects in the same order as in the request Should be empty if conversion failed.

Implementations§

Source§

impl ConversionResponse

Source

pub fn for_request(request: ConversionRequest) -> Self

Creates a new response, matching provided request

This response must be finalized with one of:

Source

pub fn success(self, converted_objects: Vec<Value>) -> Self

Creates successful conversion response

converted_objects must specify objects in the exact same order as on input.

Source

pub fn failure(self, status: Status) -> Self

Creates failed conversion response (discouraged)

request_uid must be equal to the .uid field in the request. message and reason will be returned to the apiserver.

Source

pub fn invalid(status: Status) -> Self

Creates failed conversion response, not matched with any request

You should only call this function when request couldn’t be parsed into ConversionRequest. Otherwise use error.

Source

pub fn into_review(self) -> ConversionReview

Converts response into a ConversionReview value, ready to be sent as a response

Trait Implementations§

Source§

impl Clone for ConversionResponse

Source§

fn clone(&self) -> ConversionResponse

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConversionResponse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ConversionResponse

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<ConversionRequest> for ConversionResponse

Source§

fn from(request: ConversionRequest) -> Self

Converts to this type from the input type.
Source§

impl From<ConversionResponse> for ConversionReview

Source§

fn from(response: ConversionResponse) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ConversionResponse

Source§

fn eq(&self, other: &ConversionResponse) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ConversionResponse

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ConversionResponse

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,