1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>A key-value pair that describes a property of a pipeline object. The value is specified as either a string value (<code>StringValue</code>) or a reference to another object (<code>RefValue</code>) but not as both.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Field {
    /// <p>The field identifier.</p>
    pub key: ::std::string::String,
    /// <p>The field value, expressed as a String.</p>
    pub string_value: ::std::option::Option<::std::string::String>,
    /// <p>The field value, expressed as the identifier of another object.</p>
    pub ref_value: ::std::option::Option<::std::string::String>,
}
impl Field {
    /// <p>The field identifier.</p>
    pub fn key(&self) -> &str {
        use std::ops::Deref;
        self.key.deref()
    }
    /// <p>The field value, expressed as a String.</p>
    pub fn string_value(&self) -> ::std::option::Option<&str> {
        self.string_value.as_deref()
    }
    /// <p>The field value, expressed as the identifier of another object.</p>
    pub fn ref_value(&self) -> ::std::option::Option<&str> {
        self.ref_value.as_deref()
    }
}
impl Field {
    /// Creates a new builder-style object to manufacture [`Field`](crate::types::Field).
    pub fn builder() -> crate::types::builders::FieldBuilder {
        crate::types::builders::FieldBuilder::default()
    }
}

/// A builder for [`Field`](crate::types::Field).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct FieldBuilder {
    pub(crate) key: ::std::option::Option<::std::string::String>,
    pub(crate) string_value: ::std::option::Option<::std::string::String>,
    pub(crate) ref_value: ::std::option::Option<::std::string::String>,
}
impl FieldBuilder {
    /// <p>The field identifier.</p>
    /// This field is required.
    pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.key = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The field identifier.</p>
    pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.key = input;
        self
    }
    /// <p>The field identifier.</p>
    pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
        &self.key
    }
    /// <p>The field value, expressed as a String.</p>
    pub fn string_value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.string_value = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The field value, expressed as a String.</p>
    pub fn set_string_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.string_value = input;
        self
    }
    /// <p>The field value, expressed as a String.</p>
    pub fn get_string_value(&self) -> &::std::option::Option<::std::string::String> {
        &self.string_value
    }
    /// <p>The field value, expressed as the identifier of another object.</p>
    pub fn ref_value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.ref_value = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The field value, expressed as the identifier of another object.</p>
    pub fn set_ref_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.ref_value = input;
        self
    }
    /// <p>The field value, expressed as the identifier of another object.</p>
    pub fn get_ref_value(&self) -> &::std::option::Option<::std::string::String> {
        &self.ref_value
    }
    /// Consumes the builder and constructs a [`Field`](crate::types::Field).
    /// This method will fail if any of the following fields are not set:
    /// - [`key`](crate::types::builders::FieldBuilder::key)
    pub fn build(self) -> ::std::result::Result<crate::types::Field, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Field {
            key: self.key.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field("key", "key was not specified but it is required when building Field")
            })?,
            string_value: self.string_value,
            ref_value: self.ref_value,
        })
    }
}