aws-cdk-lib.aws_codecommit.Code

class Code

LanguageType name
.NETAmazon.CDK.AWS.CodeCommit.Code
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscodecommit#Code
Javasoftware.amazon.awscdk.services.codecommit.Code
Pythonaws_cdk.aws_codecommit.Code
TypeScript (source)aws-cdk-lib » aws_codecommit » Code

Represents the contents to initialize the repository with.

Example

const repo = new codecommit.Repository(this, 'Repository', {
  repositoryName: 'MyRepositoryName',
  code: codecommit.Code.fromDirectory(path.join(__dirname, 'directory/'), 'develop'), // optional property, branch parameter can be omitted
});

Initializer

new Code()

Methods

NameDescription
bind(scope)This method is called after a repository is passed this instance of Code in its 'code' property.
static fromAsset(asset, branch?)Code from user-supplied asset.
static fromDirectory(directoryPath, branch?)Code from directory.
static fromZipFile(filePath, branch?)Code from preexisting ZIP file.

bind(scope)

public bind(scope: Construct): CodeConfig

Parameters

  • scope Construct — the binding scope.

Returns

  • CodeConfig

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


static fromAsset(asset, branch?)

public static fromAsset(asset: Asset, branch?: string): Code

Parameters

  • asset Asset — pre-existing asset.
  • branch string — the name of the branch to create in the repository.

Returns

  • Code

Code from user-supplied asset.


static fromDirectory(directoryPath, branch?)

public static fromDirectory(directoryPath: string, branch?: string): Code

Parameters

  • directoryPath string — the path to the local directory containing the contents to initialize the repository with.
  • branch string — the name of the branch to create in the repository.

Returns

  • Code

Code from directory.


static fromZipFile(filePath, branch?)

public static fromZipFile(filePath: string, branch?: string): Code

Parameters

  • filePath string — the path to the local ZIP file containing the contents to initialize the repository with.
  • branch string — the name of the branch to create in the repository.

Returns

  • Code

Code from preexisting ZIP file.