aws_sdk_ec2/operation/run_instances/
_run_instances_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Describes a launch request for one or more instances, and includes owner, requester, and security group information that applies to all instances in the launch request.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct RunInstancesOutput {
7    /// <p>The ID of the reservation.</p>
8    pub reservation_id: ::std::option::Option<::std::string::String>,
9    /// <p>The ID of the Amazon Web Services account that owns the reservation.</p>
10    pub owner_id: ::std::option::Option<::std::string::String>,
11    /// <p>The ID of the requester that launched the instances on your behalf (for example, Amazon Web Services Management Console or Auto Scaling).</p>
12    pub requester_id: ::std::option::Option<::std::string::String>,
13    /// <p>Not supported.</p>
14    pub groups: ::std::option::Option<::std::vec::Vec<crate::types::GroupIdentifier>>,
15    /// <p>The instances.</p>
16    pub instances: ::std::option::Option<::std::vec::Vec<crate::types::Instance>>,
17    _request_id: Option<String>,
18}
19impl RunInstancesOutput {
20    /// <p>The ID of the reservation.</p>
21    pub fn reservation_id(&self) -> ::std::option::Option<&str> {
22        self.reservation_id.as_deref()
23    }
24    /// <p>The ID of the Amazon Web Services account that owns the reservation.</p>
25    pub fn owner_id(&self) -> ::std::option::Option<&str> {
26        self.owner_id.as_deref()
27    }
28    /// <p>The ID of the requester that launched the instances on your behalf (for example, Amazon Web Services Management Console or Auto Scaling).</p>
29    pub fn requester_id(&self) -> ::std::option::Option<&str> {
30        self.requester_id.as_deref()
31    }
32    /// <p>Not supported.</p>
33    ///
34    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.groups.is_none()`.
35    pub fn groups(&self) -> &[crate::types::GroupIdentifier] {
36        self.groups.as_deref().unwrap_or_default()
37    }
38    /// <p>The instances.</p>
39    ///
40    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.instances.is_none()`.
41    pub fn instances(&self) -> &[crate::types::Instance] {
42        self.instances.as_deref().unwrap_or_default()
43    }
44}
45impl ::aws_types::request_id::RequestId for RunInstancesOutput {
46    fn request_id(&self) -> Option<&str> {
47        self._request_id.as_deref()
48    }
49}
50impl RunInstancesOutput {
51    /// Creates a new builder-style object to manufacture [`RunInstancesOutput`](crate::operation::run_instances::RunInstancesOutput).
52    pub fn builder() -> crate::operation::run_instances::builders::RunInstancesOutputBuilder {
53        crate::operation::run_instances::builders::RunInstancesOutputBuilder::default()
54    }
55}
56
57/// A builder for [`RunInstancesOutput`](crate::operation::run_instances::RunInstancesOutput).
58#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
59#[non_exhaustive]
60pub struct RunInstancesOutputBuilder {
61    pub(crate) reservation_id: ::std::option::Option<::std::string::String>,
62    pub(crate) owner_id: ::std::option::Option<::std::string::String>,
63    pub(crate) requester_id: ::std::option::Option<::std::string::String>,
64    pub(crate) groups: ::std::option::Option<::std::vec::Vec<crate::types::GroupIdentifier>>,
65    pub(crate) instances: ::std::option::Option<::std::vec::Vec<crate::types::Instance>>,
66    _request_id: Option<String>,
67}
68impl RunInstancesOutputBuilder {
69    /// <p>The ID of the reservation.</p>
70    pub fn reservation_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
71        self.reservation_id = ::std::option::Option::Some(input.into());
72        self
73    }
74    /// <p>The ID of the reservation.</p>
75    pub fn set_reservation_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
76        self.reservation_id = input;
77        self
78    }
79    /// <p>The ID of the reservation.</p>
80    pub fn get_reservation_id(&self) -> &::std::option::Option<::std::string::String> {
81        &self.reservation_id
82    }
83    /// <p>The ID of the Amazon Web Services account that owns the reservation.</p>
84    pub fn owner_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
85        self.owner_id = ::std::option::Option::Some(input.into());
86        self
87    }
88    /// <p>The ID of the Amazon Web Services account that owns the reservation.</p>
89    pub fn set_owner_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
90        self.owner_id = input;
91        self
92    }
93    /// <p>The ID of the Amazon Web Services account that owns the reservation.</p>
94    pub fn get_owner_id(&self) -> &::std::option::Option<::std::string::String> {
95        &self.owner_id
96    }
97    /// <p>The ID of the requester that launched the instances on your behalf (for example, Amazon Web Services Management Console or Auto Scaling).</p>
98    pub fn requester_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
99        self.requester_id = ::std::option::Option::Some(input.into());
100        self
101    }
102    /// <p>The ID of the requester that launched the instances on your behalf (for example, Amazon Web Services Management Console or Auto Scaling).</p>
103    pub fn set_requester_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
104        self.requester_id = input;
105        self
106    }
107    /// <p>The ID of the requester that launched the instances on your behalf (for example, Amazon Web Services Management Console or Auto Scaling).</p>
108    pub fn get_requester_id(&self) -> &::std::option::Option<::std::string::String> {
109        &self.requester_id
110    }
111    /// Appends an item to `groups`.
112    ///
113    /// To override the contents of this collection use [`set_groups`](Self::set_groups).
114    ///
115    /// <p>Not supported.</p>
116    pub fn groups(mut self, input: crate::types::GroupIdentifier) -> Self {
117        let mut v = self.groups.unwrap_or_default();
118        v.push(input);
119        self.groups = ::std::option::Option::Some(v);
120        self
121    }
122    /// <p>Not supported.</p>
123    pub fn set_groups(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GroupIdentifier>>) -> Self {
124        self.groups = input;
125        self
126    }
127    /// <p>Not supported.</p>
128    pub fn get_groups(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GroupIdentifier>> {
129        &self.groups
130    }
131    /// Appends an item to `instances`.
132    ///
133    /// To override the contents of this collection use [`set_instances`](Self::set_instances).
134    ///
135    /// <p>The instances.</p>
136    pub fn instances(mut self, input: crate::types::Instance) -> Self {
137        let mut v = self.instances.unwrap_or_default();
138        v.push(input);
139        self.instances = ::std::option::Option::Some(v);
140        self
141    }
142    /// <p>The instances.</p>
143    pub fn set_instances(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Instance>>) -> Self {
144        self.instances = input;
145        self
146    }
147    /// <p>The instances.</p>
148    pub fn get_instances(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Instance>> {
149        &self.instances
150    }
151    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
152        self._request_id = Some(request_id.into());
153        self
154    }
155
156    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
157        self._request_id = request_id;
158        self
159    }
160    /// Consumes the builder and constructs a [`RunInstancesOutput`](crate::operation::run_instances::RunInstancesOutput).
161    pub fn build(self) -> crate::operation::run_instances::RunInstancesOutput {
162        crate::operation::run_instances::RunInstancesOutput {
163            reservation_id: self.reservation_id,
164            owner_id: self.owner_id,
165            requester_id: self.requester_id,
166            groups: self.groups,
167            instances: self.instances,
168            _request_id: self._request_id,
169        }
170    }
171}