aws-sdk-context 1.0.0

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

/// When writing a match expression against `Activity`, it is important to ensure
/// your code is forward-compatible. That is, if a match arm handles a case for a
/// feature that is supported by the service but has not been represented as an enum
/// variant in a current version of SDK, your code should continue to work when you
/// upgrade SDK to a future version in which the enum does include a variant for that
/// feature.
///
/// Here is an example of how you can make a match expression forward-compatible:
///
/// ```text
/// # let activity = unimplemented!();
/// match activity {
///     Activity::DataSourceExtraction => { /* ... */ },
///     Activity::DataSourceIngestion => { /* ... */ },
///     Activity::DirectModification => { /* ... */ },
///     Activity::EntityResolution => { /* ... */ },
///     Activity::ImportDataDictionaryTask => { /* ... */ },
///     Activity::ImportOntologyTask => { /* ... */ },
///     Activity::ImportVerifiedQueriesTask => { /* ... */ },
///     Activity::OntologyGrounding => { /* ... */ },
///     Activity::TraceAnalysis => { /* ... */ },
///     other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ },
///     _ => { /* ... */ },
/// }
/// ```
/// The above code demonstrates that when `activity` represents
/// `NewFeature`, the execution path will lead to the second last match arm,
/// even though the enum does not contain a variant `Activity::NewFeature`
/// in the current version of SDK. The reason is that the variable `other`,
/// created by the `@` operator, is bound to
/// `Activity::Unknown(UnknownVariantValue("NewFeature".to_owned()))`
/// and calling `as_str` on it yields `"NewFeature"`.
/// This match expression is forward-compatible when executed with a newer
/// version of SDK where the variant `Activity::NewFeature` is defined.
/// Specifically, when `activity` represents `NewFeature`,
/// the execution path will hit the second last match arm as before by virtue of
/// calling `as_str` on `Activity::NewFeature` also yielding `"NewFeature"`.
///
/// Explicitly matching on the `Unknown` variant should
/// be avoided for two reasons:
/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted.
/// - It might inadvertently shadow other intended match arms.
///
/// <p>The activity that generated a change set. Valid values:</p> <ul> <li> <p> <code>DATA_SOURCE_EXTRACTION</code> - AWS Context extracted the content from a connected data source with a model, for example from the documents of an Amazon Bedrock knowledge base.</p> </li> <li> <p> <code>DATA_SOURCE_INGESTION</code> - AWS Context ingested content from a connected data source as a repeatable projection of the source, such as an AWS Glue Data Catalog sync.</p> </li> <li> <p> <code>ENTITY_RESOLUTION</code> - AWS Context merged duplicate entities into one canonical entity.</p> </li> <li> <p> <code>ONTOLOGY_GROUNDING</code> - AWS Context linked an ontology class to the data entities that instantiate it.</p> </li> <li> <p> <code>TRACE_ANALYSIS</code> - AWS Context derived skills and instructions from recorded agent sessions.</p> </li> <li> <p> <code>IMPORT_DATA_DICTIONARY_TASK</code> - An <code>IMPORT_DATA_DICTIONARY</code> task wrote the content. Change sets from earlier <code>IMPORT_VERIFIED_QUERIES</code> tasks can also carry this value.</p> </li> <li> <p> <code>IMPORT_VERIFIED_QUERIES_TASK</code> - An <code>IMPORT_VERIFIED_QUERIES</code> task wrote the content.</p> </li> <li> <p> <code>IMPORT_ONTOLOGY_TASK</code> - An <code>IMPORT_ONTOLOGY</code> task imported an ontology.</p> </li> <li> <p> <code>DIRECT_MODIFICATION</code> - A person, an agent, or an application called <code>CreateChangeSet</code> directly.</p> </li> </ul> <p>If you pass any other value as the <code>ListChangeSets</code> filter, the request fails with <code>ValidationException</code>. A change set can have no activity, so handle an absent <code>generatedBy</code>.</p>
#[non_exhaustive]
#[derive(
    ::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash,
)]
pub enum Activity {
    /// Context extracted the content from a connected data source with a model, for example from the documents of an
    /// Amazon Bedrock knowledge base.
    DataSourceExtraction,
    /// Context ingested content from a connected data source as a repeatable projection of the source, such as an AWS
    /// Glue Data Catalog sync.
    DataSourceIngestion,
    /// A change made directly through the `CreateChangeSet` API: by a person, an agent or an application calling it.
    DirectModification,
    /// Context merged duplicate entities into one canonical entity.
    EntityResolution,
    /// A data-dictionary or verified-queries import task wrote the content.
    ImportDataDictionaryTask,
    /// An ontology was imported by an `IMPORT_ONTOLOGY` task.
    ImportOntologyTask,
    /// Reserved for a verified-queries import task; no ChangeSet carries it yet.
    ImportVerifiedQueriesTask,
    /// Context linked an ontology class to the data entities that instantiate it.
    OntologyGrounding,
    /// Context derived skills and instructions from recorded agent sessions.
    TraceAnalysis,
    /// `Unknown` contains new variants that have been added since this code was generated.
    #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")]
    Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue),
}
impl ::std::convert::From<&str> for Activity {
    fn from(s: &str) -> Self {
        match s {
            "DATA_SOURCE_EXTRACTION" => Activity::DataSourceExtraction,
            "DATA_SOURCE_INGESTION" => Activity::DataSourceIngestion,
            "DIRECT_MODIFICATION" => Activity::DirectModification,
            "ENTITY_RESOLUTION" => Activity::EntityResolution,
            "IMPORT_DATA_DICTIONARY_TASK" => Activity::ImportDataDictionaryTask,
            "IMPORT_ONTOLOGY_TASK" => Activity::ImportOntologyTask,
            "IMPORT_VERIFIED_QUERIES_TASK" => Activity::ImportVerifiedQueriesTask,
            "ONTOLOGY_GROUNDING" => Activity::OntologyGrounding,
            "TRACE_ANALYSIS" => Activity::TraceAnalysis,
            other => Activity::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())),
        }
    }
}
impl ::std::str::FromStr for Activity {
    type Err = ::std::convert::Infallible;

    fn from_str(s: &str) -> ::std::result::Result<Self, <Self as ::std::str::FromStr>::Err> {
        ::std::result::Result::Ok(Activity::from(s))
    }
}
impl Activity {
    /// Returns the `&str` value of the enum member.
    pub fn as_str(&self) -> &str {
        match self {
            Activity::DataSourceExtraction => "DATA_SOURCE_EXTRACTION",
            Activity::DataSourceIngestion => "DATA_SOURCE_INGESTION",
            Activity::DirectModification => "DIRECT_MODIFICATION",
            Activity::EntityResolution => "ENTITY_RESOLUTION",
            Activity::ImportDataDictionaryTask => "IMPORT_DATA_DICTIONARY_TASK",
            Activity::ImportOntologyTask => "IMPORT_ONTOLOGY_TASK",
            Activity::ImportVerifiedQueriesTask => "IMPORT_VERIFIED_QUERIES_TASK",
            Activity::OntologyGrounding => "ONTOLOGY_GROUNDING",
            Activity::TraceAnalysis => "TRACE_ANALYSIS",
            Activity::Unknown(value) => value.as_str(),
        }
    }
    /// Returns all the `&str` representations of the enum members.
    pub const fn values() -> &'static [&'static str] {
        &[
            "DATA_SOURCE_EXTRACTION",
            "DATA_SOURCE_INGESTION",
            "DIRECT_MODIFICATION",
            "ENTITY_RESOLUTION",
            "IMPORT_DATA_DICTIONARY_TASK",
            "IMPORT_ONTOLOGY_TASK",
            "IMPORT_VERIFIED_QUERIES_TASK",
            "ONTOLOGY_GROUNDING",
            "TRACE_ANALYSIS",
        ]
    }
}
impl ::std::convert::AsRef<str> for Activity {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}
impl Activity {
    /// Parses the enum value while disallowing unknown variants.
    ///
    /// Unknown variants will result in an error.
    pub fn try_parse(value: &str) -> ::std::result::Result<Self, crate::error::UnknownVariantError> {
        match Self::from(value) {
            #[allow(deprecated)]
            Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)),
            known => Ok(known),
        }
    }
}
impl ::std::fmt::Display for Activity {
    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
        match self {
            Activity::DataSourceExtraction => write!(f, "DATA_SOURCE_EXTRACTION"),
            Activity::DataSourceIngestion => write!(f, "DATA_SOURCE_INGESTION"),
            Activity::DirectModification => write!(f, "DIRECT_MODIFICATION"),
            Activity::EntityResolution => write!(f, "ENTITY_RESOLUTION"),
            Activity::ImportDataDictionaryTask => write!(f, "IMPORT_DATA_DICTIONARY_TASK"),
            Activity::ImportOntologyTask => write!(f, "IMPORT_ONTOLOGY_TASK"),
            Activity::ImportVerifiedQueriesTask => write!(f, "IMPORT_VERIFIED_QUERIES_TASK"),
            Activity::OntologyGrounding => write!(f, "ONTOLOGY_GROUNDING"),
            Activity::TraceAnalysis => write!(f, "TRACE_ANALYSIS"),
            Activity::Unknown(value) => write!(f, "{value}"),
        }
    }
}