aws-sdk-redshift 1.106.0

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

/// <p>Describes a connection endpoint.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Endpoint {
    /// <p>The DNS address of the Cluster.</p>
    pub address: ::std::option::Option<::std::string::String>,
    /// <p>The port that the database engine is listening on.</p>
    pub port: ::std::option::Option<i32>,
    /// <p>Describes a connection endpoint.</p>
    pub vpc_endpoints: ::std::option::Option<::std::vec::Vec<crate::types::VpcEndpoint>>,
}
impl Endpoint {
    /// <p>The DNS address of the Cluster.</p>
    pub fn address(&self) -> ::std::option::Option<&str> {
        self.address.as_deref()
    }
    /// <p>The port that the database engine is listening on.</p>
    pub fn port(&self) -> ::std::option::Option<i32> {
        self.port
    }
    /// <p>Describes a connection endpoint.</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 `.vpc_endpoints.is_none()`.
    pub fn vpc_endpoints(&self) -> &[crate::types::VpcEndpoint] {
        self.vpc_endpoints.as_deref().unwrap_or_default()
    }
}
impl Endpoint {
    /// Creates a new builder-style object to manufacture [`Endpoint`](crate::types::Endpoint).
    pub fn builder() -> crate::types::builders::EndpointBuilder {
        crate::types::builders::EndpointBuilder::default()
    }
}

/// A builder for [`Endpoint`](crate::types::Endpoint).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct EndpointBuilder {
    pub(crate) address: ::std::option::Option<::std::string::String>,
    pub(crate) port: ::std::option::Option<i32>,
    pub(crate) vpc_endpoints: ::std::option::Option<::std::vec::Vec<crate::types::VpcEndpoint>>,
}
impl EndpointBuilder {
    /// <p>The DNS address of the Cluster.</p>
    pub fn address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.address = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The DNS address of the Cluster.</p>
    pub fn set_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.address = input;
        self
    }
    /// <p>The DNS address of the Cluster.</p>
    pub fn get_address(&self) -> &::std::option::Option<::std::string::String> {
        &self.address
    }
    /// <p>The port that the database engine is listening on.</p>
    pub fn port(mut self, input: i32) -> Self {
        self.port = ::std::option::Option::Some(input);
        self
    }
    /// <p>The port that the database engine is listening on.</p>
    pub fn set_port(mut self, input: ::std::option::Option<i32>) -> Self {
        self.port = input;
        self
    }
    /// <p>The port that the database engine is listening on.</p>
    pub fn get_port(&self) -> &::std::option::Option<i32> {
        &self.port
    }
    /// Appends an item to `vpc_endpoints`.
    ///
    /// To override the contents of this collection use [`set_vpc_endpoints`](Self::set_vpc_endpoints).
    ///
    /// <p>Describes a connection endpoint.</p>
    pub fn vpc_endpoints(mut self, input: crate::types::VpcEndpoint) -> Self {
        let mut v = self.vpc_endpoints.unwrap_or_default();
        v.push(input);
        self.vpc_endpoints = ::std::option::Option::Some(v);
        self
    }
    /// <p>Describes a connection endpoint.</p>
    pub fn set_vpc_endpoints(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::VpcEndpoint>>) -> Self {
        self.vpc_endpoints = input;
        self
    }
    /// <p>Describes a connection endpoint.</p>
    pub fn get_vpc_endpoints(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::VpcEndpoint>> {
        &self.vpc_endpoints
    }
    /// Consumes the builder and constructs a [`Endpoint`](crate::types::Endpoint).
    pub fn build(self) -> crate::types::Endpoint {
        crate::types::Endpoint {
            address: self.address,
            port: self.port,
            vpc_endpoints: self.vpc_endpoints,
        }
    }
}