Skip to main content

aws_sdk_ec2/types/
_available_capacity.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The capacity information for instances that can be launched onto the Dedicated Host.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct AvailableCapacity {
7    /// <p>The number of instances that can be launched onto the Dedicated Host depending on the host's available capacity. For Dedicated Hosts that support multiple instance types, this parameter represents the number of instances for each instance size that is supported on the host.</p>
8    pub available_instance_capacity: ::std::option::Option<::std::vec::Vec<crate::types::InstanceCapacity>>,
9    /// <p>The number of vCPUs available for launching instances onto the Dedicated Host.</p>
10    pub available_v_cpus: ::std::option::Option<i32>,
11}
12impl AvailableCapacity {
13    /// <p>The number of instances that can be launched onto the Dedicated Host depending on the host's available capacity. For Dedicated Hosts that support multiple instance types, this parameter represents the number of instances for each instance size that is supported on the host.</p>
14    ///
15    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.available_instance_capacity.is_none()`.
16    pub fn available_instance_capacity(&self) -> &[crate::types::InstanceCapacity] {
17        self.available_instance_capacity.as_deref().unwrap_or_default()
18    }
19    /// <p>The number of vCPUs available for launching instances onto the Dedicated Host.</p>
20    pub fn available_v_cpus(&self) -> ::std::option::Option<i32> {
21        self.available_v_cpus
22    }
23}
24impl AvailableCapacity {
25    /// Creates a new builder-style object to manufacture [`AvailableCapacity`](crate::types::AvailableCapacity).
26    pub fn builder() -> crate::types::builders::AvailableCapacityBuilder {
27        crate::types::builders::AvailableCapacityBuilder::default()
28    }
29}
30
31/// A builder for [`AvailableCapacity`](crate::types::AvailableCapacity).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct AvailableCapacityBuilder {
35    pub(crate) available_instance_capacity: ::std::option::Option<::std::vec::Vec<crate::types::InstanceCapacity>>,
36    pub(crate) available_v_cpus: ::std::option::Option<i32>,
37}
38impl AvailableCapacityBuilder {
39    /// Appends an item to `available_instance_capacity`.
40    ///
41    /// To override the contents of this collection use [`set_available_instance_capacity`](Self::set_available_instance_capacity).
42    ///
43    /// <p>The number of instances that can be launched onto the Dedicated Host depending on the host's available capacity. For Dedicated Hosts that support multiple instance types, this parameter represents the number of instances for each instance size that is supported on the host.</p>
44    pub fn available_instance_capacity(mut self, input: crate::types::InstanceCapacity) -> Self {
45        let mut v = self.available_instance_capacity.unwrap_or_default();
46        v.push(input);
47        self.available_instance_capacity = ::std::option::Option::Some(v);
48        self
49    }
50    /// <p>The number of instances that can be launched onto the Dedicated Host depending on the host's available capacity. For Dedicated Hosts that support multiple instance types, this parameter represents the number of instances for each instance size that is supported on the host.</p>
51    pub fn set_available_instance_capacity(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::InstanceCapacity>>) -> Self {
52        self.available_instance_capacity = input;
53        self
54    }
55    /// <p>The number of instances that can be launched onto the Dedicated Host depending on the host's available capacity. For Dedicated Hosts that support multiple instance types, this parameter represents the number of instances for each instance size that is supported on the host.</p>
56    pub fn get_available_instance_capacity(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::InstanceCapacity>> {
57        &self.available_instance_capacity
58    }
59    /// <p>The number of vCPUs available for launching instances onto the Dedicated Host.</p>
60    pub fn available_v_cpus(mut self, input: i32) -> Self {
61        self.available_v_cpus = ::std::option::Option::Some(input);
62        self
63    }
64    /// <p>The number of vCPUs available for launching instances onto the Dedicated Host.</p>
65    pub fn set_available_v_cpus(mut self, input: ::std::option::Option<i32>) -> Self {
66        self.available_v_cpus = input;
67        self
68    }
69    /// <p>The number of vCPUs available for launching instances onto the Dedicated Host.</p>
70    pub fn get_available_v_cpus(&self) -> &::std::option::Option<i32> {
71        &self.available_v_cpus
72    }
73    /// Consumes the builder and constructs a [`AvailableCapacity`](crate::types::AvailableCapacity).
74    pub fn build(self) -> crate::types::AvailableCapacity {
75        crate::types::AvailableCapacity {
76            available_instance_capacity: self.available_instance_capacity,
77            available_v_cpus: self.available_v_cpus,
78        }
79    }
80}