Code Class
Represents the contents to initialize the repository with.
Example
ts
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
ts
new Code()
python
Code()
java
new Code()
csharp
new Code()
go
NewCode()
Methods
bind(scope: Construct): CodeConfigdef bind(self, scope: Construct) -> CodeConfigpublic CodeConfig bind(Construct scope)public CodeConfig Bind(Construct scope)func Bind(Scope Construct) CodeConfig#This method is called after a repository is passed this instance of Code in its 'code' property.
1 parameter
Parameters
scopescopescopescopeScope— the binding scope.
fromAsset(asset: Asset, branch?: string): Code // chainable@staticmethod def from_asset(asset: Asset, branch: typing.Optional[str] = None) -> Codepublic static Code fromAsset(Asset asset, String branch)public static Code FromAsset(Asset asset, string? branch = null)func FromAsset(Asset Asset, Branch *string) Codestatic#Code from user-supplied asset.
2 parameters
Parameters
assetassetassetassetAsset— pre-existing asset.branchbranchbranchbranchBranch— the name of the branch to create in the repository.
fromDirectory(directoryPath: string, branch?: string): Code // chainable@staticmethod def from_directory(directory_path: str, branch: typing.Optional[str] = None) -> Codepublic static Code fromDirectory(String directoryPath, String branch)public static Code FromDirectory(string directoryPath, string? branch = null)func FromDirectory(DirectoryPath *string, Branch *string) Codestatic#Code from directory.
2 parameters
Parameters
directoryPathdirectory_pathdirectoryPathdirectoryPathDirectoryPath— the path to the local directory containing the contents to initialize the repository with.branchbranchbranchbranchBranch— the name of the branch to create in the repository.
fromZipFile(filePath: string, branch?: string): Code // chainable@staticmethod def from_zip_file(file_path: str, branch: typing.Optional[str] = None) -> Codepublic static Code fromZipFile(String filePath, String branch)public static Code FromZipFile(string filePath, string? branch = null)func FromZipFile(FilePath *string, Branch *string) Codestatic#Code from preexisting ZIP file.
2 parameters
Parameters
filePathfile_pathfilePathfilePathFilePath— the path to the local ZIP file containing the contents to initialize the repository with.branchbranchbranchbranchBranch— the name of the branch to create in the repository.