createWebhook method
- required String projectName,
- String? branchFilter,
- WebhookBuildType? buildType,
- List<
List< ? filterGroups,WebhookFilter> >
For an existing AWS CodeBuild build project that has its source code stored in a GitHub or Bitbucket repository, enables AWS CodeBuild to start rebuilding the source code every time a code change is pushed to the repository.
May throw InvalidInputException. May throw OAuthProviderException. May throw ResourceAlreadyExistsException. May throw ResourceNotFoundException.
Parameter projectName
:
The name of the AWS CodeBuild project.
Parameter branchFilter
:
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 branchFilter
is empty, then
all branches are built.
Parameter buildType
:
Specifies the type of build this webhook will trigger.
Parameter filterGroups
:
An array of arrays of WebhookFilter
objects used to determine
which webhooks are triggered. At least one WebhookFilter
in
the array must specify EVENT
as its type
.
For a build to be triggered, at least one filter group in the
filterGroups
array must pass. For a filter group to pass,
each of its filters must pass.
Implementation
Future<CreateWebhookOutput> createWebhook({
required String projectName,
String? branchFilter,
WebhookBuildType? buildType,
List<List<WebhookFilter>>? filterGroups,
}) async {
ArgumentError.checkNotNull(projectName, 'projectName');
_s.validateStringLength(
'projectName',
projectName,
2,
255,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'CodeBuild_20161006.CreateWebhook'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'projectName': projectName,
if (branchFilter != null) 'branchFilter': branchFilter,
if (buildType != null) 'buildType': buildType.toValue(),
if (filterGroups != null) 'filterGroups': filterGroups,
},
);
return CreateWebhookOutput.fromJson(jsonResponse.body);
}