pub struct AttemptSecrets {
pub mask: Arc<MaskSet>,
pub too_short: Mutex<Vec<SecretName>>,
/* private fields */
}Expand description
The secrets of one attempt: what was fetched before it started, what it declares, and the values masked in its log and output.
Fields§
§mask: Arc<MaskSet>The values masked in the task’s log and output (grows with on-demand reads).
too_short: Mutex<Vec<SecretName>>Secrets too short to be masked, for the log’s warning.
Implementations§
Source§impl AttemptSecrets
impl AttemptSecrets
Sourcepub fn none(stores: Arc<SecretStores>) -> Self
pub fn none(stores: Arc<SecretStores>) -> Self
No secrets (a task that names none).
Sourcepub async fn fetch(
stores: Arc<SecretStores>,
needed: &[SecretName],
declared: Vec<SecretDecl>,
) -> Result<Self, SecretError>
pub async fn fetch( stores: Arc<SecretStores>, needed: &[SecretName], declared: Vec<SecretDecl>, ) -> Result<Self, SecretError>
Fetches every secret needed (named in the task’s references or declared) before the
task starts.
§Errors
The first SecretError: nothing runs with a missing secret.
Sourcepub fn with_connections(
self,
connections: Arc<Registry>,
declared: Vec<String>,
) -> Self
pub fn with_connections( self, connections: Arc<Registry>, declared: Vec<String>, ) -> Self
The same secrets, with the root’s connections and those the task declares.
Sourcepub fn with_connection_dir(self, dir: PathBuf) -> Self
pub fn with_connection_dir(self, dir: PathBuf) -> Self
The same secrets, with the attempt’s folder for its connections’ files.
Sourcepub async fn connection_env(
&self,
name: &str,
prefix: &str,
) -> Result<BTreeMap<String, String>, ConnectionError>
pub async fn connection_env( &self, name: &str, prefix: &str, ) -> Result<BTreeMap<String, String>, ConnectionError>
The connection name as a command gets it (decisions 184, 190-192): its files written
in the attempt’s folder, and its variables, named PREFIX_....
§Errors
As AttemptSecrets::connection; a prefix that isn’t a variable name’s start, a
value its tool’s file can’t hold, or a file that can’t be written (render_failed).
Sourcepub fn has_connections(&self) -> bool
pub fn has_connections(&self) -> bool
Whether the task declares connections (their secrets fetched and masked).
Sourcepub async fn open_declared(&self) -> Result<(), ConnectionError>
pub async fn open_declared(&self) -> Result<(), ConnectionError>
Renders every connection the task declares, before it starts (decision 179): a connection missing from the folder or a secret it can’t read fails the attempt before any of its code runs, and their secrets are masked from the start.
§Errors
The first ConnectionError.
Sourcepub async fn connection(
&self,
name: &str,
) -> Result<BTreeMap<String, Value>, ConnectionError>
pub async fn connection( &self, name: &str, ) -> Result<BTreeMap<String, Value>, ConnectionError>
The values of the connection name a running task opens, rendered as stored JSON by
parameter: its secrets read (masked from then on; a default stands in for a missing
one, decision 176), its t-strings filled in.
§Errors
ConnectionError; remembered for the attempt’s error kind (decision 168).
Sourcepub fn fetched(&self) -> BTreeMap<SecretName, Value>
pub fn fetched(&self) -> BTreeMap<SecretName, Value>
The values fetched before the start, by name.
Sourcepub async fn read(&self, name: &SecretName) -> Result<Value, SecretError>
pub async fn read(&self, name: &SecretName) -> Result<Value, SecretError>
A secret the running task reads (task-ctx secret get, task_ctx.secret(...)): one
it declares, fetched before the start, or one under a declared prefix, fetched now.
§Errors
SecretError::Denied for a secret it doesn’t declare; a fetch’s error otherwise.
A failure is remembered for the attempt’s error kind (decision 168).
Sourcepub fn failed_kind(&self) -> Option<&'static str>
pub fn failed_kind(&self) -> Option<&'static str>
The error kind of the last on-demand read that failed, if any.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AttemptSecrets
impl !RefUnwindSafe for AttemptSecrets
impl !UnwindSafe for AttemptSecrets
impl Send for AttemptSecrets
impl Sync for AttemptSecrets
impl Unpin for AttemptSecrets
impl UnsafeUnpin for AttemptSecrets
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§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();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§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();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§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();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§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();§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.
§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);