kube_core/
lib.rs

1//! Types and traits necessary for interacting with the Kubernetes API
2//!
3//! This crate provides the minimal apimachinery necessary to make requests to the kubernetes API.
4//!
5//! It does not export export a client, but it also has almost no dependencies.
6//!
7//! Everything in this crate is re-exported from [`kube`](https://crates.io/crates/kube)
8//! (even with zero features) under [`kube::core`]((https://docs.rs/kube/*/kube/core/index.html)).
9#![cfg_attr(docsrs, feature(doc_cfg))]
10
11#[cfg_attr(docsrs, doc(cfg(feature = "admission")))]
12#[cfg(feature = "admission")]
13pub mod admission;
14
15pub mod conversion;
16
17pub mod discovery;
18
19pub mod duration;
20pub use duration::Duration;
21
22pub mod dynamic;
23pub use dynamic::{ApiResource, DynamicObject};
24
25pub mod crd;
26pub use crd::CustomResourceExt;
27
28pub mod cel;
29pub use cel::{ListMerge, MapMerge, Message, Reason, Rule, StructMerge};
30
31#[cfg(feature = "schema")]
32pub use cel::{merge_properties, merge_strategy, merge_strategy_property, validate, validate_property};
33
34pub mod gvk;
35pub use gvk::{GroupVersion, GroupVersionKind, GroupVersionResource};
36
37pub mod metadata;
38pub use metadata::{ListMeta, ObjectMeta, PartialObjectMeta, PartialObjectMetaExt, TypeMeta};
39
40pub mod labels;
41
42#[cfg(feature = "kubelet-debug")] pub mod kubelet_debug;
43
44pub mod object;
45pub use object::{NotUsed, Object, ObjectList};
46
47pub mod params;
48
49pub mod request;
50pub use request::Request;
51
52mod resource;
53pub use resource::{
54    ClusterResourceScope, DynamicResourceScope, NamespaceResourceScope, Resource, ResourceExt, ResourceScope,
55    SubResourceScope, api_version_from_group_version,
56};
57
58pub mod response;
59pub use response::Status;
60
61pub use labels::{Expression, ParseExpressionError, Selector, SelectorExt};
62
63#[cfg_attr(docsrs, doc(cfg(feature = "schema")))]
64#[cfg(feature = "schema")]
65pub mod schema;
66
67pub mod subresource;
68
69pub mod util;
70
71pub mod watch;
72pub use watch::WatchEvent;
73
74mod version;
75pub use version::Version;
76
77pub mod error_boundary;
78pub use error_boundary::DeserializeGuard;
79
80/// This type used to be a payload for `kube::Error::Api`. It has been replaced by `Status`.
81/// In the interest of backward compatibility, we keep this type definition here as a deprecated alias.
82/// `Status` better reflects the Kubernetes API conventions and is more versatile.
83/// If you need to migrate your code, simply replace `ErrorResponse` with `Status` and also check
84/// helper methods implemented on `Status` for easily identifying common error cases.
85///
86/// As a reference below is the original definition of this type:
87///
88/// An error response from the API.
89/// #[derive(Error, Deserialize, Serialize, Debug, Clone, Eq, PartialEq)]
90/// #[error("{message}: {reason}")]
91/// pub struct ErrorResponse {
92///     /// The status
93///     pub status: String,
94///     /// A message about the error
95///     #[serde(default)]
96///     pub message: String,
97///     /// The reason for the error
98///     #[serde(default)]
99///     pub reason: String,
100///     /// The error code
101///     pub code: u16,
102/// }
103///
104#[deprecated(
105    since = "3.0.0",
106    note = "use kube::core::Status instead. \n\nNote that the Error::Api constructor based pattern matches have been helper functions due to boxing.\n  See Status docs for the new pattern:\n  https://docs.rs/kube/latest/kube/core/struct.Status.html"
107)]
108pub type ErrorResponse = Status;