aws_sdk_athena/operation/create_named_query/_create_named_query_input.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateNamedQueryInput {
6 /// <p>The query name.</p>
7 pub name: ::std::option::Option<::std::string::String>,
8 /// <p>The query description.</p>
9 pub description: ::std::option::Option<::std::string::String>,
10 /// <p>The database to which the query belongs.</p>
11 pub database: ::std::option::Option<::std::string::String>,
12 /// <p>The contents of the query with all query statements.</p>
13 pub query_string: ::std::option::Option<::std::string::String>,
14 /// <p>A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another <code>CreateNamedQuery</code> request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the <code>QueryString</code>, an error is returned.</p><important>
15 /// <p>This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for users. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.</p>
16 /// </important>
17 pub client_request_token: ::std::option::Option<::std::string::String>,
18 /// <p>The name of the workgroup in which the named query is being created.</p>
19 pub work_group: ::std::option::Option<::std::string::String>,
20}
21impl CreateNamedQueryInput {
22 /// <p>The query name.</p>
23 pub fn name(&self) -> ::std::option::Option<&str> {
24 self.name.as_deref()
25 }
26 /// <p>The query description.</p>
27 pub fn description(&self) -> ::std::option::Option<&str> {
28 self.description.as_deref()
29 }
30 /// <p>The database to which the query belongs.</p>
31 pub fn database(&self) -> ::std::option::Option<&str> {
32 self.database.as_deref()
33 }
34 /// <p>The contents of the query with all query statements.</p>
35 pub fn query_string(&self) -> ::std::option::Option<&str> {
36 self.query_string.as_deref()
37 }
38 /// <p>A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another <code>CreateNamedQuery</code> request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the <code>QueryString</code>, an error is returned.</p><important>
39 /// <p>This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for users. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.</p>
40 /// </important>
41 pub fn client_request_token(&self) -> ::std::option::Option<&str> {
42 self.client_request_token.as_deref()
43 }
44 /// <p>The name of the workgroup in which the named query is being created.</p>
45 pub fn work_group(&self) -> ::std::option::Option<&str> {
46 self.work_group.as_deref()
47 }
48}
49impl CreateNamedQueryInput {
50 /// Creates a new builder-style object to manufacture [`CreateNamedQueryInput`](crate::operation::create_named_query::CreateNamedQueryInput).
51 pub fn builder() -> crate::operation::create_named_query::builders::CreateNamedQueryInputBuilder {
52 crate::operation::create_named_query::builders::CreateNamedQueryInputBuilder::default()
53 }
54}
55
56/// A builder for [`CreateNamedQueryInput`](crate::operation::create_named_query::CreateNamedQueryInput).
57#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
58#[non_exhaustive]
59pub struct CreateNamedQueryInputBuilder {
60 pub(crate) name: ::std::option::Option<::std::string::String>,
61 pub(crate) description: ::std::option::Option<::std::string::String>,
62 pub(crate) database: ::std::option::Option<::std::string::String>,
63 pub(crate) query_string: ::std::option::Option<::std::string::String>,
64 pub(crate) client_request_token: ::std::option::Option<::std::string::String>,
65 pub(crate) work_group: ::std::option::Option<::std::string::String>,
66}
67impl CreateNamedQueryInputBuilder {
68 /// <p>The query name.</p>
69 /// This field is required.
70 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
71 self.name = ::std::option::Option::Some(input.into());
72 self
73 }
74 /// <p>The query name.</p>
75 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
76 self.name = input;
77 self
78 }
79 /// <p>The query name.</p>
80 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
81 &self.name
82 }
83 /// <p>The query description.</p>
84 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
85 self.description = ::std::option::Option::Some(input.into());
86 self
87 }
88 /// <p>The query description.</p>
89 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
90 self.description = input;
91 self
92 }
93 /// <p>The query description.</p>
94 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
95 &self.description
96 }
97 /// <p>The database to which the query belongs.</p>
98 /// This field is required.
99 pub fn database(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
100 self.database = ::std::option::Option::Some(input.into());
101 self
102 }
103 /// <p>The database to which the query belongs.</p>
104 pub fn set_database(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
105 self.database = input;
106 self
107 }
108 /// <p>The database to which the query belongs.</p>
109 pub fn get_database(&self) -> &::std::option::Option<::std::string::String> {
110 &self.database
111 }
112 /// <p>The contents of the query with all query statements.</p>
113 /// This field is required.
114 pub fn query_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115 self.query_string = ::std::option::Option::Some(input.into());
116 self
117 }
118 /// <p>The contents of the query with all query statements.</p>
119 pub fn set_query_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120 self.query_string = input;
121 self
122 }
123 /// <p>The contents of the query with all query statements.</p>
124 pub fn get_query_string(&self) -> &::std::option::Option<::std::string::String> {
125 &self.query_string
126 }
127 /// <p>A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another <code>CreateNamedQuery</code> request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the <code>QueryString</code>, an error is returned.</p><important>
128 /// <p>This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for users. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.</p>
129 /// </important>
130 pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131 self.client_request_token = ::std::option::Option::Some(input.into());
132 self
133 }
134 /// <p>A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another <code>CreateNamedQuery</code> request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the <code>QueryString</code>, an error is returned.</p><important>
135 /// <p>This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for users. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.</p>
136 /// </important>
137 pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138 self.client_request_token = input;
139 self
140 }
141 /// <p>A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another <code>CreateNamedQuery</code> request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the <code>QueryString</code>, an error is returned.</p><important>
142 /// <p>This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for users. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.</p>
143 /// </important>
144 pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
145 &self.client_request_token
146 }
147 /// <p>The name of the workgroup in which the named query is being created.</p>
148 pub fn work_group(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
149 self.work_group = ::std::option::Option::Some(input.into());
150 self
151 }
152 /// <p>The name of the workgroup in which the named query is being created.</p>
153 pub fn set_work_group(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
154 self.work_group = input;
155 self
156 }
157 /// <p>The name of the workgroup in which the named query is being created.</p>
158 pub fn get_work_group(&self) -> &::std::option::Option<::std::string::String> {
159 &self.work_group
160 }
161 /// Consumes the builder and constructs a [`CreateNamedQueryInput`](crate::operation::create_named_query::CreateNamedQueryInput).
162 pub fn build(
163 self,
164 ) -> ::std::result::Result<crate::operation::create_named_query::CreateNamedQueryInput, ::aws_smithy_types::error::operation::BuildError> {
165 ::std::result::Result::Ok(crate::operation::create_named_query::CreateNamedQueryInput {
166 name: self.name,
167 description: self.description,
168 database: self.database,
169 query_string: self.query_string,
170 client_request_token: self.client_request_token,
171 work_group: self.work_group,
172 })
173 }
174}