Struct kube_core::conversion::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
impl ConversionResponse
sourcepub fn for_request(request: ConversionRequest) -> Self
pub fn for_request(request: ConversionRequest) -> Self
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>) -> Self
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.
sourcepub fn failure(self, status: Status) -> Self
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.
sourcepub fn invalid(status: Status) -> Self
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
.
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