Merge "Restricted Magnum service state to 'up' and 'down'"
This commit is contained in:
commit
98f79b056a
magnum
@ -20,6 +20,7 @@ from magnum.api import expose
|
||||
from magnum.api import servicegroup as svcgrp_api
|
||||
from magnum.common import policy
|
||||
from magnum import objects
|
||||
from magnum.objects import fields
|
||||
|
||||
|
||||
class MagnumService(base.APIBase):
|
||||
@ -30,7 +31,7 @@ class MagnumService(base.APIBase):
|
||||
binary = wtypes.StringType(min_length=1, max_length=255)
|
||||
"""Name of the binary"""
|
||||
|
||||
state = wtypes.StringType(min_length=1, max_length=255)
|
||||
state = wtypes.Enum(str, *fields.MagnumServiceState.ALL)
|
||||
"""State of the binary"""
|
||||
|
||||
id = wsme.wsattr(wtypes.IntegerType(minimum=1))
|
||||
|
@ -79,6 +79,18 @@ class DockerStorageDriver(fields.Enum):
|
||||
valid_values=DockerStorageDriver.ALL)
|
||||
|
||||
|
||||
class MagnumServiceState(fields.Enum):
|
||||
ALL = (
|
||||
up, down
|
||||
) = (
|
||||
'up', 'down',
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
super(MagnumServiceState, self).__init__(
|
||||
valid_values=MagnumServiceState.ALL)
|
||||
|
||||
|
||||
class ListOfDictsField(fields.AutoTypedField):
|
||||
AUTO_TYPE = fields.List(fields.Dict(fields.FieldType()))
|
||||
|
||||
@ -87,6 +99,10 @@ class BayStatusField(fields.BaseEnumField):
|
||||
AUTO_TYPE = BayStatus()
|
||||
|
||||
|
||||
class MagnumServiceField(fields.BaseEnumField):
|
||||
AUTO_TYPE = MagnumServiceState()
|
||||
|
||||
|
||||
class ContainerStatusField(fields.BaseEnumField):
|
||||
AUTO_TYPE = ContainerStatus()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user