aws_sdk_ec2/operation/allocate_hosts/
_allocate_hosts_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains the output of AllocateHosts.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct AllocateHostsOutput {
7    /// <p>The ID of the allocated Dedicated Host. This is used to launch an instance onto a specific host.</p>
8    pub host_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
9    _request_id: Option<String>,
10}
11impl AllocateHostsOutput {
12    /// <p>The ID of the allocated Dedicated Host. This is used to launch an instance onto a specific host.</p>
13    ///
14    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.host_ids.is_none()`.
15    pub fn host_ids(&self) -> &[::std::string::String] {
16        self.host_ids.as_deref().unwrap_or_default()
17    }
18}
19impl ::aws_types::request_id::RequestId for AllocateHostsOutput {
20    fn request_id(&self) -> Option<&str> {
21        self._request_id.as_deref()
22    }
23}
24impl AllocateHostsOutput {
25    /// Creates a new builder-style object to manufacture [`AllocateHostsOutput`](crate::operation::allocate_hosts::AllocateHostsOutput).
26    pub fn builder() -> crate::operation::allocate_hosts::builders::AllocateHostsOutputBuilder {
27        crate::operation::allocate_hosts::builders::AllocateHostsOutputBuilder::default()
28    }
29}
30
31/// A builder for [`AllocateHostsOutput`](crate::operation::allocate_hosts::AllocateHostsOutput).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct AllocateHostsOutputBuilder {
35    pub(crate) host_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
36    _request_id: Option<String>,
37}
38impl AllocateHostsOutputBuilder {
39    /// Appends an item to `host_ids`.
40    ///
41    /// To override the contents of this collection use [`set_host_ids`](Self::set_host_ids).
42    ///
43    /// <p>The ID of the allocated Dedicated Host. This is used to launch an instance onto a specific host.</p>
44    pub fn host_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
45        let mut v = self.host_ids.unwrap_or_default();
46        v.push(input.into());
47        self.host_ids = ::std::option::Option::Some(v);
48        self
49    }
50    /// <p>The ID of the allocated Dedicated Host. This is used to launch an instance onto a specific host.</p>
51    pub fn set_host_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
52        self.host_ids = input;
53        self
54    }
55    /// <p>The ID of the allocated Dedicated Host. This is used to launch an instance onto a specific host.</p>
56    pub fn get_host_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
57        &self.host_ids
58    }
59    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
60        self._request_id = Some(request_id.into());
61        self
62    }
63
64    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
65        self._request_id = request_id;
66        self
67    }
68    /// Consumes the builder and constructs a [`AllocateHostsOutput`](crate::operation::allocate_hosts::AllocateHostsOutput).
69    pub fn build(self) -> crate::operation::allocate_hosts::AllocateHostsOutput {
70        crate::operation::allocate_hosts::AllocateHostsOutput {
71            host_ids: self.host_ids,
72            _request_id: self._request_id,
73        }
74    }
75}