aws_sdk_kendra/types/
_document_attribute.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct DocumentAttribute {
7 pub key: ::std::string::String,
9 pub value: ::std::option::Option<crate::types::DocumentAttributeValue>,
11}
12impl DocumentAttribute {
13 pub fn key(&self) -> &str {
15 use std::ops::Deref;
16 self.key.deref()
17 }
18 pub fn value(&self) -> ::std::option::Option<&crate::types::DocumentAttributeValue> {
20 self.value.as_ref()
21 }
22}
23impl DocumentAttribute {
24 pub fn builder() -> crate::types::builders::DocumentAttributeBuilder {
26 crate::types::builders::DocumentAttributeBuilder::default()
27 }
28}
29
30#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct DocumentAttributeBuilder {
34 pub(crate) key: ::std::option::Option<::std::string::String>,
35 pub(crate) value: ::std::option::Option<crate::types::DocumentAttributeValue>,
36}
37impl DocumentAttributeBuilder {
38 pub fn key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41 self.key = ::std::option::Option::Some(input.into());
42 self
43 }
44 pub fn set_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46 self.key = input;
47 self
48 }
49 pub fn get_key(&self) -> &::std::option::Option<::std::string::String> {
51 &self.key
52 }
53 pub fn value(mut self, input: crate::types::DocumentAttributeValue) -> Self {
56 self.value = ::std::option::Option::Some(input);
57 self
58 }
59 pub fn set_value(mut self, input: ::std::option::Option<crate::types::DocumentAttributeValue>) -> Self {
61 self.value = input;
62 self
63 }
64 pub fn get_value(&self) -> &::std::option::Option<crate::types::DocumentAttributeValue> {
66 &self.value
67 }
68 pub fn build(self) -> ::std::result::Result<crate::types::DocumentAttribute, ::aws_smithy_types::error::operation::BuildError> {
72 ::std::result::Result::Ok(crate::types::DocumentAttribute {
73 key: self.key.ok_or_else(|| {
74 ::aws_smithy_types::error::operation::BuildError::missing_field(
75 "key",
76 "key was not specified but it is required when building DocumentAttribute",
77 )
78 })?,
79 value: self.value,
80 })
81 }
82}