Skip to main content

aws_sdk_athena/operation/create_capacity_reservation/
_create_capacity_reservation_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 CreateCapacityReservationInput {
6    /// <p>The number of requested data processing units.</p>
7    pub target_dpus: ::std::option::Option<i32>,
8    /// <p>The name of the capacity reservation to create.</p>
9    pub name: ::std::option::Option<::std::string::String>,
10    /// <p>The tags for the capacity reservation.</p>
11    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
12}
13impl CreateCapacityReservationInput {
14    /// <p>The number of requested data processing units.</p>
15    pub fn target_dpus(&self) -> ::std::option::Option<i32> {
16        self.target_dpus
17    }
18    /// <p>The name of the capacity reservation to create.</p>
19    pub fn name(&self) -> ::std::option::Option<&str> {
20        self.name.as_deref()
21    }
22    /// <p>The tags for the capacity reservation.</p>
23    ///
24    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
25    pub fn tags(&self) -> &[crate::types::Tag] {
26        self.tags.as_deref().unwrap_or_default()
27    }
28}
29impl CreateCapacityReservationInput {
30    /// Creates a new builder-style object to manufacture [`CreateCapacityReservationInput`](crate::operation::create_capacity_reservation::CreateCapacityReservationInput).
31    pub fn builder() -> crate::operation::create_capacity_reservation::builders::CreateCapacityReservationInputBuilder {
32        crate::operation::create_capacity_reservation::builders::CreateCapacityReservationInputBuilder::default()
33    }
34}
35
36/// A builder for [`CreateCapacityReservationInput`](crate::operation::create_capacity_reservation::CreateCapacityReservationInput).
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
38#[non_exhaustive]
39pub struct CreateCapacityReservationInputBuilder {
40    pub(crate) target_dpus: ::std::option::Option<i32>,
41    pub(crate) name: ::std::option::Option<::std::string::String>,
42    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
43}
44impl CreateCapacityReservationInputBuilder {
45    /// <p>The number of requested data processing units.</p>
46    /// This field is required.
47    pub fn target_dpus(mut self, input: i32) -> Self {
48        self.target_dpus = ::std::option::Option::Some(input);
49        self
50    }
51    /// <p>The number of requested data processing units.</p>
52    pub fn set_target_dpus(mut self, input: ::std::option::Option<i32>) -> Self {
53        self.target_dpus = input;
54        self
55    }
56    /// <p>The number of requested data processing units.</p>
57    pub fn get_target_dpus(&self) -> &::std::option::Option<i32> {
58        &self.target_dpus
59    }
60    /// <p>The name of the capacity reservation to create.</p>
61    /// This field is required.
62    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
63        self.name = ::std::option::Option::Some(input.into());
64        self
65    }
66    /// <p>The name of the capacity reservation to create.</p>
67    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
68        self.name = input;
69        self
70    }
71    /// <p>The name of the capacity reservation to create.</p>
72    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
73        &self.name
74    }
75    /// Appends an item to `tags`.
76    ///
77    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
78    ///
79    /// <p>The tags for the capacity reservation.</p>
80    pub fn tags(mut self, input: crate::types::Tag) -> Self {
81        let mut v = self.tags.unwrap_or_default();
82        v.push(input);
83        self.tags = ::std::option::Option::Some(v);
84        self
85    }
86    /// <p>The tags for the capacity reservation.</p>
87    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
88        self.tags = input;
89        self
90    }
91    /// <p>The tags for the capacity reservation.</p>
92    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
93        &self.tags
94    }
95    /// Consumes the builder and constructs a [`CreateCapacityReservationInput`](crate::operation::create_capacity_reservation::CreateCapacityReservationInput).
96    pub fn build(
97        self,
98    ) -> ::std::result::Result<
99        crate::operation::create_capacity_reservation::CreateCapacityReservationInput,
100        ::aws_smithy_types::error::operation::BuildError,
101    > {
102        ::std::result::Result::Ok(crate::operation::create_capacity_reservation::CreateCapacityReservationInput {
103            target_dpus: self.target_dpus,
104            name: self.name,
105            tags: self.tags,
106        })
107    }
108}