aws_sdk_elasticinference/types/
_filter.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A filter expression for the Elastic Inference Accelerator list.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Filter {
7    /// <p>The filter name for the Elastic Inference Accelerator list. It can assume the following values: accelerator-type: the type of Elastic Inference Accelerator to filter for. instance-id: an EC2 instance id to filter for.</p>
8    pub name: ::std::option::Option<::std::string::String>,
9    /// <p>The values for the filter of the Elastic Inference Accelerator list.</p>
10    pub values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
11}
12impl Filter {
13    /// <p>The filter name for the Elastic Inference Accelerator list. It can assume the following values: accelerator-type: the type of Elastic Inference Accelerator to filter for. instance-id: an EC2 instance id to filter for.</p>
14    pub fn name(&self) -> ::std::option::Option<&str> {
15        self.name.as_deref()
16    }
17    /// <p>The values for the filter of the Elastic Inference Accelerator list.</p>
18    ///
19    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.values.is_none()`.
20    pub fn values(&self) -> &[::std::string::String] {
21        self.values.as_deref().unwrap_or_default()
22    }
23}
24impl Filter {
25    /// Creates a new builder-style object to manufacture [`Filter`](crate::types::Filter).
26    pub fn builder() -> crate::types::builders::FilterBuilder {
27        crate::types::builders::FilterBuilder::default()
28    }
29}
30
31/// A builder for [`Filter`](crate::types::Filter).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct FilterBuilder {
35    pub(crate) name: ::std::option::Option<::std::string::String>,
36    pub(crate) values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
37}
38impl FilterBuilder {
39    /// <p>The filter name for the Elastic Inference Accelerator list. It can assume the following values: accelerator-type: the type of Elastic Inference Accelerator to filter for. instance-id: an EC2 instance id to filter for.</p>
40    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.name = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>The filter name for the Elastic Inference Accelerator list. It can assume the following values: accelerator-type: the type of Elastic Inference Accelerator to filter for. instance-id: an EC2 instance id to filter for.</p>
45    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.name = input;
47        self
48    }
49    /// <p>The filter name for the Elastic Inference Accelerator list. It can assume the following values: accelerator-type: the type of Elastic Inference Accelerator to filter for. instance-id: an EC2 instance id to filter for.</p>
50    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
51        &self.name
52    }
53    /// Appends an item to `values`.
54    ///
55    /// To override the contents of this collection use [`set_values`](Self::set_values).
56    ///
57    /// <p>The values for the filter of the Elastic Inference Accelerator list.</p>
58    pub fn values(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
59        let mut v = self.values.unwrap_or_default();
60        v.push(input.into());
61        self.values = ::std::option::Option::Some(v);
62        self
63    }
64    /// <p>The values for the filter of the Elastic Inference Accelerator list.</p>
65    pub fn set_values(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
66        self.values = input;
67        self
68    }
69    /// <p>The values for the filter of the Elastic Inference Accelerator list.</p>
70    pub fn get_values(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
71        &self.values
72    }
73    /// Consumes the builder and constructs a [`Filter`](crate::types::Filter).
74    pub fn build(self) -> crate::types::Filter {
75        crate::types::Filter {
76            name: self.name,
77            values: self.values,
78        }
79    }
80}