2018/09/27 - AWS CodeCommit - 3 new api methods
Changes This release adds API support for getting the contents of a file, getting the contents of a folder, and for deleting a file in an AWS CodeCommit repository.
Returns the contents of a specified folder in a repository.
See also: AWS API Documentation
Request Syntax
client.get_folder( repositoryName='string', commitSpecifier='string', folderPath='string' )
string
[REQUIRED]
The name of the repository.
string
A fully-qualified reference used to identify a commit that contains the version of the folder's content to return. A fully-qualified reference can be a commit ID, branch name, tag, or reference such as HEAD. If no specifier is provided, the folder content will be returned as it exists in the HEAD commit.
string
[REQUIRED]
The fully-qualified path to the folder whose contents will be returned, including the folder name. For example, /examples is a fully-qualified path to a folder named examples that was created off of the root directory (/) of a repository.
dict
Response Syntax
{ 'commitId': 'string', 'folderPath': 'string', 'treeId': 'string', 'subFolders': [ { 'treeId': 'string', 'absolutePath': 'string', 'relativePath': 'string' }, ], 'files': [ { 'blobId': 'string', 'absolutePath': 'string', 'relativePath': 'string', 'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK' }, ], 'symbolicLinks': [ { 'blobId': 'string', 'absolutePath': 'string', 'relativePath': 'string', 'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK' }, ], 'subModules': [ { 'commitId': 'string', 'absolutePath': 'string', 'relativePath': 'string' }, ] }
Response Structure
(dict) --
commitId (string) --
The full commit ID used as a reference for which version of the folder content is returned.
folderPath (string) --
The fully-qualified path of the folder whose contents are returned.
treeId (string) --
The full SHA-1 pointer of the tree information for the commit that contains the folder.
subFolders (list) --
The list of folders that exist beneath the specified folder, if any.
(dict) --
Returns information about a folder in a repository.
treeId (string) --
The full SHA-1 pointer of the tree information for the commit that contains the folder.
absolutePath (string) --
The fully-qualified path of the folder in the repository.
relativePath (string) --
The relative path of the specified folder from the folder where the query originated.
files (list) --
The list of files that exist in the specified folder, if any.
(dict) --
Returns information about a file in a repository.
blobId (string) --
The blob ID that contains the file information.
absolutePath (string) --
The fully-qualified path to the file in the repository.
relativePath (string) --
The relative path of the file from the folder where the query originated.
fileMode (string) --
The extrapolated file mode permissions for the file. Valid values include EXECUTABLE and NORMAL.
symbolicLinks (list) --
The list of symbolic links to other files and folders that exist in the specified folder, if any.
(dict) --
Returns information about a symbolic link in a repository folder.
blobId (string) --
The blob ID that contains the information about the symbolic link.
absolutePath (string) --
The fully-qualified path to the folder that contains the symbolic link.
relativePath (string) --
The relative path of the symbolic link from the folder where the query originated.
fileMode (string) --
The file mode permissions of the blob that cotains information about the symbolic link.
subModules (list) --
The list of submodules that exist in the specified folder, if any.
(dict) --
Returns information about a submodule reference in a repository folder.
commitId (string) --
The commit ID that contains the reference to the submodule.
absolutePath (string) --
The fully qualified path to the folder that contains the reference to the submodule.
relativePath (string) --
The relative path of the submodule from the folder where the query originated.
Returns the base-64 encoded contents of a specified file and its metadata.
See also: AWS API Documentation
Request Syntax
client.get_file( repositoryName='string', commitSpecifier='string', filePath='string' )
string
[REQUIRED]
The name of the repository that contains the file.
string
The fully-quaified reference that identifies the commit that contains the file. For example, you could specify a full commit ID, a tag, a branch name, or a reference such as refs/heads/master. If none is provided, then the head commit will be used.
string
[REQUIRED]
The fully-qualified path to the file, including the full name and extension of the file. For example, /examples/file.md is the fully-qualified path to a file named file.md in a folder named examples.
dict
Response Syntax
{ 'commitId': 'string', 'blobId': 'string', 'filePath': 'string', 'fileMode': 'EXECUTABLE'|'NORMAL'|'SYMLINK', 'fileSize': 123, 'fileContent': b'bytes' }
Response Structure
(dict) --
commitId (string) --
The full commit ID of the commit that contains the content returned by GetFile.
blobId (string) --
The blob ID of the object that represents the file content.
filePath (string) --
The fully qualified path to the specified file. This returns the name and extension of the file.
fileMode (string) --
The extrapolated file mode permissions of the blob. Valid values include strings such as EXECUTABLE and not numeric values.
Note
The file mode permissions returned by this API are not the standard file mode permission values, such as 100644, but rather extrapolated values. See below for a full list of supported return values.
fileSize (integer) --
The size of the contents of the file, in bytes.
fileContent (bytes) --
The base-64 encoded binary data object that represents the content of the file.
Deletes a specified file from a specified branch. A commit is created on the branch that contains the revision. The file will still exist in the commits prior to the commit that contains the deletion.
See also: AWS API Documentation
Request Syntax
client.delete_file( repositoryName='string', branchName='string', filePath='string', parentCommitId='string', keepEmptyFolders=True|False, commitMessage='string', name='string', email='string' )
string
[REQUIRED]
The name of the repository that contains the file to delete.
string
[REQUIRED]
The name of the branch where the commit will be made deleting the file.
string
[REQUIRED]
The fully-qualified path to the file that will 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.
string
[REQUIRED]
The ID of the commit that is the tip of the branch where you want to create the commit that will delete the file. This must be the HEAD commit for the branch. The commit that deletes the file will be created from this commit ID.
boolean
Specifies whether to delete the folder or directory that contains the file you want to delete if that file is the only object in the folder or directory. By default, empty folders will be 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 will also delete the empty folders dir4, dir3, and dir2.
string
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 will be used.
string
The name of the author of the commit that deletes the file. If no name is specified, the user's ARN will be used as the author name and committer name.
string
The email address for the commit that deletes the file. If no email address is specified, the email address will be left blank.
dict
Response Syntax
{ 'commitId': 'string', 'blobId': 'string', 'treeId': 'string', 'filePath': 'string' }
Response Structure
(dict) --
commitId (string) --
The full commit ID of the commit that contains the change that deletes the file.
blobId (string) --
The blob ID removed from the tree as part of deleting the file.
treeId (string) --
The full SHA-1 pointer of the tree information for the commit that contains the delete file change.
filePath (string) --
The fully-qualified path to the file that will be deleted, including the full name and extension of that file.