aws_sdk_sfn/operation/validate_state_machine_definition/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::validate_state_machine_definition::_validate_state_machine_definition_output::ValidateStateMachineDefinitionOutputBuilder;
3
4pub use crate::operation::validate_state_machine_definition::_validate_state_machine_definition_input::ValidateStateMachineDefinitionInputBuilder;
5
6impl crate::operation::validate_state_machine_definition::builders::ValidateStateMachineDefinitionInputBuilder {
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::validate_state_machine_definition::ValidateStateMachineDefinitionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::validate_state_machine_definition::ValidateStateMachineDefinitionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.validate_state_machine_definition();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ValidateStateMachineDefinition`.
24///
25/// <p>Validates the syntax of a state machine definition specified in <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html">Amazon States Language</a> (ASL), a JSON-based, structured language.</p>
26/// <p>You can validate that a state machine definition is correct without creating a state machine resource.</p>
27/// <p>Suggested uses for <code>ValidateStateMachineDefinition</code>:</p>
28/// <ul>
29/// <li>
30/// <p>Integrate automated checks into your code review or Continuous Integration (CI) process to check state machine definitions before starting deployments.</p></li>
31/// <li>
32/// <p>Run validation from a Git pre-commit hook to verify the definition before committing to your source repository.</p></li>
33/// </ul>
34/// <p>Validation will look for problems in your state machine definition and return a <b>result</b> and a list of <b>diagnostic elements</b>.</p>
35/// <p>The <b>result</b> value will be <code>OK</code> when your workflow definition can be successfully created or updated. Note the result can be <code>OK</code> even when diagnostic warnings are present in the response. The <b>result</b> value will be <code>FAIL</code> when the workflow definition contains errors that would prevent you from creating or updating your state machine.</p>
36/// <p>The list of <a href="https://docs.aws.amazon.com/step-functions/latest/apireference/API_ValidateStateMachineDefinitionDiagnostic.html">ValidateStateMachineDefinitionDiagnostic</a> data elements can contain zero or more <b>WARNING</b> and/or <b>ERROR</b> elements.</p><note>
37/// <p>The <b>ValidateStateMachineDefinition API</b> might add new diagnostics in the future, adjust diagnostic codes, or change the message wording. Your automated processes should only rely on the value of the <b>result</b> field value (OK, FAIL). Do <b>not</b> rely on the exact order, count, or wording of diagnostic messages.</p>
38/// </note>
39#[derive(::std::clone::Clone, ::std::fmt::Debug)]
40pub struct ValidateStateMachineDefinitionFluentBuilder {
41    handle: ::std::sync::Arc<crate::client::Handle>,
42    inner: crate::operation::validate_state_machine_definition::builders::ValidateStateMachineDefinitionInputBuilder,
43    config_override: ::std::option::Option<crate::config::Builder>,
44}
45impl
46    crate::client::customize::internal::CustomizableSend<
47        crate::operation::validate_state_machine_definition::ValidateStateMachineDefinitionOutput,
48        crate::operation::validate_state_machine_definition::ValidateStateMachineDefinitionError,
49    > for ValidateStateMachineDefinitionFluentBuilder
50{
51    fn send(
52        self,
53        config_override: crate::config::Builder,
54    ) -> crate::client::customize::internal::BoxFuture<
55        crate::client::customize::internal::SendResult<
56            crate::operation::validate_state_machine_definition::ValidateStateMachineDefinitionOutput,
57            crate::operation::validate_state_machine_definition::ValidateStateMachineDefinitionError,
58        >,
59    > {
60        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
61    }
62}
63impl ValidateStateMachineDefinitionFluentBuilder {
64    /// Creates a new `ValidateStateMachineDefinitionFluentBuilder`.
65    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
66        Self {
67            handle,
68            inner: ::std::default::Default::default(),
69            config_override: ::std::option::Option::None,
70        }
71    }
72    /// Access the ValidateStateMachineDefinition as a reference.
73    pub fn as_input(&self) -> &crate::operation::validate_state_machine_definition::builders::ValidateStateMachineDefinitionInputBuilder {
74        &self.inner
75    }
76    /// Sends the request and returns the response.
77    ///
78    /// If an error occurs, an `SdkError` will be returned with additional details that
79    /// can be matched against.
80    ///
81    /// By default, any retryable failures will be retried twice. Retry behavior
82    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
83    /// set when configuring the client.
84    pub async fn send(
85        self,
86    ) -> ::std::result::Result<
87        crate::operation::validate_state_machine_definition::ValidateStateMachineDefinitionOutput,
88        ::aws_smithy_runtime_api::client::result::SdkError<
89            crate::operation::validate_state_machine_definition::ValidateStateMachineDefinitionError,
90            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
91        >,
92    > {
93        let input = self
94            .inner
95            .build()
96            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
97        let runtime_plugins = crate::operation::validate_state_machine_definition::ValidateStateMachineDefinition::operation_runtime_plugins(
98            self.handle.runtime_plugins.clone(),
99            &self.handle.conf,
100            self.config_override,
101        );
102        crate::operation::validate_state_machine_definition::ValidateStateMachineDefinition::orchestrate(&runtime_plugins, input).await
103    }
104
105    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
106    pub fn customize(
107        self,
108    ) -> crate::client::customize::CustomizableOperation<
109        crate::operation::validate_state_machine_definition::ValidateStateMachineDefinitionOutput,
110        crate::operation::validate_state_machine_definition::ValidateStateMachineDefinitionError,
111        Self,
112    > {
113        crate::client::customize::CustomizableOperation::new(self)
114    }
115    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
116        self.set_config_override(::std::option::Option::Some(config_override.into()));
117        self
118    }
119
120    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
121        self.config_override = config_override;
122        self
123    }
124    /// <p>The Amazon States Language definition of the state machine. For more information, see <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html">Amazon States Language</a> (ASL).</p>
125    pub fn definition(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
126        self.inner = self.inner.definition(input.into());
127        self
128    }
129    /// <p>The Amazon States Language definition of the state machine. For more information, see <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html">Amazon States Language</a> (ASL).</p>
130    pub fn set_definition(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
131        self.inner = self.inner.set_definition(input);
132        self
133    }
134    /// <p>The Amazon States Language definition of the state machine. For more information, see <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html">Amazon States Language</a> (ASL).</p>
135    pub fn get_definition(&self) -> &::std::option::Option<::std::string::String> {
136        self.inner.get_definition()
137    }
138    /// <p>The target type of state machine for this definition. The default is <code>STANDARD</code>.</p>
139    pub fn r#type(mut self, input: crate::types::StateMachineType) -> Self {
140        self.inner = self.inner.r#type(input);
141        self
142    }
143    /// <p>The target type of state machine for this definition. The default is <code>STANDARD</code>.</p>
144    pub fn set_type(mut self, input: ::std::option::Option<crate::types::StateMachineType>) -> Self {
145        self.inner = self.inner.set_type(input);
146        self
147    }
148    /// <p>The target type of state machine for this definition. The default is <code>STANDARD</code>.</p>
149    pub fn get_type(&self) -> &::std::option::Option<crate::types::StateMachineType> {
150        self.inner.get_type()
151    }
152    /// <p>Minimum level of diagnostics to return. <code>ERROR</code> returns only <code>ERROR</code> diagnostics, whereas <code>WARNING</code> returns both <code>WARNING</code> and <code>ERROR</code> diagnostics. The default is <code>ERROR</code>.</p>
153    pub fn severity(mut self, input: crate::types::ValidateStateMachineDefinitionSeverity) -> Self {
154        self.inner = self.inner.severity(input);
155        self
156    }
157    /// <p>Minimum level of diagnostics to return. <code>ERROR</code> returns only <code>ERROR</code> diagnostics, whereas <code>WARNING</code> returns both <code>WARNING</code> and <code>ERROR</code> diagnostics. The default is <code>ERROR</code>.</p>
158    pub fn set_severity(mut self, input: ::std::option::Option<crate::types::ValidateStateMachineDefinitionSeverity>) -> Self {
159        self.inner = self.inner.set_severity(input);
160        self
161    }
162    /// <p>Minimum level of diagnostics to return. <code>ERROR</code> returns only <code>ERROR</code> diagnostics, whereas <code>WARNING</code> returns both <code>WARNING</code> and <code>ERROR</code> diagnostics. The default is <code>ERROR</code>.</p>
163    pub fn get_severity(&self) -> &::std::option::Option<crate::types::ValidateStateMachineDefinitionSeverity> {
164        self.inner.get_severity()
165    }
166    /// <p>The maximum number of diagnostics that are returned per call. The default and maximum value is 100. Setting the value to 0 will also use the default of 100.</p>
167    /// <p>If the number of diagnostics returned in the response exceeds <code>maxResults</code>, the value of the <code>truncated</code> field in the response will be set to <code>true</code>.</p>
168    pub fn max_results(mut self, input: i32) -> Self {
169        self.inner = self.inner.max_results(input);
170        self
171    }
172    /// <p>The maximum number of diagnostics that are returned per call. The default and maximum value is 100. Setting the value to 0 will also use the default of 100.</p>
173    /// <p>If the number of diagnostics returned in the response exceeds <code>maxResults</code>, the value of the <code>truncated</code> field in the response will be set to <code>true</code>.</p>
174    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
175        self.inner = self.inner.set_max_results(input);
176        self
177    }
178    /// <p>The maximum number of diagnostics that are returned per call. The default and maximum value is 100. Setting the value to 0 will also use the default of 100.</p>
179    /// <p>If the number of diagnostics returned in the response exceeds <code>maxResults</code>, the value of the <code>truncated</code> field in the response will be set to <code>true</code>.</p>
180    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
181        self.inner.get_max_results()
182    }
183}