2017-07-20 18:24:43 +00:00
|
|
|
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',
|
|
|
|
])):
|
2017-07-26 18:21:51 +00:00
|
|
|
"""
|
|
|
|
ManifestLabel represents a label on a manifest
|
|
|
|
:type uuid: string
|
|
|
|
:type key: string
|
|
|
|
:type value: string
|
|
|
|
:type source_type_name: string
|
|
|
|
:type media_type_name: string
|
|
|
|
"""
|
2017-07-20 18:24:43 +00:00
|
|
|
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):
|
2017-07-26 18:21:51 +00:00
|
|
|
"""
|
|
|
|
Data interface that the manifest labels API uses
|
|
|
|
"""
|
|
|
|
|
2017-07-20 18:24:43 +00:00
|
|
|
@abstractmethod
|
|
|
|
def get_manifest_labels(self, namespace_name, repository_name, manifestref, filter=None):
|
2017-07-26 18:21:51 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
Args:
|
|
|
|
namespace_name: string
|
|
|
|
repository_name: string
|
|
|
|
manifestref: string
|
|
|
|
filter: string
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
list(ManifestLabel) or None
|
|
|
|
|
|
|
|
"""
|
2017-07-20 18:24:43 +00:00
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def create_manifest_label(self, namespace_name, repository_name, manifestref, key, value, source_type_name, media_type_name):
|
2017-07-26 18:21:51 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
Args:
|
|
|
|
namespace_name: string
|
|
|
|
repository_name: string
|
|
|
|
manifestref: string
|
|
|
|
key: string
|
|
|
|
value: string
|
|
|
|
source_type_name: string
|
|
|
|
media_type_name: string
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
ManifestLabel or None
|
|
|
|
"""
|
2017-07-20 18:24:43 +00:00
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def get_manifest_label(self, namespace_name, repository_name, manifestref, label_uuid):
|
2017-07-26 18:21:51 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
Args:
|
|
|
|
namespace_name: string
|
|
|
|
repository_name: string
|
|
|
|
manifestref: string
|
|
|
|
label_uuid: string
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
ManifestLabel or None
|
|
|
|
"""
|
2017-07-20 18:24:43 +00:00
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def delete_manifest_label(self, namespace_name, repository_name, manifestref, label_uuid):
|
2017-07-26 18:21:51 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
Args:
|
|
|
|
namespace_name: string
|
|
|
|
repository_name: string
|
|
|
|
manifestref: string
|
|
|
|
label_uuid: string
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
ManifestLabel or None
|
|
|
|
"""
|