class Code
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CodeCommit.Code |
Java | software.amazon.awscdk.services.codecommit.Code |
Python | aws_cdk.aws_codecommit.Code |
TypeScript (source) | @aws-cdk/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
Name | Description |
---|---|
bind(scope) | This method is called after a repository is passed this instance of Code in its 'code' property. |
static from | Code from user-supplied asset. |
static from | Code from directory. |
static from | Code from preexisting ZIP file. |
bind(scope)
public bind(scope: Construct): CodeConfig
Parameters
- scope
Construct
— the binding scope.
Returns
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 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 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 from preexisting ZIP file.