branches
Creates, updates, deletes, gets or lists a branches resource.
Overview
| Name | branches |
| Type | Resource |
| Id | aws.codecommit.branches |
Fields
The following fields are returned by SELECT queries:
- list_branches
- get_branch
| Name | Datatype | Description |
|---|---|---|
branche | string | The list of branch names. |
| Name | Datatype | Description |
|---|---|---|
branch_name | string | The name of the branch. |
commit_id | string | The ID of the last commit made to the branch. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_branches | select | region | Gets information about one or more branches in a repository. | |
get_branch | select | region | Returns information about a repository branch, including its name and the last commit ID. | |
create_branch | insert | region, repositoryName, branchName, commitId | Creates a branch in a repository and points the branch to a commit. Calling the create branch operation does not set a repository's default branch. To do this, call the update default branch operation. | |
update_default_branch | update | region, repositoryName, defaultBranchName | Sets or changes the default branch name for the specified repository. If you use this operation to change the default branch name to the current default branch name, a success message is returned even though the default branch did not change. | |
delete_branch | delete | region | Deletes a branch from a repository, unless that branch is the default branch for the repository. |
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
- list_branches
- get_branch
Gets information about one or more branches in a repository.
SELECT
branche
FROM aws.codecommit.branches
WHERE region = '{{ region }}' -- required
;
Returns information about a repository branch, including its name and the last commit ID.
SELECT
branch_name,
commit_id
FROM aws.codecommit.branches
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_branch
- Manifest
Creates a branch in a repository and points the branch to a commit. Calling the create branch operation does not set a repository's default branch. To do this, call the update default branch operation.
INSERT INTO aws.codecommit.branches (
repositoryName,
branchName,
commitId,
region
)
SELECT
'{{ repositoryName }}' /* required */,
'{{ branchName }}' /* required */,
'{{ commitId }}' /* required */,
'{{ region }}'
;
# Description fields are for documentation purposes
- name: branches
props:
- name: region
value: "{{ region }}"
description: Required parameter for the branches resource.
- name: repositoryName
value: "{{ repositoryName }}"
description: |
The name of the repository in which you want to create the new branch.
- name: branchName
value: "{{ branchName }}"
description: |
The name of the new branch to create.
- name: commitId
value: "{{ commitId }}"
description: |
The ID of the commit to point the new branch to.
UPDATE examples
- update_default_branch
Sets or changes the default branch name for the specified repository. If you use this operation to change the default branch name to the current default branch name, a success message is returned even though the default branch did not change.
UPDATE aws.codecommit.branches
SET
repositoryName = '{{ repositoryName }}',
defaultBranchName = '{{ defaultBranchName }}'
WHERE
region = '{{ region }}' --required
AND repositoryName = '{{ repositoryName }}' --required
AND defaultBranchName = '{{ defaultBranchName }}' --required;
DELETE examples
- delete_branch
Deletes a branch from a repository, unless that branch is the default branch for the repository.
DELETE FROM aws.codecommit.branches
WHERE region = '{{ region }}' --required
;