Move generic resources to properties schema

Not all resources in generic_resources file on
properties schema. Use properties.Schema instead of
dictionary.

Change-Id: I558b33c304f38a5819b7b54c780181430ee7b1be
This commit is contained in:
Peter Razumovsky 2015-03-30 12:14:21 +03:00
parent af568d1c92
commit 83f0ae1590

View File

@ -59,10 +59,11 @@ class GenericResource(resource.Resource):
class ResWithComplexPropsAndAttrs(GenericResource): class ResWithComplexPropsAndAttrs(GenericResource):
properties_schema = {'a_string': {'Type': 'String'}, properties_schema = {
'a_list': {'Type': 'List'}, 'a_string': properties.Schema(properties.Schema.STRING),
'a_map': {'Type': 'Map'}, 'a_list': properties.Schema(properties.Schema.LIST),
'an_int': {'Type': 'Integer'}} 'a_map': properties.Schema(properties.Schema.MAP),
'an_int': properties.Schema(properties.Schema.INTEGER)}
attributes_schema = {'list': attributes.Schema('A list'), attributes_schema = {'list': attributes.Schema('A list'),
'map': attributes.Schema('A map'), 'map': attributes.Schema('A map'),
@ -77,8 +78,9 @@ class ResWithComplexPropsAndAttrs(GenericResource):
class ResourceWithProps(GenericResource): class ResourceWithProps(GenericResource):
properties_schema = {'Foo': {'Type': 'String'}, properties_schema = {
'FooInt': {'Type': 'Integer'}} 'Foo': properties.Schema(properties.Schema.STRING),
'FooInt': properties.Schema(properties.Schema.INTEGER)}
class ResourceWithPropsAndAttrs(ResourceWithProps): class ResourceWithPropsAndAttrs(ResourceWithProps):
@ -86,7 +88,7 @@ class ResourceWithPropsAndAttrs(ResourceWithProps):
class ResourceWithResourceID(GenericResource): class ResourceWithResourceID(GenericResource):
properties_schema = {'ID': {'Type': 'String'}} properties_schema = {'ID': properties.Schema(properties.Schema.STRING)}
def handle_create(self): def handle_create(self):
super(ResourceWithResourceID, self).handle_create() super(ResourceWithResourceID, self).handle_create()
@ -125,8 +127,8 @@ class ResourceWithComplexAttributes(GenericResource):
class ResourceWithRequiredProps(GenericResource): class ResourceWithRequiredProps(GenericResource):
properties_schema = {'Foo': {'Type': 'String', properties_schema = {'Foo': properties.Schema(properties.Schema.STRING,
'Required': True}} required=True)}
class SignalResource(signal_responder.SignalResponder): class SignalResource(signal_responder.SignalResponder):