aws_sdk_codebuild/operation/create_webhook/
_create_webhook_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateWebhookInput {
6    /// <p>The name of the CodeBuild project.</p>
7    pub project_name: ::std::option::Option<::std::string::String>,
8    /// <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>
9    /// <p>It is recommended that you use <code>filterGroups</code> instead of <code>branchFilter</code>.</p>
10    /// </note>
11    pub branch_filter: ::std::option::Option<::std::string::String>,
12    /// <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>
13    /// <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>
14    pub filter_groups: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::WebhookFilter>>>,
15    /// <p>Specifies the type of build this webhook will trigger.</p><note>
16    /// <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>
17    /// </note>
18    pub build_type: ::std::option::Option<crate::types::WebhookBuildType>,
19    /// <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>
20    /// <p><code>manualCreation</code> is only available for GitHub webhooks.</p>
21    /// </note>
22    pub manual_creation: ::std::option::Option<bool>,
23    /// <p>The scope configuration for global or organization webhooks.</p><note>
24    /// <p>Global or organization webhooks are only available for GitHub and Github Enterprise webhooks.</p>
25    /// </note>
26    pub scope_configuration: ::std::option::Option<crate::types::ScopeConfiguration>,
27    /// <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>
28    pub pull_request_build_policy: ::std::option::Option<crate::types::PullRequestBuildPolicy>,
29}
30impl CreateWebhookInput {
31    /// <p>The name of the CodeBuild project.</p>
32    pub fn project_name(&self) -> ::std::option::Option<&str> {
33        self.project_name.as_deref()
34    }
35    /// <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>
36    /// <p>It is recommended that you use <code>filterGroups</code> instead of <code>branchFilter</code>.</p>
37    /// </note>
38    pub fn branch_filter(&self) -> ::std::option::Option<&str> {
39        self.branch_filter.as_deref()
40    }
41    /// <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>
42    /// <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>
43    ///
44    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.filter_groups.is_none()`.
45    pub fn filter_groups(&self) -> &[::std::vec::Vec<crate::types::WebhookFilter>] {
46        self.filter_groups.as_deref().unwrap_or_default()
47    }
48    /// <p>Specifies the type of build this webhook will trigger.</p><note>
49    /// <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>
50    /// </note>
51    pub fn build_type(&self) -> ::std::option::Option<&crate::types::WebhookBuildType> {
52        self.build_type.as_ref()
53    }
54    /// <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>
55    /// <p><code>manualCreation</code> is only available for GitHub webhooks.</p>
56    /// </note>
57    pub fn manual_creation(&self) -> ::std::option::Option<bool> {
58        self.manual_creation
59    }
60    /// <p>The scope configuration for global or organization webhooks.</p><note>
61    /// <p>Global or organization webhooks are only available for GitHub and Github Enterprise webhooks.</p>
62    /// </note>
63    pub fn scope_configuration(&self) -> ::std::option::Option<&crate::types::ScopeConfiguration> {
64        self.scope_configuration.as_ref()
65    }
66    /// <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>
67    pub fn pull_request_build_policy(&self) -> ::std::option::Option<&crate::types::PullRequestBuildPolicy> {
68        self.pull_request_build_policy.as_ref()
69    }
70}
71impl CreateWebhookInput {
72    /// Creates a new builder-style object to manufacture [`CreateWebhookInput`](crate::operation::create_webhook::CreateWebhookInput).
73    pub fn builder() -> crate::operation::create_webhook::builders::CreateWebhookInputBuilder {
74        crate::operation::create_webhook::builders::CreateWebhookInputBuilder::default()
75    }
76}
77
78/// A builder for [`CreateWebhookInput`](crate::operation::create_webhook::CreateWebhookInput).
79#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
80#[non_exhaustive]
81pub struct CreateWebhookInputBuilder {
82    pub(crate) project_name: ::std::option::Option<::std::string::String>,
83    pub(crate) branch_filter: ::std::option::Option<::std::string::String>,
84    pub(crate) filter_groups: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::WebhookFilter>>>,
85    pub(crate) build_type: ::std::option::Option<crate::types::WebhookBuildType>,
86    pub(crate) manual_creation: ::std::option::Option<bool>,
87    pub(crate) scope_configuration: ::std::option::Option<crate::types::ScopeConfiguration>,
88    pub(crate) pull_request_build_policy: ::std::option::Option<crate::types::PullRequestBuildPolicy>,
89}
90impl CreateWebhookInputBuilder {
91    /// <p>The name of the CodeBuild project.</p>
92    /// This field is required.
93    pub fn project_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
94        self.project_name = ::std::option::Option::Some(input.into());
95        self
96    }
97    /// <p>The name of the CodeBuild project.</p>
98    pub fn set_project_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
99        self.project_name = input;
100        self
101    }
102    /// <p>The name of the CodeBuild project.</p>
103    pub fn get_project_name(&self) -> &::std::option::Option<::std::string::String> {
104        &self.project_name
105    }
106    /// <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>
107    /// <p>It is recommended that you use <code>filterGroups</code> instead of <code>branchFilter</code>.</p>
108    /// </note>
109    pub fn branch_filter(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
110        self.branch_filter = ::std::option::Option::Some(input.into());
111        self
112    }
113    /// <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>
114    /// <p>It is recommended that you use <code>filterGroups</code> instead of <code>branchFilter</code>.</p>
115    /// </note>
116    pub fn set_branch_filter(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
117        self.branch_filter = input;
118        self
119    }
120    /// <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>
121    /// <p>It is recommended that you use <code>filterGroups</code> instead of <code>branchFilter</code>.</p>
122    /// </note>
123    pub fn get_branch_filter(&self) -> &::std::option::Option<::std::string::String> {
124        &self.branch_filter
125    }
126    /// Appends an item to `filter_groups`.
127    ///
128    /// To override the contents of this collection use [`set_filter_groups`](Self::set_filter_groups).
129    ///
130    /// <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>
131    /// <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>
132    pub fn filter_groups(mut self, input: ::std::vec::Vec<crate::types::WebhookFilter>) -> Self {
133        let mut v = self.filter_groups.unwrap_or_default();
134        v.push(input);
135        self.filter_groups = ::std::option::Option::Some(v);
136        self
137    }
138    /// <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>
139    /// <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>
140    pub fn set_filter_groups(mut self, input: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::WebhookFilter>>>) -> Self {
141        self.filter_groups = input;
142        self
143    }
144    /// <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>
145    /// <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>
146    pub fn get_filter_groups(&self) -> &::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::WebhookFilter>>> {
147        &self.filter_groups
148    }
149    /// <p>Specifies the type of build this webhook will trigger.</p><note>
150    /// <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>
151    /// </note>
152    pub fn build_type(mut self, input: crate::types::WebhookBuildType) -> Self {
153        self.build_type = ::std::option::Option::Some(input);
154        self
155    }
156    /// <p>Specifies the type of build this webhook will trigger.</p><note>
157    /// <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>
158    /// </note>
159    pub fn set_build_type(mut self, input: ::std::option::Option<crate::types::WebhookBuildType>) -> Self {
160        self.build_type = input;
161        self
162    }
163    /// <p>Specifies the type of build this webhook will trigger.</p><note>
164    /// <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>
165    /// </note>
166    pub fn get_build_type(&self) -> &::std::option::Option<crate::types::WebhookBuildType> {
167        &self.build_type
168    }
169    /// <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>
170    /// <p><code>manualCreation</code> is only available for GitHub webhooks.</p>
171    /// </note>
172    pub fn manual_creation(mut self, input: bool) -> Self {
173        self.manual_creation = ::std::option::Option::Some(input);
174        self
175    }
176    /// <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>
177    /// <p><code>manualCreation</code> is only available for GitHub webhooks.</p>
178    /// </note>
179    pub fn set_manual_creation(mut self, input: ::std::option::Option<bool>) -> Self {
180        self.manual_creation = input;
181        self
182    }
183    /// <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>
184    /// <p><code>manualCreation</code> is only available for GitHub webhooks.</p>
185    /// </note>
186    pub fn get_manual_creation(&self) -> &::std::option::Option<bool> {
187        &self.manual_creation
188    }
189    /// <p>The scope configuration for global or organization webhooks.</p><note>
190    /// <p>Global or organization webhooks are only available for GitHub and Github Enterprise webhooks.</p>
191    /// </note>
192    pub fn scope_configuration(mut self, input: crate::types::ScopeConfiguration) -> Self {
193        self.scope_configuration = ::std::option::Option::Some(input);
194        self
195    }
196    /// <p>The scope configuration for global or organization webhooks.</p><note>
197    /// <p>Global or organization webhooks are only available for GitHub and Github Enterprise webhooks.</p>
198    /// </note>
199    pub fn set_scope_configuration(mut self, input: ::std::option::Option<crate::types::ScopeConfiguration>) -> Self {
200        self.scope_configuration = input;
201        self
202    }
203    /// <p>The scope configuration for global or organization webhooks.</p><note>
204    /// <p>Global or organization webhooks are only available for GitHub and Github Enterprise webhooks.</p>
205    /// </note>
206    pub fn get_scope_configuration(&self) -> &::std::option::Option<crate::types::ScopeConfiguration> {
207        &self.scope_configuration
208    }
209    /// <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>
210    pub fn pull_request_build_policy(mut self, input: crate::types::PullRequestBuildPolicy) -> Self {
211        self.pull_request_build_policy = ::std::option::Option::Some(input);
212        self
213    }
214    /// <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>
215    pub fn set_pull_request_build_policy(mut self, input: ::std::option::Option<crate::types::PullRequestBuildPolicy>) -> Self {
216        self.pull_request_build_policy = input;
217        self
218    }
219    /// <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>
220    pub fn get_pull_request_build_policy(&self) -> &::std::option::Option<crate::types::PullRequestBuildPolicy> {
221        &self.pull_request_build_policy
222    }
223    /// Consumes the builder and constructs a [`CreateWebhookInput`](crate::operation::create_webhook::CreateWebhookInput).
224    pub fn build(
225        self,
226    ) -> ::std::result::Result<crate::operation::create_webhook::CreateWebhookInput, ::aws_smithy_types::error::operation::BuildError> {
227        ::std::result::Result::Ok(crate::operation::create_webhook::CreateWebhookInput {
228            project_name: self.project_name,
229            branch_filter: self.branch_filter,
230            filter_groups: self.filter_groups,
231            build_type: self.build_type,
232            manual_creation: self.manual_creation,
233            scope_configuration: self.scope_configuration,
234            pull_request_build_policy: self.pull_request_build_policy,
235        })
236    }
237}