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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// A telemetry field available for use in query expressions.
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Field {
/// The name of the field. Field names are case-sensitive and must be used exactly as returned when referencing them in query expressions.
pub name: ::std::string::String,
/// Child fields nested under this field.
pub children: ::std::option::Option<::std::vec::Vec<crate::types::Field>>,
}
impl Field {
/// The name of the field. Field names are case-sensitive and must be used exactly as returned when referencing them in query expressions.
pub fn name(&self) -> &str {
use std::ops::Deref;
self.name.deref()
}
/// Child fields nested under this field.
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.children.is_none()`.
pub fn children(&self) -> &[crate::types::Field] {
self.children.as_deref().unwrap_or_default()
}
}
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).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct FieldBuilder {
pub(crate) name: ::std::option::Option<::std::string::String>,
pub(crate) children: ::std::option::Option<::std::vec::Vec<crate::types::Field>>,
}
impl FieldBuilder {
/// The name of the field. Field names are case-sensitive and must be used exactly as returned when referencing them in query expressions.
/// This field is required.
pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.name = ::std::option::Option::Some(input.into());
self
}
/// The name of the field. Field names are case-sensitive and must be used exactly as returned when referencing them in query expressions.
pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.name = input;
self
}
/// The name of the field. Field names are case-sensitive and must be used exactly as returned when referencing them in query expressions.
pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
&self.name
}
/// Appends an item to `children`.
///
/// To override the contents of this collection use [`set_children`](Self::set_children).
///
/// Child fields nested under this field.
pub fn children(mut self, input: crate::types::Field) -> Self {
let mut v = self.children.unwrap_or_default();
v.push(input);
self.children = ::std::option::Option::Some(v);
self
}
/// Child fields nested under this field.
pub fn set_children(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Field>>) -> Self {
self.children = input;
self
}
/// Child fields nested under this field.
pub fn get_children(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Field>> {
&self.children
}
/// Consumes the builder and constructs a [`Field`](crate::types::Field).
/// This method will fail if any of the following fields are not set:
/// - [`name`](crate::types::builders::FieldBuilder::name)
pub fn build(self) -> ::std::result::Result<crate::types::Field, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::Field {
name: self.name.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"name",
"name was not specified but it is required when building Field",
)
})?,
children: self.children,
})
}
}