updateWebhook method

Future<UpdateWebhookOutput> updateWebhook({
  1. required String projectName,
  2. String? branchFilter,
  3. WebhookBuildType? buildType,
  4. List<List<WebhookFilter>>? filterGroups,
  5. bool? rotateSecret,
})

Updates the webhook associated with an AWS CodeBuild build project.

May throw InvalidInputException. May throw ResourceNotFoundException. May throw OAuthProviderException.

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 if a webhook event can trigger a build. A filter group must contain at least one EVENT WebhookFilter.

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,
  bool? rotateSecret,
}) 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.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.toValue(),
      if (filterGroups != null) 'filterGroups': filterGroups,
      if (rotateSecret != null) 'rotateSecret': rotateSecret,
    },
  );

  return UpdateWebhookOutput.fromJson(jsonResponse.body);
}