aws-sdk-bedrock 1.136.0

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

/// <p>An offer dictates usage terms for the model.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Offer {
    /// <p>Offer Id for a model offer.</p>
    pub offer_id: ::std::option::Option<::std::string::String>,
    /// <p>Offer token.</p>
    pub offer_token: ::std::string::String,
    /// <p>Details about the terms of the offer.</p>
    pub term_details: ::std::option::Option<crate::types::TermDetails>,
}
impl Offer {
    /// <p>Offer Id for a model offer.</p>
    pub fn offer_id(&self) -> ::std::option::Option<&str> {
        self.offer_id.as_deref()
    }
    /// <p>Offer token.</p>
    pub fn offer_token(&self) -> &str {
        use std::ops::Deref;
        self.offer_token.deref()
    }
    /// <p>Details about the terms of the offer.</p>
    pub fn term_details(&self) -> ::std::option::Option<&crate::types::TermDetails> {
        self.term_details.as_ref()
    }
}
impl Offer {
    /// Creates a new builder-style object to manufacture [`Offer`](crate::types::Offer).
    pub fn builder() -> crate::types::builders::OfferBuilder {
        crate::types::builders::OfferBuilder::default()
    }
}

/// A builder for [`Offer`](crate::types::Offer).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct OfferBuilder {
    pub(crate) offer_id: ::std::option::Option<::std::string::String>,
    pub(crate) offer_token: ::std::option::Option<::std::string::String>,
    pub(crate) term_details: ::std::option::Option<crate::types::TermDetails>,
}
impl OfferBuilder {
    /// <p>Offer Id for a model offer.</p>
    pub fn offer_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.offer_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Offer Id for a model offer.</p>
    pub fn set_offer_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.offer_id = input;
        self
    }
    /// <p>Offer Id for a model offer.</p>
    pub fn get_offer_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.offer_id
    }
    /// <p>Offer token.</p>
    /// This field is required.
    pub fn offer_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.offer_token = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Offer token.</p>
    pub fn set_offer_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.offer_token = input;
        self
    }
    /// <p>Offer token.</p>
    pub fn get_offer_token(&self) -> &::std::option::Option<::std::string::String> {
        &self.offer_token
    }
    /// <p>Details about the terms of the offer.</p>
    /// This field is required.
    pub fn term_details(mut self, input: crate::types::TermDetails) -> Self {
        self.term_details = ::std::option::Option::Some(input);
        self
    }
    /// <p>Details about the terms of the offer.</p>
    pub fn set_term_details(mut self, input: ::std::option::Option<crate::types::TermDetails>) -> Self {
        self.term_details = input;
        self
    }
    /// <p>Details about the terms of the offer.</p>
    pub fn get_term_details(&self) -> &::std::option::Option<crate::types::TermDetails> {
        &self.term_details
    }
    /// Consumes the builder and constructs a [`Offer`](crate::types::Offer).
    /// This method will fail if any of the following fields are not set:
    /// - [`offer_token`](crate::types::builders::OfferBuilder::offer_token)
    pub fn build(self) -> ::std::result::Result<crate::types::Offer, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Offer {
            offer_id: self.offer_id,
            offer_token: self.offer_token.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "offer_token",
                    "offer_token was not specified but it is required when building Offer",
                )
            })?,
            term_details: self.term_details,
        })
    }
}