aws_sdk_datapipeline/operation/put_pipeline_definition/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_pipeline_definition::_put_pipeline_definition_output::PutPipelineDefinitionOutputBuilder;
3
4pub use crate::operation::put_pipeline_definition::_put_pipeline_definition_input::PutPipelineDefinitionInputBuilder;
5
6impl crate::operation::put_pipeline_definition::builders::PutPipelineDefinitionInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::put_pipeline_definition::PutPipelineDefinitionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_pipeline_definition::PutPipelineDefinitionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_pipeline_definition();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutPipelineDefinition`.
24///
25/// <p>Adds tasks, schedules, and preconditions to the specified pipeline. You can use <code>PutPipelineDefinition</code> to populate a new pipeline.</p>
26/// <p><code>PutPipelineDefinition</code> also validates the configuration as it adds it to the pipeline. Changes to the pipeline are saved unless one of the following three validation errors exists in the pipeline.</p>
27/// <ol>
28/// <li>An object is missing a name or identifier field.</li>
29/// <li>A string or reference field is empty.</li>
30/// <li>The number of objects in the pipeline exceeds the maximum allowed objects.</li>
31/// <li>The pipeline is in a FINISHED state.</li>
32/// </ol>
33/// <p>Pipeline object definitions are passed to the <code>PutPipelineDefinition</code> action and returned by the <code>GetPipelineDefinition</code> action.</p><examples>
34/// <example>
35/// <name>
36/// Example 1
37/// </name>
38/// <description>
39/// This example sets an valid pipeline configuration and returns success.
40/// </description>
41/// <request>
42/// POST / HTTP/1.1 Content-Type: application/x-amz-json-1.1 X-Amz-Target: DataPipeline.PutPipelineDefinition Content-Length: 914 Host: datapipeline.us-east-1.amazonaws.com X-Amz-Date: Mon, 12 Nov 2012 17:49:52 GMT Authorization: AuthParams {"pipelineId": "df-0937003356ZJEXAMPLE", "pipelineObjects": \[ {"id": "Default", "name": "Default", "fields": \[ {"key": "workerGroup", "stringValue": "workerGroup"} \] }, {"id": "Schedule", "name": "Schedule", "fields": \[ {"key": "startDateTime", "stringValue": "2012-12-12T00:00:00"}, {"key": "type", "stringValue": "Schedule"}, {"key": "period", "stringValue": "1 hour"}, {"key": "endDateTime", "stringValue": "2012-12-21T18:00:00"} \] }, {"id": "SayHello", "name": "SayHello", "fields": \[ {"key": "type", "stringValue": "ShellCommandActivity"}, {"key": "command", "stringValue": "echo hello"}, {"key": "parent", "refValue": "Default"}, {"key": "schedule", "refValue": "Schedule"} \] } \] }
43/// </request>
44/// <response>
45/// HTTP/1.1 200 x-amzn-RequestId: f74afc14-0754-11e2-af6f-6bc7a6be60d9 Content-Type: application/x-amz-json-1.1 Content-Length: 18 Date: Mon, 12 Nov 2012 17:50:53 GMT {"errored": false}
46/// </response>
47/// </example>
48/// <example>
49/// <name>
50/// Example 2
51/// </name>
52/// <description>
53/// This example sets an invalid pipeline configuration (the value for
54/// <code>workerGroup</code> is an empty string) and returns an error message.
55/// </description>
56/// <request>
57/// POST / HTTP/1.1 Content-Type: application/x-amz-json-1.1 X-Amz-Target: DataPipeline.PutPipelineDefinition Content-Length: 903 Host: datapipeline.us-east-1.amazonaws.com X-Amz-Date: Mon, 12 Nov 2012 17:49:52 GMT Authorization: AuthParams {"pipelineId": "df-06372391ZG65EXAMPLE", "pipelineObjects": \[ {"id": "Default", "name": "Default", "fields": \[ {"key": "workerGroup", "stringValue": ""} \] }, {"id": "Schedule", "name": "Schedule", "fields": \[ {"key": "startDateTime", "stringValue": "2012-09-25T17:00:00"}, {"key": "type", "stringValue": "Schedule"}, {"key": "period", "stringValue": "1 hour"}, {"key": "endDateTime", "stringValue": "2012-09-25T18:00:00"} \] }, {"id": "SayHello", "name": "SayHello", "fields": \[ {"key": "type", "stringValue": "ShellCommandActivity"}, {"key": "command", "stringValue": "echo hello"}, {"key": "parent", "refValue": "Default"}, {"key": "schedule", "refValue": "Schedule"} \] } \] }
58/// </request>
59/// <response>
60/// HTTP/1.1 200 x-amzn-RequestId: f74afc14-0754-11e2-af6f-6bc7a6be60d9 Content-Type: application/x-amz-json-1.1 Content-Length: 18 Date: Mon, 12 Nov 2012 17:50:53 GMT {"__type": "com.amazon.setl.webservice#InvalidRequestException", "message": "Pipeline definition has errors: Could not save the pipeline definition due to FATAL errors: \[com.amazon.setl.webservice.ValidationError@108d7ea9\] Please call Validate to validate your pipeline"}
61/// </response>
62/// </example>
63/// </examples>
64#[derive(::std::clone::Clone, ::std::fmt::Debug)]
65pub struct PutPipelineDefinitionFluentBuilder {
66    handle: ::std::sync::Arc<crate::client::Handle>,
67    inner: crate::operation::put_pipeline_definition::builders::PutPipelineDefinitionInputBuilder,
68    config_override: ::std::option::Option<crate::config::Builder>,
69}
70impl
71    crate::client::customize::internal::CustomizableSend<
72        crate::operation::put_pipeline_definition::PutPipelineDefinitionOutput,
73        crate::operation::put_pipeline_definition::PutPipelineDefinitionError,
74    > for PutPipelineDefinitionFluentBuilder
75{
76    fn send(
77        self,
78        config_override: crate::config::Builder,
79    ) -> crate::client::customize::internal::BoxFuture<
80        crate::client::customize::internal::SendResult<
81            crate::operation::put_pipeline_definition::PutPipelineDefinitionOutput,
82            crate::operation::put_pipeline_definition::PutPipelineDefinitionError,
83        >,
84    > {
85        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
86    }
87}
88impl PutPipelineDefinitionFluentBuilder {
89    /// Creates a new `PutPipelineDefinitionFluentBuilder`.
90    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
91        Self {
92            handle,
93            inner: ::std::default::Default::default(),
94            config_override: ::std::option::Option::None,
95        }
96    }
97    /// Access the PutPipelineDefinition as a reference.
98    pub fn as_input(&self) -> &crate::operation::put_pipeline_definition::builders::PutPipelineDefinitionInputBuilder {
99        &self.inner
100    }
101    /// Sends the request and returns the response.
102    ///
103    /// If an error occurs, an `SdkError` will be returned with additional details that
104    /// can be matched against.
105    ///
106    /// By default, any retryable failures will be retried twice. Retry behavior
107    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
108    /// set when configuring the client.
109    pub async fn send(
110        self,
111    ) -> ::std::result::Result<
112        crate::operation::put_pipeline_definition::PutPipelineDefinitionOutput,
113        ::aws_smithy_runtime_api::client::result::SdkError<
114            crate::operation::put_pipeline_definition::PutPipelineDefinitionError,
115            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
116        >,
117    > {
118        let input = self
119            .inner
120            .build()
121            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
122        let runtime_plugins = crate::operation::put_pipeline_definition::PutPipelineDefinition::operation_runtime_plugins(
123            self.handle.runtime_plugins.clone(),
124            &self.handle.conf,
125            self.config_override,
126        );
127        crate::operation::put_pipeline_definition::PutPipelineDefinition::orchestrate(&runtime_plugins, input).await
128    }
129
130    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
131    pub fn customize(
132        self,
133    ) -> crate::client::customize::CustomizableOperation<
134        crate::operation::put_pipeline_definition::PutPipelineDefinitionOutput,
135        crate::operation::put_pipeline_definition::PutPipelineDefinitionError,
136        Self,
137    > {
138        crate::client::customize::CustomizableOperation::new(self)
139    }
140    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
141        self.set_config_override(::std::option::Option::Some(config_override.into()));
142        self
143    }
144
145    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
146        self.config_override = config_override;
147        self
148    }
149    /// <p>The ID of the pipeline.</p>
150    pub fn pipeline_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
151        self.inner = self.inner.pipeline_id(input.into());
152        self
153    }
154    /// <p>The ID of the pipeline.</p>
155    pub fn set_pipeline_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
156        self.inner = self.inner.set_pipeline_id(input);
157        self
158    }
159    /// <p>The ID of the pipeline.</p>
160    pub fn get_pipeline_id(&self) -> &::std::option::Option<::std::string::String> {
161        self.inner.get_pipeline_id()
162    }
163    ///
164    /// Appends an item to `pipelineObjects`.
165    ///
166    /// To override the contents of this collection use [`set_pipeline_objects`](Self::set_pipeline_objects).
167    ///
168    /// <p>The objects that define the pipeline. These objects overwrite the existing pipeline definition.</p>
169    pub fn pipeline_objects(mut self, input: crate::types::PipelineObject) -> Self {
170        self.inner = self.inner.pipeline_objects(input);
171        self
172    }
173    /// <p>The objects that define the pipeline. These objects overwrite the existing pipeline definition.</p>
174    pub fn set_pipeline_objects(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PipelineObject>>) -> Self {
175        self.inner = self.inner.set_pipeline_objects(input);
176        self
177    }
178    /// <p>The objects that define the pipeline. These objects overwrite the existing pipeline definition.</p>
179    pub fn get_pipeline_objects(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PipelineObject>> {
180        self.inner.get_pipeline_objects()
181    }
182    ///
183    /// Appends an item to `parameterObjects`.
184    ///
185    /// To override the contents of this collection use [`set_parameter_objects`](Self::set_parameter_objects).
186    ///
187    /// <p>The parameter objects used with the pipeline.</p>
188    pub fn parameter_objects(mut self, input: crate::types::ParameterObject) -> Self {
189        self.inner = self.inner.parameter_objects(input);
190        self
191    }
192    /// <p>The parameter objects used with the pipeline.</p>
193    pub fn set_parameter_objects(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ParameterObject>>) -> Self {
194        self.inner = self.inner.set_parameter_objects(input);
195        self
196    }
197    /// <p>The parameter objects used with the pipeline.</p>
198    pub fn get_parameter_objects(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ParameterObject>> {
199        self.inner.get_parameter_objects()
200    }
201    ///
202    /// Appends an item to `parameterValues`.
203    ///
204    /// To override the contents of this collection use [`set_parameter_values`](Self::set_parameter_values).
205    ///
206    /// <p>The parameter values used with the pipeline.</p>
207    pub fn parameter_values(mut self, input: crate::types::ParameterValue) -> Self {
208        self.inner = self.inner.parameter_values(input);
209        self
210    }
211    /// <p>The parameter values used with the pipeline.</p>
212    pub fn set_parameter_values(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ParameterValue>>) -> Self {
213        self.inner = self.inner.set_parameter_values(input);
214        self
215    }
216    /// <p>The parameter values used with the pipeline.</p>
217    pub fn get_parameter_values(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ParameterValue>> {
218        self.inner.get_parameter_values()
219    }
220}