Repository L2 construct
Provides a CodeCommit Repository.
Example
declare const project: codebuild.PipelineProject;
const repository = new codecommit.Repository(this, 'MyRepository', {
repositoryName: 'MyRepository',
});
const project = new codebuild.PipelineProject(this, 'MyProject');
const sourceOutput = new codepipeline.Artifact();
const sourceAction = new codepipeline_actions.CodeCommitSourceAction({
actionName: 'CodeCommit',
repository,
output: sourceOutput,
});
const buildAction = new codepipeline_actions.CodeBuildAction({
actionName: 'CodeBuild',
project,
input: sourceOutput,
outputs: [new codepipeline.Artifact()], // optional
executeBatchBuild: true, // optional, defaults to false
combineBatchBuildArtifacts: true, // optional, defaults to false
});
new codepipeline.Pipeline(this, 'MyPipeline', {
stages: [
{
stageName: 'Source',
actions: [sourceAction],
},
{
stageName: 'Build',
actions: [buildAction],
},
],
});
# project: codebuild.PipelineProject
repository = codecommit.Repository(self, "MyRepository",
repository_name="MyRepository"
)
project = codebuild.PipelineProject(self, "MyProject")
source_output = codepipeline.Artifact()
source_action = codepipeline_actions.CodeCommitSourceAction(
action_name="CodeCommit",
repository=repository,
output=source_output
)
build_action = codepipeline_actions.CodeBuildAction(
action_name="CodeBuild",
project=project,
input=source_output,
outputs=[codepipeline.Artifact()], # optional
execute_batch_build=True, # optional, defaults to false
combine_batch_build_artifacts=True
)
codepipeline.Pipeline(self, "MyPipeline",
stages=[codepipeline.StageProps(
stage_name="Source",
actions=[source_action]
), codepipeline.StageProps(
stage_name="Build",
actions=[build_action]
)
]
)
PipelineProject project;
Repository repository = Repository.Builder.create(this, "MyRepository")
.repositoryName("MyRepository")
.build();
PipelineProject project = new PipelineProject(this, "MyProject");
Artifact sourceOutput = new Artifact();
CodeCommitSourceAction sourceAction = CodeCommitSourceAction.Builder.create()
.actionName("CodeCommit")
.repository(repository)
.output(sourceOutput)
.build();
CodeBuildAction buildAction = CodeBuildAction.Builder.create()
.actionName("CodeBuild")
.project(project)
.input(sourceOutput)
.outputs(List.of(new Artifact())) // optional
.executeBatchBuild(true) // optional, defaults to false
.combineBatchBuildArtifacts(true)
.build();
Pipeline.Builder.create(this, "MyPipeline")
.stages(List.of(StageProps.builder()
.stageName("Source")
.actions(List.of(sourceAction))
.build(), StageProps.builder()
.stageName("Build")
.actions(List.of(buildAction))
.build()))
.build();
// Install: dotnet add package Amazon.CDK.Lib
PipelineProject project;
var repository = new Repository(this, "MyRepository", new RepositoryProps {
RepositoryName = "MyRepository"
});
var project = new PipelineProject(this, "MyProject");
var sourceOutput = new Artifact();
var sourceAction = new CodeCommitSourceAction(new CodeCommitSourceActionProps {
ActionName = "CodeCommit",
Repository = repository,
Output = sourceOutput
});
var buildAction = new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CodeBuild",
Project = project,
Input = sourceOutput,
Outputs = new [] { new Artifact() }, // optional
ExecuteBatchBuild = true, // optional, defaults to false
CombineBatchBuildArtifacts = true
});
new Pipeline(this, "MyPipeline", new PipelineProps {
Stages = new [] { new StageProps {
StageName = "Source",
Actions = new [] { sourceAction }
}, new StageProps {
StageName = "Build",
Actions = new [] { buildAction }
} }
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var project PipelineProject
repository := codecommit.NewRepository(this, jsii.String("MyRepository"), &RepositoryProps{
RepositoryName: jsii.String("MyRepository"),
})
project := codebuild.NewPipelineProject(this, jsii.String("MyProject"))
sourceOutput := codepipeline.NewArtifact()
sourceAction := codepipeline_actions.NewCodeCommitSourceAction(&CodeCommitSourceActionProps{
ActionName: jsii.String("CodeCommit"),
Repository: Repository,
Output: sourceOutput,
})
buildAction := codepipeline_actions.NewCodeBuildAction(&CodeBuildActionProps{
ActionName: jsii.String("CodeBuild"),
Project: Project,
Input: sourceOutput,
Outputs: []Artifact{
codepipeline.NewArtifact(),
},
// optional
ExecuteBatchBuild: jsii.Boolean(true),
// optional, defaults to false
CombineBatchBuildArtifacts: jsii.Boolean(true),
})
codepipeline.NewPipeline(this, jsii.String("MyPipeline"), &PipelineProps{
Stages: []StageProps{
&StageProps{
StageName: jsii.String("Source"),
Actions: []IAction{
sourceAction,
},
},
&StageProps{
StageName: jsii.String("Build"),
Actions: []IAction{
buildAction,
},
},
},
})
Initializer
new Repository(scope: Construct, id: string, props: RepositoryProps)
Repository(scope: Construct, id: str, props: RepositoryProps)
new Repository(Construct scope, String id, RepositoryProps props)
new Repository(Construct scope, string id, RepositoryProps props)
NewRepository(Scope Construct, Id *string, Props RepositoryProps)
Construct Props
default
Default: No initialization (create empty repo)
descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string= No description.#Use the description to identify the purpose of the repository.
repositoryNamestringrepository_namestrrepositoryNameStringRepositoryNamestringRepositoryName*stringrequired#This property is required for all CodeCommit repositories.
Properties
envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironmentrequired#notes
For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.
grantsRepositoryGrantsgrantsRepositoryGrantsgrantsRepositoryGrantsGrantsRepositoryGrantsGrantsRepositoryGrantsrequired#PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#repositoryArnstringrepository_arnstrrepositoryArnStringRepositoryArnstringRepositoryArn*stringrequired#repositoryCloneUrlGrcstringrepository_clone_url_grcstrrepositoryCloneUrlGrcStringRepositoryCloneUrlGrcstringRepositoryCloneUrlGrc*stringrequired#HTTPS (GRC) is the protocol to use with git-remote-codecommit (GRC).
It is the recommended method for supporting connections made with federated access, identity providers, and temporary credentials.
repositoryCloneUrlHttpstringrepository_clone_url_httpstrrepositoryCloneUrlHttpStringRepositoryCloneUrlHttpstringRepositoryCloneUrlHttp*stringrequired#repositoryCloneUrlSshstringrepository_clone_url_sshstrrepositoryCloneUrlSshStringRepositoryCloneUrlSshstringRepositoryCloneUrlSsh*stringrequired#repositoryNamestringrepository_namestrrepositoryNameStringRepositoryNamestringRepositoryName*stringrequired#repositoryRefRepositoryReferencerepository_refRepositoryReferencerepositoryRefRepositoryReferenceRepositoryRefRepositoryReferenceRepositoryRefRepositoryReferencerequired#Methods
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#notes · 1 parameter
When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#notes
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).
bindAsNotificationRuleSource(_scope: Construct): NotificationRuleSourceConfigdef bind_as_notification_rule_source(self, _scope: Construct) -> NotificationRuleSourceConfigpublic NotificationRuleSourceConfig bindAsNotificationRuleSource(Construct _scope)public NotificationRuleSourceConfig BindAsNotificationRuleSource(Construct _scope)func BindAsNotificationRuleSource(_scope Construct) NotificationRuleSourceConfig#fromRepositoryArn(scope: Construct, id: string, repositoryArn: string): IRepository@staticmethod def from_repository_arn(scope: Construct, id: str, repository_arn: str) -> IRepositorypublic static IRepository fromRepositoryArn(Construct scope, String id, String repositoryArn)public static IRepository FromRepositoryArn(Construct scope, string id, string repositoryArn)func FromRepositoryArn(Scope Construct, Id *string, RepositoryArn *string) IRepositorystatic#1 parameter
Parameters
repositoryArnrepository_arnrepositoryArnrepositoryArnRepositoryArn— (e.g.arn:aws:codecommit:us-east-1:123456789012:MyDemoRepo).
fromRepositoryName(scope: Construct, id: string, repositoryName: string): IRepository@staticmethod def from_repository_name(scope: Construct, id: str, repository_name: str) -> IRepositorypublic static IRepository fromRepositoryName(Construct scope, String id, String repositoryName)public static IRepository FromRepositoryName(Construct scope, string id, string repositoryName)func FromRepositoryName(Scope Construct, Id *string, RepositoryName *string) IRepositorystatic#grant(grantee: IGrantable, ...actions: string[]): Grantdef grant(self, grantee: IGrantable, actions: str) -> Grantpublic Grant grant(IGrantable grantee, String actions)public Grant Grant(IGrantable grantee, string actions)func Grant(Grantee IGrantable, Actions *string) Grant#grantPull(grantee: IGrantable): Grantdef grant_pull(self, grantee: IGrantable) -> Grantpublic Grant grantPull(IGrantable grantee)public Grant GrantPull(IGrantable grantee)func GrantPull(Grantee IGrantable) Grant#[disable-awslint:no-grants]
grantPullPush(grantee: IGrantable): Grantdef grant_pull_push(self, grantee: IGrantable) -> Grantpublic Grant grantPullPush(IGrantable grantee)public Grant GrantPullPush(IGrantable grantee)func GrantPullPush(Grantee IGrantable) Grant#[disable-awslint:no-grants]
grantRead(grantee: IGrantable): Grantdef grant_read(self, grantee: IGrantable) -> Grantpublic Grant grantRead(IGrantable grantee)public Grant GrantRead(IGrantable grantee)func GrantRead(Grantee IGrantable) Grant#[disable-awslint:no-grants]
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#notifiyOnPullRequestMerged(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRuledef notifiy_on_pull_request_merged(self, id: str, target: INotificationRuleTarget, options: typing.Optional[NotificationRuleOptions] = None) -> INotificationRulepublic INotificationRule notifiyOnPullRequestMerged(String id, INotificationRuleTarget target, NotificationRuleOptions options)public INotificationRule NotifiyOnPullRequestMerged(string id, INotificationRuleTarget target, NotificationRuleOptions? options = null)func NotifiyOnPullRequestMerged(Id *string, Target INotificationRuleTarget, Options NotificationRuleOptions) INotificationRule#notify(arn: string, options?: RepositoryTriggerOptions): Repository // chainabledef notify(self, arn: str, options: typing.Optional[RepositoryTriggerOptions] = None) -> Repositorypublic Repository notify(String arn, RepositoryTriggerOptions options)public Repository Notify(string arn, RepositoryTriggerOptions? options = null)func Notify(Arn *string, Options RepositoryTriggerOptions) Repository#2 parameters
Parameters
arnarnarnarnArn— Arn of the resource that repository events will notify.optionsoptionsoptionsoptionsOptions— Trigger options to run actions.
notifyOn(id: string, target: INotificationRuleTarget, options: RepositoryNotifyOnOptions): INotificationRuledef notify_on(self, id: str, target: INotificationRuleTarget, options: RepositoryNotifyOnOptions) -> INotificationRulepublic INotificationRule notifyOn(String id, INotificationRuleTarget target, RepositoryNotifyOnOptions options)public INotificationRule NotifyOn(string id, INotificationRuleTarget target, RepositoryNotifyOnOptions options)func NotifyOn(Id *string, Target INotificationRuleTarget, Options RepositoryNotifyOnOptions) INotificationRule#You can also use the methods to define rules for the specific event emitted. e.g. notifyOnPullRequestCreated.
notifyOnApprovalRuleOverridden(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRuledef notify_on_approval_rule_overridden(self, id: str, target: INotificationRuleTarget, options: typing.Optional[NotificationRuleOptions] = None) -> INotificationRulepublic INotificationRule notifyOnApprovalRuleOverridden(String id, INotificationRuleTarget target, NotificationRuleOptions options)public INotificationRule NotifyOnApprovalRuleOverridden(string id, INotificationRuleTarget target, NotificationRuleOptions? options = null)func NotifyOnApprovalRuleOverridden(Id *string, Target INotificationRuleTarget, Options NotificationRuleOptions) INotificationRule#notifyOnApprovalStatusChanged(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRuledef notify_on_approval_status_changed(self, id: str, target: INotificationRuleTarget, options: typing.Optional[NotificationRuleOptions] = None) -> INotificationRulepublic INotificationRule notifyOnApprovalStatusChanged(String id, INotificationRuleTarget target, NotificationRuleOptions options)public INotificationRule NotifyOnApprovalStatusChanged(string id, INotificationRuleTarget target, NotificationRuleOptions? options = null)func NotifyOnApprovalStatusChanged(Id *string, Target INotificationRuleTarget, Options NotificationRuleOptions) INotificationRule#notifyOnBranchOrTagCreated(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRuledef notify_on_branch_or_tag_created(self, id: str, target: INotificationRuleTarget, options: typing.Optional[NotificationRuleOptions] = None) -> INotificationRulepublic INotificationRule notifyOnBranchOrTagCreated(String id, INotificationRuleTarget target, NotificationRuleOptions options)public INotificationRule NotifyOnBranchOrTagCreated(string id, INotificationRuleTarget target, NotificationRuleOptions? options = null)func NotifyOnBranchOrTagCreated(Id *string, Target INotificationRuleTarget, Options NotificationRuleOptions) INotificationRule#notifyOnBranchOrTagDeleted(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRuledef notify_on_branch_or_tag_deleted(self, id: str, target: INotificationRuleTarget, options: typing.Optional[NotificationRuleOptions] = None) -> INotificationRulepublic INotificationRule notifyOnBranchOrTagDeleted(String id, INotificationRuleTarget target, NotificationRuleOptions options)public INotificationRule NotifyOnBranchOrTagDeleted(string id, INotificationRuleTarget target, NotificationRuleOptions? options = null)func NotifyOnBranchOrTagDeleted(Id *string, Target INotificationRuleTarget, Options NotificationRuleOptions) INotificationRule#notifyOnPullRequestComment(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRuledef notify_on_pull_request_comment(self, id: str, target: INotificationRuleTarget, options: typing.Optional[NotificationRuleOptions] = None) -> INotificationRulepublic INotificationRule notifyOnPullRequestComment(String id, INotificationRuleTarget target, NotificationRuleOptions options)public INotificationRule NotifyOnPullRequestComment(string id, INotificationRuleTarget target, NotificationRuleOptions? options = null)func NotifyOnPullRequestComment(Id *string, Target INotificationRuleTarget, Options NotificationRuleOptions) INotificationRule#notifyOnPullRequestCreated(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRuledef notify_on_pull_request_created(self, id: str, target: INotificationRuleTarget, options: typing.Optional[NotificationRuleOptions] = None) -> INotificationRulepublic INotificationRule notifyOnPullRequestCreated(String id, INotificationRuleTarget target, NotificationRuleOptions options)public INotificationRule NotifyOnPullRequestCreated(string id, INotificationRuleTarget target, NotificationRuleOptions? options = null)func NotifyOnPullRequestCreated(Id *string, Target INotificationRuleTarget, Options NotificationRuleOptions) INotificationRule#notifyOnPullRequestMerged(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRuledef notify_on_pull_request_merged(self, id: str, target: INotificationRuleTarget, options: typing.Optional[NotificationRuleOptions] = None) -> INotificationRulepublic INotificationRule notifyOnPullRequestMerged(String id, INotificationRuleTarget target, NotificationRuleOptions options)public INotificationRule NotifyOnPullRequestMerged(string id, INotificationRuleTarget target, NotificationRuleOptions? options = null)func NotifyOnPullRequestMerged(Id *string, Target INotificationRuleTarget, Options NotificationRuleOptions) INotificationRule#onCommentOnCommit(id: string, options?: OnEventOptions): Ruledef on_comment_on_commit(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onCommentOnCommit(String id, OnEventOptions options)public Rule OnCommentOnCommit(string id, OnEventOptions? options = null)func OnCommentOnCommit(Id *string, Options OnEventOptions) Rule#onCommentOnPullRequest(id: string, options?: OnEventOptions): Ruledef on_comment_on_pull_request(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onCommentOnPullRequest(String id, OnEventOptions options)public Rule OnCommentOnPullRequest(string id, OnEventOptions? options = null)func OnCommentOnPullRequest(Id *string, Options OnEventOptions) Rule#onCommit(id: string, options?: OnCommitOptions): Ruledef on_commit(self, id: str, options: typing.Optional[OnCommitOptions] = None) -> Rulepublic Rule onCommit(String id, OnCommitOptions options)public Rule OnCommit(string id, OnCommitOptions? options = null)func OnCommit(Id *string, Options OnCommitOptions) Rule#onEvent(id: string, options?: OnEventOptions): Ruledef on_event(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onEvent(String id, OnEventOptions options)public Rule OnEvent(string id, OnEventOptions? options = null)func OnEvent(Id *string, Options OnEventOptions) Rule#Use rule.addEventPattern(pattern) to specify a filter.
onPullRequestStateChange(id: string, options?: OnEventOptions): Ruledef on_pull_request_state_change(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onPullRequestStateChange(String id, OnEventOptions options)public Rule OnPullRequestStateChange(string id, OnEventOptions? options = null)func OnPullRequestStateChange(Id *string, Options OnEventOptions) Rule#onReferenceCreated(id: string, options?: OnEventOptions): Ruledef on_reference_created(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onReferenceCreated(String id, OnEventOptions options)public Rule OnReferenceCreated(string id, OnEventOptions? options = null)func OnReferenceCreated(Id *string, Options OnEventOptions) Rule#onReferenceDeleted(id: string, options?: OnEventOptions): Ruledef on_reference_deleted(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onReferenceDeleted(String id, OnEventOptions options)public Rule OnReferenceDeleted(string id, OnEventOptions? options = null)func OnReferenceDeleted(Id *string, Options OnEventOptions) Rule#onReferenceUpdated(id: string, options?: OnEventOptions): Ruledef on_reference_updated(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onReferenceUpdated(String id, OnEventOptions options)public Rule OnReferenceUpdated(string id, OnEventOptions? options = null)func OnReferenceUpdated(Id *string, Options OnEventOptions) Rule#onStateChange(id: string, options?: OnEventOptions): Ruledef on_state_change(self, id: str, options: typing.Optional[OnEventOptions] = None) -> Rulepublic Rule onStateChange(String id, OnEventOptions options)public Rule OnStateChange(string id, OnEventOptions? options = null)func OnStateChange(Id *string, Options OnEventOptions) Rule#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.