Skip to main content

aws_sdk_sagemakergeospatial/types/
_filter.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The structure representing the filters supported by a RasterDataCollection.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Filter {
7    /// <p>The name of the filter.</p>
8    pub name: ::std::string::String,
9    /// <p>The type of the filter being used.</p>
10    pub r#type: ::std::string::String,
11    /// <p>The minimum value of the filter.</p>
12    pub minimum: ::std::option::Option<f32>,
13    /// <p>The maximum value of the filter.</p>
14    pub maximum: ::std::option::Option<f32>,
15}
16impl Filter {
17    /// <p>The name of the filter.</p>
18    pub fn name(&self) -> &str {
19        use std::ops::Deref;
20        self.name.deref()
21    }
22    /// <p>The type of the filter being used.</p>
23    pub fn r#type(&self) -> &str {
24        use std::ops::Deref;
25        self.r#type.deref()
26    }
27    /// <p>The minimum value of the filter.</p>
28    pub fn minimum(&self) -> ::std::option::Option<f32> {
29        self.minimum
30    }
31    /// <p>The maximum value of the filter.</p>
32    pub fn maximum(&self) -> ::std::option::Option<f32> {
33        self.maximum
34    }
35}
36impl Filter {
37    /// Creates a new builder-style object to manufacture [`Filter`](crate::types::Filter).
38    pub fn builder() -> crate::types::builders::FilterBuilder {
39        crate::types::builders::FilterBuilder::default()
40    }
41}
42
43/// A builder for [`Filter`](crate::types::Filter).
44#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
45#[non_exhaustive]
46pub struct FilterBuilder {
47    pub(crate) name: ::std::option::Option<::std::string::String>,
48    pub(crate) r#type: ::std::option::Option<::std::string::String>,
49    pub(crate) minimum: ::std::option::Option<f32>,
50    pub(crate) maximum: ::std::option::Option<f32>,
51}
52impl FilterBuilder {
53    /// <p>The name of the filter.</p>
54    /// This field is required.
55    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
56        self.name = ::std::option::Option::Some(input.into());
57        self
58    }
59    /// <p>The name of the filter.</p>
60    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
61        self.name = input;
62        self
63    }
64    /// <p>The name of the filter.</p>
65    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
66        &self.name
67    }
68    /// <p>The type of the filter being used.</p>
69    /// This field is required.
70    pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
71        self.r#type = ::std::option::Option::Some(input.into());
72        self
73    }
74    /// <p>The type of the filter being used.</p>
75    pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
76        self.r#type = input;
77        self
78    }
79    /// <p>The type of the filter being used.</p>
80    pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
81        &self.r#type
82    }
83    /// <p>The minimum value of the filter.</p>
84    pub fn minimum(mut self, input: f32) -> Self {
85        self.minimum = ::std::option::Option::Some(input);
86        self
87    }
88    /// <p>The minimum value of the filter.</p>
89    pub fn set_minimum(mut self, input: ::std::option::Option<f32>) -> Self {
90        self.minimum = input;
91        self
92    }
93    /// <p>The minimum value of the filter.</p>
94    pub fn get_minimum(&self) -> &::std::option::Option<f32> {
95        &self.minimum
96    }
97    /// <p>The maximum value of the filter.</p>
98    pub fn maximum(mut self, input: f32) -> Self {
99        self.maximum = ::std::option::Option::Some(input);
100        self
101    }
102    /// <p>The maximum value of the filter.</p>
103    pub fn set_maximum(mut self, input: ::std::option::Option<f32>) -> Self {
104        self.maximum = input;
105        self
106    }
107    /// <p>The maximum value of the filter.</p>
108    pub fn get_maximum(&self) -> &::std::option::Option<f32> {
109        &self.maximum
110    }
111    /// Consumes the builder and constructs a [`Filter`](crate::types::Filter).
112    /// This method will fail if any of the following fields are not set:
113    /// - [`name`](crate::types::builders::FilterBuilder::name)
114    /// - [`r#type`](crate::types::builders::FilterBuilder::type)
115    pub fn build(self) -> ::std::result::Result<crate::types::Filter, ::aws_smithy_types::error::operation::BuildError> {
116        ::std::result::Result::Ok(crate::types::Filter {
117            name: self.name.ok_or_else(|| {
118                ::aws_smithy_types::error::operation::BuildError::missing_field(
119                    "name",
120                    "name was not specified but it is required when building Filter",
121                )
122            })?,
123            r#type: self.r#type.ok_or_else(|| {
124                ::aws_smithy_types::error::operation::BuildError::missing_field(
125                    "r#type",
126                    "r#type was not specified but it is required when building Filter",
127                )
128            })?,
129            minimum: self.minimum,
130            maximum: self.maximum,
131        })
132    }
133}