aws_sdk_neptunegraph/operation/execute_query/
_execute_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 ExecuteQueryInput {
6    /// <p>The unique identifier of the Neptune Analytics graph.</p>
7    pub graph_identifier: ::std::option::Option<::std::string::String>,
8    /// <p>The query string to be executed.</p>
9    pub query_string: ::std::option::Option<::std::string::String>,
10    /// <p>The query language the query is written in. Currently only openCypher is supported.</p>
11    pub language: ::std::option::Option<crate::types::QueryLanguage>,
12    /// <p>The data parameters the query can use in JSON format. For example: {"name": "john", "age": 20}. (optional)</p>
13    pub parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::aws_smithy_types::Document>>,
14    /// <p>Query plan cache is a feature that saves the query plan and reuses it on successive executions of the same query. This reduces query latency, and works for both <code>READ</code> and <code>UPDATE</code> queries. The plan cache is an LRU cache with a 5 minute TTL and a capacity of 1000.</p>
15    pub plan_cache: ::std::option::Option<crate::types::PlanCacheType>,
16    /// <p>The explain mode parameter returns a query explain instead of the actual query results. A query explain can be used to gather insights about the query execution such as planning decisions, time spent on each operator, solutions flowing etc.</p>
17    pub explain_mode: ::std::option::Option<crate::types::ExplainMode>,
18    /// <p>Specifies the query timeout duration, in milliseconds. (optional)</p>
19    pub query_timeout_milliseconds: ::std::option::Option<i32>,
20}
21impl ExecuteQueryInput {
22    /// <p>The unique identifier of the Neptune Analytics graph.</p>
23    pub fn graph_identifier(&self) -> ::std::option::Option<&str> {
24        self.graph_identifier.as_deref()
25    }
26    /// <p>The query string to be executed.</p>
27    pub fn query_string(&self) -> ::std::option::Option<&str> {
28        self.query_string.as_deref()
29    }
30    /// <p>The query language the query is written in. Currently only openCypher is supported.</p>
31    pub fn language(&self) -> ::std::option::Option<&crate::types::QueryLanguage> {
32        self.language.as_ref()
33    }
34    /// <p>The data parameters the query can use in JSON format. For example: {"name": "john", "age": 20}. (optional)</p>
35    pub fn parameters(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::aws_smithy_types::Document>> {
36        self.parameters.as_ref()
37    }
38    /// <p>Query plan cache is a feature that saves the query plan and reuses it on successive executions of the same query. This reduces query latency, and works for both <code>READ</code> and <code>UPDATE</code> queries. The plan cache is an LRU cache with a 5 minute TTL and a capacity of 1000.</p>
39    pub fn plan_cache(&self) -> ::std::option::Option<&crate::types::PlanCacheType> {
40        self.plan_cache.as_ref()
41    }
42    /// <p>The explain mode parameter returns a query explain instead of the actual query results. A query explain can be used to gather insights about the query execution such as planning decisions, time spent on each operator, solutions flowing etc.</p>
43    pub fn explain_mode(&self) -> ::std::option::Option<&crate::types::ExplainMode> {
44        self.explain_mode.as_ref()
45    }
46    /// <p>Specifies the query timeout duration, in milliseconds. (optional)</p>
47    pub fn query_timeout_milliseconds(&self) -> ::std::option::Option<i32> {
48        self.query_timeout_milliseconds
49    }
50}
51impl ExecuteQueryInput {
52    /// Creates a new builder-style object to manufacture [`ExecuteQueryInput`](crate::operation::execute_query::ExecuteQueryInput).
53    pub fn builder() -> crate::operation::execute_query::builders::ExecuteQueryInputBuilder {
54        crate::operation::execute_query::builders::ExecuteQueryInputBuilder::default()
55    }
56}
57
58/// A builder for [`ExecuteQueryInput`](crate::operation::execute_query::ExecuteQueryInput).
59#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
60#[non_exhaustive]
61pub struct ExecuteQueryInputBuilder {
62    pub(crate) graph_identifier: ::std::option::Option<::std::string::String>,
63    pub(crate) query_string: ::std::option::Option<::std::string::String>,
64    pub(crate) language: ::std::option::Option<crate::types::QueryLanguage>,
65    pub(crate) parameters: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::aws_smithy_types::Document>>,
66    pub(crate) plan_cache: ::std::option::Option<crate::types::PlanCacheType>,
67    pub(crate) explain_mode: ::std::option::Option<crate::types::ExplainMode>,
68    pub(crate) query_timeout_milliseconds: ::std::option::Option<i32>,
69}
70impl ExecuteQueryInputBuilder {
71    /// <p>The unique identifier of the Neptune Analytics graph.</p>
72    /// This field is required.
73    pub fn graph_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
74        self.graph_identifier = ::std::option::Option::Some(input.into());
75        self
76    }
77    /// <p>The unique identifier of the Neptune Analytics graph.</p>
78    pub fn set_graph_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
79        self.graph_identifier = input;
80        self
81    }
82    /// <p>The unique identifier of the Neptune Analytics graph.</p>
83    pub fn get_graph_identifier(&self) -> &::std::option::Option<::std::string::String> {
84        &self.graph_identifier
85    }
86    /// <p>The query string to be executed.</p>
87    /// This field is required.
88    pub fn query_string(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
89        self.query_string = ::std::option::Option::Some(input.into());
90        self
91    }
92    /// <p>The query string to be executed.</p>
93    pub fn set_query_string(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
94        self.query_string = input;
95        self
96    }
97    /// <p>The query string to be executed.</p>
98    pub fn get_query_string(&self) -> &::std::option::Option<::std::string::String> {
99        &self.query_string
100    }
101    /// <p>The query language the query is written in. Currently only openCypher is supported.</p>
102    /// This field is required.
103    pub fn language(mut self, input: crate::types::QueryLanguage) -> Self {
104        self.language = ::std::option::Option::Some(input);
105        self
106    }
107    /// <p>The query language the query is written in. Currently only openCypher is supported.</p>
108    pub fn set_language(mut self, input: ::std::option::Option<crate::types::QueryLanguage>) -> Self {
109        self.language = input;
110        self
111    }
112    /// <p>The query language the query is written in. Currently only openCypher is supported.</p>
113    pub fn get_language(&self) -> &::std::option::Option<crate::types::QueryLanguage> {
114        &self.language
115    }
116    /// Adds a key-value pair to `parameters`.
117    ///
118    /// To override the contents of this collection use [`set_parameters`](Self::set_parameters).
119    ///
120    /// <p>The data parameters the query can use in JSON format. For example: {"name": "john", "age": 20}. (optional)</p>
121    pub fn parameters(mut self, k: impl ::std::convert::Into<::std::string::String>, v: ::aws_smithy_types::Document) -> Self {
122        let mut hash_map = self.parameters.unwrap_or_default();
123        hash_map.insert(k.into(), v);
124        self.parameters = ::std::option::Option::Some(hash_map);
125        self
126    }
127    /// <p>The data parameters the query can use in JSON format. For example: {"name": "john", "age": 20}. (optional)</p>
128    pub fn set_parameters(
129        mut self,
130        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::aws_smithy_types::Document>>,
131    ) -> Self {
132        self.parameters = input;
133        self
134    }
135    /// <p>The data parameters the query can use in JSON format. For example: {"name": "john", "age": 20}. (optional)</p>
136    pub fn get_parameters(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::aws_smithy_types::Document>> {
137        &self.parameters
138    }
139    /// <p>Query plan cache is a feature that saves the query plan and reuses it on successive executions of the same query. This reduces query latency, and works for both <code>READ</code> and <code>UPDATE</code> queries. The plan cache is an LRU cache with a 5 minute TTL and a capacity of 1000.</p>
140    pub fn plan_cache(mut self, input: crate::types::PlanCacheType) -> Self {
141        self.plan_cache = ::std::option::Option::Some(input);
142        self
143    }
144    /// <p>Query plan cache is a feature that saves the query plan and reuses it on successive executions of the same query. This reduces query latency, and works for both <code>READ</code> and <code>UPDATE</code> queries. The plan cache is an LRU cache with a 5 minute TTL and a capacity of 1000.</p>
145    pub fn set_plan_cache(mut self, input: ::std::option::Option<crate::types::PlanCacheType>) -> Self {
146        self.plan_cache = input;
147        self
148    }
149    /// <p>Query plan cache is a feature that saves the query plan and reuses it on successive executions of the same query. This reduces query latency, and works for both <code>READ</code> and <code>UPDATE</code> queries. The plan cache is an LRU cache with a 5 minute TTL and a capacity of 1000.</p>
150    pub fn get_plan_cache(&self) -> &::std::option::Option<crate::types::PlanCacheType> {
151        &self.plan_cache
152    }
153    /// <p>The explain mode parameter returns a query explain instead of the actual query results. A query explain can be used to gather insights about the query execution such as planning decisions, time spent on each operator, solutions flowing etc.</p>
154    pub fn explain_mode(mut self, input: crate::types::ExplainMode) -> Self {
155        self.explain_mode = ::std::option::Option::Some(input);
156        self
157    }
158    /// <p>The explain mode parameter returns a query explain instead of the actual query results. A query explain can be used to gather insights about the query execution such as planning decisions, time spent on each operator, solutions flowing etc.</p>
159    pub fn set_explain_mode(mut self, input: ::std::option::Option<crate::types::ExplainMode>) -> Self {
160        self.explain_mode = input;
161        self
162    }
163    /// <p>The explain mode parameter returns a query explain instead of the actual query results. A query explain can be used to gather insights about the query execution such as planning decisions, time spent on each operator, solutions flowing etc.</p>
164    pub fn get_explain_mode(&self) -> &::std::option::Option<crate::types::ExplainMode> {
165        &self.explain_mode
166    }
167    /// <p>Specifies the query timeout duration, in milliseconds. (optional)</p>
168    pub fn query_timeout_milliseconds(mut self, input: i32) -> Self {
169        self.query_timeout_milliseconds = ::std::option::Option::Some(input);
170        self
171    }
172    /// <p>Specifies the query timeout duration, in milliseconds. (optional)</p>
173    pub fn set_query_timeout_milliseconds(mut self, input: ::std::option::Option<i32>) -> Self {
174        self.query_timeout_milliseconds = input;
175        self
176    }
177    /// <p>Specifies the query timeout duration, in milliseconds. (optional)</p>
178    pub fn get_query_timeout_milliseconds(&self) -> &::std::option::Option<i32> {
179        &self.query_timeout_milliseconds
180    }
181    /// Consumes the builder and constructs a [`ExecuteQueryInput`](crate::operation::execute_query::ExecuteQueryInput).
182    pub fn build(
183        self,
184    ) -> ::std::result::Result<crate::operation::execute_query::ExecuteQueryInput, ::aws_smithy_types::error::operation::BuildError> {
185        ::std::result::Result::Ok(crate::operation::execute_query::ExecuteQueryInput {
186            graph_identifier: self.graph_identifier,
187            query_string: self.query_string,
188            language: self.language,
189            parameters: self.parameters,
190            plan_cache: self.plan_cache,
191            explain_mode: self.explain_mode,
192            query_timeout_milliseconds: self.query_timeout_milliseconds,
193        })
194    }
195}