aws_sdk_ec2/operation/modify_instance_event_window/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::modify_instance_event_window::_modify_instance_event_window_output::ModifyInstanceEventWindowOutputBuilder;
3
4pub use crate::operation::modify_instance_event_window::_modify_instance_event_window_input::ModifyInstanceEventWindowInputBuilder;
5
6impl crate::operation::modify_instance_event_window::builders::ModifyInstanceEventWindowInputBuilder {
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::modify_instance_event_window::ModifyInstanceEventWindowOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::modify_instance_event_window::ModifyInstanceEventWindowError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.modify_instance_event_window();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ModifyInstanceEventWindow`.
24///
25/// <p>Modifies the specified event window.</p>
26/// <p>You can define either a set of time ranges or a cron expression when modifying the event window, but not both.</p>
27/// <p>To modify the targets associated with the event window, use the <code>AssociateInstanceEventWindow</code> and <code>DisassociateInstanceEventWindow</code> API.</p>
28/// <p>If Amazon Web Services has already scheduled an event, modifying an event window won't change the time of the scheduled event.</p>
29/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/event-windows.html">Define event windows for scheduled events</a> in the <i>Amazon EC2 User Guide</i>.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct ModifyInstanceEventWindowFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::modify_instance_event_window::builders::ModifyInstanceEventWindowInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37    crate::client::customize::internal::CustomizableSend<
38        crate::operation::modify_instance_event_window::ModifyInstanceEventWindowOutput,
39        crate::operation::modify_instance_event_window::ModifyInstanceEventWindowError,
40    > for ModifyInstanceEventWindowFluentBuilder
41{
42    fn send(
43        self,
44        config_override: crate::config::Builder,
45    ) -> crate::client::customize::internal::BoxFuture<
46        crate::client::customize::internal::SendResult<
47            crate::operation::modify_instance_event_window::ModifyInstanceEventWindowOutput,
48            crate::operation::modify_instance_event_window::ModifyInstanceEventWindowError,
49        >,
50    > {
51        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52    }
53}
54impl ModifyInstanceEventWindowFluentBuilder {
55    /// Creates a new `ModifyInstanceEventWindowFluentBuilder`.
56    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57        Self {
58            handle,
59            inner: ::std::default::Default::default(),
60            config_override: ::std::option::Option::None,
61        }
62    }
63    /// Access the ModifyInstanceEventWindow as a reference.
64    pub fn as_input(&self) -> &crate::operation::modify_instance_event_window::builders::ModifyInstanceEventWindowInputBuilder {
65        &self.inner
66    }
67    /// Sends the request and returns the response.
68    ///
69    /// If an error occurs, an `SdkError` will be returned with additional details that
70    /// can be matched against.
71    ///
72    /// By default, any retryable failures will be retried twice. Retry behavior
73    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74    /// set when configuring the client.
75    pub async fn send(
76        self,
77    ) -> ::std::result::Result<
78        crate::operation::modify_instance_event_window::ModifyInstanceEventWindowOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::modify_instance_event_window::ModifyInstanceEventWindowError,
81            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82        >,
83    > {
84        let input = self
85            .inner
86            .build()
87            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88        let runtime_plugins = crate::operation::modify_instance_event_window::ModifyInstanceEventWindow::operation_runtime_plugins(
89            self.handle.runtime_plugins.clone(),
90            &self.handle.conf,
91            self.config_override,
92        );
93        crate::operation::modify_instance_event_window::ModifyInstanceEventWindow::orchestrate(&runtime_plugins, input).await
94    }
95
96    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97    pub fn customize(
98        self,
99    ) -> crate::client::customize::CustomizableOperation<
100        crate::operation::modify_instance_event_window::ModifyInstanceEventWindowOutput,
101        crate::operation::modify_instance_event_window::ModifyInstanceEventWindowError,
102        Self,
103    > {
104        crate::client::customize::CustomizableOperation::new(self)
105    }
106    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107        self.set_config_override(::std::option::Option::Some(config_override.into()));
108        self
109    }
110
111    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112        self.config_override = config_override;
113        self
114    }
115    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
116    pub fn dry_run(mut self, input: bool) -> Self {
117        self.inner = self.inner.dry_run(input);
118        self
119    }
120    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
121    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
122        self.inner = self.inner.set_dry_run(input);
123        self
124    }
125    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
126    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
127        self.inner.get_dry_run()
128    }
129    /// <p>The name of the event window.</p>
130    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.name(input.into());
132        self
133    }
134    /// <p>The name of the event window.</p>
135    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_name(input);
137        self
138    }
139    /// <p>The name of the event window.</p>
140    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_name()
142    }
143    /// <p>The ID of the event window.</p>
144    pub fn instance_event_window_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.inner = self.inner.instance_event_window_id(input.into());
146        self
147    }
148    /// <p>The ID of the event window.</p>
149    pub fn set_instance_event_window_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.inner = self.inner.set_instance_event_window_id(input);
151        self
152    }
153    /// <p>The ID of the event window.</p>
154    pub fn get_instance_event_window_id(&self) -> &::std::option::Option<::std::string::String> {
155        self.inner.get_instance_event_window_id()
156    }
157    ///
158    /// Appends an item to `TimeRanges`.
159    ///
160    /// To override the contents of this collection use [`set_time_ranges`](Self::set_time_ranges).
161    ///
162    /// <p>The time ranges of the event window.</p>
163    pub fn time_ranges(mut self, input: crate::types::InstanceEventWindowTimeRangeRequest) -> Self {
164        self.inner = self.inner.time_ranges(input);
165        self
166    }
167    /// <p>The time ranges of the event window.</p>
168    pub fn set_time_ranges(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::InstanceEventWindowTimeRangeRequest>>) -> Self {
169        self.inner = self.inner.set_time_ranges(input);
170        self
171    }
172    /// <p>The time ranges of the event window.</p>
173    pub fn get_time_ranges(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::InstanceEventWindowTimeRangeRequest>> {
174        self.inner.get_time_ranges()
175    }
176    /// <p>The cron expression of the event window, for example, <code>* 0-4,20-23 * * 1,5</code>.</p>
177    /// <p>Constraints:</p>
178    /// <ul>
179    /// <li>
180    /// <p>Only hour and day of the week values are supported.</p></li>
181    /// <li>
182    /// <p>For day of the week values, you can specify either integers <code>0</code> through <code>6</code>, or alternative single values <code>SUN</code> through <code>SAT</code>.</p></li>
183    /// <li>
184    /// <p>The minute, month, and year must be specified by <code>*</code>.</p></li>
185    /// <li>
186    /// <p>The hour value must be one or a multiple range, for example, <code>0-4</code> or <code>0-4,20-23</code>.</p></li>
187    /// <li>
188    /// <p>Each hour range must be &gt;= 2 hours, for example, <code>0-2</code> or <code>20-23</code>.</p></li>
189    /// <li>
190    /// <p>The event window must be &gt;= 4 hours. The combined total time ranges in the event window must be &gt;= 4 hours.</p></li>
191    /// </ul>
192    /// <p>For more information about cron expressions, see <a href="https://en.wikipedia.org/wiki/Cron">cron</a> on the <i>Wikipedia website</i>.</p>
193    pub fn cron_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
194        self.inner = self.inner.cron_expression(input.into());
195        self
196    }
197    /// <p>The cron expression of the event window, for example, <code>* 0-4,20-23 * * 1,5</code>.</p>
198    /// <p>Constraints:</p>
199    /// <ul>
200    /// <li>
201    /// <p>Only hour and day of the week values are supported.</p></li>
202    /// <li>
203    /// <p>For day of the week values, you can specify either integers <code>0</code> through <code>6</code>, or alternative single values <code>SUN</code> through <code>SAT</code>.</p></li>
204    /// <li>
205    /// <p>The minute, month, and year must be specified by <code>*</code>.</p></li>
206    /// <li>
207    /// <p>The hour value must be one or a multiple range, for example, <code>0-4</code> or <code>0-4,20-23</code>.</p></li>
208    /// <li>
209    /// <p>Each hour range must be &gt;= 2 hours, for example, <code>0-2</code> or <code>20-23</code>.</p></li>
210    /// <li>
211    /// <p>The event window must be &gt;= 4 hours. The combined total time ranges in the event window must be &gt;= 4 hours.</p></li>
212    /// </ul>
213    /// <p>For more information about cron expressions, see <a href="https://en.wikipedia.org/wiki/Cron">cron</a> on the <i>Wikipedia website</i>.</p>
214    pub fn set_cron_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
215        self.inner = self.inner.set_cron_expression(input);
216        self
217    }
218    /// <p>The cron expression of the event window, for example, <code>* 0-4,20-23 * * 1,5</code>.</p>
219    /// <p>Constraints:</p>
220    /// <ul>
221    /// <li>
222    /// <p>Only hour and day of the week values are supported.</p></li>
223    /// <li>
224    /// <p>For day of the week values, you can specify either integers <code>0</code> through <code>6</code>, or alternative single values <code>SUN</code> through <code>SAT</code>.</p></li>
225    /// <li>
226    /// <p>The minute, month, and year must be specified by <code>*</code>.</p></li>
227    /// <li>
228    /// <p>The hour value must be one or a multiple range, for example, <code>0-4</code> or <code>0-4,20-23</code>.</p></li>
229    /// <li>
230    /// <p>Each hour range must be &gt;= 2 hours, for example, <code>0-2</code> or <code>20-23</code>.</p></li>
231    /// <li>
232    /// <p>The event window must be &gt;= 4 hours. The combined total time ranges in the event window must be &gt;= 4 hours.</p></li>
233    /// </ul>
234    /// <p>For more information about cron expressions, see <a href="https://en.wikipedia.org/wiki/Cron">cron</a> on the <i>Wikipedia website</i>.</p>
235    pub fn get_cron_expression(&self) -> &::std::option::Option<::std::string::String> {
236        self.inner.get_cron_expression()
237    }
238}