# AWS CodeCommit Construct Library
<!--BEGIN STABILITY BANNER-->---
![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)
![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)
---
<!--END STABILITY BANNER-->
AWS CodeCommit is a version control service that enables you to privately store and manage Git repositories in the AWS cloud.
For further information on CodeCommit,
see the [AWS CodeCommit documentation](https://docs.aws.amazon.com/codecommit).
To add a CodeCommit Repository to your stack:
```python
repo = codecommit.Repository(self, "Repository",
repository_name="MyRepositoryName",
description="Some description."
)
```
Use the `repositoryCloneUrlHttp`, `repositoryCloneUrlSsh` or `repositoryCloneUrlGrc`
property to clone your repository.
To add an Amazon SNS trigger to your repository:
```python
# repo: codecommit.Repository
# trigger is established for all repository actions on all branches by default.
repo.notify("arn:aws:sns:*:123456789012:my_topic")
```
## Add initial commit
It is possible to initialize the Repository via the `Code` class.
It provides methods for loading code from a directory, `.zip` file and from a pre-created CDK Asset.
Example:
```python
repo = codecommit.Repository(self, "Repository",
repository_name="MyRepositoryName",
code=codecommit.Code.from_directory(path.join(__dirname, "directory/"), "develop")
)
```
## Events
CodeCommit repositories emit Amazon CloudWatch events for certain activities.
Use the `repo.onXxx` methods to define rules that trigger on these events
and invoke targets as a result:
```python
import aws_cdk.aws_sns as sns
import aws_cdk.aws_events_targets as targets
# repo: codecommit.Repository
# project: codebuild.PipelineProject
# my_topic: sns.Topic
# starts a CodeBuild project when a commit is pushed to the "master" branch of the repo
repo.on_commit("CommitToMaster",
target=targets.CodeBuildProject(project),
branches=["master"]
)
# publishes a message to an Amazon SNS topic when a comment is made on a pull request
rule = repo.on_comment_on_pull_request("CommentOnPullRequest",
target=targets.SnsTopic(my_topic)
)
```
## CodeStar Notifications
To define CodeStar Notification rules for Repositories, use one of the `notifyOnXxx()` methods.
They are very similar to `onXxx()` methods for CloudWatch events:
```python
import aws_cdk.aws_chatbot as chatbot
# repository: codecommit.Repository
target = chatbot.SlackChannelConfiguration(self, "MySlackChannel",
slack_channel_configuration_name="YOUR_CHANNEL_NAME",
slack_workspace_id="YOUR_SLACK_WORKSPACE_ID",
slack_channel_id="YOUR_SLACK_CHANNEL_ID"
)
rule = repository.notify_on_pull_request_created("NotifyOnPullRequestCreated", target)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/aws/aws-cdk",
"name": "aws-cdk.aws-codecommit",
"maintainer": "",
"docs_url": null,
"requires_python": "~=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Amazon Web Services",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/ea/b8/62b4bcd8a4118e3d7f80438c26cfa89cde0e4765ab5fa30684f7f21bc48a/aws-cdk.aws-codecommit-1.203.0.tar.gz",
"platform": null,
"description": "# AWS CodeCommit Construct Library\n\n<!--BEGIN STABILITY BANNER-->---\n\n\n![cfn-resources: Stable](https://img.shields.io/badge/cfn--resources-stable-success.svg?style=for-the-badge)\n\n![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)\n\n---\n<!--END STABILITY BANNER-->\n\nAWS CodeCommit is a version control service that enables you to privately store and manage Git repositories in the AWS cloud.\n\nFor further information on CodeCommit,\nsee the [AWS CodeCommit documentation](https://docs.aws.amazon.com/codecommit).\n\nTo add a CodeCommit Repository to your stack:\n\n```python\nrepo = codecommit.Repository(self, \"Repository\",\n repository_name=\"MyRepositoryName\",\n description=\"Some description.\"\n)\n```\n\nUse the `repositoryCloneUrlHttp`, `repositoryCloneUrlSsh` or `repositoryCloneUrlGrc`\nproperty to clone your repository.\n\nTo add an Amazon SNS trigger to your repository:\n\n```python\n# repo: codecommit.Repository\n\n\n# trigger is established for all repository actions on all branches by default.\nrepo.notify(\"arn:aws:sns:*:123456789012:my_topic\")\n```\n\n## Add initial commit\n\nIt is possible to initialize the Repository via the `Code` class.\nIt provides methods for loading code from a directory, `.zip` file and from a pre-created CDK Asset.\n\nExample:\n\n```python\nrepo = codecommit.Repository(self, \"Repository\",\n repository_name=\"MyRepositoryName\",\n code=codecommit.Code.from_directory(path.join(__dirname, \"directory/\"), \"develop\")\n)\n```\n\n## Events\n\nCodeCommit repositories emit Amazon CloudWatch events for certain activities.\nUse the `repo.onXxx` methods to define rules that trigger on these events\nand invoke targets as a result:\n\n```python\nimport aws_cdk.aws_sns as sns\nimport aws_cdk.aws_events_targets as targets\n\n# repo: codecommit.Repository\n# project: codebuild.PipelineProject\n# my_topic: sns.Topic\n\n\n# starts a CodeBuild project when a commit is pushed to the \"master\" branch of the repo\nrepo.on_commit(\"CommitToMaster\",\n target=targets.CodeBuildProject(project),\n branches=[\"master\"]\n)\n\n# publishes a message to an Amazon SNS topic when a comment is made on a pull request\nrule = repo.on_comment_on_pull_request(\"CommentOnPullRequest\",\n target=targets.SnsTopic(my_topic)\n)\n```\n\n## CodeStar Notifications\n\nTo define CodeStar Notification rules for Repositories, use one of the `notifyOnXxx()` methods.\nThey are very similar to `onXxx()` methods for CloudWatch events:\n\n```python\nimport aws_cdk.aws_chatbot as chatbot\n\n# repository: codecommit.Repository\n\ntarget = chatbot.SlackChannelConfiguration(self, \"MySlackChannel\",\n slack_channel_configuration_name=\"YOUR_CHANNEL_NAME\",\n slack_workspace_id=\"YOUR_SLACK_WORKSPACE_ID\",\n slack_channel_id=\"YOUR_SLACK_CHANNEL_ID\"\n)\nrule = repository.notify_on_pull_request_created(\"NotifyOnPullRequestCreated\", target)\n```\n\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "The CDK Construct Library for AWS::CodeCommit",
"version": "1.203.0",
"project_urls": {
"Homepage": "https://github.com/aws/aws-cdk",
"Source": "https://github.com/aws/aws-cdk.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6513e50045de9bbab80febfd735a7ca21fd1fd76110e2780d819fba7f3410f73",
"md5": "14da7a463221e9ecc62b9195e91f95bb",
"sha256": "4a17013789d8204ca6048580653ab8f02ced2283362df17e73b7aba6ba13cedb"
},
"downloads": -1,
"filename": "aws_cdk.aws_codecommit-1.203.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "14da7a463221e9ecc62b9195e91f95bb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.7",
"size": 104313,
"upload_time": "2023-05-31T22:53:35",
"upload_time_iso_8601": "2023-05-31T22:53:35.686301Z",
"url": "https://files.pythonhosted.org/packages/65/13/e50045de9bbab80febfd735a7ca21fd1fd76110e2780d819fba7f3410f73/aws_cdk.aws_codecommit-1.203.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "eab862b4bcd8a4118e3d7f80438c26cfa89cde0e4765ab5fa30684f7f21bc48a",
"md5": "b1af8a900d74a0bdcab578c63d0f2272",
"sha256": "50f81ec8697da1d3eac04a7919be2db5820186f4f4116e96648f8bab1d336b1e"
},
"downloads": -1,
"filename": "aws-cdk.aws-codecommit-1.203.0.tar.gz",
"has_sig": false,
"md5_digest": "b1af8a900d74a0bdcab578c63d0f2272",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.7",
"size": 105490,
"upload_time": "2023-05-31T23:01:21",
"upload_time_iso_8601": "2023-05-31T23:01:21.955722Z",
"url": "https://files.pythonhosted.org/packages/ea/b8/62b4bcd8a4118e3d7f80438c26cfa89cde0e4765ab5fa30684f7f21bc48a/aws-cdk.aws-codecommit-1.203.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-31 23:01:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aws",
"github_project": "aws-cdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aws-cdk.aws-codecommit"
}