@aws-cdk_aws-amplify-alpha.Branch

class Branch (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Amplify.Alpha.Branch
Gogithub.com/aws/aws-cdk-go/awscdkamplifyalpha/v2#Branch
Javasoftware.amazon.awscdk.services.amplify.alpha.Branch
Pythonaws_cdk.aws_amplify_alpha.Branch
TypeScript (source)@aws-cdk/aws-amplify-alpha ยป Branch

Implements IConstruct, IDependable, IResource, IBranch

An Amplify Console branch.

Example

declare const amplifyApp: amplify.App;

const main = amplifyApp.addBranch('main'); // `id` will be used as repo branch name
const dev = amplifyApp.addBranch('dev', {
  performanceMode: true, // optional, enables performance mode
});
dev.addEnvironment('STAGE', 'dev');

Initializer

new Branch(scope: Construct, id: string, props: BranchProps)

Parameters

  • scope Construct
  • id string
  • props BranchProps

Construct Props

NameTypeDescription
app๐Ÿ”นIAppThe application within which the branch must be created.
asset?๐Ÿ”นAssetAsset for deployment.
autoBuild?๐Ÿ”นbooleanWhether to enable auto building for the branch.
basicAuth?๐Ÿ”นBasicAuthThe Basic Auth configuration.
branchName?๐Ÿ”นstringThe name of the branch.
buildSpec?๐Ÿ”นBuildSpecBuildSpec for the branch.
description?๐Ÿ”นstringA description for the branch.
environmentVariables?๐Ÿ”น{ [string]: string }Environment variables for the branch.
performanceMode?๐Ÿ”นbooleanEnables performance mode for the branch.
pullRequestEnvironmentName?๐Ÿ”นstringThe dedicated backend environment for the pull request previews.
pullRequestPreview?๐Ÿ”นbooleanWhether to enable pull request preview for the branch.
stage?๐Ÿ”นstringStage for the branch.

app๐Ÿ”น

Type: IApp

The application within which the branch must be created.


asset?๐Ÿ”น

Type: Asset (optional, default: no asset)

Asset for deployment.

The Amplify app must not have a sourceCodeProvider configured as this resource uses Amplify's startDeployment API to initiate and deploy a S3 asset onto the App.


autoBuild?๐Ÿ”น

Type: boolean (optional, default: true)

Whether to enable auto building for the branch.


basicAuth?๐Ÿ”น

Type: BasicAuth (optional, default: no password protection)

The Basic Auth configuration.

Use this to set password protection for the branch


branchName?๐Ÿ”น

Type: string (optional, default: the construct's id)

The name of the branch.


buildSpec?๐Ÿ”น

Type: BuildSpec (optional, default: no build spec)

BuildSpec for the branch.

See also: https://docs.aws.amazon.com/amplify/latest/userguide/build-settings.html


description?๐Ÿ”น

Type: string (optional, default: no description)

A description for the branch.


environmentVariables?๐Ÿ”น

Type: { [string]: string } (optional, default: application environment variables)

Environment variables for the branch.

All environment variables that you add are encrypted to prevent rogue access so you can use them to store secret information.


performanceMode?๐Ÿ”น

Type: boolean (optional, default: false)

Enables performance mode for the branch.

Performance mode optimizes for faster hosting performance by keeping content cached at the edge for a longer interval. When performance mode is enabled, hosting configuration or code changes can take up to 10 minutes to roll out.


pullRequestEnvironmentName?๐Ÿ”น

Type: string (optional, default: automatically provision a temporary backend)

The dedicated backend environment for the pull request previews.


pullRequestPreview?๐Ÿ”น

Type: boolean (optional, default: true)

Whether to enable pull request preview for the branch.


stage?๐Ÿ”น

Type: string (optional, default: no stage)

Stage for the branch.

Properties

NameTypeDescription
arn๐Ÿ”นstringThe ARN of the branch.
branchName๐Ÿ”นstringThe name of the branch.
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
node๐Ÿ”นNodeThe tree node.
stack๐Ÿ”นStackThe stack in which this resource is defined.

arn๐Ÿ”น

Type: string

The ARN of the branch.


branchName๐Ÿ”น

Type: string

The name of the branch.


env๐Ÿ”น

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


node๐Ÿ”น

Type: Node

The tree node.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
addEnvironment(name, value)๐Ÿ”นAdds an environment variable to this branch.
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
toString()๐Ÿ”นReturns a string representation of this construct.
static fromBranchName(scope, id, branchName)๐Ÿ”นImport an existing branch.

addEnvironment(name, value)๐Ÿ”น

public addEnvironment(name: string, value: string): Branch

Parameters

  • name string
  • value string

Returns

  • Branch

Adds an environment variable to this branch.

All environment variables that you add are encrypted to prevent rogue access so you can use them to store secret information.


applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromBranchName(scope, id, branchName)๐Ÿ”น

public static fromBranchName(scope: Construct, id: string, branchName: string): IBranch

Parameters

  • scope Construct
  • id string
  • branchName string

Returns

  • IBranch

Import an existing branch.