aws-sdk-appflow 1.98.0

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

/// <p>A class for modeling different type of tasks. Task implementation varies based on the <code>TaskType</code>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Task {
    /// <p>The source fields to which a particular task is applied.</p>
    pub source_fields: ::std::vec::Vec<::std::string::String>,
    /// <p>The operation to be performed on the provided source fields.</p>
    pub connector_operator: ::std::option::Option<crate::types::ConnectorOperator>,
    /// <p>A field in a destination connector, or a field value against which Amazon AppFlow validates a source field.</p>
    pub destination_field: ::std::option::Option<::std::string::String>,
    /// <p>Specifies the particular task implementation that Amazon AppFlow performs.</p>
    pub task_type: crate::types::TaskType,
    /// <p>A map used to store task-related information. The execution service looks for particular information based on the <code>TaskType</code>.</p>
    pub task_properties: ::std::option::Option<::std::collections::HashMap<crate::types::OperatorPropertiesKeys, ::std::string::String>>,
}
impl Task {
    /// <p>The source fields to which a particular task is applied.</p>
    pub fn source_fields(&self) -> &[::std::string::String] {
        use std::ops::Deref;
        self.source_fields.deref()
    }
    /// <p>The operation to be performed on the provided source fields.</p>
    pub fn connector_operator(&self) -> ::std::option::Option<&crate::types::ConnectorOperator> {
        self.connector_operator.as_ref()
    }
    /// <p>A field in a destination connector, or a field value against which Amazon AppFlow validates a source field.</p>
    pub fn destination_field(&self) -> ::std::option::Option<&str> {
        self.destination_field.as_deref()
    }
    /// <p>Specifies the particular task implementation that Amazon AppFlow performs.</p>
    pub fn task_type(&self) -> &crate::types::TaskType {
        &self.task_type
    }
    /// <p>A map used to store task-related information. The execution service looks for particular information based on the <code>TaskType</code>.</p>
    pub fn task_properties(
        &self,
    ) -> ::std::option::Option<&::std::collections::HashMap<crate::types::OperatorPropertiesKeys, ::std::string::String>> {
        self.task_properties.as_ref()
    }
}
impl Task {
    /// Creates a new builder-style object to manufacture [`Task`](crate::types::Task).
    pub fn builder() -> crate::types::builders::TaskBuilder {
        crate::types::builders::TaskBuilder::default()
    }
}

/// A builder for [`Task`](crate::types::Task).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct TaskBuilder {
    pub(crate) source_fields: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) connector_operator: ::std::option::Option<crate::types::ConnectorOperator>,
    pub(crate) destination_field: ::std::option::Option<::std::string::String>,
    pub(crate) task_type: ::std::option::Option<crate::types::TaskType>,
    pub(crate) task_properties: ::std::option::Option<::std::collections::HashMap<crate::types::OperatorPropertiesKeys, ::std::string::String>>,
}
impl TaskBuilder {
    /// Appends an item to `source_fields`.
    ///
    /// To override the contents of this collection use [`set_source_fields`](Self::set_source_fields).
    ///
    /// <p>The source fields to which a particular task is applied.</p>
    pub fn source_fields(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.source_fields.unwrap_or_default();
        v.push(input.into());
        self.source_fields = ::std::option::Option::Some(v);
        self
    }
    /// <p>The source fields to which a particular task is applied.</p>
    pub fn set_source_fields(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.source_fields = input;
        self
    }
    /// <p>The source fields to which a particular task is applied.</p>
    pub fn get_source_fields(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.source_fields
    }
    /// <p>The operation to be performed on the provided source fields.</p>
    pub fn connector_operator(mut self, input: crate::types::ConnectorOperator) -> Self {
        self.connector_operator = ::std::option::Option::Some(input);
        self
    }
    /// <p>The operation to be performed on the provided source fields.</p>
    pub fn set_connector_operator(mut self, input: ::std::option::Option<crate::types::ConnectorOperator>) -> Self {
        self.connector_operator = input;
        self
    }
    /// <p>The operation to be performed on the provided source fields.</p>
    pub fn get_connector_operator(&self) -> &::std::option::Option<crate::types::ConnectorOperator> {
        &self.connector_operator
    }
    /// <p>A field in a destination connector, or a field value against which Amazon AppFlow validates a source field.</p>
    pub fn destination_field(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.destination_field = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>A field in a destination connector, or a field value against which Amazon AppFlow validates a source field.</p>
    pub fn set_destination_field(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.destination_field = input;
        self
    }
    /// <p>A field in a destination connector, or a field value against which Amazon AppFlow validates a source field.</p>
    pub fn get_destination_field(&self) -> &::std::option::Option<::std::string::String> {
        &self.destination_field
    }
    /// <p>Specifies the particular task implementation that Amazon AppFlow performs.</p>
    /// This field is required.
    pub fn task_type(mut self, input: crate::types::TaskType) -> Self {
        self.task_type = ::std::option::Option::Some(input);
        self
    }
    /// <p>Specifies the particular task implementation that Amazon AppFlow performs.</p>
    pub fn set_task_type(mut self, input: ::std::option::Option<crate::types::TaskType>) -> Self {
        self.task_type = input;
        self
    }
    /// <p>Specifies the particular task implementation that Amazon AppFlow performs.</p>
    pub fn get_task_type(&self) -> &::std::option::Option<crate::types::TaskType> {
        &self.task_type
    }
    /// Adds a key-value pair to `task_properties`.
    ///
    /// To override the contents of this collection use [`set_task_properties`](Self::set_task_properties).
    ///
    /// <p>A map used to store task-related information. The execution service looks for particular information based on the <code>TaskType</code>.</p>
    pub fn task_properties(mut self, k: crate::types::OperatorPropertiesKeys, v: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut hash_map = self.task_properties.unwrap_or_default();
        hash_map.insert(k, v.into());
        self.task_properties = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>A map used to store task-related information. The execution service looks for particular information based on the <code>TaskType</code>.</p>
    pub fn set_task_properties(
        mut self,
        input: ::std::option::Option<::std::collections::HashMap<crate::types::OperatorPropertiesKeys, ::std::string::String>>,
    ) -> Self {
        self.task_properties = input;
        self
    }
    /// <p>A map used to store task-related information. The execution service looks for particular information based on the <code>TaskType</code>.</p>
    pub fn get_task_properties(
        &self,
    ) -> &::std::option::Option<::std::collections::HashMap<crate::types::OperatorPropertiesKeys, ::std::string::String>> {
        &self.task_properties
    }
    /// Consumes the builder and constructs a [`Task`](crate::types::Task).
    /// This method will fail if any of the following fields are not set:
    /// - [`source_fields`](crate::types::builders::TaskBuilder::source_fields)
    /// - [`task_type`](crate::types::builders::TaskBuilder::task_type)
    pub fn build(self) -> ::std::result::Result<crate::types::Task, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Task {
            source_fields: self.source_fields.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "source_fields",
                    "source_fields was not specified but it is required when building Task",
                )
            })?,
            connector_operator: self.connector_operator,
            destination_field: self.destination_field,
            task_type: self.task_type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "task_type",
                    "task_type was not specified but it is required when building Task",
                )
            })?,
            task_properties: self.task_properties,
        })
    }
}