42 lines
1 KiB
Python
42 lines
1 KiB
Python
from abc import ABCMeta, abstractmethod
|
|
from collections import namedtuple
|
|
|
|
from six import add_metaclass
|
|
|
|
|
|
class ManifestLabel(
|
|
namedtuple('ManifestLabel', [
|
|
'uuid',
|
|
'key',
|
|
'value',
|
|
'source_type_name',
|
|
'media_type_name',
|
|
])):
|
|
|
|
def to_dict(self):
|
|
return {
|
|
'id': self.uuid,
|
|
'key': self.key,
|
|
'value': self.value,
|
|
'source_type': self.source_type_name,
|
|
'media_type': self.media_type_name,
|
|
}
|
|
|
|
|
|
@add_metaclass(ABCMeta)
|
|
class ManifestLabelInterface(object):
|
|
@abstractmethod
|
|
def get_manifest_labels(self, namespace_name, repository_name, manifestref, filter=None):
|
|
pass
|
|
|
|
@abstractmethod
|
|
def create_manifest_label(self, namespace_name, repository_name, manifestref, key, value, source_type_name, media_type_name):
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_manifest_label(self, namespace_name, repository_name, manifestref, label_uuid):
|
|
pass
|
|
|
|
@abstractmethod
|
|
def delete_manifest_label(self, namespace_name, repository_name, manifestref, label_uuid):
|
|
pass
|