updateWebhook method
Updates the webhook associated with an CodeBuild build project.
May throw InvalidInputException.
May throw OAuthProviderException.
May throw ResourceNotFoundException.
Parameter projectName :
The name of the 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
if a webhook event can trigger a build. A filter group must contain at
least one EVENT WebhookFilter.
Parameter pullRequestBuildPolicy :
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.
Parameter rotateSecret :
A boolean value that specifies whether the associated GitHub repository's
secret token should be updated. If you use Bitbucket for your repository,
rotateSecret is ignored.
Implementation
Future<UpdateWebhookOutput> updateWebhook({
required String projectName,
String? branchFilter,
WebhookBuildType? buildType,
List<List<WebhookFilter>>? filterGroups,
PullRequestBuildPolicy? pullRequestBuildPolicy,
bool? rotateSecret,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'CodeBuild_20161006.UpdateWebhook'
};
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.value,
if (filterGroups != null) 'filterGroups': filterGroups,
if (pullRequestBuildPolicy != null)
'pullRequestBuildPolicy': pullRequestBuildPolicy,
if (rotateSecret != null) 'rotateSecret': rotateSecret,
},
);
return UpdateWebhookOutput.fromJson(jsonResponse.body);
}