aws-sdk-pcs 1.70.1

AWS SDK for AWS Parallel Computing Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>An endpoint available for interaction with the scheduler.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Endpoint {
    /// <p>Indicates the type of endpoint running at the specific IP address.</p>
    pub r#type: crate::types::EndpointType,
    /// <p>For clusters that use IPv4, this is the endpoint's private IP address.</p>
    /// <p>Example: <code>10.1.2.3</code></p>
    /// <p>For clusters configured to use IPv6, this is an empty string.</p>
    pub private_ip_address: ::std::string::String,
    /// <p>The endpoint's public IP address.</p>
    /// <p>Example: <code>192.0.2.1</code></p>
    pub public_ip_address: ::std::option::Option<::std::string::String>,
    /// <p>The endpoint's IPv6 address.</p>
    /// <p>Example: <code>2001:db8::1</code></p>
    pub ipv6_address: ::std::option::Option<::std::string::String>,
    /// <p>The endpoint's connection port number.</p>
    /// <p>Example: <code>1234</code></p>
    pub port: ::std::string::String,
}
impl Endpoint {
    /// <p>Indicates the type of endpoint running at the specific IP address.</p>
    pub fn r#type(&self) -> &crate::types::EndpointType {
        &self.r#type
    }
    /// <p>For clusters that use IPv4, this is the endpoint's private IP address.</p>
    /// <p>Example: <code>10.1.2.3</code></p>
    /// <p>For clusters configured to use IPv6, this is an empty string.</p>
    pub fn private_ip_address(&self) -> &str {
        use std::ops::Deref;
        self.private_ip_address.deref()
    }
    /// <p>The endpoint's public IP address.</p>
    /// <p>Example: <code>192.0.2.1</code></p>
    pub fn public_ip_address(&self) -> ::std::option::Option<&str> {
        self.public_ip_address.as_deref()
    }
    /// <p>The endpoint's IPv6 address.</p>
    /// <p>Example: <code>2001:db8::1</code></p>
    pub fn ipv6_address(&self) -> ::std::option::Option<&str> {
        self.ipv6_address.as_deref()
    }
    /// <p>The endpoint's connection port number.</p>
    /// <p>Example: <code>1234</code></p>
    pub fn port(&self) -> &str {
        use std::ops::Deref;
        self.port.deref()
    }
}
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) r#type: ::std::option::Option<crate::types::EndpointType>,
    pub(crate) private_ip_address: ::std::option::Option<::std::string::String>,
    pub(crate) public_ip_address: ::std::option::Option<::std::string::String>,
    pub(crate) ipv6_address: ::std::option::Option<::std::string::String>,
    pub(crate) port: ::std::option::Option<::std::string::String>,
}
impl EndpointBuilder {
    /// <p>Indicates the type of endpoint running at the specific IP address.</p>
    /// This field is required.
    pub fn r#type(mut self, input: crate::types::EndpointType) -> Self {
        self.r#type = ::std::option::Option::Some(input);
        self
    }
    /// <p>Indicates the type of endpoint running at the specific IP address.</p>
    pub fn set_type(mut self, input: ::std::option::Option<crate::types::EndpointType>) -> Self {
        self.r#type = input;
        self
    }
    /// <p>Indicates the type of endpoint running at the specific IP address.</p>
    pub fn get_type(&self) -> &::std::option::Option<crate::types::EndpointType> {
        &self.r#type
    }
    /// <p>For clusters that use IPv4, this is the endpoint's private IP address.</p>
    /// <p>Example: <code>10.1.2.3</code></p>
    /// <p>For clusters configured to use IPv6, this is an empty string.</p>
    /// This field is required.
    pub fn private_ip_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.private_ip_address = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>For clusters that use IPv4, this is the endpoint's private IP address.</p>
    /// <p>Example: <code>10.1.2.3</code></p>
    /// <p>For clusters configured to use IPv6, this is an empty string.</p>
    pub fn set_private_ip_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.private_ip_address = input;
        self
    }
    /// <p>For clusters that use IPv4, this is the endpoint's private IP address.</p>
    /// <p>Example: <code>10.1.2.3</code></p>
    /// <p>For clusters configured to use IPv6, this is an empty string.</p>
    pub fn get_private_ip_address(&self) -> &::std::option::Option<::std::string::String> {
        &self.private_ip_address
    }
    /// <p>The endpoint's public IP address.</p>
    /// <p>Example: <code>192.0.2.1</code></p>
    pub fn public_ip_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.public_ip_address = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The endpoint's public IP address.</p>
    /// <p>Example: <code>192.0.2.1</code></p>
    pub fn set_public_ip_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.public_ip_address = input;
        self
    }
    /// <p>The endpoint's public IP address.</p>
    /// <p>Example: <code>192.0.2.1</code></p>
    pub fn get_public_ip_address(&self) -> &::std::option::Option<::std::string::String> {
        &self.public_ip_address
    }
    /// <p>The endpoint's IPv6 address.</p>
    /// <p>Example: <code>2001:db8::1</code></p>
    pub fn ipv6_address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.ipv6_address = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The endpoint's IPv6 address.</p>
    /// <p>Example: <code>2001:db8::1</code></p>
    pub fn set_ipv6_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.ipv6_address = input;
        self
    }
    /// <p>The endpoint's IPv6 address.</p>
    /// <p>Example: <code>2001:db8::1</code></p>
    pub fn get_ipv6_address(&self) -> &::std::option::Option<::std::string::String> {
        &self.ipv6_address
    }
    /// <p>The endpoint's connection port number.</p>
    /// <p>Example: <code>1234</code></p>
    /// This field is required.
    pub fn port(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.port = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The endpoint's connection port number.</p>
    /// <p>Example: <code>1234</code></p>
    pub fn set_port(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.port = input;
        self
    }
    /// <p>The endpoint's connection port number.</p>
    /// <p>Example: <code>1234</code></p>
    pub fn get_port(&self) -> &::std::option::Option<::std::string::String> {
        &self.port
    }
    /// Consumes the builder and constructs a [`Endpoint`](crate::types::Endpoint).
    /// This method will fail if any of the following fields are not set:
    /// - [`r#type`](crate::types::builders::EndpointBuilder::type)
    /// - [`private_ip_address`](crate::types::builders::EndpointBuilder::private_ip_address)
    /// - [`port`](crate::types::builders::EndpointBuilder::port)
    pub fn build(self) -> ::std::result::Result<crate::types::Endpoint, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Endpoint {
            r#type: self.r#type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "r#type",
                    "r#type was not specified but it is required when building Endpoint",
                )
            })?,
            private_ip_address: self.private_ip_address.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "private_ip_address",
                    "private_ip_address was not specified but it is required when building Endpoint",
                )
            })?,
            public_ip_address: self.public_ip_address,
            ipv6_address: self.ipv6_address,
            port: self.port.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "port",
                    "port was not specified but it is required when building Endpoint",
                )
            })?,
        })
    }
}