aws-sdk-appsync 1.111.0

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

/// <p>The integration data source configuration for the handler.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Integration {
    /// <p>The unique name of the data source that has been configured on the API.</p>
    pub data_source_name: ::std::string::String,
    /// <p>The configuration for a Lambda data source.</p>
    pub lambda_config: ::std::option::Option<crate::types::LambdaConfig>,
}
impl Integration {
    /// <p>The unique name of the data source that has been configured on the API.</p>
    pub fn data_source_name(&self) -> &str {
        use std::ops::Deref;
        self.data_source_name.deref()
    }
    /// <p>The configuration for a Lambda data source.</p>
    pub fn lambda_config(&self) -> ::std::option::Option<&crate::types::LambdaConfig> {
        self.lambda_config.as_ref()
    }
}
impl Integration {
    /// Creates a new builder-style object to manufacture [`Integration`](crate::types::Integration).
    pub fn builder() -> crate::types::builders::IntegrationBuilder {
        crate::types::builders::IntegrationBuilder::default()
    }
}

/// A builder for [`Integration`](crate::types::Integration).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct IntegrationBuilder {
    pub(crate) data_source_name: ::std::option::Option<::std::string::String>,
    pub(crate) lambda_config: ::std::option::Option<crate::types::LambdaConfig>,
}
impl IntegrationBuilder {
    /// <p>The unique name of the data source that has been configured on the API.</p>
    /// This field is required.
    pub fn data_source_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.data_source_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The unique name of the data source that has been configured on the API.</p>
    pub fn set_data_source_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.data_source_name = input;
        self
    }
    /// <p>The unique name of the data source that has been configured on the API.</p>
    pub fn get_data_source_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.data_source_name
    }
    /// <p>The configuration for a Lambda data source.</p>
    pub fn lambda_config(mut self, input: crate::types::LambdaConfig) -> Self {
        self.lambda_config = ::std::option::Option::Some(input);
        self
    }
    /// <p>The configuration for a Lambda data source.</p>
    pub fn set_lambda_config(mut self, input: ::std::option::Option<crate::types::LambdaConfig>) -> Self {
        self.lambda_config = input;
        self
    }
    /// <p>The configuration for a Lambda data source.</p>
    pub fn get_lambda_config(&self) -> &::std::option::Option<crate::types::LambdaConfig> {
        &self.lambda_config
    }
    /// Consumes the builder and constructs a [`Integration`](crate::types::Integration).
    /// This method will fail if any of the following fields are not set:
    /// - [`data_source_name`](crate::types::builders::IntegrationBuilder::data_source_name)
    pub fn build(self) -> ::std::result::Result<crate::types::Integration, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Integration {
            data_source_name: self.data_source_name.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "data_source_name",
                    "data_source_name was not specified but it is required when building Integration",
                )
            })?,
            lambda_config: self.lambda_config,
        })
    }
}