files
Creates, updates, deletes, gets or lists a files resource.
Overview
| Name | files |
| Type | Resource |
| Id | aws.codecommit.files |
Fields
The following fields are returned by SELECT queries:
- get_file
| Name | Datatype | Description |
|---|---|---|
blob_id | string | The blob ID of the object that represents the file content. |
commit_id | string | The full commit ID of the commit that contains the content returned by GetFile. |
file_content | string (byte) | The base-64 encoded binary data object that represents the content of the file. |
file_mode | string | The 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_path | string | The fully qualified path to the specified file. Returns the name and extension of the file. |
file_size | integer (int64) | The size of the contents of the file, in bytes. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_file | select | region | Returns the base-64 encoded contents of a specified file and its metadata. | |
put_file | replace | region, repositoryName, branchName, fileContent, filePath | Adds or updates a file in a branch in an CodeCommit repository, and generates a commit for the addition in the specified branch. | |
delete_file | delete | region | 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
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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_file
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
- put_file
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
- delete_file
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
;