branches
Creates, updates, deletes or gets a branch resource or lists branches in a region
Overview
| Name | branches |
| Type | Resource |
| Description | The AWS::Amplify::Branch resource creates a new branch within an app. |
| Id | awscc.amplify.branches |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
app_id | string | |
arn | string | |
basic_auth_config | object | |
backend | object | |
branch_name | string | |
build_spec | string | |
compute_role_arn | string | |
description | string | |
enable_auto_build | boolean | |
enable_performance_mode | boolean | |
enable_pull_request_preview | boolean | |
enable_skew_protection | boolean | |
environment_variables | array | |
framework | string | |
pull_request_environment_name | string | |
stage | string | |
tags | array | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
arn | string | |
region | string | AWS region. |
For more information, see AWS::Amplify::Branch.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | branches | INSERT | AppId, BranchName, region |
delete_resource | branches | DELETE | Identifier, region |
update_resource | branches | UPDATE | Identifier, PatchDocument, region |
list_resources | branches_list_only | SELECT | region |
get_resource | branches | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual branch.
SELECT
region,
app_id,
arn,
basic_auth_config,
backend,
branch_name,
build_spec,
compute_role_arn,
description,
enable_auto_build,
enable_performance_mode,
enable_pull_request_preview,
enable_skew_protection,
environment_variables,
framework,
pull_request_environment_name,
stage,
tags
FROM awscc.amplify.branches
WHERE
region = 'us-east-1' AND
Identifier = '{{ arn }}';
Lists all branches in a region.
SELECT
region,
arn
FROM awscc.amplify.branches_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new branch resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.amplify.branches (
AppId,
BranchName,
region
)
SELECT
'{{ app_id }}',
'{{ branch_name }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.amplify.branches (
AppId,
BasicAuthConfig,
Backend,
BranchName,
BuildSpec,
ComputeRoleArn,
Description,
EnableAutoBuild,
EnablePerformanceMode,
EnablePullRequestPreview,
EnableSkewProtection,
EnvironmentVariables,
Framework,
PullRequestEnvironmentName,
Stage,
Tags,
region
)
SELECT
'{{ app_id }}',
'{{ basic_auth_config }}',
'{{ backend }}',
'{{ branch_name }}',
'{{ build_spec }}',
'{{ compute_role_arn }}',
'{{ description }}',
'{{ enable_auto_build }}',
'{{ enable_performance_mode }}',
'{{ enable_pull_request_preview }}',
'{{ enable_skew_protection }}',
'{{ environment_variables }}',
'{{ framework }}',
'{{ pull_request_environment_name }}',
'{{ stage }}',
'{{ tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: branch
props:
- name: app_id
value: '{{ app_id }}'
- name: basic_auth_config
value:
enable_basic_auth: '{{ enable_basic_auth }}'
username: '{{ username }}'
password: '{{ password }}'
- name: backend
value:
stack_arn: '{{ stack_arn }}'
- name: branch_name
value: '{{ branch_name }}'
- name: build_spec
value: '{{ build_spec }}'
- name: compute_role_arn
value: '{{ compute_role_arn }}'
- name: description
value: '{{ description }}'
- name: enable_auto_build
value: '{{ enable_auto_build }}'
- name: enable_performance_mode
value: '{{ enable_performance_mode }}'
- name: enable_pull_request_preview
value: '{{ enable_pull_request_preview }}'
- name: enable_skew_protection
value: '{{ enable_skew_protection }}'
- name: environment_variables
value:
- name: '{{ name }}'
value: '{{ value }}'
- name: framework
value: '{{ framework }}'
- name: pull_request_environment_name
value: '{{ pull_request_environment_name }}'
- name: stage
value: '{{ stage }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a branch resource, using stack-deploy.
/*+ update */
UPDATE awscc.amplify.branches
SET PatchDocument = string('{{ {
"BasicAuthConfig": basic_auth_config,
"Backend": backend,
"BuildSpec": build_spec,
"ComputeRoleArn": compute_role_arn,
"Description": description,
"EnableAutoBuild": enable_auto_build,
"EnablePerformanceMode": enable_performance_mode,
"EnablePullRequestPreview": enable_pull_request_preview,
"EnableSkewProtection": enable_skew_protection,
"EnvironmentVariables": environment_variables,
"Framework": framework,
"PullRequestEnvironmentName": pull_request_environment_name,
"Stage": stage,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ arn }}';
DELETE example
/*+ delete */
DELETE FROM awscc.amplify.branches
WHERE
Identifier = '{{ arn }}' AND
region = 'us-east-1';
Permissions
To operate on the branches resource, the following permissions are required:
- Create
- Delete
- List
- Read
- Update
amplify:GetBranch,
amplify:CreateBranch,
amplify:TagResource,
codecommit:GetRepository,
codecommit:PutRepositoryTriggers,
codecommit:GetRepositoryTriggers,
s3:GetObject,
s3:GetObjectAcl,
s3:PutObject,
s3:PutObjectAcl,
sns:CreateTopic,
sns:Subscribe,
iam:PassRole
amplify:GetBranch,
amplify:DeleteBranch,
codecommit:GetRepository,
codecommit:GetRepositoryTriggers,
sns:Unsubscribe,
iam:PassRole
amplify:GetBranch,
amplify:ListBranches,
amplify:ListTagsForResource,
iam:PassRole
amplify:GetBranch,
amplify:ListTagsForResource,
codecommit:GetRepository,
codecommit:GetRepositoryTriggers,
s3:GetObject,
s3:GetObjectAcl,
iam:PassRole
amplify:GetBranch,
amplify:UpdateBranch,
amplify:ListTagsForResource,
amplify:TagResource,
amplify:UntagResource,
codecommit:GetRepository,
codecommit:PutRepositoryTriggers,
codecommit:GetRepositoryTriggers,
s3:GetObject,
s3:GetObjectAcl,
s3:PutObject,
s3:PutObjectAcl,
sns:CreateTopic,
sns:Subscribe,
sns:Unsubscribe,
iam:PassRole