aws_sdk_appsync/operation/put_graphql_api_environment_variables/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_graphql_api_environment_variables::_put_graphql_api_environment_variables_output::PutGraphqlApiEnvironmentVariablesOutputBuilder;
3
4pub use crate::operation::put_graphql_api_environment_variables::_put_graphql_api_environment_variables_input::PutGraphqlApiEnvironmentVariablesInputBuilder;
5
6impl crate::operation::put_graphql_api_environment_variables::builders::PutGraphqlApiEnvironmentVariablesInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::put_graphql_api_environment_variables::PutGraphqlApiEnvironmentVariablesOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_graphql_api_environment_variables::PutGraphqlApiEnvironmentVariablesError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_graphql_api_environment_variables();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutGraphqlApiEnvironmentVariables`.
24///
25/// <p>Creates a list of environmental variables in an API by its ID value.</p>
26/// <p>When creating an environmental variable, it must follow the constraints below:</p>
27/// <ul>
28/// <li>
29/// <p>Both JavaScript and VTL templates support environmental variables.</p></li>
30/// <li>
31/// <p>Environmental variables are not evaluated before function invocation.</p></li>
32/// <li>
33/// <p>Environmental variables only support string values.</p></li>
34/// <li>
35/// <p>Any defined value in an environmental variable is considered a string literal and not expanded.</p></li>
36/// <li>
37/// <p>Variable evaluations should ideally be performed in the function code.</p></li>
38/// </ul>
39/// <p>When creating an environmental variable key-value pair, it must follow the additional constraints below:</p>
40/// <ul>
41/// <li>
42/// <p>Keys must begin with a letter.</p></li>
43/// <li>
44/// <p>Keys must be at least two characters long.</p></li>
45/// <li>
46/// <p>Keys can only contain letters, numbers, and the underscore character (_).</p></li>
47/// <li>
48/// <p>Values can be up to 512 characters long.</p></li>
49/// <li>
50/// <p>You can configure up to 50 key-value pairs in a GraphQL API.</p></li>
51/// </ul>
52/// <p>You can create a list of environmental variables by adding it to the <code>environmentVariables</code> payload as a list in the format <code>{"key1":"value1","key2":"value2", …}</code>. Note that each call of the <code>PutGraphqlApiEnvironmentVariables</code> action will result in the overwriting of the existing environmental variable list of that API. This means the existing environmental variables will be lost. To avoid this, you must include all existing and new environmental variables in the list each time you call this action.</p>
53#[derive(::std::clone::Clone, ::std::fmt::Debug)]
54pub struct PutGraphqlApiEnvironmentVariablesFluentBuilder {
55    handle: ::std::sync::Arc<crate::client::Handle>,
56    inner: crate::operation::put_graphql_api_environment_variables::builders::PutGraphqlApiEnvironmentVariablesInputBuilder,
57    config_override: ::std::option::Option<crate::config::Builder>,
58}
59impl
60    crate::client::customize::internal::CustomizableSend<
61        crate::operation::put_graphql_api_environment_variables::PutGraphqlApiEnvironmentVariablesOutput,
62        crate::operation::put_graphql_api_environment_variables::PutGraphqlApiEnvironmentVariablesError,
63    > for PutGraphqlApiEnvironmentVariablesFluentBuilder
64{
65    fn send(
66        self,
67        config_override: crate::config::Builder,
68    ) -> crate::client::customize::internal::BoxFuture<
69        crate::client::customize::internal::SendResult<
70            crate::operation::put_graphql_api_environment_variables::PutGraphqlApiEnvironmentVariablesOutput,
71            crate::operation::put_graphql_api_environment_variables::PutGraphqlApiEnvironmentVariablesError,
72        >,
73    > {
74        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
75    }
76}
77impl PutGraphqlApiEnvironmentVariablesFluentBuilder {
78    /// Creates a new `PutGraphqlApiEnvironmentVariablesFluentBuilder`.
79    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
80        Self {
81            handle,
82            inner: ::std::default::Default::default(),
83            config_override: ::std::option::Option::None,
84        }
85    }
86    /// Access the PutGraphqlApiEnvironmentVariables as a reference.
87    pub fn as_input(&self) -> &crate::operation::put_graphql_api_environment_variables::builders::PutGraphqlApiEnvironmentVariablesInputBuilder {
88        &self.inner
89    }
90    /// Sends the request and returns the response.
91    ///
92    /// If an error occurs, an `SdkError` will be returned with additional details that
93    /// can be matched against.
94    ///
95    /// By default, any retryable failures will be retried twice. Retry behavior
96    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
97    /// set when configuring the client.
98    pub async fn send(
99        self,
100    ) -> ::std::result::Result<
101        crate::operation::put_graphql_api_environment_variables::PutGraphqlApiEnvironmentVariablesOutput,
102        ::aws_smithy_runtime_api::client::result::SdkError<
103            crate::operation::put_graphql_api_environment_variables::PutGraphqlApiEnvironmentVariablesError,
104            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
105        >,
106    > {
107        let input = self
108            .inner
109            .build()
110            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
111        let runtime_plugins = crate::operation::put_graphql_api_environment_variables::PutGraphqlApiEnvironmentVariables::operation_runtime_plugins(
112            self.handle.runtime_plugins.clone(),
113            &self.handle.conf,
114            self.config_override,
115        );
116        crate::operation::put_graphql_api_environment_variables::PutGraphqlApiEnvironmentVariables::orchestrate(&runtime_plugins, input).await
117    }
118
119    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
120    pub fn customize(
121        self,
122    ) -> crate::client::customize::CustomizableOperation<
123        crate::operation::put_graphql_api_environment_variables::PutGraphqlApiEnvironmentVariablesOutput,
124        crate::operation::put_graphql_api_environment_variables::PutGraphqlApiEnvironmentVariablesError,
125        Self,
126    > {
127        crate::client::customize::CustomizableOperation::new(self)
128    }
129    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
130        self.set_config_override(::std::option::Option::Some(config_override.into()));
131        self
132    }
133
134    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
135        self.config_override = config_override;
136        self
137    }
138    /// <p>The ID of the API to which the environmental variable list will be written.</p>
139    pub fn api_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
140        self.inner = self.inner.api_id(input.into());
141        self
142    }
143    /// <p>The ID of the API to which the environmental variable list will be written.</p>
144    pub fn set_api_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
145        self.inner = self.inner.set_api_id(input);
146        self
147    }
148    /// <p>The ID of the API to which the environmental variable list will be written.</p>
149    pub fn get_api_id(&self) -> &::std::option::Option<::std::string::String> {
150        self.inner.get_api_id()
151    }
152    ///
153    /// Adds a key-value pair to `environmentVariables`.
154    ///
155    /// To override the contents of this collection use [`set_environment_variables`](Self::set_environment_variables).
156    ///
157    /// <p>The list of environmental variables to add to the API.</p>
158    /// <p>When creating an environmental variable key-value pair, it must follow the additional constraints below:</p>
159    /// <ul>
160    /// <li>
161    /// <p>Keys must begin with a letter.</p></li>
162    /// <li>
163    /// <p>Keys must be at least two characters long.</p></li>
164    /// <li>
165    /// <p>Keys can only contain letters, numbers, and the underscore character (_).</p></li>
166    /// <li>
167    /// <p>Values can be up to 512 characters long.</p></li>
168    /// <li>
169    /// <p>You can configure up to 50 key-value pairs in a GraphQL API.</p></li>
170    /// </ul>
171    /// <p>You can create a list of environmental variables by adding it to the <code>environmentVariables</code> payload as a list in the format <code>{"key1":"value1","key2":"value2", …}</code>. Note that each call of the <code>PutGraphqlApiEnvironmentVariables</code> action will result in the overwriting of the existing environmental variable list of that API. This means the existing environmental variables will be lost. To avoid this, you must include all existing and new environmental variables in the list each time you call this action.</p>
172    pub fn environment_variables(
173        mut self,
174        k: impl ::std::convert::Into<::std::string::String>,
175        v: impl ::std::convert::Into<::std::string::String>,
176    ) -> Self {
177        self.inner = self.inner.environment_variables(k.into(), v.into());
178        self
179    }
180    /// <p>The list of environmental variables to add to the API.</p>
181    /// <p>When creating an environmental variable key-value pair, it must follow the additional constraints below:</p>
182    /// <ul>
183    /// <li>
184    /// <p>Keys must begin with a letter.</p></li>
185    /// <li>
186    /// <p>Keys must be at least two characters long.</p></li>
187    /// <li>
188    /// <p>Keys can only contain letters, numbers, and the underscore character (_).</p></li>
189    /// <li>
190    /// <p>Values can be up to 512 characters long.</p></li>
191    /// <li>
192    /// <p>You can configure up to 50 key-value pairs in a GraphQL API.</p></li>
193    /// </ul>
194    /// <p>You can create a list of environmental variables by adding it to the <code>environmentVariables</code> payload as a list in the format <code>{"key1":"value1","key2":"value2", …}</code>. Note that each call of the <code>PutGraphqlApiEnvironmentVariables</code> action will result in the overwriting of the existing environmental variable list of that API. This means the existing environmental variables will be lost. To avoid this, you must include all existing and new environmental variables in the list each time you call this action.</p>
195    pub fn set_environment_variables(
196        mut self,
197        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
198    ) -> Self {
199        self.inner = self.inner.set_environment_variables(input);
200        self
201    }
202    /// <p>The list of environmental variables to add to the API.</p>
203    /// <p>When creating an environmental variable key-value pair, it must follow the additional constraints below:</p>
204    /// <ul>
205    /// <li>
206    /// <p>Keys must begin with a letter.</p></li>
207    /// <li>
208    /// <p>Keys must be at least two characters long.</p></li>
209    /// <li>
210    /// <p>Keys can only contain letters, numbers, and the underscore character (_).</p></li>
211    /// <li>
212    /// <p>Values can be up to 512 characters long.</p></li>
213    /// <li>
214    /// <p>You can configure up to 50 key-value pairs in a GraphQL API.</p></li>
215    /// </ul>
216    /// <p>You can create a list of environmental variables by adding it to the <code>environmentVariables</code> payload as a list in the format <code>{"key1":"value1","key2":"value2", …}</code>. Note that each call of the <code>PutGraphqlApiEnvironmentVariables</code> action will result in the overwriting of the existing environmental variable list of that API. This means the existing environmental variables will be lost. To avoid this, you must include all existing and new environmental variables in the list each time you call this action.</p>
217    pub fn get_environment_variables(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
218        self.inner.get_environment_variables()
219    }
220}