aws_sdk_codebuild/operation/create_webhook/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_webhook::_create_webhook_output::CreateWebhookOutputBuilder;
3
4pub use crate::operation::create_webhook::_create_webhook_input::CreateWebhookInputBuilder;
5
6impl crate::operation::create_webhook::builders::CreateWebhookInputBuilder {
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_webhook::CreateWebhookOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_webhook::CreateWebhookError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_webhook();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateWebhook`.
24///
25/// <p>For an existing CodeBuild build project that has its source code stored in a GitHub or Bitbucket repository, enables CodeBuild to start rebuilding the source code every time a code change is pushed to the repository.</p><important>
26/// <p>If you enable webhooks for an CodeBuild project, and the project is used as a build step in CodePipeline, then two identical builds are created for each commit. One build is triggered through webhooks, and one through CodePipeline. Because billing is on a per-build basis, you are billed for both builds. Therefore, if you are using CodePipeline, we recommend that you disable webhooks in CodeBuild. In the CodeBuild console, clear the Webhook box. For more information, see step 5 in <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/change-project.html#change-project-console">Change a Build Project's Settings</a>.</p>
27/// </important>
28#[derive(::std::clone::Clone, ::std::fmt::Debug)]
29pub struct CreateWebhookFluentBuilder {
30    handle: ::std::sync::Arc<crate::client::Handle>,
31    inner: crate::operation::create_webhook::builders::CreateWebhookInputBuilder,
32    config_override: ::std::option::Option<crate::config::Builder>,
33}
34impl
35    crate::client::customize::internal::CustomizableSend<
36        crate::operation::create_webhook::CreateWebhookOutput,
37        crate::operation::create_webhook::CreateWebhookError,
38    > for CreateWebhookFluentBuilder
39{
40    fn send(
41        self,
42        config_override: crate::config::Builder,
43    ) -> crate::client::customize::internal::BoxFuture<
44        crate::client::customize::internal::SendResult<
45            crate::operation::create_webhook::CreateWebhookOutput,
46            crate::operation::create_webhook::CreateWebhookError,
47        >,
48    > {
49        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
50    }
51}
52impl CreateWebhookFluentBuilder {
53    /// Creates a new `CreateWebhookFluentBuilder`.
54    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
55        Self {
56            handle,
57            inner: ::std::default::Default::default(),
58            config_override: ::std::option::Option::None,
59        }
60    }
61    /// Access the CreateWebhook as a reference.
62    pub fn as_input(&self) -> &crate::operation::create_webhook::builders::CreateWebhookInputBuilder {
63        &self.inner
64    }
65    /// Sends the request and returns the response.
66    ///
67    /// If an error occurs, an `SdkError` will be returned with additional details that
68    /// can be matched against.
69    ///
70    /// By default, any retryable failures will be retried twice. Retry behavior
71    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
72    /// set when configuring the client.
73    pub async fn send(
74        self,
75    ) -> ::std::result::Result<
76        crate::operation::create_webhook::CreateWebhookOutput,
77        ::aws_smithy_runtime_api::client::result::SdkError<
78            crate::operation::create_webhook::CreateWebhookError,
79            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
80        >,
81    > {
82        let input = self
83            .inner
84            .build()
85            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
86        let runtime_plugins = crate::operation::create_webhook::CreateWebhook::operation_runtime_plugins(
87            self.handle.runtime_plugins.clone(),
88            &self.handle.conf,
89            self.config_override,
90        );
91        crate::operation::create_webhook::CreateWebhook::orchestrate(&runtime_plugins, input).await
92    }
93
94    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
95    pub fn customize(
96        self,
97    ) -> crate::client::customize::CustomizableOperation<
98        crate::operation::create_webhook::CreateWebhookOutput,
99        crate::operation::create_webhook::CreateWebhookError,
100        Self,
101    > {
102        crate::client::customize::CustomizableOperation::new(self)
103    }
104    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
105        self.set_config_override(::std::option::Option::Some(config_override.into()));
106        self
107    }
108
109    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
110        self.config_override = config_override;
111        self
112    }
113    /// <p>The name of the CodeBuild project.</p>
114    pub fn project_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.inner = self.inner.project_name(input.into());
116        self
117    }
118    /// <p>The name of the CodeBuild project.</p>
119    pub fn set_project_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.inner = self.inner.set_project_name(input);
121        self
122    }
123    /// <p>The name of the CodeBuild project.</p>
124    pub fn get_project_name(&self) -> &::std::option::Option<::std::string::String> {
125        self.inner.get_project_name()
126    }
127    /// <p>A regular expression used to determine which repository branches are built when a webhook is triggered. If the name of a branch matches the regular expression, then it is built. If <code>branchFilter</code> is empty, then all branches are built.</p><note>
128    /// <p>It is recommended that you use <code>filterGroups</code> instead of <code>branchFilter</code>.</p>
129    /// </note>
130    pub fn branch_filter(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.branch_filter(input.into());
132        self
133    }
134    /// <p>A regular expression used to determine which repository branches are built when a webhook is triggered. If the name of a branch matches the regular expression, then it is built. If <code>branchFilter</code> is empty, then all branches are built.</p><note>
135    /// <p>It is recommended that you use <code>filterGroups</code> instead of <code>branchFilter</code>.</p>
136    /// </note>
137    pub fn set_branch_filter(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138        self.inner = self.inner.set_branch_filter(input);
139        self
140    }
141    /// <p>A regular expression used to determine which repository branches are built when a webhook is triggered. If the name of a branch matches the regular expression, then it is built. If <code>branchFilter</code> is empty, then all branches are built.</p><note>
142    /// <p>It is recommended that you use <code>filterGroups</code> instead of <code>branchFilter</code>.</p>
143    /// </note>
144    pub fn get_branch_filter(&self) -> &::std::option::Option<::std::string::String> {
145        self.inner.get_branch_filter()
146    }
147    ///
148    /// Appends an item to `filterGroups`.
149    ///
150    /// To override the contents of this collection use [`set_filter_groups`](Self::set_filter_groups).
151    ///
152    /// <p>An array of arrays of <code>WebhookFilter</code> objects used to determine which webhooks are triggered. At least one <code>WebhookFilter</code> in the array must specify <code>EVENT</code> as its <code>type</code>.</p>
153    /// <p>For a build to be triggered, at least one filter group in the <code>filterGroups</code> array must pass. For a filter group to pass, each of its filters must pass.</p>
154    pub fn filter_groups(mut self, input: ::std::vec::Vec<crate::types::WebhookFilter>) -> Self {
155        self.inner = self.inner.filter_groups(input);
156        self
157    }
158    /// <p>An array of arrays of <code>WebhookFilter</code> objects used to determine which webhooks are triggered. At least one <code>WebhookFilter</code> in the array must specify <code>EVENT</code> as its <code>type</code>.</p>
159    /// <p>For a build to be triggered, at least one filter group in the <code>filterGroups</code> array must pass. For a filter group to pass, each of its filters must pass.</p>
160    pub fn set_filter_groups(mut self, input: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::WebhookFilter>>>) -> Self {
161        self.inner = self.inner.set_filter_groups(input);
162        self
163    }
164    /// <p>An array of arrays of <code>WebhookFilter</code> objects used to determine which webhooks are triggered. At least one <code>WebhookFilter</code> in the array must specify <code>EVENT</code> as its <code>type</code>.</p>
165    /// <p>For a build to be triggered, at least one filter group in the <code>filterGroups</code> array must pass. For a filter group to pass, each of its filters must pass.</p>
166    pub fn get_filter_groups(&self) -> &::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::WebhookFilter>>> {
167        self.inner.get_filter_groups()
168    }
169    /// <p>Specifies the type of build this webhook will trigger.</p><note>
170    /// <p><code>RUNNER_BUILDKITE_BUILD</code> is only available for <code>NO_SOURCE</code> source type projects configured for Buildkite runner builds. For more information about CodeBuild-hosted Buildkite runner builds, see <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/sample-runner-buildkite.html">Tutorial: Configure a CodeBuild-hosted Buildkite runner</a> in the <i>CodeBuild user guide</i>.</p>
171    /// </note>
172    pub fn build_type(mut self, input: crate::types::WebhookBuildType) -> Self {
173        self.inner = self.inner.build_type(input);
174        self
175    }
176    /// <p>Specifies the type of build this webhook will trigger.</p><note>
177    /// <p><code>RUNNER_BUILDKITE_BUILD</code> is only available for <code>NO_SOURCE</code> source type projects configured for Buildkite runner builds. For more information about CodeBuild-hosted Buildkite runner builds, see <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/sample-runner-buildkite.html">Tutorial: Configure a CodeBuild-hosted Buildkite runner</a> in the <i>CodeBuild user guide</i>.</p>
178    /// </note>
179    pub fn set_build_type(mut self, input: ::std::option::Option<crate::types::WebhookBuildType>) -> Self {
180        self.inner = self.inner.set_build_type(input);
181        self
182    }
183    /// <p>Specifies the type of build this webhook will trigger.</p><note>
184    /// <p><code>RUNNER_BUILDKITE_BUILD</code> is only available for <code>NO_SOURCE</code> source type projects configured for Buildkite runner builds. For more information about CodeBuild-hosted Buildkite runner builds, see <a href="https://docs.aws.amazon.com/codebuild/latest/userguide/sample-runner-buildkite.html">Tutorial: Configure a CodeBuild-hosted Buildkite runner</a> in the <i>CodeBuild user guide</i>.</p>
185    /// </note>
186    pub fn get_build_type(&self) -> &::std::option::Option<crate::types::WebhookBuildType> {
187        self.inner.get_build_type()
188    }
189    /// <p>If manualCreation is true, CodeBuild doesn't create a webhook in GitHub and instead returns <code>payloadUrl</code> and <code>secret</code> values for the webhook. The <code>payloadUrl</code> and <code>secret</code> values in the output can be used to manually create a webhook within GitHub.</p><note>
190    /// <p><code>manualCreation</code> is only available for GitHub webhooks.</p>
191    /// </note>
192    pub fn manual_creation(mut self, input: bool) -> Self {
193        self.inner = self.inner.manual_creation(input);
194        self
195    }
196    /// <p>If manualCreation is true, CodeBuild doesn't create a webhook in GitHub and instead returns <code>payloadUrl</code> and <code>secret</code> values for the webhook. The <code>payloadUrl</code> and <code>secret</code> values in the output can be used to manually create a webhook within GitHub.</p><note>
197    /// <p><code>manualCreation</code> is only available for GitHub webhooks.</p>
198    /// </note>
199    pub fn set_manual_creation(mut self, input: ::std::option::Option<bool>) -> Self {
200        self.inner = self.inner.set_manual_creation(input);
201        self
202    }
203    /// <p>If manualCreation is true, CodeBuild doesn't create a webhook in GitHub and instead returns <code>payloadUrl</code> and <code>secret</code> values for the webhook. The <code>payloadUrl</code> and <code>secret</code> values in the output can be used to manually create a webhook within GitHub.</p><note>
204    /// <p><code>manualCreation</code> is only available for GitHub webhooks.</p>
205    /// </note>
206    pub fn get_manual_creation(&self) -> &::std::option::Option<bool> {
207        self.inner.get_manual_creation()
208    }
209    /// <p>The scope configuration for global or organization webhooks.</p><note>
210    /// <p>Global or organization webhooks are only available for GitHub and Github Enterprise webhooks.</p>
211    /// </note>
212    pub fn scope_configuration(mut self, input: crate::types::ScopeConfiguration) -> Self {
213        self.inner = self.inner.scope_configuration(input);
214        self
215    }
216    /// <p>The scope configuration for global or organization webhooks.</p><note>
217    /// <p>Global or organization webhooks are only available for GitHub and Github Enterprise webhooks.</p>
218    /// </note>
219    pub fn set_scope_configuration(mut self, input: ::std::option::Option<crate::types::ScopeConfiguration>) -> Self {
220        self.inner = self.inner.set_scope_configuration(input);
221        self
222    }
223    /// <p>The scope configuration for global or organization webhooks.</p><note>
224    /// <p>Global or organization webhooks are only available for GitHub and Github Enterprise webhooks.</p>
225    /// </note>
226    pub fn get_scope_configuration(&self) -> &::std::option::Option<crate::types::ScopeConfiguration> {
227        self.inner.get_scope_configuration()
228    }
229    /// <p>A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>
230    pub fn pull_request_build_policy(mut self, input: crate::types::PullRequestBuildPolicy) -> Self {
231        self.inner = self.inner.pull_request_build_policy(input);
232        self
233    }
234    /// <p>A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>
235    pub fn set_pull_request_build_policy(mut self, input: ::std::option::Option<crate::types::PullRequestBuildPolicy>) -> Self {
236        self.inner = self.inner.set_pull_request_build_policy(input);
237        self
238    }
239    /// <p>A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.</p>
240    pub fn get_pull_request_build_policy(&self) -> &::std::option::Option<crate::types::PullRequestBuildPolicy> {
241        self.inner.get_pull_request_build_policy()
242    }
243}