forked from AdaCore/e3-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for CodeCommit Repository
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from e3.aws.cfn import AWSType, Resource | ||
import re | ||
|
||
|
||
class Repository(Resource): | ||
"""CodeCommit Repository.""" | ||
|
||
ATTRIBUTES = ("Arn", "CloneUrlHttp", "CloneUrlSsh", "Name") | ||
|
||
def __init__(self, name, description): | ||
"""Initialize a Repository. | ||
:param name: name of the repository | ||
:type name: str | ||
:param description: description of the repository content | ||
:type description: str | ||
""" | ||
resource_name = re.sub(r"[^a-zA-Z0-9]+", "", name) | ||
super(Repository, self).__init__( | ||
resource_name, kind=AWSType.CODE_COMMIT_REPOSITORY | ||
) | ||
self.name = resource_name | ||
self.repository_name = name | ||
self.description = description | ||
|
||
@property | ||
def properties(self): | ||
"""Serialize the object as a simple dict. | ||
Can be used to transform to CloudFormation Yaml format. | ||
:rtype: dict | ||
""" | ||
return { | ||
"RepositoryName": self.repository_name, | ||
"RepositoryDescription": self.description, | ||
} |