aws-sdk-ec2 1.218.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 Region.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Region {
    /// <p>The Region opt-in status. The possible values are <code>opt-in-not-required</code>, <code>opted-in</code>, and <code>not-opted-in</code>.</p>
    pub opt_in_status: ::std::option::Option<::std::string::String>,
    /// <p>The geography information for the Region. The geography is returned as a list.</p>
    pub geography: ::std::option::Option<::std::vec::Vec<crate::types::RegionGeography>>,
    /// <p>The name of the Region.</p>
    pub region_name: ::std::option::Option<::std::string::String>,
    /// <p>The Region service endpoint.</p>
    pub endpoint: ::std::option::Option<::std::string::String>,
}
impl Region {
    /// <p>The Region opt-in status. The possible values are <code>opt-in-not-required</code>, <code>opted-in</code>, and <code>not-opted-in</code>.</p>
    pub fn opt_in_status(&self) -> ::std::option::Option<&str> {
        self.opt_in_status.as_deref()
    }
    /// <p>The geography information for the Region. The geography is returned as a list.</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 `.geography.is_none()`.
    pub fn geography(&self) -> &[crate::types::RegionGeography] {
        self.geography.as_deref().unwrap_or_default()
    }
    /// <p>The name of the Region.</p>
    pub fn region_name(&self) -> ::std::option::Option<&str> {
        self.region_name.as_deref()
    }
    /// <p>The Region service endpoint.</p>
    pub fn endpoint(&self) -> ::std::option::Option<&str> {
        self.endpoint.as_deref()
    }
}
impl Region {
    /// Creates a new builder-style object to manufacture [`Region`](crate::types::Region).
    pub fn builder() -> crate::types::builders::RegionBuilder {
        crate::types::builders::RegionBuilder::default()
    }
}

/// A builder for [`Region`](crate::types::Region).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct RegionBuilder {
    pub(crate) opt_in_status: ::std::option::Option<::std::string::String>,
    pub(crate) geography: ::std::option::Option<::std::vec::Vec<crate::types::RegionGeography>>,
    pub(crate) region_name: ::std::option::Option<::std::string::String>,
    pub(crate) endpoint: ::std::option::Option<::std::string::String>,
}
impl RegionBuilder {
    /// <p>The Region opt-in status. The possible values are <code>opt-in-not-required</code>, <code>opted-in</code>, and <code>not-opted-in</code>.</p>
    pub fn opt_in_status(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.opt_in_status = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Region opt-in status. The possible values are <code>opt-in-not-required</code>, <code>opted-in</code>, and <code>not-opted-in</code>.</p>
    pub fn set_opt_in_status(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.opt_in_status = input;
        self
    }
    /// <p>The Region opt-in status. The possible values are <code>opt-in-not-required</code>, <code>opted-in</code>, and <code>not-opted-in</code>.</p>
    pub fn get_opt_in_status(&self) -> &::std::option::Option<::std::string::String> {
        &self.opt_in_status
    }
    /// Appends an item to `geography`.
    ///
    /// To override the contents of this collection use [`set_geography`](Self::set_geography).
    ///
    /// <p>The geography information for the Region. The geography is returned as a list.</p>
    pub fn geography(mut self, input: crate::types::RegionGeography) -> Self {
        let mut v = self.geography.unwrap_or_default();
        v.push(input);
        self.geography = ::std::option::Option::Some(v);
        self
    }
    /// <p>The geography information for the Region. The geography is returned as a list.</p>
    pub fn set_geography(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::RegionGeography>>) -> Self {
        self.geography = input;
        self
    }
    /// <p>The geography information for the Region. The geography is returned as a list.</p>
    pub fn get_geography(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::RegionGeography>> {
        &self.geography
    }
    /// <p>The name of the Region.</p>
    pub fn region_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.region_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the Region.</p>
    pub fn set_region_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.region_name = input;
        self
    }
    /// <p>The name of the Region.</p>
    pub fn get_region_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.region_name
    }
    /// <p>The Region service endpoint.</p>
    pub fn endpoint(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.endpoint = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Region service endpoint.</p>
    pub fn set_endpoint(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.endpoint = input;
        self
    }
    /// <p>The Region service endpoint.</p>
    pub fn get_endpoint(&self) -> &::std::option::Option<::std::string::String> {
        &self.endpoint
    }
    /// Consumes the builder and constructs a [`Region`](crate::types::Region).
    pub fn build(self) -> crate::types::Region {
        crate::types::Region {
            opt_in_status: self.opt_in_status,
            geography: self.geography,
            region_name: self.region_name,
            endpoint: self.endpoint,
        }
    }
}