class Repository (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CodeCommit.Repository |
Java | software.amazon.awscdk.services.codecommit.Repository |
Python | aws_cdk.aws_codecommit.Repository |
TypeScript (source) | @aws-cdk/aws-codecommit » Repository |
Implements
IConstruct
, IConstruct
, IDependable
, IResource
, IRepository
, INotification
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],
},
],
});
Initializer
new Repository(scope: Construct, id: string, props: RepositoryProps)
Parameters
- scope
Construct
- id
string
- props
Repository
Props
Construct Props
Name | Type | Description |
---|---|---|
repository | string | Name of the repository. |
code? | Code | The contents with which to initialize the repository after it has been created. |
description? | string | A description of the repository. |
repositoryName
Type:
string
Name of the repository.
This property is required for all CodeCommit repositories.
code?
Type:
Code
(optional, default: No initialization (create empty repo))
The contents with which to initialize the repository after it has been created.
description?
Type:
string
(optional, default: No description.)
A description of the repository.
Use the description to identify the purpose of the repository.
Properties
Name | Type | Description |
---|---|---|
env | Resource | The environment this resource belongs to. |
node | Construct | The construct tree node associated with this construct. |
repository | string | The ARN of this Repository. |
repository | string | The HTTPS (GRC) clone URL. |
repository | string | The HTTP clone URL. |
repository | string | The SSH clone URL. |
repository | string | The human-visible name of this Repository. |
stack | Stack | The stack in which this resource is defined. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Construct
The construct tree node associated with this construct.
repositoryArn
Type:
string
The ARN of this Repository.
repositoryCloneUrlGrc
Type:
string
The HTTPS (GRC) clone URL.
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.
repositoryCloneUrlHttp
Type:
string
The HTTP clone URL.
repositoryCloneUrlSsh
Type:
string
The SSH clone URL.
repositoryName
Type:
string
The human-visible name of this Repository.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
bind | Returns a source configuration for notification rule. |
grant(grantee, ...actions) | Grant the given principal identity permissions to perform the actions on this repository. |
grant | Grant the given identity permissions to pull this repository. |
grant | Grant the given identity permissions to pull and push this repository. |
grant | Grant the given identity permissions to read this repository. |
notifiy | Defines a CodeStar Notification rule which triggers when a pull request is merged. |
notify(arn, options?) | Create a trigger to notify another service to run actions on repository events. |
notify | Defines a CodeStar Notification rule triggered when the project events specified by you are emitted. Similar to onEvent API. |
notify | Defines a CodeStar Notification rule which triggers when an approval rule is overridden. |
notify | Defines a CodeStar Notification rule which triggers when an approval status is changed. |
notify | Defines a CodeStar Notification rule which triggers when a new branch or tag is created. |
notify | Defines a CodeStar Notification rule which triggers when a branch or tag is deleted. |
notify | Defines a CodeStar Notification rule which triggers when a comment is made on a pull request. |
notify | Defines a CodeStar Notification rule which triggers when a pull request is created. |
notify | Defines a CodeStar Notification rule which triggers when a pull request is merged. |
on | Defines a CloudWatch event rule which triggers when a comment is made on a commit. |
on | Defines a CloudWatch event rule which triggers when a comment is made on a pull request. |
on | Defines a CloudWatch event rule which triggers when a commit is pushed to a branch. |
on | Defines a CloudWatch event rule which triggers for repository events. |
on | Defines a CloudWatch event rule which triggers when a pull request state is changed. |
on | Defines a CloudWatch event rule which triggers when a reference is created (i.e. a new branch/tag is created) to the repository. |
on | Defines a CloudWatch event rule which triggers when a reference is delete (i.e. a branch/tag is deleted) from the repository. |
on | Defines a CloudWatch event rule which triggers when a reference is updated (i.e. a commit is pushed to an existing or new branch) from the repository. |
on | Defines a CloudWatch event rule which triggers when a "CodeCommit Repository State Change" event occurs. |
to | Returns a string representation of this construct. |
static from | Imports a codecommit repository. |
static from |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
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
).
AsNotificationRuleSource(_scope)
bindpublic bindAsNotificationRuleSource(_scope: Construct): NotificationRuleSourceConfig
Parameters
- _scope
Construct
Returns
Returns a source configuration for notification rule.
grant(grantee, ...actions)
public grant(grantee: IGrantable, ...actions: string[]): Grant
Parameters
- grantee
IGrantable
- actions
string
Returns
Grant the given principal identity permissions to perform the actions on this repository.
Pull(grantee)
grantpublic grantPull(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
Returns
Grant the given identity permissions to pull this repository.
PullPush(grantee)
grantpublic grantPullPush(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
Returns
Grant the given identity permissions to pull and push this repository.
Read(grantee)
grantpublic grantRead(grantee: IGrantable): Grant
Parameters
- grantee
IGrantable
Returns
Grant the given identity permissions to read this repository.
OnPullRequestMerged(id, target, options?)
notifiypublic notifiyOnPullRequestMerged(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule
Parameters
- id
string
- target
INotification
Rule Target - options
Notification
Rule Options
Returns
Defines a CodeStar Notification rule which triggers when a pull request is merged.
notify(arn, options?)
public notify(arn: string, options?: RepositoryTriggerOptions): Repository
Parameters
- arn
string
— Arn of the resource that repository events will notify. - options
Repository
— Trigger options to run actions.Trigger Options
Returns
Create a trigger to notify another service to run actions on repository events.
On(id, target, options)
notifypublic notifyOn(id: string, target: INotificationRuleTarget, options: RepositoryNotifyOnOptions): INotificationRule
Parameters
- id
string
- target
INotification
Rule Target - options
Repository
Notify On Options
Returns
Defines a CodeStar Notification rule triggered when the project events specified by you are emitted. Similar to onEvent
API.
You can also use the methods to define rules for the specific event emitted.
eg: notifyOnPullRequstCreated
.
OnApprovalRuleOverridden(id, target, options?)
notifypublic notifyOnApprovalRuleOverridden(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule
Parameters
- id
string
- target
INotification
Rule Target - options
Notification
Rule Options
Returns
Defines a CodeStar Notification rule which triggers when an approval rule is overridden.
OnApprovalStatusChanged(id, target, options?)
notifypublic notifyOnApprovalStatusChanged(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule
Parameters
- id
string
- target
INotification
Rule Target - options
Notification
Rule Options
Returns
Defines a CodeStar Notification rule which triggers when an approval status is changed.
OnBranchOrTagCreated(id, target, options?)
notifypublic notifyOnBranchOrTagCreated(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule
Parameters
- id
string
- target
INotification
Rule Target - options
Notification
Rule Options
Returns
Defines a CodeStar Notification rule which triggers when a new branch or tag is created.
OnBranchOrTagDeleted(id, target, options?)
notifypublic notifyOnBranchOrTagDeleted(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule
Parameters
- id
string
- target
INotification
Rule Target - options
Notification
Rule Options
Returns
Defines a CodeStar Notification rule which triggers when a branch or tag is deleted.
OnPullRequestComment(id, target, options?)
notifypublic notifyOnPullRequestComment(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule
Parameters
- id
string
- target
INotification
Rule Target - options
Notification
Rule Options
Returns
Defines a CodeStar Notification rule which triggers when a comment is made on a pull request.
OnPullRequestCreated(id, target, options?)
notifypublic notifyOnPullRequestCreated(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule
Parameters
- id
string
- target
INotification
Rule Target - options
Notification
Rule Options
Returns
Defines a CodeStar Notification rule which triggers when a pull request is created.
OnPullRequestMerged(id, target, options?)
notifypublic notifyOnPullRequestMerged(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule
Parameters
- id
string
- target
INotification
Rule Target - options
Notification
Rule Options
Returns
Defines a CodeStar Notification rule which triggers when a pull request is merged.
CommentOnCommit(id, options?)
onpublic onCommentOnCommit(id: string, options?: OnEventOptions): Rule
Parameters
- id
string
- options
On
Event Options
Returns
Defines a CloudWatch event rule which triggers when a comment is made on a commit.
CommentOnPullRequest(id, options?)
onpublic onCommentOnPullRequest(id: string, options?: OnEventOptions): Rule
Parameters
- id
string
- options
On
Event Options
Returns
Defines a CloudWatch event rule which triggers when a comment is made on a pull request.
Commit(id, options?)
onpublic onCommit(id: string, options?: OnCommitOptions): Rule
Parameters
- id
string
- options
On
Commit Options
Returns
Defines a CloudWatch event rule which triggers when a commit is pushed to a branch.
Event(id, options?)
onpublic onEvent(id: string, options?: OnEventOptions): Rule
Parameters
- id
string
- options
On
Event Options
Returns
Defines a CloudWatch event rule which triggers for repository events.
Use
rule.addEventPattern(pattern)
to specify a filter.
PullRequestStateChange(id, options?)
onpublic onPullRequestStateChange(id: string, options?: OnEventOptions): Rule
Parameters
- id
string
- options
On
Event Options
Returns
Defines a CloudWatch event rule which triggers when a pull request state is changed.
ReferenceCreated(id, options?)
onpublic onReferenceCreated(id: string, options?: OnEventOptions): Rule
Parameters
- id
string
- options
On
Event Options
Returns
Defines a CloudWatch event rule which triggers when a reference is created (i.e. a new branch/tag is created) to the repository.
ReferenceDeleted(id, options?)
onpublic onReferenceDeleted(id: string, options?: OnEventOptions): Rule
Parameters
- id
string
- options
On
Event Options
Returns
Defines a CloudWatch event rule which triggers when a reference is delete (i.e. a branch/tag is deleted) from the repository.
ReferenceUpdated(id, options?)
onpublic onReferenceUpdated(id: string, options?: OnEventOptions): Rule
Parameters
- id
string
- options
On
Event Options
Returns
Defines a CloudWatch event rule which triggers when a reference is updated (i.e. a commit is pushed to an existing or new branch) from the repository.
StateChange(id, options?)
onpublic onStateChange(id: string, options?: OnEventOptions): Rule
Parameters
- id
string
- options
On
Event Options
Returns
Defines a CloudWatch event rule which triggers when a "CodeCommit Repository State Change" event occurs.
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
RepositoryArn(scope, id, repositoryArn)
static frompublic static fromRepositoryArn(scope: Construct, id: string, repositoryArn: string): IRepository
Parameters
- scope
Construct
- id
string
- repositoryArn
string
— (e.g.arn:aws:codecommit:us-east-1:123456789012:MyDemoRepo
).
Returns
Imports a codecommit repository.
RepositoryName(scope, id, repositoryName)
static frompublic static fromRepositoryName(scope: Construct, id: string, repositoryName: string): IRepository
Parameters
- scope
Construct
- id
string
- repositoryName
string
Returns