aws_sdk_dynamodb/types/
_endpoint.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An endpoint information details.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Endpoint {
7    /// <p>IP address of the endpoint.</p>
8    pub address: ::std::string::String,
9    /// <p>Endpoint cache time to live (TTL) value.</p>
10    pub cache_period_in_minutes: i64,
11}
12impl Endpoint {
13    /// <p>IP address of the endpoint.</p>
14    pub fn address(&self) -> &str {
15        use std::ops::Deref;
16        self.address.deref()
17    }
18    /// <p>Endpoint cache time to live (TTL) value.</p>
19    pub fn cache_period_in_minutes(&self) -> i64 {
20        self.cache_period_in_minutes
21    }
22}
23impl Endpoint {
24    /// Creates a new builder-style object to manufacture [`Endpoint`](crate::types::Endpoint).
25    pub fn builder() -> crate::types::builders::EndpointBuilder {
26        crate::types::builders::EndpointBuilder::default()
27    }
28}
29
30/// A builder for [`Endpoint`](crate::types::Endpoint).
31#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct EndpointBuilder {
34    pub(crate) address: ::std::option::Option<::std::string::String>,
35    pub(crate) cache_period_in_minutes: ::std::option::Option<i64>,
36}
37impl EndpointBuilder {
38    /// <p>IP address of the endpoint.</p>
39    /// This field is required.
40    pub fn address(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.address = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>IP address of the endpoint.</p>
45    pub fn set_address(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.address = input;
47        self
48    }
49    /// <p>IP address of the endpoint.</p>
50    pub fn get_address(&self) -> &::std::option::Option<::std::string::String> {
51        &self.address
52    }
53    /// <p>Endpoint cache time to live (TTL) value.</p>
54    /// This field is required.
55    pub fn cache_period_in_minutes(mut self, input: i64) -> Self {
56        self.cache_period_in_minutes = ::std::option::Option::Some(input);
57        self
58    }
59    /// <p>Endpoint cache time to live (TTL) value.</p>
60    pub fn set_cache_period_in_minutes(mut self, input: ::std::option::Option<i64>) -> Self {
61        self.cache_period_in_minutes = input;
62        self
63    }
64    /// <p>Endpoint cache time to live (TTL) value.</p>
65    pub fn get_cache_period_in_minutes(&self) -> &::std::option::Option<i64> {
66        &self.cache_period_in_minutes
67    }
68    /// Consumes the builder and constructs a [`Endpoint`](crate::types::Endpoint).
69    /// This method will fail if any of the following fields are not set:
70    /// - [`address`](crate::types::builders::EndpointBuilder::address)
71    pub fn build(self) -> ::std::result::Result<crate::types::Endpoint, ::aws_smithy_types::error::operation::BuildError> {
72        ::std::result::Result::Ok(crate::types::Endpoint {
73            address: self.address.ok_or_else(|| {
74                ::aws_smithy_types::error::operation::BuildError::missing_field(
75                    "address",
76                    "address was not specified but it is required when building Endpoint",
77                )
78            })?,
79            cache_period_in_minutes: self.cache_period_in_minutes.unwrap_or_default(),
80        })
81    }
82}