updateDefaultBranch method

Future<void> updateDefaultBranch({
  1. required String defaultBranchName,
  2. required String repositoryName,
})

Sets or changes the default branch name for the specified repository.

May throw RepositoryNameRequiredException. May throw RepositoryDoesNotExistException. May throw InvalidRepositoryNameException. May throw BranchNameRequiredException. May throw InvalidBranchNameException. May throw BranchDoesNotExistException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException.

Parameter defaultBranchName : The name of the branch to set as the default.

Parameter repositoryName : The name of the repository to set or change the default branch for.

Implementation

Future<void> updateDefaultBranch({
  required String defaultBranchName,
  required String repositoryName,
}) async {
  ArgumentError.checkNotNull(defaultBranchName, 'defaultBranchName');
  _s.validateStringLength(
    'defaultBranchName',
    defaultBranchName,
    1,
    256,
    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.UpdateDefaultBranch'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'defaultBranchName': defaultBranchName,
      'repositoryName': repositoryName,
    },
  );
}