pub struct Status {
pub status: Option<StatusSummary>,
pub code: u16,
pub message: String,
pub metadata: Option<ListMeta>,
pub reason: String,
pub details: Option<StatusDetails>,
}Expand description
A Kubernetes status object
This struct is returned by the Kubernetes API on failures,
and bubbles up to users inside a [kube::Error::Api] variant
when client requests fail in [kube::Client].
To match on specific error cases, you can;
match err {
kube::Error::Api(s) if s.is_not_found() => {...},
}or in a standalone if statement with std::matches;
if std::matches!(err, kube::Error::Api(s) if s.is_forbidden()) {...}Fields§
§status: Option<StatusSummary>Status of the operation
One of: Success or Failure - more info
code: u16Suggested HTTP return code (0 if unset)
message: StringA human-readable description of the status of this operation
metadata: Option<ListMeta>Standard list metadata - more info
reason: StringA machine-readable description of why this operation is in the “Failure” status.
If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.
details: Option<StatusDetails>Extended data associated with the reason.
Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.
Implementations§
Source§impl Status
impl Status
Sourcepub fn with_details(self, details: StatusDetails) -> Status
pub fn with_details(self, details: StatusDetails) -> Status
Adds details to the Status
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Checks if this Status represents success
Note that it is possible for Status to be in indeterminate state
when both is_success and is_failure return false.
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Checks if this Status represents failure
Note that it is possible for Status to be in indeterminate state
when both is_success and is_failure return false.
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Checks if this Status represents not found error
Note that it is possible for Status to be in indeterminate state
when both is_success and is_failure return false.
Sourcepub fn is_already_exists(&self) -> bool
pub fn is_already_exists(&self) -> bool
Checks if this Status indicates that a specified resource already exists.
Sourcepub fn is_conflict(&self) -> bool
pub fn is_conflict(&self) -> bool
Checks if this Status indicates update conflict
Sourcepub fn is_forbidden(&self) -> bool
pub fn is_forbidden(&self) -> bool
Checks if this Status indicates that the request is forbidden and cannot
be completed as requested.
Sourcepub fn is_invalid(&self) -> bool
pub fn is_invalid(&self) -> bool
Checks if this Status indicates that provided resource is not valid.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Status
impl<'de> Deserialize<'de> for Status
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Status, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Status, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Error for Status
impl Error for Status
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl Serialize for Status
impl Serialize for Status
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,
impl StructuralPartialEq for Status
Auto Trait Implementations§
impl Freeze for Status
impl RefUnwindSafe for Status
impl Send for Status
impl Sync for Status
impl Unpin for Status
impl UnwindSafe for Status
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Source§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Source§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.