Skip to content
v2.277.0

Experimental

@aws-cdk/aws-cloud9-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

CloneRepository Class ​

The class for different repository providers.

Example ​

ts
import * as codecommit from 'aws-cdk-lib/aws-codecommit';

// create a codecommit repository to clone into the cloud9 environment
const repoNew = new codecommit.Repository(this, 'RepoNew', {
  repositoryName: 'new-repo',
});

// import an existing codecommit repository to clone into the cloud9 environment
const repoExisting = codecommit.Repository.fromRepositoryName(this, 'RepoExisting', 'existing-repo');

// create a new Cloud9 environment and clone the two repositories
declare const vpc: ec2.Vpc;
new cloud9.Ec2Environment(this, 'C9Env', {
  vpc,
  clonedRepositories: [
    cloud9.CloneRepository.fromCodeCommit(repoNew, '/src/new-repo'),
    cloud9.CloneRepository.fromCodeCommit(repoExisting, '/src/existing-repo'),
  ],
  imageId: cloud9.ImageId.AMAZON_LINUX_2,
});
python
import aws_cdk.aws_codecommit as codecommit

# create a new Cloud9 environment and clone the two repositories
# vpc: ec2.Vpc


# create a codecommit repository to clone into the cloud9 environment
repo_new = codecommit.Repository(self, "RepoNew",
    repository_name="new-repo"
)

# import an existing codecommit repository to clone into the cloud9 environment
repo_existing = codecommit.Repository.from_repository_name(self, "RepoExisting", "existing-repo")
cloud9.Ec2Environment(self, "C9Env",
    vpc=vpc,
    cloned_repositories=[
        cloud9.CloneRepository.from_code_commit(repo_new, "/src/new-repo"),
        cloud9.CloneRepository.from_code_commit(repo_existing, "/src/existing-repo")
    ],
    image_id=cloud9.ImageId.AMAZON_LINUX_2
)
java
import software.amazon.awscdk.services.codecommit.*;

// create a new Cloud9 environment and clone the two repositories
Vpc vpc;


// create a codecommit repository to clone into the cloud9 environment
Repository repoNew = Repository.Builder.create(this, "RepoNew")
        .repositoryName("new-repo")
        .build();

// import an existing codecommit repository to clone into the cloud9 environment
IRepository repoExisting = Repository.fromRepositoryName(this, "RepoExisting", "existing-repo");
Ec2Environment.Builder.create(this, "C9Env")
        .vpc(vpc)
        .clonedRepositories(List.of(CloneRepository.fromCodeCommit(repoNew, "/src/new-repo"), CloneRepository.fromCodeCommit(repoExisting, "/src/existing-repo")))
        .imageId(ImageId.AMAZON_LINUX_2)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.Cloud9.Alpha
using Amazon.CDK.AWS.CodeCommit;

// create a new Cloud9 environment and clone the two repositories
Vpc vpc;


// create a codecommit repository to clone into the cloud9 environment
var repoNew = new Repository(this, "RepoNew", new RepositoryProps {
    RepositoryName = "new-repo"
});

// import an existing codecommit repository to clone into the cloud9 environment
var repoExisting = Repository.FromRepositoryName(this, "RepoExisting", "existing-repo");
new Ec2Environment(this, "C9Env", new Ec2EnvironmentProps {
    Vpc = vpc,
    ClonedRepositories = new [] { CloneRepository.FromCodeCommit(repoNew, "/src/new-repo"), CloneRepository.FromCodeCommit(repoExisting, "/src/existing-repo") },
    ImageId = ImageId.AMAZON_LINUX_2
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkcloud9alpha/v2
import "github.com/aws/aws-cdk-go/awscdk"

// create a new Cloud9 environment and clone the two repositories
var vpc Vpc


// create a codecommit repository to clone into the cloud9 environment
repoNew := codecommit.NewRepository(this, jsii.String("RepoNew"), &RepositoryProps{
	RepositoryName: jsii.String("new-repo"),
})

// import an existing codecommit repository to clone into the cloud9 environment
repoExisting := codecommit.Repository_FromRepositoryName(this, jsii.String("RepoExisting"), jsii.String("existing-repo"))
cloud9.NewEc2Environment(this, jsii.String("C9Env"), &Ec2EnvironmentProps{
	Vpc: Vpc,
	ClonedRepositories: []CloneRepository{
		cloud9.CloneRepository_FromCodeCommit(repoNew, jsii.String("/src/new-repo")),
		cloud9.CloneRepository_*FromCodeCommit(repoExisting, jsii.String("/src/existing-repo")),
	},
	ImageId: cloud9.ImageId_AMAZON_LINUX_2,
})

Properties ​

pathComponentstringpath_componentstrpathComponentStringPathComponentstringPathComponent*string #
repositoryUrlstringrepository_urlstrrepositoryUrlStringRepositoryUrlstringRepositoryUrl*string #

Methods ​

fromCodeCommit(repository: IRepository, path: string): CloneRepository // chainable@staticmethod def from_code_commit(repository: IRepository, path: str) -> CloneRepositorypublic static CloneRepository fromCodeCommit(IRepository repository, String path)public static CloneRepository FromCodeCommit(IRepository repository, string path)func FromCodeCommit(Repository IRepository, Path *string) CloneRepository static #
import repository to cloud9 environment from AWS CodeCommit.
2 parameters

Parameters

  • repositoryrepositoryrepositoryrepositoryRepository — the codecommit repository to clone from.
  • pathpathpathpathPath — the target path in cloud9 environment.