aws_sdk_codegurureviewer/operation/create_code_review/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_code_review::_create_code_review_output::CreateCodeReviewOutputBuilder;
3
4pub use crate::operation::create_code_review::_create_code_review_input::CreateCodeReviewInputBuilder;
5
6impl crate::operation::create_code_review::builders::CreateCodeReviewInputBuilder {
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::create_code_review::CreateCodeReviewOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_code_review::CreateCodeReviewError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_code_review();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateCodeReview`.
24///
25/// <p>Use to create a code review with a <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReviewType.html">CodeReviewType</a> of <code>RepositoryAnalysis</code>. This type of code review analyzes all code under a specified branch in an associated repository. <code>PullRequest</code> code reviews are automatically triggered by a pull request.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreateCodeReviewFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::create_code_review::builders::CreateCodeReviewInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::create_code_review::CreateCodeReviewOutput,
35        crate::operation::create_code_review::CreateCodeReviewError,
36    > for CreateCodeReviewFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::create_code_review::CreateCodeReviewOutput,
44            crate::operation::create_code_review::CreateCodeReviewError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl CreateCodeReviewFluentBuilder {
51    /// Creates a new `CreateCodeReviewFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the CreateCodeReview as a reference.
60    pub fn as_input(&self) -> &crate::operation::create_code_review::builders::CreateCodeReviewInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::create_code_review::CreateCodeReviewOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::create_code_review::CreateCodeReviewError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::create_code_review::CreateCodeReview::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::create_code_review::CreateCodeReview::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::create_code_review::CreateCodeReviewOutput,
97        crate::operation::create_code_review::CreateCodeReviewError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>The name of the code review. The name of each code review in your Amazon Web Services account must be unique.</p>
112    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.name(input.into());
114        self
115    }
116    /// <p>The name of the code review. The name of each code review in your Amazon Web Services account must be unique.</p>
117    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_name(input);
119        self
120    }
121    /// <p>The name of the code review. The name of each code review in your Amazon Web Services account must be unique.</p>
122    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_name()
124    }
125    /// <p>The Amazon Resource Name (ARN) of the <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html">RepositoryAssociation</a> object. You can retrieve this ARN by calling <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html">ListRepositoryAssociations</a>.</p>
126    /// <p>A code review can only be created on an associated repository. This is the ARN of the associated repository.</p>
127    pub fn repository_association_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.repository_association_arn(input.into());
129        self
130    }
131    /// <p>The Amazon Resource Name (ARN) of the <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html">RepositoryAssociation</a> object. You can retrieve this ARN by calling <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html">ListRepositoryAssociations</a>.</p>
132    /// <p>A code review can only be created on an associated repository. This is the ARN of the associated repository.</p>
133    pub fn set_repository_association_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
134        self.inner = self.inner.set_repository_association_arn(input);
135        self
136    }
137    /// <p>The Amazon Resource Name (ARN) of the <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html">RepositoryAssociation</a> object. You can retrieve this ARN by calling <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_ListRepositoryAssociations.html">ListRepositoryAssociations</a>.</p>
138    /// <p>A code review can only be created on an associated repository. This is the ARN of the associated repository.</p>
139    pub fn get_repository_association_arn(&self) -> &::std::option::Option<::std::string::String> {
140        self.inner.get_repository_association_arn()
141    }
142    /// <p>The type of code review to create. This is specified using a <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReviewType.html">CodeReviewType</a> object. You can create a code review only of type <code>RepositoryAnalysis</code>.</p>
143    pub fn r#type(mut self, input: crate::types::CodeReviewType) -> Self {
144        self.inner = self.inner.r#type(input);
145        self
146    }
147    /// <p>The type of code review to create. This is specified using a <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReviewType.html">CodeReviewType</a> object. You can create a code review only of type <code>RepositoryAnalysis</code>.</p>
148    pub fn set_type(mut self, input: ::std::option::Option<crate::types::CodeReviewType>) -> Self {
149        self.inner = self.inner.set_type(input);
150        self
151    }
152    /// <p>The type of code review to create. This is specified using a <a href="https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_CodeReviewType.html">CodeReviewType</a> object. You can create a code review only of type <code>RepositoryAnalysis</code>.</p>
153    pub fn get_type(&self) -> &::std::option::Option<crate::types::CodeReviewType> {
154        self.inner.get_type()
155    }
156    /// <p>Amazon CodeGuru Reviewer uses this value to prevent the accidental creation of duplicate code reviews if there are failures and retries.</p>
157    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158        self.inner = self.inner.client_request_token(input.into());
159        self
160    }
161    /// <p>Amazon CodeGuru Reviewer uses this value to prevent the accidental creation of duplicate code reviews if there are failures and retries.</p>
162    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
163        self.inner = self.inner.set_client_request_token(input);
164        self
165    }
166    /// <p>Amazon CodeGuru Reviewer uses this value to prevent the accidental creation of duplicate code reviews if there are failures and retries.</p>
167    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
168        self.inner.get_client_request_token()
169    }
170}