Add support for metadata on robot accounts
Fixes https://jira.coreos.com/browse/QUAY-847 Fixes https://jira.coreos.com/browse/QUAY-816
This commit is contained in:
parent
a693771345
commit
254cdfe43a
8 changed files with 229 additions and 52 deletions
|
@ -41,6 +41,7 @@ class RobotWithPermissions(
|
|||
'created',
|
||||
'teams',
|
||||
'repository_names',
|
||||
'description',
|
||||
])):
|
||||
"""
|
||||
RobotWithPermissions is a list of robot entries.
|
||||
|
@ -49,7 +50,7 @@ class RobotWithPermissions(
|
|||
:type created: datetime|None
|
||||
:type teams: [Team]
|
||||
:type repository_names: [string]
|
||||
|
||||
:type description: string
|
||||
"""
|
||||
|
||||
def to_dict(self):
|
||||
|
@ -58,7 +59,8 @@ class RobotWithPermissions(
|
|||
'token': self.password,
|
||||
'created': format_date(self.created) if self.created is not None else None,
|
||||
'teams': [team.to_dict() for team in self.teams],
|
||||
'repositories': self.repository_names
|
||||
'repositories': self.repository_names,
|
||||
'description': self.description,
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,22 +69,31 @@ class Robot(
|
|||
'name',
|
||||
'password',
|
||||
'created',
|
||||
'description',
|
||||
'unstructured_metadata',
|
||||
])):
|
||||
"""
|
||||
Robot represents a robot entity.
|
||||
:type name: string
|
||||
:type password: string
|
||||
:type created: datetime|None
|
||||
|
||||
:type description: string
|
||||
:type unstructured_metadata: dict
|
||||
"""
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
def to_dict(self, include_metadata=False):
|
||||
data = {
|
||||
'name': self.name,
|
||||
'token': self.password,
|
||||
'created': format_date(self.created) if self.created is not None else None,
|
||||
'description': self.description,
|
||||
}
|
||||
|
||||
if include_metadata:
|
||||
data['unstructured_metadata'] = self.unstructured_metadata
|
||||
|
||||
return data
|
||||
|
||||
|
||||
@add_metaclass(ABCMeta)
|
||||
class RobotInterface(object):
|
||||
|
|
Reference in a new issue