Code

class aws_cdk.aws_codecommit.Code

Bases: object

Represents the contents to initialize the repository with.

ExampleMetadata:

infused

Example:

repo = codecommit.Repository(self, "Repository",
    repository_name="MyRepositoryName",
    code=codecommit.Code.from_directory(path.join(__dirname, "directory/"), "develop")
)

Methods

abstract bind(scope)

This method is called after a repository is passed this instance of Code in its ‘code’ property.

Parameters:

scope (Construct) – the binding scope.

Return type:

CodeConfig

Static Methods

classmethod from_asset(asset, branch=None)

Code from user-supplied asset.

Parameters:
  • asset (Asset) – pre-existing asset.

  • branch (Optional[str]) – the name of the branch to create in the repository. Default is “main”

Return type:

Code

classmethod from_directory(directory_path, branch=None)

Code from directory.

Parameters:
  • directory_path (str) – the path to the local directory containing the contents to initialize the repository with.

  • branch (Optional[str]) – the name of the branch to create in the repository. Default is “main”

Return type:

Code

classmethod from_zip_file(file_path, branch=None)

Code from preexisting ZIP file.

Parameters:
  • file_path (str) – the path to the local ZIP file containing the contents to initialize the repository with.

  • branch (Optional[str]) – the name of the branch to create in the repository. Default is “main”

Return type:

Code