Skip to main content

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 finalizers;
41pub use finalizers::FinalizerExt;
42
43pub mod labels;
44
45#[cfg(feature = "kubelet-debug")] pub mod kubelet_debug;
46
47pub mod object;
48pub use object::{NotUsed, Object, ObjectList};
49
50pub mod owner_ref;
51pub use owner_ref::{AlreadyOwnedError, OwnerRefExt};
52
53pub mod params;
54
55pub mod request;
56pub use request::Request;
57
58mod resource;
59pub use resource::{
60    ClusterResourceScope, DynamicResourceScope, NamespaceResourceScope, NamespaceScope, Resource,
61    ResourceExt, ResourceScope, SubResourceScope, api_version_from_group_version,
62};
63
64pub mod response;
65pub use response::Status;
66
67pub use labels::{Expression, ParseExpressionError, Selector, SelectorExt};
68
69#[cfg_attr(docsrs, doc(cfg(feature = "schema")))]
70#[cfg(feature = "schema")]
71pub mod schema;
72
73pub mod subresource;
74
75pub mod util;
76
77pub mod watch;
78pub use watch::WatchEvent;
79
80mod version;
81pub use version::Version;
82
83pub mod error_boundary;
84pub use error_boundary::DeserializeGuard;
85
86/// This type used to be a payload for `kube::Error::Api`. It has been replaced by `Status`.
87/// In the interest of backward compatibility, we keep this type definition here as a deprecated alias.
88/// `Status` better reflects the Kubernetes API conventions and is more versatile.
89/// If you need to migrate your code, simply replace `ErrorResponse` with `Status` and also check
90/// helper methods implemented on `Status` for easily identifying common error cases.
91///
92/// As a reference below is the original definition of this type:
93///
94/// An error response from the API.
95/// #[derive(Error, Deserialize, Serialize, Debug, Clone, Eq, PartialEq)]
96/// #[error("{message}: {reason}")]
97/// pub struct ErrorResponse {
98///     /// The status
99///     pub status: String,
100///     /// A message about the error
101///     #[serde(default)]
102///     pub message: String,
103///     /// The reason for the error
104///     #[serde(default)]
105///     pub reason: String,
106///     /// The error code
107///     pub code: u16,
108/// }
109///
110#[deprecated(
111    since = "3.0.0",
112    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"
113)]
114pub type ErrorResponse = Status;