associateApprovalRuleTemplateWithRepository method

Future<void> associateApprovalRuleTemplateWithRepository({
  1. required String approvalRuleTemplateName,
  2. required String repositoryName,
})

Creates an association between an approval rule template and a specified repository. Then, the next time a pull request is created in the repository where the destination reference (if specified) matches the destination reference (branch) for the pull request, an approval rule that matches the template conditions is automatically created for that pull request. If no destination references are specified in the template, an approval rule that matches the template contents is created for all pull requests in that repository.

May throw ApprovalRuleTemplateNameRequiredException. May throw InvalidApprovalRuleTemplateNameException. May throw ApprovalRuleTemplateDoesNotExistException. May throw MaximumRuleTemplatesAssociatedWithRepositoryException. May throw RepositoryNameRequiredException. May throw InvalidRepositoryNameException. May throw RepositoryDoesNotExistException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException.

Parameter approvalRuleTemplateName : The name for the approval rule template.

Parameter repositoryName : The name of the repository that you want to associate with the template.

Implementation

Future<void> associateApprovalRuleTemplateWithRepository({
  required String approvalRuleTemplateName,
  required String repositoryName,
}) async {
  ArgumentError.checkNotNull(
      approvalRuleTemplateName, 'approvalRuleTemplateName');
  _s.validateStringLength(
    'approvalRuleTemplateName',
    approvalRuleTemplateName,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(repositoryName, 'repositoryName');
  _s.validateStringLength(
    'repositoryName',
    repositoryName,
    1,
    100,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'CodeCommit_20150413.AssociateApprovalRuleTemplateWithRepository'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'approvalRuleTemplateName': approvalRuleTemplateName,
      'repositoryName': repositoryName,
    },
  );
}