Skip to main content

aws_sdk_appflow/types/
_custom_connector_destination_properties.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The properties that are applied when the custom connector is being used as a destination.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CustomConnectorDestinationProperties {
7    /// <p>The entity specified in the custom connector as a destination in the flow.</p>
8    pub entity_name: ::std::string::String,
9    /// <p>The settings that determine how Amazon AppFlow handles an error when placing data in the custom connector as destination.</p>
10    pub error_handling_config: ::std::option::Option<crate::types::ErrorHandlingConfig>,
11    /// <p>Specifies the type of write operation to be performed in the custom connector when it's used as destination.</p>
12    pub write_operation_type: ::std::option::Option<crate::types::WriteOperationType>,
13    /// <p>The name of the field that Amazon AppFlow uses as an ID when performing a write operation such as update, delete, or upsert.</p>
14    pub id_field_names: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
15    /// <p>The custom properties that are specific to the connector when it's used as a destination in the flow.</p>
16    pub custom_properties: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
17}
18impl CustomConnectorDestinationProperties {
19    /// <p>The entity specified in the custom connector as a destination in the flow.</p>
20    pub fn entity_name(&self) -> &str {
21        use std::ops::Deref;
22        self.entity_name.deref()
23    }
24    /// <p>The settings that determine how Amazon AppFlow handles an error when placing data in the custom connector as destination.</p>
25    pub fn error_handling_config(&self) -> ::std::option::Option<&crate::types::ErrorHandlingConfig> {
26        self.error_handling_config.as_ref()
27    }
28    /// <p>Specifies the type of write operation to be performed in the custom connector when it's used as destination.</p>
29    pub fn write_operation_type(&self) -> ::std::option::Option<&crate::types::WriteOperationType> {
30        self.write_operation_type.as_ref()
31    }
32    /// <p>The name of the field that Amazon AppFlow uses as an ID when performing a write operation such as update, delete, or upsert.</p>
33    ///
34    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.id_field_names.is_none()`.
35    pub fn id_field_names(&self) -> &[::std::string::String] {
36        self.id_field_names.as_deref().unwrap_or_default()
37    }
38    /// <p>The custom properties that are specific to the connector when it's used as a destination in the flow.</p>
39    pub fn custom_properties(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
40        self.custom_properties.as_ref()
41    }
42}
43impl CustomConnectorDestinationProperties {
44    /// Creates a new builder-style object to manufacture [`CustomConnectorDestinationProperties`](crate::types::CustomConnectorDestinationProperties).
45    pub fn builder() -> crate::types::builders::CustomConnectorDestinationPropertiesBuilder {
46        crate::types::builders::CustomConnectorDestinationPropertiesBuilder::default()
47    }
48}
49
50/// A builder for [`CustomConnectorDestinationProperties`](crate::types::CustomConnectorDestinationProperties).
51#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
52#[non_exhaustive]
53pub struct CustomConnectorDestinationPropertiesBuilder {
54    pub(crate) entity_name: ::std::option::Option<::std::string::String>,
55    pub(crate) error_handling_config: ::std::option::Option<crate::types::ErrorHandlingConfig>,
56    pub(crate) write_operation_type: ::std::option::Option<crate::types::WriteOperationType>,
57    pub(crate) id_field_names: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
58    pub(crate) custom_properties: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
59}
60impl CustomConnectorDestinationPropertiesBuilder {
61    /// <p>The entity specified in the custom connector as a destination in the flow.</p>
62    /// This field is required.
63    pub fn entity_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64        self.entity_name = ::std::option::Option::Some(input.into());
65        self
66    }
67    /// <p>The entity specified in the custom connector as a destination in the flow.</p>
68    pub fn set_entity_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
69        self.entity_name = input;
70        self
71    }
72    /// <p>The entity specified in the custom connector as a destination in the flow.</p>
73    pub fn get_entity_name(&self) -> &::std::option::Option<::std::string::String> {
74        &self.entity_name
75    }
76    /// <p>The settings that determine how Amazon AppFlow handles an error when placing data in the custom connector as destination.</p>
77    pub fn error_handling_config(mut self, input: crate::types::ErrorHandlingConfig) -> Self {
78        self.error_handling_config = ::std::option::Option::Some(input);
79        self
80    }
81    /// <p>The settings that determine how Amazon AppFlow handles an error when placing data in the custom connector as destination.</p>
82    pub fn set_error_handling_config(mut self, input: ::std::option::Option<crate::types::ErrorHandlingConfig>) -> Self {
83        self.error_handling_config = input;
84        self
85    }
86    /// <p>The settings that determine how Amazon AppFlow handles an error when placing data in the custom connector as destination.</p>
87    pub fn get_error_handling_config(&self) -> &::std::option::Option<crate::types::ErrorHandlingConfig> {
88        &self.error_handling_config
89    }
90    /// <p>Specifies the type of write operation to be performed in the custom connector when it's used as destination.</p>
91    pub fn write_operation_type(mut self, input: crate::types::WriteOperationType) -> Self {
92        self.write_operation_type = ::std::option::Option::Some(input);
93        self
94    }
95    /// <p>Specifies the type of write operation to be performed in the custom connector when it's used as destination.</p>
96    pub fn set_write_operation_type(mut self, input: ::std::option::Option<crate::types::WriteOperationType>) -> Self {
97        self.write_operation_type = input;
98        self
99    }
100    /// <p>Specifies the type of write operation to be performed in the custom connector when it's used as destination.</p>
101    pub fn get_write_operation_type(&self) -> &::std::option::Option<crate::types::WriteOperationType> {
102        &self.write_operation_type
103    }
104    /// Appends an item to `id_field_names`.
105    ///
106    /// To override the contents of this collection use [`set_id_field_names`](Self::set_id_field_names).
107    ///
108    /// <p>The name of the field that Amazon AppFlow uses as an ID when performing a write operation such as update, delete, or upsert.</p>
109    pub fn id_field_names(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
110        let mut v = self.id_field_names.unwrap_or_default();
111        v.push(input.into());
112        self.id_field_names = ::std::option::Option::Some(v);
113        self
114    }
115    /// <p>The name of the field that Amazon AppFlow uses as an ID when performing a write operation such as update, delete, or upsert.</p>
116    pub fn set_id_field_names(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
117        self.id_field_names = input;
118        self
119    }
120    /// <p>The name of the field that Amazon AppFlow uses as an ID when performing a write operation such as update, delete, or upsert.</p>
121    pub fn get_id_field_names(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
122        &self.id_field_names
123    }
124    /// Adds a key-value pair to `custom_properties`.
125    ///
126    /// To override the contents of this collection use [`set_custom_properties`](Self::set_custom_properties).
127    ///
128    /// <p>The custom properties that are specific to the connector when it's used as a destination in the flow.</p>
129    pub fn custom_properties(
130        mut self,
131        k: impl ::std::convert::Into<::std::string::String>,
132        v: impl ::std::convert::Into<::std::string::String>,
133    ) -> Self {
134        let mut hash_map = self.custom_properties.unwrap_or_default();
135        hash_map.insert(k.into(), v.into());
136        self.custom_properties = ::std::option::Option::Some(hash_map);
137        self
138    }
139    /// <p>The custom properties that are specific to the connector when it's used as a destination in the flow.</p>
140    pub fn set_custom_properties(
141        mut self,
142        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
143    ) -> Self {
144        self.custom_properties = input;
145        self
146    }
147    /// <p>The custom properties that are specific to the connector when it's used as a destination in the flow.</p>
148    pub fn get_custom_properties(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
149        &self.custom_properties
150    }
151    /// Consumes the builder and constructs a [`CustomConnectorDestinationProperties`](crate::types::CustomConnectorDestinationProperties).
152    /// This method will fail if any of the following fields are not set:
153    /// - [`entity_name`](crate::types::builders::CustomConnectorDestinationPropertiesBuilder::entity_name)
154    pub fn build(
155        self,
156    ) -> ::std::result::Result<crate::types::CustomConnectorDestinationProperties, ::aws_smithy_types::error::operation::BuildError> {
157        ::std::result::Result::Ok(crate::types::CustomConnectorDestinationProperties {
158            entity_name: self.entity_name.ok_or_else(|| {
159                ::aws_smithy_types::error::operation::BuildError::missing_field(
160                    "entity_name",
161                    "entity_name was not specified but it is required when building CustomConnectorDestinationProperties",
162                )
163            })?,
164            error_handling_config: self.error_handling_config,
165            write_operation_type: self.write_operation_type,
166            id_field_names: self.id_field_names,
167            custom_properties: self.custom_properties,
168        })
169    }
170}