aws_sdk_ec2/operation/create_fleet/
_create_fleet_output.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 CreateFleetOutput {
6    /// <p>The ID of the EC2 Fleet.</p>
7    pub fleet_id: ::std::option::Option<::std::string::String>,
8    /// <p>Information about the instances that could not be launched by the fleet. Supported only for fleets of type <code>instant</code>.</p>
9    pub errors: ::std::option::Option<::std::vec::Vec<crate::types::CreateFleetError>>,
10    /// <p>Information about the instances that were launched by the fleet. Supported only for fleets of type <code>instant</code>.</p>
11    pub instances: ::std::option::Option<::std::vec::Vec<crate::types::CreateFleetInstance>>,
12    _request_id: Option<String>,
13}
14impl CreateFleetOutput {
15    /// <p>The ID of the EC2 Fleet.</p>
16    pub fn fleet_id(&self) -> ::std::option::Option<&str> {
17        self.fleet_id.as_deref()
18    }
19    /// <p>Information about the instances that could not be launched by the fleet. Supported only for fleets of type <code>instant</code>.</p>
20    ///
21    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.errors.is_none()`.
22    pub fn errors(&self) -> &[crate::types::CreateFleetError] {
23        self.errors.as_deref().unwrap_or_default()
24    }
25    /// <p>Information about the instances that were launched by the fleet. Supported only for fleets of type <code>instant</code>.</p>
26    ///
27    /// 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()`.
28    pub fn instances(&self) -> &[crate::types::CreateFleetInstance] {
29        self.instances.as_deref().unwrap_or_default()
30    }
31}
32impl ::aws_types::request_id::RequestId for CreateFleetOutput {
33    fn request_id(&self) -> Option<&str> {
34        self._request_id.as_deref()
35    }
36}
37impl CreateFleetOutput {
38    /// Creates a new builder-style object to manufacture [`CreateFleetOutput`](crate::operation::create_fleet::CreateFleetOutput).
39    pub fn builder() -> crate::operation::create_fleet::builders::CreateFleetOutputBuilder {
40        crate::operation::create_fleet::builders::CreateFleetOutputBuilder::default()
41    }
42}
43
44/// A builder for [`CreateFleetOutput`](crate::operation::create_fleet::CreateFleetOutput).
45#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
46#[non_exhaustive]
47pub struct CreateFleetOutputBuilder {
48    pub(crate) fleet_id: ::std::option::Option<::std::string::String>,
49    pub(crate) errors: ::std::option::Option<::std::vec::Vec<crate::types::CreateFleetError>>,
50    pub(crate) instances: ::std::option::Option<::std::vec::Vec<crate::types::CreateFleetInstance>>,
51    _request_id: Option<String>,
52}
53impl CreateFleetOutputBuilder {
54    /// <p>The ID of the EC2 Fleet.</p>
55    pub fn fleet_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
56        self.fleet_id = ::std::option::Option::Some(input.into());
57        self
58    }
59    /// <p>The ID of the EC2 Fleet.</p>
60    pub fn set_fleet_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
61        self.fleet_id = input;
62        self
63    }
64    /// <p>The ID of the EC2 Fleet.</p>
65    pub fn get_fleet_id(&self) -> &::std::option::Option<::std::string::String> {
66        &self.fleet_id
67    }
68    /// Appends an item to `errors`.
69    ///
70    /// To override the contents of this collection use [`set_errors`](Self::set_errors).
71    ///
72    /// <p>Information about the instances that could not be launched by the fleet. Supported only for fleets of type <code>instant</code>.</p>
73    pub fn errors(mut self, input: crate::types::CreateFleetError) -> Self {
74        let mut v = self.errors.unwrap_or_default();
75        v.push(input);
76        self.errors = ::std::option::Option::Some(v);
77        self
78    }
79    /// <p>Information about the instances that could not be launched by the fleet. Supported only for fleets of type <code>instant</code>.</p>
80    pub fn set_errors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CreateFleetError>>) -> Self {
81        self.errors = input;
82        self
83    }
84    /// <p>Information about the instances that could not be launched by the fleet. Supported only for fleets of type <code>instant</code>.</p>
85    pub fn get_errors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CreateFleetError>> {
86        &self.errors
87    }
88    /// Appends an item to `instances`.
89    ///
90    /// To override the contents of this collection use [`set_instances`](Self::set_instances).
91    ///
92    /// <p>Information about the instances that were launched by the fleet. Supported only for fleets of type <code>instant</code>.</p>
93    pub fn instances(mut self, input: crate::types::CreateFleetInstance) -> Self {
94        let mut v = self.instances.unwrap_or_default();
95        v.push(input);
96        self.instances = ::std::option::Option::Some(v);
97        self
98    }
99    /// <p>Information about the instances that were launched by the fleet. Supported only for fleets of type <code>instant</code>.</p>
100    pub fn set_instances(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CreateFleetInstance>>) -> Self {
101        self.instances = input;
102        self
103    }
104    /// <p>Information about the instances that were launched by the fleet. Supported only for fleets of type <code>instant</code>.</p>
105    pub fn get_instances(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CreateFleetInstance>> {
106        &self.instances
107    }
108    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
109        self._request_id = Some(request_id.into());
110        self
111    }
112
113    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
114        self._request_id = request_id;
115        self
116    }
117    /// Consumes the builder and constructs a [`CreateFleetOutput`](crate::operation::create_fleet::CreateFleetOutput).
118    pub fn build(self) -> crate::operation::create_fleet::CreateFleetOutput {
119        crate::operation::create_fleet::CreateFleetOutput {
120            fleet_id: self.fleet_id,
121            errors: self.errors,
122            instances: self.instances,
123            _request_id: self._request_id,
124        }
125    }
126}