pub struct SlsaStatementBuilder { /* private fields */ }Expand description
Fluent builder for InTotoStatement.
Implementations§
Source§impl SlsaStatementBuilder
impl SlsaStatementBuilder
Sourcepub fn new(builder_id: impl Into<String>) -> Self
pub fn new(builder_id: impl Into<String>) -> Self
Start a new builder. builder_id is the URI identifying the
build system and is mandatory per SLSA v1.1.
Sourcepub fn build_type(&mut self, uri: impl Into<String>) -> &mut Self
pub fn build_type(&mut self, uri: impl Into<String>) -> &mut Self
Override the default buildType URI.
Sourcepub fn external_parameters(&mut self, params: Value) -> &mut Self
pub fn external_parameters(&mut self, params: Value) -> &mut Self
Set the build’s externalParameters.
Sourcepub fn internal_parameters(&mut self, params: Value) -> &mut Self
pub fn internal_parameters(&mut self, params: Value) -> &mut Self
Set the build’s internalParameters.
Sourcepub fn add_resolved_dependency(
&mut self,
descriptor: ResourceDescriptor,
) -> &mut Self
pub fn add_resolved_dependency( &mut self, descriptor: ResourceDescriptor, ) -> &mut Self
Append a resolved dependency.
Sourcepub fn add_byproduct(&mut self, descriptor: ResourceDescriptor) -> &mut Self
pub fn add_byproduct(&mut self, descriptor: ResourceDescriptor) -> &mut Self
Append a byproduct.
Sourcepub fn invocation_id(&mut self, id: impl Into<String>) -> &mut Self
pub fn invocation_id(&mut self, id: impl Into<String>) -> &mut Self
Set the invocation id.
Sourcepub fn started_on(&mut self, ts: impl Into<String>) -> &mut Self
pub fn started_on(&mut self, ts: impl Into<String>) -> &mut Self
Set the start timestamp (RFC 3339).
Sourcepub fn finished_on(&mut self, ts: impl Into<String>) -> &mut Self
pub fn finished_on(&mut self, ts: impl Into<String>) -> &mut Self
Set the finish timestamp (RFC 3339).
Sourcepub fn add_subject_from_entry(
&mut self,
manifest: &ArtifactManifest,
entry: &ArtifactEntry,
) -> Result<&mut Self>
pub fn add_subject_from_entry( &mut self, manifest: &ArtifactManifest, entry: &ArtifactEntry, ) -> Result<&mut Self>
Append a subject derived from one manifest entry.
§Errors
Returns Err if the entry’s name cannot be decoded from the
manifest name table.
Sourcepub fn add_all_subjects_from_manifest(
&mut self,
manifest: &ArtifactManifest,
) -> Result<&mut Self>
pub fn add_all_subjects_from_manifest( &mut self, manifest: &ArtifactManifest, ) -> Result<&mut Self>
Append subjects for every entry in manifest.
§Errors
Propagates any name-table decoding error from
Self::add_subject_from_entry.
Sourcepub fn build(self) -> Result<InTotoStatement>
pub fn build(self) -> Result<InTotoStatement>
Finalize into a validated InTotoStatement.
§Errors
Returns Err if no subjects were registered or if builder_id
is empty — both are required by SLSA v1.1.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SlsaStatementBuilder
impl RefUnwindSafe for SlsaStatementBuilder
impl Send for SlsaStatementBuilder
impl Sync for SlsaStatementBuilder
impl Unpin for SlsaStatementBuilder
impl UnsafeUnpin for SlsaStatementBuilder
impl UnwindSafe for SlsaStatementBuilder
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> 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> 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