-
Notifications
You must be signed in to change notification settings - Fork 242
/
_definition_document.rs
88 lines (86 loc) · 4.03 KB
/
_definition_document.rs
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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>A document that defines an entity.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct DefinitionDocument {
/// <p>The language used to define the entity. <code>GRAPHQL</code> is the only valid value.</p>
pub language: crate::types::DefinitionLanguage,
/// <p>The GraphQL text that defines the entity.</p>
pub text: ::std::string::String,
}
impl DefinitionDocument {
/// <p>The language used to define the entity. <code>GRAPHQL</code> is the only valid value.</p>
pub fn language(&self) -> &crate::types::DefinitionLanguage {
&self.language
}
/// <p>The GraphQL text that defines the entity.</p>
pub fn text(&self) -> &str {
use std::ops::Deref;
self.text.deref()
}
}
impl DefinitionDocument {
/// Creates a new builder-style object to manufacture [`DefinitionDocument`](crate::types::DefinitionDocument).
pub fn builder() -> crate::types::builders::DefinitionDocumentBuilder {
crate::types::builders::DefinitionDocumentBuilder::default()
}
}
/// A builder for [`DefinitionDocument`](crate::types::DefinitionDocument).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct DefinitionDocumentBuilder {
pub(crate) language: ::std::option::Option<crate::types::DefinitionLanguage>,
pub(crate) text: ::std::option::Option<::std::string::String>,
}
impl DefinitionDocumentBuilder {
/// <p>The language used to define the entity. <code>GRAPHQL</code> is the only valid value.</p>
/// This field is required.
pub fn language(mut self, input: crate::types::DefinitionLanguage) -> Self {
self.language = ::std::option::Option::Some(input);
self
}
/// <p>The language used to define the entity. <code>GRAPHQL</code> is the only valid value.</p>
pub fn set_language(mut self, input: ::std::option::Option<crate::types::DefinitionLanguage>) -> Self {
self.language = input;
self
}
/// <p>The language used to define the entity. <code>GRAPHQL</code> is the only valid value.</p>
pub fn get_language(&self) -> &::std::option::Option<crate::types::DefinitionLanguage> {
&self.language
}
/// <p>The GraphQL text that defines the entity.</p>
/// This field is required.
pub fn text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.text = ::std::option::Option::Some(input.into());
self
}
/// <p>The GraphQL text that defines the entity.</p>
pub fn set_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.text = input;
self
}
/// <p>The GraphQL text that defines the entity.</p>
pub fn get_text(&self) -> &::std::option::Option<::std::string::String> {
&self.text
}
/// Consumes the builder and constructs a [`DefinitionDocument`](crate::types::DefinitionDocument).
/// This method will fail if any of the following fields are not set:
/// - [`language`](crate::types::builders::DefinitionDocumentBuilder::language)
/// - [`text`](crate::types::builders::DefinitionDocumentBuilder::text)
pub fn build(self) -> ::std::result::Result<crate::types::DefinitionDocument, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::DefinitionDocument {
language: self.language.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"language",
"language was not specified but it is required when building DefinitionDocument",
)
})?,
text: self.text.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"text",
"text was not specified but it is required when building DefinitionDocument",
)
})?,
})
}
}