8000 EC2 Container Registry by philtay · Pull Request #36 · cloudtools/awacs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

EC2 Container Registry #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions awacs/ecr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from aws import Action, BaseARN

service_name = 'AWS EC2 Container Registry'
prefix = 'ecr'


class ARN(BaseARN):
def __init__(self, resource='*', region='', account=''):
sup = super(ARN, self)
sup.__init__(service=prefix, resource=resource, region=region,
account=account)


class ECRAction(Action):
def __init__(self, action=None):
self.prefix = prefix
self.action = action


BatchCheckLayerAvailability = ECRAction('BatchCheckLayerAvailability')
BatchDeleteImage = ECRAction('BatchDeleteImage')
BatchGetImage = ECRAction('BatchGetImage')
CompleteLayerUpload = ECRAction('CompleteLayerUpload')
CreateRepository = ECRAction('CreateRepository')
DeleteRepository = ECRAction('DeleteRepository')
DeleteRepositoryPolicy = ECRAction('DeleteRepositoryPolicy')
DescribeRepositories = ECRAction('DescribeRepositories')
GetAuthorizationToken = ECRAction('GetAuthorizationToken')
GetDownloadUrlForLayer = ECRAction('GetDownloadUrlForLayer')
GetRepositoryPolicy = ECRAction('GetRepositoryPolicy')
InitiateLayerUpload = ECRAction('InitiateLayerUpload')
ListImages = ECRAction('ListImages')
PutImage = ECRAction('PutImage')
SetRepositoryPolicy = ECRAction('SetRepositoryPolicy')
UploadLayerPart = ECRAction('UploadLayerPart')
29 changes: 29 additions & 0 deletions examples/ecr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Example taken from AWS docs:
# http://docs.aws.amazon.com/AmazonECR/latest/userguide/ecr_managed_policies.html

from awacs.aws import Allow
from awacs.aws import Policy, Statement
import awacs.ecr as ecr


# AmazonEC2ContainerRegistryReadOnly
pd = Policy(
Statement=[
Statement(
Effect=Allow,
Action=[
ecr.GetAuthorizationToken,
ecr.BatchCheckLayerAvailability,
ecr.GetDownloadUrlForLayer,
ecr.GetRepositoryPolicy,
ecr.DescribeRepositories,
ecr.ListImages,
ecr.BatchGetImage,
],
Resource=['*']
)
]
)


print(pd.to_json())
0