pub struct SecretRef {
pub name: String,
pub service: Option<String>,
pub project: Option<String>,
pub environment: Option<String>,
pub field: Option<String>,
}Expand description
A reference to a secret, parsed from the $S: prefix syntax.
§Formats
$S:name- Deployment-level secret$S:name/field- Deployment-level secret with JSON field extraction$S:@service/name[/field]- Service-level secret$S::env/name[/field]- Environment-scoped secret (global environment)$S:project:env/name[/field]- Project-scoped environment secret
§Environment-scope disambiguation
Environment-scoped references require a colon in the scope segment so
they cannot be confused with the legacy deployment-level name/field
form. The leading colon in $S::env/name marks “no project, scope is
environment env”. The $S:project:env/name form is unambiguous
because it already contains a colon.
Fields§
§name: StringThe name of the secret.
service: Option<String>Optional service name (for service-scoped secrets).
project: Option<String>Optional project name (for project-scoped environment secrets).
environment: Option<String>Optional environment name (for environment-scoped secrets).
field: Option<String>Optional field to extract from a structured secret (e.g., JSON).
Implementations§
Source§impl SecretRef
impl SecretRef
Sourcepub const PREFIX: &'static str = "$S:"
pub const PREFIX: &'static str = "$S:"
The prefix used to identify secret references in configuration values.
Sourcepub fn is_secret_ref(value: &str) -> bool
pub fn is_secret_ref(value: &str) -> bool
Check if a string value is a secret reference.
Sourcepub fn parse(value: &str) -> Option<Self>
pub fn parse(value: &str) -> Option<Self>
Parse a secret reference from a string.
§Formats
$S:name- Deployment-level secret$S:name/field- Deployment-level secret with JSON field extraction$S:@service/name[/field]- Service-level secret$S::env/name[/field]- Environment-scoped secret (global environment)$S:project:env/name[/field]- Project-scoped environment secret
Returns None if the string is not a valid secret reference.
Sourcepub fn to_scope(&self, deployment: &str) -> SecretScope
pub fn to_scope(&self, deployment: &str) -> SecretScope
Convert this reference to a SecretScope for a given deployment.
Environment/project scopes are not representable by SecretScope
(which only models deployment vs service); those references fall
back to a deployment-level scope and must be resolved by a higher
layer that understands environment and project scoping.
Sourcepub fn is_deployment_level(&self) -> bool
pub fn is_deployment_level(&self) -> bool
Check if this is a deployment-level secret reference.
Sourcepub fn is_service_level(&self) -> bool
pub fn is_service_level(&self) -> bool
Check if this is a service-level secret reference.
Sourcepub fn is_environment_level(&self) -> bool
pub fn is_environment_level(&self) -> bool
Check if this reference is environment-scoped (with or without a project).
Sourcepub fn is_project_environment_level(&self) -> bool
pub fn is_project_environment_level(&self) -> bool
Check if this reference is scoped to a project environment.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SecretRef
impl<'de> Deserialize<'de> for SecretRef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for SecretRef
impl StructuralPartialEq for SecretRef
Auto Trait Implementations§
impl Freeze for SecretRef
impl RefUnwindSafe for SecretRef
impl Send for SecretRef
impl Sync for SecretRef
impl Unpin for SecretRef
impl UnsafeUnpin for SecretRef
impl UnwindSafe for SecretRef
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<C> SignWithKey<String> for Cwhere
C: ToBase64,
impl<C> SignWithKey<String> for Cwhere
C: ToBase64,
fn sign_with_key(self, key: &impl SigningAlgorithm) -> Result<String, Error>
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.