Skip to main content

files

Creates, updates, deletes, gets or lists a files resource.

Overview

Namefiles
TypeResource
Idaws.codecommit.files

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
blob_idstringThe blob ID of the object that represents the file content.
commit_idstringThe full commit ID of the commit that contains the content returned by GetFile.
file_contentstring (byte)The base-64 encoded binary data object that represents the content of the file.
file_modestringThe extrapolated file mode permissions of the blob. Valid values include strings such as EXECUTABLE and not numeric values. The file mode permissions returned by this API are not the standard file mode permission values, such as 100644, but rather extrapolated values. See the supported return values. (EXECUTABLE, NORMAL, SYMLINK)
file_pathstringThe fully qualified path to the specified file. Returns the name and extension of the file.
file_sizeinteger (int64)The size of the contents of the file, in bytes.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_fileselectregionReturns the base-64 encoded contents of a specified file and its metadata.
put_filereplaceregion, repositoryName, branchName, fileContent, filePathAdds or updates a file in a branch in an CodeCommit repository, and generates a commit for the addition in the specified branch.
delete_filedeleteregionDeletes 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

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Returns the base-64 encoded contents of a specified file and its metadata.

SELECT
blob_id,
commit_id,
file_content,
file_mode,
file_path,
file_size
FROM aws.codecommit.files
WHERE region = '{{ region }}' -- required
;

REPLACE examples

Adds or updates a file in a branch in an CodeCommit repository, and generates a commit for the addition in the specified branch.

REPLACE aws.codecommit.files
SET
repositoryName = '{{ repositoryName }}',
branchName = '{{ branchName }}',
fileContent = '{{ fileContent }}',
filePath = '{{ filePath }}',
fileMode = '{{ fileMode }}',
parentCommitId = '{{ parentCommitId }}',
commitMessage = '{{ commitMessage }}',
name = '{{ name }}',
email = '{{ email }}'
WHERE
region = '{{ region }}' --required
AND repositoryName = '{{ repositoryName }}' --required
AND branchName = '{{ branchName }}' --required
AND fileContent = '{{ fileContent }}' --required
AND filePath = '{{ filePath }}' --required
RETURNING
blob_id,
commit_id,
tree_id;

DELETE examples

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.

DELETE FROM aws.codecommit.files
WHERE region = '{{ region }}' --required
;