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}
28impl CreateWebhookInput {
29    /// <p>The name of the CodeBuild project.</p>
30    pub fn project_name(&self) -> ::std::option::Option<&str> {
31        self.project_name.as_deref()
32    }
33    /// <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>
34    /// <p>It is recommended that you use <code>filterGroups</code> instead of <code>branchFilter</code>.</p>
35    /// </note>
36    pub fn branch_filter(&self) -> ::std::option::Option<&str> {
37        self.branch_filter.as_deref()
38    }
39    /// <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>
40    /// <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>
41    ///
42    /// 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()`.
43    pub fn filter_groups(&self) -> &[::std::vec::Vec<crate::types::WebhookFilter>] {
44        self.filter_groups.as_deref().unwrap_or_default()
45    }
46    /// <p>Specifies the type of build this webhook will trigger.</p><note>
47    /// <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>
48    /// </note>
49    pub fn build_type(&self) -> ::std::option::Option<&crate::types::WebhookBuildType> {
50        self.build_type.as_ref()
51    }
52    /// <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>
53    /// <p><code>manualCreation</code> is only available for GitHub webhooks.</p>
54    /// </note>
55    pub fn manual_creation(&self) -> ::std::option::Option<bool> {
56        self.manual_creation
57    }
58    /// <p>The scope configuration for global or organization webhooks.</p><note>
59    /// <p>Global or organization webhooks are only available for GitHub and Github Enterprise webhooks.</p>
60    /// </note>
61    pub fn scope_configuration(&self) -> ::std::option::Option<&crate::types::ScopeConfiguration> {
62        self.scope_configuration.as_ref()
63    }
64}
65impl CreateWebhookInput {
66    /// Creates a new builder-style object to manufacture [`CreateWebhookInput`](crate::operation::create_webhook::CreateWebhookInput).
67    pub fn builder() -> crate::operation::create_webhook::builders::CreateWebhookInputBuilder {
68        crate::operation::create_webhook::builders::CreateWebhookInputBuilder::default()
69    }
70}
71
72/// A builder for [`CreateWebhookInput`](crate::operation::create_webhook::CreateWebhookInput).
73#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
74#[non_exhaustive]
75pub struct CreateWebhookInputBuilder {
76    pub(crate) project_name: ::std::option::Option<::std::string::String>,
77    pub(crate) branch_filter: ::std::option::Option<::std::string::String>,
78    pub(crate) filter_groups: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::WebhookFilter>>>,
79    pub(crate) build_type: ::std::option::Option<crate::types::WebhookBuildType>,
80    pub(crate) manual_creation: ::std::option::Option<bool>,
81    pub(crate) scope_configuration: ::std::option::Option<crate::types::ScopeConfiguration>,
82}
83impl CreateWebhookInputBuilder {
84    /// <p>The name of the CodeBuild project.</p>
85    /// This field is required.
86    pub fn project_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
87        self.project_name = ::std::option::Option::Some(input.into());
88        self
89    }
90    /// <p>The name of the CodeBuild project.</p>
91    pub fn set_project_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
92        self.project_name = input;
93        self
94    }
95    /// <p>The name of the CodeBuild project.</p>
96    pub fn get_project_name(&self) -> &::std::option::Option<::std::string::String> {
97        &self.project_name
98    }
99    /// <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>
100    /// <p>It is recommended that you use <code>filterGroups</code> instead of <code>branchFilter</code>.</p>
101    /// </note>
102    pub fn branch_filter(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
103        self.branch_filter = ::std::option::Option::Some(input.into());
104        self
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 set_branch_filter(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
110        self.branch_filter = input;
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 get_branch_filter(&self) -> &::std::option::Option<::std::string::String> {
117        &self.branch_filter
118    }
119    /// Appends an item to `filter_groups`.
120    ///
121    /// To override the contents of this collection use [`set_filter_groups`](Self::set_filter_groups).
122    ///
123    /// <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>
124    /// <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>
125    pub fn filter_groups(mut self, input: ::std::vec::Vec<crate::types::WebhookFilter>) -> Self {
126        let mut v = self.filter_groups.unwrap_or_default();
127        v.push(input);
128        self.filter_groups = ::std::option::Option::Some(v);
129        self
130    }
131    /// <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>
132    /// <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>
133    pub fn set_filter_groups(mut self, input: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::WebhookFilter>>>) -> Self {
134        self.filter_groups = input;
135        self
136    }
137    /// <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>
138    /// <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>
139    pub fn get_filter_groups(&self) -> &::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::WebhookFilter>>> {
140        &self.filter_groups
141    }
142    /// <p>Specifies the type of build this webhook will trigger.</p><note>
143    /// <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>
144    /// </note>
145    pub fn build_type(mut self, input: crate::types::WebhookBuildType) -> Self {
146        self.build_type = ::std::option::Option::Some(input);
147        self
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 set_build_type(mut self, input: ::std::option::Option<crate::types::WebhookBuildType>) -> Self {
153        self.build_type = 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 get_build_type(&self) -> &::std::option::Option<crate::types::WebhookBuildType> {
160        &self.build_type
161    }
162    /// <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>
163    /// <p><code>manualCreation</code> is only available for GitHub webhooks.</p>
164    /// </note>
165    pub fn manual_creation(mut self, input: bool) -> Self {
166        self.manual_creation = ::std::option::Option::Some(input);
167        self
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 set_manual_creation(mut self, input: ::std::option::Option<bool>) -> Self {
173        self.manual_creation = 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 get_manual_creation(&self) -> &::std::option::Option<bool> {
180        &self.manual_creation
181    }
182    /// <p>The scope configuration for global or organization webhooks.</p><note>
183    /// <p>Global or organization webhooks are only available for GitHub and Github Enterprise webhooks.</p>
184    /// </note>
185    pub fn scope_configuration(mut self, input: crate::types::ScopeConfiguration) -> Self {
186        self.scope_configuration = ::std::option::Option::Some(input);
187        self
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 set_scope_configuration(mut self, input: ::std::option::Option<crate::types::ScopeConfiguration>) -> Self {
193        self.scope_configuration = 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 get_scope_configuration(&self) -> &::std::option::Option<crate::types::ScopeConfiguration> {
200        &self.scope_configuration
201    }
202    /// Consumes the builder and constructs a [`CreateWebhookInput`](crate::operation::create_webhook::CreateWebhookInput).
203    pub fn build(
204        self,
205    ) -> ::std::result::Result<crate::operation::create_webhook::CreateWebhookInput, ::aws_smithy_types::error::operation::BuildError> {
206        ::std::result::Result::Ok(crate::operation::create_webhook::CreateWebhookInput {
207            project_name: self.project_name,
208            branch_filter: self.branch_filter,
209            filter_groups: self.filter_groups,
210            build_type: self.build_type,
211            manual_creation: self.manual_creation,
212            scope_configuration: self.scope_configuration,
213        })
214    }
215}