pub struct Operation {
pub id: String,
pub method: HttpMethod,
pub path: String,
pub body: Option<Value>,
pub content_type: Option<String>,
pub verb_probe: Option<(Gvr, Verb)>,
pub kind: OpKind,
pub focus: Option<JsonPath>,
}Expand description
One authored operation.
Fields§
§id: StringStable identifier (report + status-diff signature).
method: HttpMethodThe HTTP verb.
path: StringThe REST path (already rendered, incl. any query string).
body: Option<Value>Request body, if any.
content_type: Option<String>Content-Type header, if any.
verb_probe: Option<(Gvr, Verb)>When set, a status mismatch on this op is reported as a
Divergence::MissingVerb
(one side supports the verb, the other refuses) rather than a bare
status-code diff.
kind: OpKindThe surface class.
focus: Option<JsonPath>When set (for OpKind::Object), the differ restricts the object
comparison to the subtree at this path — a FIELD-LEVEL probe. It
isolates a targeted invariant (e.g. “a /status PUT left
spec.containers[0].image unchanged”) from a kind’s unrelated
server-side-defaulting divergence, so a Pod field-diff need not carry
the whole (heavily-defaulted) PodSpec into the ratchet.
Implementations§
Source§impl Operation
impl Operation
Sourcepub fn with_focus(self, focus: JsonPath) -> Self
pub fn with_focus(self, focus: JsonPath) -> Self
Restrict the object diff to the subtree at focus (a field-level
probe). Builder style; see Operation::focus.
Sourcepub fn create_namespace(name: &str) -> Self
pub fn create_namespace(name: &str) -> Self
POST a new Namespace.
Sourcepub fn get_namespace(name: &str) -> Self
pub fn get_namespace(name: &str) -> Self
GET a Namespace (where server-side defaulting divergences surface).
Sourcepub fn create_configmap(ns: &str, name: &str, data: Value) -> Self
pub fn create_configmap(ns: &str, name: &str, data: Value) -> Self
POST a new ConfigMap with the given data.
Sourcepub fn get_configmap(ns: &str, name: &str) -> Self
pub fn get_configmap(ns: &str, name: &str) -> Self
GET a ConfigMap.
Sourcepub fn create_labeled_configmap(
ns: &str,
name: &str,
labels: &[(&str, &str)],
) -> Self
pub fn create_labeled_configmap( ns: &str, name: &str, labels: &[(&str, &str)], ) -> Self
POST a ConfigMap carrying labels (the selector-test vehicle). The
labels drive labelSelector matching; the trivial data keeps the
object valid.
Sourcepub fn list_configmaps(ns: &str, name_filter: &str) -> Self
pub fn list_configmaps(ns: &str, name_filter: &str) -> Self
LIST ConfigMaps filtered to a single name via fieldSelector
(isolates the diff from cluster-auto-created objects like
kube-root-ca.crt). The = in the selector is percent-encoded.
Sourcepub fn merge_patch_configmap(ns: &str, name: &str, patch: Value) -> Self
pub fn merge_patch_configmap(ns: &str, name: &str, patch: Value) -> Self
PATCH a ConfigMap (JSON merge patch).
Sourcepub fn replace_configmap(ns: &str, name: &str, body: Value) -> Self
pub fn replace_configmap(ns: &str, name: &str, body: Value) -> Self
PUT (replace) a ConfigMap — the sharp verb probe. engenho’s router
refuses PUT on the main object (400); k3s returns 200. A status
mismatch here becomes MissingVerb{Update, present_on: K3s}.
Sourcepub fn delete_configmap(ns: &str, name: &str) -> Self
pub fn delete_configmap(ns: &str, name: &str) -> Self
DELETE a ConfigMap.
Sourcepub fn delete_namespace(name: &str) -> Self
pub fn delete_namespace(name: &str) -> Self
DELETE a Namespace (cleanup on the shared k3s cluster).
Sourcepub fn discovery_core_v1() -> Self
pub fn discovery_core_v1() -> Self
GET the core/v1 discovery index.
Sourcepub fn merge_patch(ns: &str, plural: &str, name: &str, patch: Value) -> Self
pub fn merge_patch(ns: &str, plural: &str, name: &str, patch: Value) -> Self
PATCH an object with an application/merge-patch+json body (RFC 7386).
Sourcepub fn strategic_patch(ns: &str, plural: &str, name: &str, patch: Value) -> Self
pub fn strategic_patch(ns: &str, plural: &str, name: &str, patch: Value) -> Self
PATCH an object with an application/strategic-merge-patch+json body
(K8s strategic merge — list-merge-by-key, $patch: delete,
null-removes-key).
Sourcepub fn json_patch(ns: &str, plural: &str, name: &str, ops: Value) -> Self
pub fn json_patch(ns: &str, plural: &str, name: &str, ops: Value) -> Self
PATCH an object with an application/json-patch+json body (RFC 6902 —
an op array).
Sourcepub fn create_pod(ns: &str, name: &str, image: &str) -> Self
pub fn create_pod(ns: &str, name: &str, image: &str) -> Self
POST a minimal single-container Pod (container named c).
Sourcepub fn create_pod_containers(
ns: &str,
name: &str,
containers: &[(&str, &str)],
) -> Self
pub fn create_pod_containers( ns: &str, name: &str, containers: &[(&str, &str)], ) -> Self
POST a Pod with the given (container-name, image) list — the
vehicle for the strategic list-merge-by-key probe (patch ONE container
by name, prove the others survive).
Sourcepub fn delete_pod(ns: &str, name: &str) -> Self
pub fn delete_pod(ns: &str, name: &str) -> Self
DELETE a Pod (force, no grace, best-effort cleanup on the oracle).
Sourcepub fn get_status(ns: &str, plural: &str, name: &str) -> Self
pub fn get_status(ns: &str, plural: &str, name: &str) -> Self
GET the /status subresource of an object.
Sourcepub fn put_status(ns: &str, plural: &str, name: &str, body: Value) -> Self
pub fn put_status(ns: &str, plural: &str, name: &str, body: Value) -> Self
PUT the /status subresource of an object.
Sourcepub fn replace(ns: &str, plural: &str, name: &str, body: Value) -> Self
pub fn replace(ns: &str, plural: &str, name: &str, body: Value) -> Self
PUT (replace) the MAIN object of any kind.
Sourcepub fn list_selector(
ns: &str,
plural: &str,
id_tag: &str,
label_selector: Option<&str>,
field_selector: Option<&str>,
) -> Self
pub fn list_selector( ns: &str, plural: &str, id_tag: &str, label_selector: Option<&str>, field_selector: Option<&str>, ) -> Self
LIST a namespaced collection with an optional labelSelector and/or
fieldSelector. Both selector strings are percent-encoded through the
typed pct_encode (never a raw format!() of the query), so the
full k8s selector grammar (in (a,b), !k, k!=v) round-trips on the
wire.
Sourcepub fn body_bytes(&self) -> Option<Vec<u8>>
pub fn body_bytes(&self) -> Option<Vec<u8>>
The body serialized to bytes, if present.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Operation
impl RefUnwindSafe for Operation
impl Send for Operation
impl Sync for Operation
impl Unpin for Operation
impl UnsafeUnpin for Operation
impl UnwindSafe for Operation
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> 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>
impl<T> OptionalSend for T
impl<T> OptionalSync for T
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);