Skip to main content

Target

Struct Target 

Source
pub struct Target {
Show 16 fields pub id: String, pub path: PathBuf, pub project: String, pub exporter: String, pub mode: String, pub apply: bool, pub validate: Option<String>, pub reload: Option<String>, pub check: Option<String>, pub accept_rule_approval: bool, pub require_approval: bool, pub file_mode: Option<String>, pub owner: Option<String>, pub compose_project: Option<String>, pub compose_file: Option<PathBuf>, pub services: Vec<String>,
}
Expand description

One [[target]] in the node’s config. Everything executable is here, on this host, written by the operator. Nothing the hub sends can add to it.

Fields§

§id: String§path: PathBuf§project: String§exporter: String§mode: String§apply: bool

Observe until deliberately flipped.

§validate: Option<String>

A command run after the bytes are written. If it contains {file} it runs against a temporary file first and the target is replaced only when it passes.

§reload: Option<String>§check: Option<String>

A health check run after reload: a command, or an http://host:port/path URL that must answer 2xx. A failure puts the previous file back and reloads it.

§accept_rule_approval: bool

Accept a push that carries a rule approval: a short-lived token signed by this node’s automation_approver key, bound to this node, target, bytes and operation. Needs automation_approver; cannot be combined with require_approval, which asks for a human.

§require_approval: bool

Refuse any push that does not carry the hub’s signed approval of exactly these bytes (Phase 37). Set here, on the host, so a hub bug or a hub policy change cannot turn it off.

§file_mode: Option<String>

Permission bits of the written file, as octal text ("0400"). Unix only. A Compose target defaults to 0400; any other target keeps the mode the file already has.

§owner: Option<String>

Owner of the written file as numeric uid or uid:gid (the user inside the container that reads the secret, e.g. 999:999 for the Postgres image). Needs the node to run as root or that user. Unix only.

§compose_project: Option<String>

Makes this a Docker Compose secret-file target: after the write the node runs docker compose -p <project> -f <compose_file> config -q and then recreates only services. Replaces validate and reload, which it generates.

§compose_file: Option<PathBuf>§services: Vec<String>

Implementations§

Source§

impl Target

Source

pub fn file_mode_bits(&self) -> Option<u32>

file_mode as bits: Some when set, or 0o400 for a Compose target.

Source

pub fn owner_ids(&self) -> Option<(u32, u32)>

owner as (uid, gid); a bare uid uses the same number as gid.

Trait Implementations§

Source§

impl Clone for Target

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Target

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Target

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Target

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Target

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Target

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AnyEq for T
where T: Any + PartialEq,

§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

§

fn as_any(&self) -> &(dyn Any + 'static)

§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more