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
impl ConversionResponse
Sourcepub fn for_request(request: ConversionRequest) -> ConversionResponse
pub fn for_request(request: ConversionRequest) -> ConversionResponse
Creates a new response, matching provided request
This response must be finalized with one of:
ConversionResponse::success
when conversion succeededConversionResponse::failure
when conversion failed
Sourcepub fn success(self, converted_objects: Vec<Value>) -> ConversionResponse
pub fn success(self, converted_objects: Vec<Value>) -> ConversionResponse
Creates successful conversion response
converted_objects
must specify objects in the exact same order as on input.
Sourcepub fn failure(self, status: Status) -> ConversionResponse
pub fn failure(self, status: Status) -> ConversionResponse
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.
Sourcepub fn invalid(status: Status) -> ConversionResponse
pub fn invalid(status: Status) -> ConversionResponse
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
.
Sourcepub fn into_review(self) -> ConversionReview
pub fn into_review(self) -> ConversionReview
Converts response into a ConversionReview
value, ready to be sent as a response
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ConversionResponse
impl<'de> Deserialize<'de> for ConversionResponse
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConversionResponse, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ConversionResponse, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<ConversionRequest> for ConversionResponse
impl From<ConversionRequest> for ConversionResponse
Source§fn from(request: ConversionRequest) -> ConversionResponse
fn from(request: ConversionRequest) -> ConversionResponse
Source§impl From<ConversionResponse> for ConversionReview
impl From<ConversionResponse> for ConversionReview
Source§fn from(response: ConversionResponse) -> ConversionReview
fn from(response: ConversionResponse) -> ConversionReview
Source§impl Serialize for ConversionResponse
impl Serialize for ConversionResponse
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for ConversionResponse
impl RefUnwindSafe for ConversionResponse
impl Send for ConversionResponse
impl Sync for ConversionResponse
impl Unpin for ConversionResponse
impl UnwindSafe for ConversionResponse
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more