aws-sdk-ec2 1.221.0

AWS SDK for Amazon Elastic Compute Cloud
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <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>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct RunInstancesOutput {
    /// <p>The ID of the reservation.</p>
    pub reservation_id: ::std::option::Option<::std::string::String>,
    /// <p>The ID of the Amazon Web Services account that owns the reservation.</p>
    pub owner_id: ::std::option::Option<::std::string::String>,
    /// <p>The ID of the requester that launched the instances on your behalf (for example, Amazon Web Services Management Console or Auto Scaling).</p>
    pub requester_id: ::std::option::Option<::std::string::String>,
    /// <p>Not supported.</p>
    pub groups: ::std::option::Option<::std::vec::Vec<crate::types::GroupIdentifier>>,
    /// <p>The instances.</p>
    pub instances: ::std::option::Option<::std::vec::Vec<crate::types::Instance>>,
    _request_id: Option<String>,
}
impl RunInstancesOutput {
    /// <p>The ID of the reservation.</p>
    pub fn reservation_id(&self) -> ::std::option::Option<&str> {
        self.reservation_id.as_deref()
    }
    /// <p>The ID of the Amazon Web Services account that owns the reservation.</p>
    pub fn owner_id(&self) -> ::std::option::Option<&str> {
        self.owner_id.as_deref()
    }
    /// <p>The ID of the requester that launched the instances on your behalf (for example, Amazon Web Services Management Console or Auto Scaling).</p>
    pub fn requester_id(&self) -> ::std::option::Option<&str> {
        self.requester_id.as_deref()
    }
    /// <p>Not supported.</p>
    ///
    /// 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()`.
    pub fn groups(&self) -> &[crate::types::GroupIdentifier] {
        self.groups.as_deref().unwrap_or_default()
    }
    /// <p>The instances.</p>
    ///
    /// 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()`.
    pub fn instances(&self) -> &[crate::types::Instance] {
        self.instances.as_deref().unwrap_or_default()
    }
}
impl ::aws_types::request_id::RequestId for RunInstancesOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl RunInstancesOutput {
    /// Creates a new builder-style object to manufacture [`RunInstancesOutput`](crate::operation::run_instances::RunInstancesOutput).
    pub fn builder() -> crate::operation::run_instances::builders::RunInstancesOutputBuilder {
        crate::operation::run_instances::builders::RunInstancesOutputBuilder::default()
    }
}

/// A builder for [`RunInstancesOutput`](crate::operation::run_instances::RunInstancesOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct RunInstancesOutputBuilder {
    pub(crate) reservation_id: ::std::option::Option<::std::string::String>,
    pub(crate) owner_id: ::std::option::Option<::std::string::String>,
    pub(crate) requester_id: ::std::option::Option<::std::string::String>,
    pub(crate) groups: ::std::option::Option<::std::vec::Vec<crate::types::GroupIdentifier>>,
    pub(crate) instances: ::std::option::Option<::std::vec::Vec<crate::types::Instance>>,
    _request_id: Option<String>,
}
impl RunInstancesOutputBuilder {
    /// <p>The ID of the reservation.</p>
    pub fn reservation_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.reservation_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ID of the reservation.</p>
    pub fn set_reservation_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.reservation_id = input;
        self
    }
    /// <p>The ID of the reservation.</p>
    pub fn get_reservation_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.reservation_id
    }
    /// <p>The ID of the Amazon Web Services account that owns the reservation.</p>
    pub fn owner_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.owner_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ID of the Amazon Web Services account that owns the reservation.</p>
    pub fn set_owner_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.owner_id = input;
        self
    }
    /// <p>The ID of the Amazon Web Services account that owns the reservation.</p>
    pub fn get_owner_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.owner_id
    }
    /// <p>The ID of the requester that launched the instances on your behalf (for example, Amazon Web Services Management Console or Auto Scaling).</p>
    pub fn requester_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.requester_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ID of the requester that launched the instances on your behalf (for example, Amazon Web Services Management Console or Auto Scaling).</p>
    pub fn set_requester_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.requester_id = input;
        self
    }
    /// <p>The ID of the requester that launched the instances on your behalf (for example, Amazon Web Services Management Console or Auto Scaling).</p>
    pub fn get_requester_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.requester_id
    }
    /// Appends an item to `groups`.
    ///
    /// To override the contents of this collection use [`set_groups`](Self::set_groups).
    ///
    /// <p>Not supported.</p>
    pub fn groups(mut self, input: crate::types::GroupIdentifier) -> Self {
        let mut v = self.groups.unwrap_or_default();
        v.push(input);
        self.groups = ::std::option::Option::Some(v);
        self
    }
    /// <p>Not supported.</p>
    pub fn set_groups(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::GroupIdentifier>>) -> Self {
        self.groups = input;
        self
    }
    /// <p>Not supported.</p>
    pub fn get_groups(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::GroupIdentifier>> {
        &self.groups
    }
    /// Appends an item to `instances`.
    ///
    /// To override the contents of this collection use [`set_instances`](Self::set_instances).
    ///
    /// <p>The instances.</p>
    pub fn instances(mut self, input: crate::types::Instance) -> Self {
        let mut v = self.instances.unwrap_or_default();
        v.push(input);
        self.instances = ::std::option::Option::Some(v);
        self
    }
    /// <p>The instances.</p>
    pub fn set_instances(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Instance>>) -> Self {
        self.instances = input;
        self
    }
    /// <p>The instances.</p>
    pub fn get_instances(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Instance>> {
        &self.instances
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`RunInstancesOutput`](crate::operation::run_instances::RunInstancesOutput).
    pub fn build(self) -> crate::operation::run_instances::RunInstancesOutput {
        crate::operation::run_instances::RunInstancesOutput {
            reservation_id: self.reservation_id,
            owner_id: self.owner_id,
            requester_id: self.requester_id,
            groups: self.groups,
            instances: self.instances,
            _request_id: self._request_id,
        }
    }
}