Skip to main content

aws_sdk_fis/types/
_experiment_target_filter.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Describes a filter used for the target resources in an experiment.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ExperimentTargetFilter {
7    /// <p>The attribute path for the filter.</p>
8    pub path: ::std::option::Option<::std::string::String>,
9    /// <p>The attribute values for the filter.</p>
10    pub values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
11}
12impl ExperimentTargetFilter {
13    /// <p>The attribute path for the filter.</p>
14    pub fn path(&self) -> ::std::option::Option<&str> {
15        self.path.as_deref()
16    }
17    /// <p>The attribute values for the filter.</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 ExperimentTargetFilter {
25    /// Creates a new builder-style object to manufacture [`ExperimentTargetFilter`](crate::types::ExperimentTargetFilter).
26    pub fn builder() -> crate::types::builders::ExperimentTargetFilterBuilder {
27        crate::types::builders::ExperimentTargetFilterBuilder::default()
28    }
29}
30
31/// A builder for [`ExperimentTargetFilter`](crate::types::ExperimentTargetFilter).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct ExperimentTargetFilterBuilder {
35    pub(crate) path: ::std::option::Option<::std::string::String>,
36    pub(crate) values: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
37}
38impl ExperimentTargetFilterBuilder {
39    /// <p>The attribute path for the filter.</p>
40    pub fn path(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.path = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>The attribute path for the filter.</p>
45    pub fn set_path(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.path = input;
47        self
48    }
49    /// <p>The attribute path for the filter.</p>
50    pub fn get_path(&self) -> &::std::option::Option<::std::string::String> {
51        &self.path
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 attribute values for the filter.</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 attribute values for the filter.</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 attribute values for the filter.</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 [`ExperimentTargetFilter`](crate::types::ExperimentTargetFilter).
74    pub fn build(self) -> crate::types::ExperimentTargetFilter {
75        crate::types::ExperimentTargetFilter {
76            path: self.path,
77            values: self.values,
78        }
79    }
80}