# IRepository

Extends: IRepository
Extends: IResource, INotificationRuleSource, IRepositoryRef
Implemented by: Repository

- Source: [`aws-codecommit/lib/repository.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-codecommit/lib/repository.ts#L31)
- Type last changed: v2.227.0 · 21 Nov 2025

## Properties

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  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.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `repositoryArn`: string — The ARN of this Repository.

- `repositoryCloneUrlGrc`: 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`: string — The HTTP clone URL.

- `repositoryCloneUrlSsh`: string — The SSH clone URL.

- `repositoryName`: string — The human-visible name of this Repository.

- `repositoryRef`: [RepositoryReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_codecommit.RepositoryReference.html) — A reference to a Repository resource.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

## Methods

- `applyRemovalPolicy(policy: RemovalPolicy): void` — 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`).

- `bindAsNotificationRuleSource(scope: Construct): NotificationRuleSourceConfig` — Returns a source configuration for notification rule.

- `grant(grantee: IGrantable, ...actions: string[]): Grant` — Grant the given principal identity permissions to perform the actions on this repository.

- `grantPull(grantee: IGrantable): Grant` — Grant the given identity permissions to pull this repository.

- `grantPullPush(grantee: IGrantable): Grant` — Grant the given identity permissions to pull and push this repository.

- `grantRead(grantee: IGrantable): Grant` — Grant the given identity permissions to read this repository.

- `notifyOn(id: string, target: INotificationRuleTarget, options: RepositoryNotifyOnOptions): INotificationRule` — 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.
  e.g. `notifyOnPullRequestCreated`.

  **Returns:** CodeStar Notifications rule associated with this repository.

- `notifyOnApprovalRuleOverridden(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule` — Defines a CodeStar Notification rule which triggers when an approval rule is overridden.

- `notifyOnApprovalStatusChanged(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule` — Defines a CodeStar Notification rule which triggers when an approval status is changed.

- `notifyOnBranchOrTagCreated(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule` — Defines a CodeStar Notification rule which triggers when a new branch or tag is created.

- `notifyOnBranchOrTagDeleted(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule` — Defines a CodeStar Notification rule which triggers when a branch or tag is deleted.

- `notifyOnPullRequestComment(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule` — Defines a CodeStar Notification rule which triggers when a comment is made on a pull request.

- `notifyOnPullRequestCreated(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule` — Defines a CodeStar Notification rule which triggers when a pull request is created.

- `notifyOnPullRequestMerged(id: string, target: INotificationRuleTarget, options?: NotificationRuleOptions): INotificationRule` — Defines a CodeStar Notification rule which triggers when a pull request is merged.

- `onCommentOnCommit(id: string, options?: OnEventOptions): Rule` — Defines a CloudWatch event rule which triggers when a comment is made on a commit.

- `onCommentOnPullRequest(id: string, options?: OnEventOptions): Rule` — Defines a CloudWatch event rule which triggers when a comment is made on a pull request.

- `onCommit(id: string, options?: OnCommitOptions): Rule` — Defines a CloudWatch event rule which triggers when a commit is pushed to a branch.

- `onEvent(id: string, options?: OnEventOptions): Rule` — Defines a CloudWatch event rule which triggers for repository events.

  Use
  `rule.addEventPattern(pattern)` to specify a filter.

- `onPullRequestStateChange(id: string, options?: OnEventOptions): Rule` — Defines a CloudWatch event rule which triggers when a pull request state is changed.

- `onReferenceCreated(id: string, options?: OnEventOptions): Rule` — Defines a CloudWatch event rule which triggers when a reference is created (i.e. a new branch/tag is created) to the repository.

- `onReferenceDeleted(id: string, options?: OnEventOptions): Rule` — Defines a CloudWatch event rule which triggers when a reference is delete (i.e. a branch/tag is deleted) from the repository.

- `onReferenceUpdated(id: string, options?: OnEventOptions): Rule` — 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.

- `onStateChange(id: string, options?: OnEventOptions): Rule` — Defines a CloudWatch event rule which triggers when a "CodeCommit Repository State Change" event occurs.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  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.

  **Parameters**

  - `mixins` — The mixins to apply.

  **Returns:** This construct for chaining
