add pre-oci models for endpoints/api/__init__.py

This commit is contained in:
Evan Cordell 2017-07-18 15:37:44 -04:00
parent a6ea16abc5
commit b8fc20c191
3 changed files with 83 additions and 15 deletions

View file

@ -0,0 +1,54 @@
from abc import ABCMeta, abstractmethod
from six import add_metaclass
@add_metaclass(ABCMeta)
class InitDataInterface(object):
"""
Interface that represents all data store interactions required by __init__.
"""
@abstractmethod
def is_app_repository(self, namespace_name, repository_name):
"""
Args:
namespace_name: namespace or user
repository_name: repository
Returns:
Boolean
"""
pass
@abstractmethod
def repository_is_public(self, namespace_name, repository_name):
"""
Args:
namespace_name: namespace or user
repository_name: repository
Returns:
Boolean
"""
pass
@abstractmethod
def log_action(self, kind, namespace_name, repository_name, performer, ip, metadata):
"""
Args:
kind: type of log
user_or_orgname: name of user or organization
performer: user doing the action
ip: originating ip
metadata: metadata
repository: repository the action is related to
Returns:
None
"""
pass