deleteBranch method
Deletes a branch from a repository, unless that branch is the default branch for the repository.
May throw RepositoryNameRequiredException. May throw RepositoryDoesNotExistException. May throw InvalidRepositoryNameException. May throw BranchNameRequiredException. May throw InvalidBranchNameException. May throw DefaultBranchCannotBeDeletedException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException.
Parameter branchName
:
The name of the branch to delete.
Parameter repositoryName
:
The name of the repository that contains the branch to be deleted.
Implementation
Future<DeleteBranchOutput> deleteBranch({
required String branchName,
required String repositoryName,
}) async {
ArgumentError.checkNotNull(branchName, 'branchName');
_s.validateStringLength(
'branchName',
branchName,
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.DeleteBranch'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'branchName': branchName,
'repositoryName': repositoryName,
},
);
return DeleteBranchOutput.fromJson(jsonResponse.body);
}