Class Repository
Provides a CodeCommit Repository.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.CodeCommit
Assembly: Amazon.CDK.AWS.CodeCommit.dll
Syntax (csharp)
public class Repository : Resource, IRepository, IResource, IConstruct, IDependable, INotificationRuleSourceSyntax (vb)
Public Class Repository
    Inherits Resource
    Implements IRepository, IResource, IConstruct, IDependable, INotificationRuleSourceRemarks
ExampleMetadata: infused
Examples
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 }
    } }
});Synopsis
Constructors
| Repository(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference | 
| Repository(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps | 
| Repository(Construct, String, IRepositoryProps) | 
Properties
| RepositoryArn | The ARN of this Repository. | 
| RepositoryCloneUrlGrc | The HTTPS (GRC) clone URL. | 
| RepositoryCloneUrlHttp | The HTTP clone URL. | 
| RepositoryCloneUrlSsh | The SSH clone URL. | 
| RepositoryName | The human-visible name of this Repository. | 
Methods
| BindAsNotificationRuleSource(Construct) | Returns a source configuration for notification rule. | 
| FromRepositoryArn(Construct, String, String) | Imports a codecommit repository. | 
| FromRepositoryName(Construct, String, String) | |
| Grant(IGrantable, String[]) | Grant the given principal identity permissions to perform the actions on this repository. | 
| GrantPull(IGrantable) | Grant the given identity permissions to pull this repository. | 
| GrantPullPush(IGrantable) | Grant the given identity permissions to pull and push this repository. | 
| GrantRead(IGrantable) | Grant the given identity permissions to read this repository. | 
| NotifiyOnPullRequestMerged(String, INotificationRuleTarget, INotificationRuleOptions) | Defines a CodeStar Notification rule which triggers when a pull request is merged. | 
| Notify(String, IRepositoryTriggerOptions) | Create a trigger to notify another service to run actions on repository events. | 
| NotifyOn(String, INotificationRuleTarget, IRepositoryNotifyOnOptions) | Defines a CodeStar Notification rule triggered when the project events specified by you are emitted. Similar to  | 
| NotifyOnApprovalRuleOverridden(String, INotificationRuleTarget, INotificationRuleOptions) | Defines a CodeStar Notification rule which triggers when an approval rule is overridden. | 
| NotifyOnApprovalStatusChanged(String, INotificationRuleTarget, INotificationRuleOptions) | Defines a CodeStar Notification rule which triggers when an approval status is changed. | 
| NotifyOnBranchOrTagCreated(String, INotificationRuleTarget, INotificationRuleOptions) | Defines a CodeStar Notification rule which triggers when a new branch or tag is created. | 
| NotifyOnBranchOrTagDeleted(String, INotificationRuleTarget, INotificationRuleOptions) | Defines a CodeStar Notification rule which triggers when a branch or tag is deleted. | 
| NotifyOnPullRequestComment(String, INotificationRuleTarget, INotificationRuleOptions) | Defines a CodeStar Notification rule which triggers when a comment is made on a pull request. | 
| NotifyOnPullRequestCreated(String, INotificationRuleTarget, INotificationRuleOptions) | Defines a CodeStar Notification rule which triggers when a pull request is created. | 
| NotifyOnPullRequestMerged(String, INotificationRuleTarget, INotificationRuleOptions) | Defines a CodeStar Notification rule which triggers when a pull request is merged. | 
| OnCommentOnCommit(String, IOnEventOptions) | Defines a CloudWatch event rule which triggers when a comment is made on a commit. | 
| OnCommentOnPullRequest(String, IOnEventOptions) | Defines a CloudWatch event rule which triggers when a comment is made on a pull request. | 
| OnCommit(String, IOnCommitOptions) | Defines a CloudWatch event rule which triggers when a commit is pushed to a branch. | 
| OnEvent(String, IOnEventOptions) | Defines a CloudWatch event rule which triggers for repository events. | 
| OnPullRequestStateChange(String, IOnEventOptions) | Defines a CloudWatch event rule which triggers when a pull request state is changed. | 
| OnReferenceCreated(String, IOnEventOptions) | Defines a CloudWatch event rule which triggers when a reference is created (i.e. a new branch/tag is created) to the repository. | 
| OnReferenceDeleted(String, IOnEventOptions) | Defines a CloudWatch event rule which triggers when a reference is delete (i.e. a branch/tag is deleted) from the repository. | 
| OnReferenceUpdated(String, IOnEventOptions) | 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(String, IOnEventOptions) | Defines a CloudWatch event rule which triggers when a "CodeCommit Repository State Change" event occurs. | 
Constructors
Repository(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Repository(ByRefValue reference)Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
- The Javascript-owned object reference 
Repository(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Repository(DeputyBase.DeputyProps props)Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
- The deputy props 
Repository(Construct, String, IRepositoryProps)
public Repository(Construct scope, string id, IRepositoryProps props)Parameters
- scope Constructs.Construct
- id System.String
- props IRepositoryProps
Properties
RepositoryArn
The ARN of this Repository.
public virtual string RepositoryArn { get; }Property Value
System.String
RepositoryCloneUrlGrc
The HTTPS (GRC) clone URL.
public virtual string RepositoryCloneUrlGrc { get; }Property Value
System.String
Remarks
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
The HTTP clone URL.
public virtual string RepositoryCloneUrlHttp { get; }Property Value
System.String
RepositoryCloneUrlSsh
The SSH clone URL.
public virtual string RepositoryCloneUrlSsh { get; }Property Value
System.String
RepositoryName
The human-visible name of this Repository.
public virtual string RepositoryName { get; }Property Value
System.String
Methods
BindAsNotificationRuleSource(Construct)
Returns a source configuration for notification rule.
public virtual INotificationRuleSourceConfig BindAsNotificationRuleSource(Construct scope)Parameters
- scope Constructs.Construct
Returns
FromRepositoryArn(Construct, String, String)
Imports a codecommit repository.
public static IRepository FromRepositoryArn(Construct scope, string id, string repositoryArn)Parameters
- scope Constructs.Construct
- id System.String
- repositoryArn System.String
- (e.g. - arn:aws:codecommit:us-east-1:123456789012:MyDemoRepo).
Returns
FromRepositoryName(Construct, String, String)
public static IRepository FromRepositoryName(Construct scope, string id, string repositoryName)Parameters
- scope Constructs.Construct
- id System.String
- repositoryName System.String
Returns
Grant(IGrantable, String[])
Grant the given principal identity permissions to perform the actions on this repository.
public virtual Grant Grant(IGrantable grantee, params string[] actions)Parameters
- grantee IGrantable
- actions System.String[]
Returns
GrantPull(IGrantable)
Grant the given identity permissions to pull this repository.
public virtual Grant GrantPull(IGrantable grantee)Parameters
- grantee IGrantable
Returns
GrantPullPush(IGrantable)
Grant the given identity permissions to pull and push this repository.
public virtual Grant GrantPullPush(IGrantable grantee)Parameters
- grantee IGrantable
Returns
GrantRead(IGrantable)
Grant the given identity permissions to read this repository.
public virtual Grant GrantRead(IGrantable grantee)Parameters
- grantee IGrantable
Returns
NotifiyOnPullRequestMerged(String, INotificationRuleTarget, INotificationRuleOptions)
Defines a CodeStar Notification rule which triggers when a pull request is merged.
public virtual INotificationRule NotifiyOnPullRequestMerged(string id, INotificationRuleTarget target, INotificationRuleOptions options = null)Parameters
- id System.String
- target INotificationRuleTarget
- options INotificationRuleOptions
Returns
Notify(String, IRepositoryTriggerOptions)
Create a trigger to notify another service to run actions on repository events.
public virtual Repository Notify(string arn, IRepositoryTriggerOptions options = null)Parameters
- arn System.String
- Arn of the resource that repository events will notify. 
- options IRepositoryTriggerOptions
- Trigger options to run actions. 
Returns
NotifyOn(String, INotificationRuleTarget, IRepositoryNotifyOnOptions)
Defines a CodeStar Notification rule triggered when the project events specified by you are emitted. Similar to onEvent API.
public virtual INotificationRule NotifyOn(string id, INotificationRuleTarget target, IRepositoryNotifyOnOptions options)Parameters
- id System.String
- target INotificationRuleTarget
- options IRepositoryNotifyOnOptions
Returns
Remarks
You can also use the methods to define rules for the specific event emitted.
eg: notifyOnPullRequstCreated.
NotifyOnApprovalRuleOverridden(String, INotificationRuleTarget, INotificationRuleOptions)
Defines a CodeStar Notification rule which triggers when an approval rule is overridden.
public virtual INotificationRule NotifyOnApprovalRuleOverridden(string id, INotificationRuleTarget target, INotificationRuleOptions options = null)Parameters
- id System.String
- target INotificationRuleTarget
- options INotificationRuleOptions
Returns
NotifyOnApprovalStatusChanged(String, INotificationRuleTarget, INotificationRuleOptions)
Defines a CodeStar Notification rule which triggers when an approval status is changed.
public virtual INotificationRule NotifyOnApprovalStatusChanged(string id, INotificationRuleTarget target, INotificationRuleOptions options = null)Parameters
- id System.String
- target INotificationRuleTarget
- options INotificationRuleOptions
Returns
NotifyOnBranchOrTagCreated(String, INotificationRuleTarget, INotificationRuleOptions)
Defines a CodeStar Notification rule which triggers when a new branch or tag is created.
public virtual INotificationRule NotifyOnBranchOrTagCreated(string id, INotificationRuleTarget target, INotificationRuleOptions options = null)Parameters
- id System.String
- target INotificationRuleTarget
- options INotificationRuleOptions
Returns
NotifyOnBranchOrTagDeleted(String, INotificationRuleTarget, INotificationRuleOptions)
Defines a CodeStar Notification rule which triggers when a branch or tag is deleted.
public virtual INotificationRule NotifyOnBranchOrTagDeleted(string id, INotificationRuleTarget target, INotificationRuleOptions options = null)Parameters
- id System.String
- target INotificationRuleTarget
- options INotificationRuleOptions
Returns
NotifyOnPullRequestComment(String, INotificationRuleTarget, INotificationRuleOptions)
Defines a CodeStar Notification rule which triggers when a comment is made on a pull request.
public virtual INotificationRule NotifyOnPullRequestComment(string id, INotificationRuleTarget target, INotificationRuleOptions options = null)Parameters
- id System.String
- target INotificationRuleTarget
- options INotificationRuleOptions
Returns
NotifyOnPullRequestCreated(String, INotificationRuleTarget, INotificationRuleOptions)
Defines a CodeStar Notification rule which triggers when a pull request is created.
public virtual INotificationRule NotifyOnPullRequestCreated(string id, INotificationRuleTarget target, INotificationRuleOptions options = null)Parameters
- id System.String
- target INotificationRuleTarget
- options INotificationRuleOptions
Returns
NotifyOnPullRequestMerged(String, INotificationRuleTarget, INotificationRuleOptions)
Defines a CodeStar Notification rule which triggers when a pull request is merged.
public virtual INotificationRule NotifyOnPullRequestMerged(string id, INotificationRuleTarget target, INotificationRuleOptions options = null)Parameters
- id System.String
- target INotificationRuleTarget
- options INotificationRuleOptions
Returns
OnCommentOnCommit(String, IOnEventOptions)
Defines a CloudWatch event rule which triggers when a comment is made on a commit.
public virtual Rule OnCommentOnCommit(string id, IOnEventOptions options = null)Parameters
- id System.String
- options IOnEventOptions
Returns
OnCommentOnPullRequest(String, IOnEventOptions)
Defines a CloudWatch event rule which triggers when a comment is made on a pull request.
public virtual Rule OnCommentOnPullRequest(string id, IOnEventOptions options = null)Parameters
- id System.String
- options IOnEventOptions
Returns
OnCommit(String, IOnCommitOptions)
Defines a CloudWatch event rule which triggers when a commit is pushed to a branch.
public virtual Rule OnCommit(string id, IOnCommitOptions options = null)Parameters
- id System.String
- options IOnCommitOptions
Returns
OnEvent(String, IOnEventOptions)
Defines a CloudWatch event rule which triggers for repository events.
public virtual Rule OnEvent(string id, IOnEventOptions options = null)Parameters
- id System.String
- options IOnEventOptions
Returns
Remarks
Use
rule.addEventPattern(pattern) to specify a filter.
OnPullRequestStateChange(String, IOnEventOptions)
Defines a CloudWatch event rule which triggers when a pull request state is changed.
public virtual Rule OnPullRequestStateChange(string id, IOnEventOptions options = null)Parameters
- id System.String
- options IOnEventOptions
Returns
OnReferenceCreated(String, IOnEventOptions)
Defines a CloudWatch event rule which triggers when a reference is created (i.e. a new branch/tag is created) to the repository.
public virtual Rule OnReferenceCreated(string id, IOnEventOptions options = null)Parameters
- id System.String
- options IOnEventOptions
Returns
OnReferenceDeleted(String, IOnEventOptions)
Defines a CloudWatch event rule which triggers when a reference is delete (i.e. a branch/tag is deleted) from the repository.
public virtual Rule OnReferenceDeleted(string id, IOnEventOptions options = null)Parameters
- id System.String
- options IOnEventOptions
Returns
OnReferenceUpdated(String, IOnEventOptions)
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.
public virtual Rule OnReferenceUpdated(string id, IOnEventOptions options = null)Parameters
- id System.String
- options IOnEventOptions
Returns
OnStateChange(String, IOnEventOptions)
Defines a CloudWatch event rule which triggers when a "CodeCommit Repository State Change" event occurs.
public virtual Rule OnStateChange(string id, IOnEventOptions options = null)Parameters
- id System.String
- options IOnEventOptions
Returns