aws-sdk-b2bi 1.52.0

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

/// <p>Specifies the mapping template for the transformer. This template is used to map the parsed EDI file using JSONata or XSLT.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Mapping {
    /// <p>The transformation language for the template, either XSLT or JSONATA.</p>
    pub template_language: crate::types::MappingTemplateLanguage,
    /// <p>A string that represents the mapping template, in the transformation language specified in <code>templateLanguage</code>.</p>
    pub template: ::std::option::Option<::std::string::String>,
}
impl Mapping {
    /// <p>The transformation language for the template, either XSLT or JSONATA.</p>
    pub fn template_language(&self) -> &crate::types::MappingTemplateLanguage {
        &self.template_language
    }
    /// <p>A string that represents the mapping template, in the transformation language specified in <code>templateLanguage</code>.</p>
    pub fn template(&self) -> ::std::option::Option<&str> {
        self.template.as_deref()
    }
}
impl Mapping {
    /// Creates a new builder-style object to manufacture [`Mapping`](crate::types::Mapping).
    pub fn builder() -> crate::types::builders::MappingBuilder {
        crate::types::builders::MappingBuilder::default()
    }
}

/// A builder for [`Mapping`](crate::types::Mapping).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct MappingBuilder {
    pub(crate) template_language: ::std::option::Option<crate::types::MappingTemplateLanguage>,
    pub(crate) template: ::std::option::Option<::std::string::String>,
}
impl MappingBuilder {
    /// <p>The transformation language for the template, either XSLT or JSONATA.</p>
    /// This field is required.
    pub fn template_language(mut self, input: crate::types::MappingTemplateLanguage) -> Self {
        self.template_language = ::std::option::Option::Some(input);
        self
    }
    /// <p>The transformation language for the template, either XSLT or JSONATA.</p>
    pub fn set_template_language(mut self, input: ::std::option::Option<crate::types::MappingTemplateLanguage>) -> Self {
        self.template_language = input;
        self
    }
    /// <p>The transformation language for the template, either XSLT or JSONATA.</p>
    pub fn get_template_language(&self) -> &::std::option::Option<crate::types::MappingTemplateLanguage> {
        &self.template_language
    }
    /// <p>A string that represents the mapping template, in the transformation language specified in <code>templateLanguage</code>.</p>
    pub fn template(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.template = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A string that represents the mapping template, in the transformation language specified in <code>templateLanguage</code>.</p>
    pub fn set_template(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.template = input;
        self
    }
    /// <p>A string that represents the mapping template, in the transformation language specified in <code>templateLanguage</code>.</p>
    pub fn get_template(&self) -> &::std::option::Option<::std::string::String> {
        &self.template
    }
    /// Consumes the builder and constructs a [`Mapping`](crate::types::Mapping).
    /// This method will fail if any of the following fields are not set:
    /// - [`template_language`](crate::types::builders::MappingBuilder::template_language)
    pub fn build(self) -> ::std::result::Result<crate::types::Mapping, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Mapping {
            template_language: self.template_language.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "template_language",
                    "template_language was not specified but it is required when building Mapping",
                )
            })?,
            template: self.template,
        })
    }
}