aws_sdk_codecommit/operation/create_pull_request_approval_rule/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_pull_request_approval_rule::_create_pull_request_approval_rule_output::CreatePullRequestApprovalRuleOutputBuilder;
3
4pub use crate::operation::create_pull_request_approval_rule::_create_pull_request_approval_rule_input::CreatePullRequestApprovalRuleInputBuilder;
5
6impl crate::operation::create_pull_request_approval_rule::builders::CreatePullRequestApprovalRuleInputBuilder {
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_pull_request_approval_rule::CreatePullRequestApprovalRuleOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_pull_request_approval_rule::CreatePullRequestApprovalRuleError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_pull_request_approval_rule();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreatePullRequestApprovalRule`.
24///
25/// <p>Creates an approval rule for a pull request.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct CreatePullRequestApprovalRuleFluentBuilder {
28 handle: ::std::sync::Arc<crate::client::Handle>,
29 inner: crate::operation::create_pull_request_approval_rule::builders::CreatePullRequestApprovalRuleInputBuilder,
30 config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33 crate::client::customize::internal::CustomizableSend<
34 crate::operation::create_pull_request_approval_rule::CreatePullRequestApprovalRuleOutput,
35 crate::operation::create_pull_request_approval_rule::CreatePullRequestApprovalRuleError,
36 > for CreatePullRequestApprovalRuleFluentBuilder
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_pull_request_approval_rule::CreatePullRequestApprovalRuleOutput,
44 crate::operation::create_pull_request_approval_rule::CreatePullRequestApprovalRuleError,
45 >,
46 > {
47 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48 }
49}
50impl CreatePullRequestApprovalRuleFluentBuilder {
51 /// Creates a new `CreatePullRequestApprovalRuleFluentBuilder`.
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 CreatePullRequestApprovalRule as a reference.
60 pub fn as_input(&self) -> &crate::operation::create_pull_request_approval_rule::builders::CreatePullRequestApprovalRuleInputBuilder {
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_pull_request_approval_rule::CreatePullRequestApprovalRuleOutput,
75 ::aws_smithy_runtime_api::client::result::SdkError<
76 crate::operation::create_pull_request_approval_rule::CreatePullRequestApprovalRuleError,
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_pull_request_approval_rule::CreatePullRequestApprovalRule::operation_runtime_plugins(
85 self.handle.runtime_plugins.clone(),
86 &self.handle.conf,
87 self.config_override,
88 );
89 crate::operation::create_pull_request_approval_rule::CreatePullRequestApprovalRule::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_pull_request_approval_rule::CreatePullRequestApprovalRuleOutput,
97 crate::operation::create_pull_request_approval_rule::CreatePullRequestApprovalRuleError,
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 system-generated ID of the pull request for which you want to create the approval rule.</p>
112 pub fn pull_request_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113 self.inner = self.inner.pull_request_id(input.into());
114 self
115 }
116 /// <p>The system-generated ID of the pull request for which you want to create the approval rule.</p>
117 pub fn set_pull_request_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118 self.inner = self.inner.set_pull_request_id(input);
119 self
120 }
121 /// <p>The system-generated ID of the pull request for which you want to create the approval rule.</p>
122 pub fn get_pull_request_id(&self) -> &::std::option::Option<::std::string::String> {
123 self.inner.get_pull_request_id()
124 }
125 /// <p>The name for the approval rule.</p>
126 pub fn approval_rule_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127 self.inner = self.inner.approval_rule_name(input.into());
128 self
129 }
130 /// <p>The name for the approval rule.</p>
131 pub fn set_approval_rule_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132 self.inner = self.inner.set_approval_rule_name(input);
133 self
134 }
135 /// <p>The name for the approval rule.</p>
136 pub fn get_approval_rule_name(&self) -> &::std::option::Option<::std::string::String> {
137 self.inner.get_approval_rule_name()
138 }
139 /// <p>The content of the approval rule, including the number of approvals needed and the structure of an approval pool defined for approvals, if any. For more information about approval pools, see the CodeCommit User Guide.</p><note>
140 /// <p>When you create the content of the approval rule, you can specify approvers in an approval pool in one of two ways:</p>
141 /// <ul>
142 /// <li>
143 /// <p><b>CodeCommitApprovers</b>: This option only requires an Amazon Web Services account and a resource. It can be used for both IAM users and federated access users whose name matches the provided resource name. This is a very powerful option that offers a great deal of flexibility. For example, if you specify the Amazon Web Services account <i>123456789012</i> and <i>Mary_Major</i>, all of the following would be counted as approvals coming from that user:</p>
144 /// <ul>
145 /// <li>
146 /// <p>An IAM user in the account (arn:aws:iam::<i>123456789012</i>:user/<i>Mary_Major</i>)</p></li>
147 /// <li>
148 /// <p>A federated user identified in IAM as Mary_Major (arn:aws:sts::<i>123456789012</i>:federated-user/<i>Mary_Major</i>)</p></li>
149 /// </ul>
150 /// <p>This option does not recognize an active session of someone assuming the role of CodeCommitReview with a role session name of <i>Mary_Major</i> (arn:aws:sts::<i>123456789012</i>:assumed-role/CodeCommitReview/<i>Mary_Major</i>) unless you include a wildcard (*Mary_Major).</p></li>
151 /// <li>
152 /// <p><b>Fully qualified ARN</b>: This option allows you to specify the fully qualified Amazon Resource Name (ARN) of the IAM user or role.</p></li>
153 /// </ul>
154 /// <p>For more information about IAM ARNs, wildcards, and formats, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html">IAM Identifiers</a> in the <i>IAM User Guide</i>.</p>
155 /// </note>
156 pub fn approval_rule_content(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
157 self.inner = self.inner.approval_rule_content(input.into());
158 self
159 }
160 /// <p>The content of the approval rule, including the number of approvals needed and the structure of an approval pool defined for approvals, if any. For more information about approval pools, see the CodeCommit User Guide.</p><note>
161 /// <p>When you create the content of the approval rule, you can specify approvers in an approval pool in one of two ways:</p>
162 /// <ul>
163 /// <li>
164 /// <p><b>CodeCommitApprovers</b>: This option only requires an Amazon Web Services account and a resource. It can be used for both IAM users and federated access users whose name matches the provided resource name. This is a very powerful option that offers a great deal of flexibility. For example, if you specify the Amazon Web Services account <i>123456789012</i> and <i>Mary_Major</i>, all of the following would be counted as approvals coming from that user:</p>
165 /// <ul>
166 /// <li>
167 /// <p>An IAM user in the account (arn:aws:iam::<i>123456789012</i>:user/<i>Mary_Major</i>)</p></li>
168 /// <li>
169 /// <p>A federated user identified in IAM as Mary_Major (arn:aws:sts::<i>123456789012</i>:federated-user/<i>Mary_Major</i>)</p></li>
170 /// </ul>
171 /// <p>This option does not recognize an active session of someone assuming the role of CodeCommitReview with a role session name of <i>Mary_Major</i> (arn:aws:sts::<i>123456789012</i>:assumed-role/CodeCommitReview/<i>Mary_Major</i>) unless you include a wildcard (*Mary_Major).</p></li>
172 /// <li>
173 /// <p><b>Fully qualified ARN</b>: This option allows you to specify the fully qualified Amazon Resource Name (ARN) of the IAM user or role.</p></li>
174 /// </ul>
175 /// <p>For more information about IAM ARNs, wildcards, and formats, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html">IAM Identifiers</a> in the <i>IAM User Guide</i>.</p>
176 /// </note>
177 pub fn set_approval_rule_content(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
178 self.inner = self.inner.set_approval_rule_content(input);
179 self
180 }
181 /// <p>The content of the approval rule, including the number of approvals needed and the structure of an approval pool defined for approvals, if any. For more information about approval pools, see the CodeCommit User Guide.</p><note>
182 /// <p>When you create the content of the approval rule, you can specify approvers in an approval pool in one of two ways:</p>
183 /// <ul>
184 /// <li>
185 /// <p><b>CodeCommitApprovers</b>: This option only requires an Amazon Web Services account and a resource. It can be used for both IAM users and federated access users whose name matches the provided resource name. This is a very powerful option that offers a great deal of flexibility. For example, if you specify the Amazon Web Services account <i>123456789012</i> and <i>Mary_Major</i>, all of the following would be counted as approvals coming from that user:</p>
186 /// <ul>
187 /// <li>
188 /// <p>An IAM user in the account (arn:aws:iam::<i>123456789012</i>:user/<i>Mary_Major</i>)</p></li>
189 /// <li>
190 /// <p>A federated user identified in IAM as Mary_Major (arn:aws:sts::<i>123456789012</i>:federated-user/<i>Mary_Major</i>)</p></li>
191 /// </ul>
192 /// <p>This option does not recognize an active session of someone assuming the role of CodeCommitReview with a role session name of <i>Mary_Major</i> (arn:aws:sts::<i>123456789012</i>:assumed-role/CodeCommitReview/<i>Mary_Major</i>) unless you include a wildcard (*Mary_Major).</p></li>
193 /// <li>
194 /// <p><b>Fully qualified ARN</b>: This option allows you to specify the fully qualified Amazon Resource Name (ARN) of the IAM user or role.</p></li>
195 /// </ul>
196 /// <p>For more information about IAM ARNs, wildcards, and formats, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html">IAM Identifiers</a> in the <i>IAM User Guide</i>.</p>
197 /// </note>
198 pub fn get_approval_rule_content(&self) -> &::std::option::Option<::std::string::String> {
199 self.inner.get_approval_rule_content()
200 }
201}