aws_sdk_appsync/operation/create_function/
_create_function_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateFunctionInput {
6    /// <p>The GraphQL API ID.</p>
7    pub api_id: ::std::option::Option<::std::string::String>,
8    /// <p>The <code>Function</code> name. The function name does not have to be unique.</p>
9    pub name: ::std::option::Option<::std::string::String>,
10    /// <p>The <code>Function</code> description.</p>
11    pub description: ::std::option::Option<::std::string::String>,
12    /// <p>The <code>Function</code> <code>DataSource</code> name.</p>
13    pub data_source_name: ::std::option::Option<::std::string::String>,
14    /// <p>The <code>Function</code> request mapping template. Functions support only the 2018-05-29 version of the request mapping template.</p>
15    pub request_mapping_template: ::std::option::Option<::std::string::String>,
16    /// <p>The <code>Function</code> response mapping template.</p>
17    pub response_mapping_template: ::std::option::Option<::std::string::String>,
18    /// <p>The <code>version</code> of the request mapping template. Currently, the supported value is 2018-05-29. Note that when using VTL and mapping templates, the <code>functionVersion</code> is required.</p>
19    pub function_version: ::std::option::Option<::std::string::String>,
20    /// <p>Describes a Sync configuration for a resolver.</p>
21    /// <p>Specifies which Conflict Detection strategy and Resolution strategy to use when the resolver is invoked.</p>
22    pub sync_config: ::std::option::Option<crate::types::SyncConfig>,
23    /// <p>The maximum batching size for a resolver.</p>
24    pub max_batch_size: ::std::option::Option<i32>,
25    /// <p>Describes a runtime used by an Amazon Web Services AppSync pipeline resolver or Amazon Web Services AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.</p>
26    pub runtime: ::std::option::Option<crate::types::AppSyncRuntime>,
27    /// <p>The <code>function</code> code that contains the request and response functions. When code is used, the <code>runtime</code> is required. The <code>runtime</code> value must be <code>APPSYNC_JS</code>.</p>
28    pub code: ::std::option::Option<::std::string::String>,
29}
30impl CreateFunctionInput {
31    /// <p>The GraphQL API ID.</p>
32    pub fn api_id(&self) -> ::std::option::Option<&str> {
33        self.api_id.as_deref()
34    }
35    /// <p>The <code>Function</code> name. The function name does not have to be unique.</p>
36    pub fn name(&self) -> ::std::option::Option<&str> {
37        self.name.as_deref()
38    }
39    /// <p>The <code>Function</code> description.</p>
40    pub fn description(&self) -> ::std::option::Option<&str> {
41        self.description.as_deref()
42    }
43    /// <p>The <code>Function</code> <code>DataSource</code> name.</p>
44    pub fn data_source_name(&self) -> ::std::option::Option<&str> {
45        self.data_source_name.as_deref()
46    }
47    /// <p>The <code>Function</code> request mapping template. Functions support only the 2018-05-29 version of the request mapping template.</p>
48    pub fn request_mapping_template(&self) -> ::std::option::Option<&str> {
49        self.request_mapping_template.as_deref()
50    }
51    /// <p>The <code>Function</code> response mapping template.</p>
52    pub fn response_mapping_template(&self) -> ::std::option::Option<&str> {
53        self.response_mapping_template.as_deref()
54    }
55    /// <p>The <code>version</code> of the request mapping template. Currently, the supported value is 2018-05-29. Note that when using VTL and mapping templates, the <code>functionVersion</code> is required.</p>
56    pub fn function_version(&self) -> ::std::option::Option<&str> {
57        self.function_version.as_deref()
58    }
59    /// <p>Describes a Sync configuration for a resolver.</p>
60    /// <p>Specifies which Conflict Detection strategy and Resolution strategy to use when the resolver is invoked.</p>
61    pub fn sync_config(&self) -> ::std::option::Option<&crate::types::SyncConfig> {
62        self.sync_config.as_ref()
63    }
64    /// <p>The maximum batching size for a resolver.</p>
65    pub fn max_batch_size(&self) -> ::std::option::Option<i32> {
66        self.max_batch_size
67    }
68    /// <p>Describes a runtime used by an Amazon Web Services AppSync pipeline resolver or Amazon Web Services AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.</p>
69    pub fn runtime(&self) -> ::std::option::Option<&crate::types::AppSyncRuntime> {
70        self.runtime.as_ref()
71    }
72    /// <p>The <code>function</code> code that contains the request and response functions. When code is used, the <code>runtime</code> is required. The <code>runtime</code> value must be <code>APPSYNC_JS</code>.</p>
73    pub fn code(&self) -> ::std::option::Option<&str> {
74        self.code.as_deref()
75    }
76}
77impl CreateFunctionInput {
78    /// Creates a new builder-style object to manufacture [`CreateFunctionInput`](crate::operation::create_function::CreateFunctionInput).
79    pub fn builder() -> crate::operation::create_function::builders::CreateFunctionInputBuilder {
80        crate::operation::create_function::builders::CreateFunctionInputBuilder::default()
81    }
82}
83
84/// A builder for [`CreateFunctionInput`](crate::operation::create_function::CreateFunctionInput).
85#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
86#[non_exhaustive]
87pub struct CreateFunctionInputBuilder {
88    pub(crate) api_id: ::std::option::Option<::std::string::String>,
89    pub(crate) name: ::std::option::Option<::std::string::String>,
90    pub(crate) description: ::std::option::Option<::std::string::String>,
91    pub(crate) data_source_name: ::std::option::Option<::std::string::String>,
92    pub(crate) request_mapping_template: ::std::option::Option<::std::string::String>,
93    pub(crate) response_mapping_template: ::std::option::Option<::std::string::String>,
94    pub(crate) function_version: ::std::option::Option<::std::string::String>,
95    pub(crate) sync_config: ::std::option::Option<crate::types::SyncConfig>,
96    pub(crate) max_batch_size: ::std::option::Option<i32>,
97    pub(crate) runtime: ::std::option::Option<crate::types::AppSyncRuntime>,
98    pub(crate) code: ::std::option::Option<::std::string::String>,
99}
100impl CreateFunctionInputBuilder {
101    /// <p>The GraphQL API ID.</p>
102    /// This field is required.
103    pub fn api_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104        self.api_id = ::std::option::Option::Some(input.into());
105        self
106    }
107    /// <p>The GraphQL API ID.</p>
108    pub fn set_api_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109        self.api_id = input;
110        self
111    }
112    /// <p>The GraphQL API ID.</p>
113    pub fn get_api_id(&self) -> &::std::option::Option<::std::string::String> {
114        &self.api_id
115    }
116    /// <p>The <code>Function</code> name. The function name does not have to be unique.</p>
117    /// This field is required.
118    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119        self.name = ::std::option::Option::Some(input.into());
120        self
121    }
122    /// <p>The <code>Function</code> name. The function name does not have to be unique.</p>
123    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
124        self.name = input;
125        self
126    }
127    /// <p>The <code>Function</code> name. The function name does not have to be unique.</p>
128    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
129        &self.name
130    }
131    /// <p>The <code>Function</code> description.</p>
132    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133        self.description = ::std::option::Option::Some(input.into());
134        self
135    }
136    /// <p>The <code>Function</code> description.</p>
137    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138        self.description = input;
139        self
140    }
141    /// <p>The <code>Function</code> description.</p>
142    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
143        &self.description
144    }
145    /// <p>The <code>Function</code> <code>DataSource</code> name.</p>
146    /// This field is required.
147    pub fn data_source_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148        self.data_source_name = ::std::option::Option::Some(input.into());
149        self
150    }
151    /// <p>The <code>Function</code> <code>DataSource</code> name.</p>
152    pub fn set_data_source_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153        self.data_source_name = input;
154        self
155    }
156    /// <p>The <code>Function</code> <code>DataSource</code> name.</p>
157    pub fn get_data_source_name(&self) -> &::std::option::Option<::std::string::String> {
158        &self.data_source_name
159    }
160    /// <p>The <code>Function</code> request mapping template. Functions support only the 2018-05-29 version of the request mapping template.</p>
161    pub fn request_mapping_template(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
162        self.request_mapping_template = ::std::option::Option::Some(input.into());
163        self
164    }
165    /// <p>The <code>Function</code> request mapping template. Functions support only the 2018-05-29 version of the request mapping template.</p>
166    pub fn set_request_mapping_template(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
167        self.request_mapping_template = input;
168        self
169    }
170    /// <p>The <code>Function</code> request mapping template. Functions support only the 2018-05-29 version of the request mapping template.</p>
171    pub fn get_request_mapping_template(&self) -> &::std::option::Option<::std::string::String> {
172        &self.request_mapping_template
173    }
174    /// <p>The <code>Function</code> response mapping template.</p>
175    pub fn response_mapping_template(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
176        self.response_mapping_template = ::std::option::Option::Some(input.into());
177        self
178    }
179    /// <p>The <code>Function</code> response mapping template.</p>
180    pub fn set_response_mapping_template(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
181        self.response_mapping_template = input;
182        self
183    }
184    /// <p>The <code>Function</code> response mapping template.</p>
185    pub fn get_response_mapping_template(&self) -> &::std::option::Option<::std::string::String> {
186        &self.response_mapping_template
187    }
188    /// <p>The <code>version</code> of the request mapping template. Currently, the supported value is 2018-05-29. Note that when using VTL and mapping templates, the <code>functionVersion</code> is required.</p>
189    pub fn function_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
190        self.function_version = ::std::option::Option::Some(input.into());
191        self
192    }
193    /// <p>The <code>version</code> of the request mapping template. Currently, the supported value is 2018-05-29. Note that when using VTL and mapping templates, the <code>functionVersion</code> is required.</p>
194    pub fn set_function_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
195        self.function_version = input;
196        self
197    }
198    /// <p>The <code>version</code> of the request mapping template. Currently, the supported value is 2018-05-29. Note that when using VTL and mapping templates, the <code>functionVersion</code> is required.</p>
199    pub fn get_function_version(&self) -> &::std::option::Option<::std::string::String> {
200        &self.function_version
201    }
202    /// <p>Describes a Sync configuration for a resolver.</p>
203    /// <p>Specifies which Conflict Detection strategy and Resolution strategy to use when the resolver is invoked.</p>
204    pub fn sync_config(mut self, input: crate::types::SyncConfig) -> Self {
205        self.sync_config = ::std::option::Option::Some(input);
206        self
207    }
208    /// <p>Describes a Sync configuration for a resolver.</p>
209    /// <p>Specifies which Conflict Detection strategy and Resolution strategy to use when the resolver is invoked.</p>
210    pub fn set_sync_config(mut self, input: ::std::option::Option<crate::types::SyncConfig>) -> Self {
211        self.sync_config = input;
212        self
213    }
214    /// <p>Describes a Sync configuration for a resolver.</p>
215    /// <p>Specifies which Conflict Detection strategy and Resolution strategy to use when the resolver is invoked.</p>
216    pub fn get_sync_config(&self) -> &::std::option::Option<crate::types::SyncConfig> {
217        &self.sync_config
218    }
219    /// <p>The maximum batching size for a resolver.</p>
220    pub fn max_batch_size(mut self, input: i32) -> Self {
221        self.max_batch_size = ::std::option::Option::Some(input);
222        self
223    }
224    /// <p>The maximum batching size for a resolver.</p>
225    pub fn set_max_batch_size(mut self, input: ::std::option::Option<i32>) -> Self {
226        self.max_batch_size = input;
227        self
228    }
229    /// <p>The maximum batching size for a resolver.</p>
230    pub fn get_max_batch_size(&self) -> &::std::option::Option<i32> {
231        &self.max_batch_size
232    }
233    /// <p>Describes a runtime used by an Amazon Web Services AppSync pipeline resolver or Amazon Web Services AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.</p>
234    pub fn runtime(mut self, input: crate::types::AppSyncRuntime) -> Self {
235        self.runtime = ::std::option::Option::Some(input);
236        self
237    }
238    /// <p>Describes a runtime used by an Amazon Web Services AppSync pipeline resolver or Amazon Web Services AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.</p>
239    pub fn set_runtime(mut self, input: ::std::option::Option<crate::types::AppSyncRuntime>) -> Self {
240        self.runtime = input;
241        self
242    }
243    /// <p>Describes a runtime used by an Amazon Web Services AppSync pipeline resolver or Amazon Web Services AppSync function. Specifies the name and version of the runtime to use. Note that if a runtime is specified, code must also be specified.</p>
244    pub fn get_runtime(&self) -> &::std::option::Option<crate::types::AppSyncRuntime> {
245        &self.runtime
246    }
247    /// <p>The <code>function</code> code that contains the request and response functions. When code is used, the <code>runtime</code> is required. The <code>runtime</code> value must be <code>APPSYNC_JS</code>.</p>
248    pub fn code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
249        self.code = ::std::option::Option::Some(input.into());
250        self
251    }
252    /// <p>The <code>function</code> code that contains the request and response functions. When code is used, the <code>runtime</code> is required. The <code>runtime</code> value must be <code>APPSYNC_JS</code>.</p>
253    pub fn set_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
254        self.code = input;
255        self
256    }
257    /// <p>The <code>function</code> code that contains the request and response functions. When code is used, the <code>runtime</code> is required. The <code>runtime</code> value must be <code>APPSYNC_JS</code>.</p>
258    pub fn get_code(&self) -> &::std::option::Option<::std::string::String> {
259        &self.code
260    }
261    /// Consumes the builder and constructs a [`CreateFunctionInput`](crate::operation::create_function::CreateFunctionInput).
262    pub fn build(
263        self,
264    ) -> ::std::result::Result<crate::operation::create_function::CreateFunctionInput, ::aws_smithy_types::error::operation::BuildError> {
265        ::std::result::Result::Ok(crate::operation::create_function::CreateFunctionInput {
266            api_id: self.api_id,
267            name: self.name,
268            description: self.description,
269            data_source_name: self.data_source_name,
270            request_mapping_template: self.request_mapping_template,
271            response_mapping_template: self.response_mapping_template,
272            function_version: self.function_version,
273            sync_config: self.sync_config,
274            max_batch_size: self.max_batch_size,
275            runtime: self.runtime,
276            code: self.code,
277        })
278    }
279}