aws_sdk_ec2/operation/create_interruptible_capacity_reservation_allocation/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_interruptible_capacity_reservation_allocation::_create_interruptible_capacity_reservation_allocation_output::CreateInterruptibleCapacityReservationAllocationOutputBuilder;
3
4pub use crate::operation::create_interruptible_capacity_reservation_allocation::_create_interruptible_capacity_reservation_allocation_input::CreateInterruptibleCapacityReservationAllocationInputBuilder;
5
6impl crate::operation::create_interruptible_capacity_reservation_allocation::builders::CreateInterruptibleCapacityReservationAllocationInputBuilder {
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::create_interruptible_capacity_reservation_allocation::CreateInterruptibleCapacityReservationAllocationOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_interruptible_capacity_reservation_allocation::CreateInterruptibleCapacityReservationAllocationError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_interruptible_capacity_reservation_allocation();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateInterruptibleCapacityReservationAllocation`.
24///
25/// <p>Creates an interruptible Capacity Reservation by specifying the number of unused instances you want to allocate from your source reservation. This helps you make unused capacity available for other workloads within your account while maintaining control to reclaim it.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreateInterruptibleCapacityReservationAllocationFluentBuilder {
28                handle: ::std::sync::Arc<crate::client::Handle>,
29                inner: crate::operation::create_interruptible_capacity_reservation_allocation::builders::CreateInterruptibleCapacityReservationAllocationInputBuilder,
30config_override: ::std::option::Option<crate::config::Builder>,
31            }
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::create_interruptible_capacity_reservation_allocation::CreateInterruptibleCapacityReservationAllocationOutput,
35        crate::operation::create_interruptible_capacity_reservation_allocation::CreateInterruptibleCapacityReservationAllocationError,
36    > for CreateInterruptibleCapacityReservationAllocationFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::create_interruptible_capacity_reservation_allocation::CreateInterruptibleCapacityReservationAllocationOutput,
44            crate::operation::create_interruptible_capacity_reservation_allocation::CreateInterruptibleCapacityReservationAllocationError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl CreateInterruptibleCapacityReservationAllocationFluentBuilder {
51    /// Creates a new `CreateInterruptibleCapacityReservationAllocationFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the CreateInterruptibleCapacityReservationAllocation as a reference.
60    pub fn as_input(
61        &self,
62    ) -> &crate::operation::create_interruptible_capacity_reservation_allocation::builders::CreateInterruptibleCapacityReservationAllocationInputBuilder
63    {
64        &self.inner
65    }
66    /// Sends the request and returns the response.
67    ///
68    /// If an error occurs, an `SdkError` will be returned with additional details that
69    /// can be matched against.
70    ///
71    /// By default, any retryable failures will be retried twice. Retry behavior
72    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73    /// set when configuring the client.
74    pub async fn send(
75        self,
76    ) -> ::std::result::Result<
77        crate::operation::create_interruptible_capacity_reservation_allocation::CreateInterruptibleCapacityReservationAllocationOutput,
78        ::aws_smithy_runtime_api::client::result::SdkError<
79            crate::operation::create_interruptible_capacity_reservation_allocation::CreateInterruptibleCapacityReservationAllocationError,
80            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81        >,
82    > {
83        let input = self
84            .inner
85            .build()
86            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87        let runtime_plugins = crate::operation::create_interruptible_capacity_reservation_allocation::CreateInterruptibleCapacityReservationAllocation::operation_runtime_plugins(
88                            self.handle.runtime_plugins.clone(),
89                            &self.handle.conf,
90                            self.config_override,
91                        );
92        crate::operation::create_interruptible_capacity_reservation_allocation::CreateInterruptibleCapacityReservationAllocation::orchestrate(
93            &runtime_plugins,
94            input,
95        )
96        .await
97    }
98
99    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
100    pub fn customize(
101        self,
102    ) -> crate::client::customize::CustomizableOperation<
103        crate::operation::create_interruptible_capacity_reservation_allocation::CreateInterruptibleCapacityReservationAllocationOutput,
104        crate::operation::create_interruptible_capacity_reservation_allocation::CreateInterruptibleCapacityReservationAllocationError,
105        Self,
106    > {
107        crate::client::customize::CustomizableOperation::new(self)
108    }
109    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
110        self.set_config_override(::std::option::Option::Some(config_override.into()));
111        self
112    }
113
114    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
115        self.config_override = config_override;
116        self
117    }
118    /// <p>The ID of the source Capacity Reservation from which to create the interruptible Capacity Reservation. Your Capacity Reservation must be in active state with no end date set and have available capacity for allocation.</p>
119    pub fn capacity_reservation_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120        self.inner = self.inner.capacity_reservation_id(input.into());
121        self
122    }
123    /// <p>The ID of the source Capacity Reservation from which to create the interruptible Capacity Reservation. Your Capacity Reservation must be in active state with no end date set and have available capacity for allocation.</p>
124    pub fn set_capacity_reservation_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
125        self.inner = self.inner.set_capacity_reservation_id(input);
126        self
127    }
128    /// <p>The ID of the source Capacity Reservation from which to create the interruptible Capacity Reservation. Your Capacity Reservation must be in active state with no end date set and have available capacity for allocation.</p>
129    pub fn get_capacity_reservation_id(&self) -> &::std::option::Option<::std::string::String> {
130        self.inner.get_capacity_reservation_id()
131    }
132    /// <p>The number of instances to allocate from your source reservation. You can only allocate available instances (also called unused capacity).</p>
133    pub fn instance_count(mut self, input: i32) -> Self {
134        self.inner = self.inner.instance_count(input);
135        self
136    }
137    /// <p>The number of instances to allocate from your source reservation. You can only allocate available instances (also called unused capacity).</p>
138    pub fn set_instance_count(mut self, input: ::std::option::Option<i32>) -> Self {
139        self.inner = self.inner.set_instance_count(input);
140        self
141    }
142    /// <p>The number of instances to allocate from your source reservation. You can only allocate available instances (also called unused capacity).</p>
143    pub fn get_instance_count(&self) -> &::std::option::Option<i32> {
144        self.inner.get_instance_count()
145    }
146    /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
147    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148        self.inner = self.inner.client_token(input.into());
149        self
150    }
151    /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
152    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153        self.inner = self.inner.set_client_token(input);
154        self
155    }
156    /// <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
157    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
158        self.inner.get_client_token()
159    }
160    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response.</p>
161    pub fn dry_run(mut self, input: bool) -> Self {
162        self.inner = self.inner.dry_run(input);
163        self
164    }
165    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response.</p>
166    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
167        self.inner = self.inner.set_dry_run(input);
168        self
169    }
170    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response.</p>
171    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
172        self.inner.get_dry_run()
173    }
174    ///
175    /// Appends an item to `TagSpecifications`.
176    ///
177    /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
178    ///
179    /// <p>The tags to apply to the interruptible Capacity Reservation during creation.</p>
180    pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
181        self.inner = self.inner.tag_specifications(input);
182        self
183    }
184    /// <p>The tags to apply to the interruptible Capacity Reservation during creation.</p>
185    pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
186        self.inner = self.inner.set_tag_specifications(input);
187        self
188    }
189    /// <p>The tags to apply to the interruptible Capacity Reservation during creation.</p>
190    pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
191        self.inner.get_tag_specifications()
192    }
193}