Branch

class aws_cdk.aws_amplify_alpha.Branch(scope, id, *, app, asset=None, auto_build=None, basic_auth=None, branch_name=None, build_spec=None, description=None, environment_variables=None, performance_mode=None, pull_request_environment_name=None, pull_request_preview=None, stage=None)

Bases: Resource

(experimental) An Amplify Console branch.

Stability:

experimental

ExampleMetadata:

infused

Example:

# amplify_app: amplify.App


main = amplify_app.add_branch("main") # `id` will be used as repo branch name
dev = amplify_app.add_branch("dev",
    performance_mode=True
)
dev.add_environment("STAGE", "dev")
Parameters:
  • scope (Construct) –

  • id (str) –

  • app (IApp) – (experimental) The application within which the branch must be created.

  • asset (Optional[Asset]) – (experimental) 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. Default: - no asset

  • auto_build (Optional[bool]) – (experimental) Whether to enable auto building for the branch. Default: true

  • basic_auth (Optional[BasicAuth]) – (experimental) The Basic Auth configuration. Use this to set password protection for the branch Default: - no password protection

  • branch_name (Optional[str]) – (experimental) The name of the branch. Default: - the construct’s id

  • build_spec (Optional[BuildSpec]) – (experimental) BuildSpec for the branch. Default: - no build spec

  • description (Optional[str]) – (experimental) A description for the branch. Default: - no description

  • environment_variables (Optional[Mapping[str, str]]) – (experimental) 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. Default: - application environment variables

  • performance_mode (Optional[bool]) – (experimental) 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. Default: false

  • pull_request_environment_name (Optional[str]) – (experimental) The dedicated backend environment for the pull request previews. Default: - automatically provision a temporary backend

  • pull_request_preview (Optional[bool]) – (experimental) Whether to enable pull request preview for the branch. Default: true

  • stage (Optional[str]) – (experimental) Stage for the branch. Default: - no stage

Stability:

experimental

Methods

add_environment(name, value)

(experimental) 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.

Parameters:
  • name (str) –

  • value (str) –

Stability:

experimental

Return type:

Branch

apply_removal_policy(policy)

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).

Parameters:

policy (RemovalPolicy) –

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

arn

(experimental) The ARN of the branch.

Stability:

experimental

Attribute:

true

branch_name

(experimental) The name of the branch.

Stability:

experimental

env

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

The tree node.

stack

The stack in which this resource is defined.

Static Methods

classmethod from_branch_name(scope, id, branch_name)

(experimental) Import an existing branch.

Parameters:
  • scope (Construct) –

  • id (str) –

  • branch_name (str) –

Stability:

experimental

Return type:

IBranch

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool