delete_file
async
¶
delete_file(
repository_name: RepositoryName,
branch_name: BranchName,
file_path: Path,
parent_commit_id: CommitId,
*,
config_overrides: Optional[AsyncCodeCommitClientConfig] = None,
keep_empty_folders: Optional[KeepEmptyFolders] = None,
commit_message: Optional[Message] = None,
name: Optional[Name] = None,
email: Optional[Email] = None,
) -> DeleteFileOutput
Deletes a specified file from a specified branch. A commit is created on the branch that contains the revision. The file still exists in the commits earlier to the commit that contains the deletion.
Parameters:
-
repository_name(RepositoryName) –The name of the repository that contains the file to delete.
-
branch_name(BranchName) –The name of the branch where the commit that deletes the file is made.
-
file_path(Path) –The fully qualified path to the file that to be deleted, including the full name and extension of that file. For example, /examples/file.md is a fully qualified path to a file named file.md in a folder named examples.
-
parent_commit_id(CommitId) –The ID of the commit that is the tip of the branch where you want to create the commit that deletes the file. This must be the HEAD commit for the branch. The commit that deletes the file is created from this commit ID.
-
keep_empty_folders(Optional[KeepEmptyFolders], default:None) –If a file is the only object in the folder or directory, specifies whether to delete the folder or directory that contains the file. By default, empty folders are deleted. This includes empty folders that are part of the directory structure. For example, if the path to a file is dir1/dir2/dir3/dir4, and dir2 and dir3 are empty, deleting the last file in dir4 also deletes the empty folders dir4, dir3, and dir2.
-
commit_message(Optional[Message], default:None) –The commit message you want to include as part of deleting the file. Commit messages are limited to 256 KB. If no message is specified, a default message is used.
-
name(Optional[Name], default:None) –The name of the author of the commit that deletes the file. If no name is specified, the user's ARN is used as the author name and committer name.
-
email(Optional[Email], default:None) –The email address for the commit that deletes the file. If no email address is specified, the email address is left blank.
Raises:
-
BranchDoesNotExistException–The specified branch does not exist.
-
BranchNameIsTagNameException–The specified branch name is not valid because it is a tag name. Enter the name of a branch in the repository. For a list of valid branch names, use ListBranches.
-
BranchNameRequiredException–A branch name is required, but was not specified.
-
CommitMessageLengthExceededException–The commit message is too long. Provide a shorter string.
-
EncryptionIntegrityChecksFailedException–An encryption integrity check failed.
-
EncryptionKeyAccessDeniedException–An encryption key could not be accessed.
-
EncryptionKeyDisabledException–The encryption key is disabled.
-
EncryptionKeyNotFoundException–No encryption key was found.
-
EncryptionKeyUnavailableException–The encryption key is not available.
-
FileDoesNotExistException–The specified file does not exist. Verify that you have used the correct file name, full path, and extension.
-
InvalidBranchNameException–The specified reference name is not valid.
-
InvalidEmailException–The specified email address either contains one or more characters that are not allowed, or it exceeds the maximum number of characters allowed for an email address.
-
InvalidParentCommitIdException–The parent commit ID is not valid. The commit ID cannot be empty, and must match the head commit ID for the branch of the repository where you want to add or update a file.
-
InvalidPathException–The specified path is not valid.
-
InvalidRepositoryNameException–A specified repository name is not valid.
This exception occurs only when a specified repository name is not valid. Other exceptions occur when a required repository parameter is missing, or when a specified repository does not exist.
-
NameLengthExceededException–The user name is not valid because it has exceeded the character limit for author names.
-
ParentCommitDoesNotExistException–The parent commit ID is not valid because it does not exist. The specified parent commit ID does not exist in the specified branch of the repository.
-
ParentCommitIdOutdatedException–The file could not be added because the provided parent commit ID is not the current tip of the specified branch. To view the full commit ID of the current head of the branch, use GetBranch.
-
ParentCommitIdRequiredException–A parent commit ID is required. To view the full commit ID of a branch in a repository, use GetBranch or a Git command (for example, git pull or git log).
-
PathRequiredException–The folderPath for a location cannot be null.
-
RepositoryDoesNotExistException–The specified repository does not exist.
-
RepositoryNameRequiredException–A repository name is required, but was not specified.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_codecommit/_services/async_code_commit.py
1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 | |