aws-sdk-agentregistrycontrol 1.4.0

AWS SDK for Agent Registry Control
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// One provenance entry describing the lineage of a registry record.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Provenance {
    /// The relationship between the registry record and its provenance source.
    pub relation: crate::types::ProvenanceRelation,
    /// <p>The identifier of the upstream source that the registry record was detected from.</p>
    pub source_id: ::std::string::String,
    /// <p>The type of the upstream source that the registry record was detected from.</p>
    pub source_type: ::std::option::Option<crate::types::SourceType>,
    /// <p>Additional details about the upstream source that the registry record was detected from, such as the AgentCore Gateway or Runtime configuration. The populated member corresponds to the source type.</p>
    pub source_details: ::std::option::Option<crate::types::SourceDetails>,
}
impl Provenance {
    /// The relationship between the registry record and its provenance source.
    pub fn relation(&self) -> &crate::types::ProvenanceRelation {
        &self.relation
    }
    /// <p>The identifier of the upstream source that the registry record was detected from.</p>
    pub fn source_id(&self) -> &str {
        use std::ops::Deref;
        self.source_id.deref()
    }
    /// <p>The type of the upstream source that the registry record was detected from.</p>
    pub fn source_type(&self) -> ::std::option::Option<&crate::types::SourceType> {
        self.source_type.as_ref()
    }
    /// <p>Additional details about the upstream source that the registry record was detected from, such as the AgentCore Gateway or Runtime configuration. The populated member corresponds to the source type.</p>
    pub fn source_details(&self) -> ::std::option::Option<&crate::types::SourceDetails> {
        self.source_details.as_ref()
    }
}
impl Provenance {
    /// Creates a new builder-style object to manufacture [`Provenance`](crate::types::Provenance).
    pub fn builder() -> crate::types::builders::ProvenanceBuilder {
        crate::types::builders::ProvenanceBuilder::default()
    }
}

/// A builder for [`Provenance`](crate::types::Provenance).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ProvenanceBuilder {
    pub(crate) relation: ::std::option::Option<crate::types::ProvenanceRelation>,
    pub(crate) source_id: ::std::option::Option<::std::string::String>,
    pub(crate) source_type: ::std::option::Option<crate::types::SourceType>,
    pub(crate) source_details: ::std::option::Option<crate::types::SourceDetails>,
}
impl ProvenanceBuilder {
    /// The relationship between the registry record and its provenance source.
    /// This field is required.
    pub fn relation(mut self, input: crate::types::ProvenanceRelation) -> Self {
        self.relation = ::std::option::Option::Some(input);
        self
    }
    /// The relationship between the registry record and its provenance source.
    pub fn set_relation(mut self, input: ::std::option::Option<crate::types::ProvenanceRelation>) -> Self {
        self.relation = input;
        self
    }
    /// The relationship between the registry record and its provenance source.
    pub fn get_relation(&self) -> &::std::option::Option<crate::types::ProvenanceRelation> {
        &self.relation
    }
    /// <p>The identifier of the upstream source that the registry record was detected from.</p>
    /// This field is required.
    pub fn source_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.source_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identifier of the upstream source that the registry record was detected from.</p>
    pub fn set_source_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.source_id = input;
        self
    }
    /// <p>The identifier of the upstream source that the registry record was detected from.</p>
    pub fn get_source_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.source_id
    }
    /// <p>The type of the upstream source that the registry record was detected from.</p>
    pub fn source_type(mut self, input: crate::types::SourceType) -> Self {
        self.source_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of the upstream source that the registry record was detected from.</p>
    pub fn set_source_type(mut self, input: ::std::option::Option<crate::types::SourceType>) -> Self {
        self.source_type = input;
        self
    }
    /// <p>The type of the upstream source that the registry record was detected from.</p>
    pub fn get_source_type(&self) -> &::std::option::Option<crate::types::SourceType> {
        &self.source_type
    }
    /// <p>Additional details about the upstream source that the registry record was detected from, such as the AgentCore Gateway or Runtime configuration. The populated member corresponds to the source type.</p>
    pub fn source_details(mut self, input: crate::types::SourceDetails) -> Self {
        self.source_details = ::std::option::Option::Some(input);
        self
    }
    /// <p>Additional details about the upstream source that the registry record was detected from, such as the AgentCore Gateway or Runtime configuration. The populated member corresponds to the source type.</p>
    pub fn set_source_details(mut self, input: ::std::option::Option<crate::types::SourceDetails>) -> Self {
        self.source_details = input;
        self
    }
    /// <p>Additional details about the upstream source that the registry record was detected from, such as the AgentCore Gateway or Runtime configuration. The populated member corresponds to the source type.</p>
    pub fn get_source_details(&self) -> &::std::option::Option<crate::types::SourceDetails> {
        &self.source_details
    }
    /// Consumes the builder and constructs a [`Provenance`](crate::types::Provenance).
    /// This method will fail if any of the following fields are not set:
    /// - [`relation`](crate::types::builders::ProvenanceBuilder::relation)
    /// - [`source_id`](crate::types::builders::ProvenanceBuilder::source_id)
    pub fn build(self) -> ::std::result::Result<crate::types::Provenance, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Provenance {
            relation: self.relation.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "relation",
                    "relation was not specified but it is required when building Provenance",
                )
            })?,
            source_id: self.source_id.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "source_id",
                    "source_id was not specified but it is required when building Provenance",
                )
            })?,
            source_type: self.source_type,
            source_details: self.source_details,
        })
    }
}