Merge "Implements resource attribute bool"

This commit is contained in:
Jenkins 2016-03-29 15:07:21 +00:00 committed by Gerrit Code Review
commit b4555a348b
5 changed files with 18 additions and 1 deletions

View File

@ -321,7 +321,8 @@
"myid": {"type": "uuid"}, "myid": {"type": "uuid"},
"display_name": {"type": "string", "required": true}, "display_name": {"type": "string", "required": true},
"prefix": {"type": "string", "required": false, "max_length": 8, "min_length": 3}, "prefix": {"type": "string", "required": false, "max_length": 8, "min_length": 3},
"size": {"type": "number", "min": 5, "max": 32.8} "size": {"type": "number", "min": 5, "max": 32.8},
"enabled": {"type": "bool", "required": false}
} }
} }

View File

@ -81,3 +81,7 @@ class UUIDSchema(resource_type.UUIDSchema):
class NumberSchema(resource_type.NumberSchema): class NumberSchema(resource_type.NumberSchema):
satype = sqlalchemy.Float(53) satype = sqlalchemy.Float(53)
class BoolSchema(resource_type.BoolSchema):
satype = sqlalchemy.Boolean

View File

@ -138,6 +138,11 @@ class NumberSchema(CommonAttributeSchema):
return d return d
class BoolSchema(CommonAttributeSchema):
typename = "bool"
schema_ext = bool
class ResourceTypeAttributes(list): class ResourceTypeAttributes(list):
def jsonify(self): def jsonify(self):
d = {} d = {}

View File

@ -77,6 +77,9 @@ tests:
type: number type: number
required: false required: false
min: -2.3 min: -2.3
bool:
type: bool
required: false
status: 201 status: 201
response_json_paths: response_json_paths:
$.name: my_custom_resource $.name: my_custom_resource
@ -104,6 +107,9 @@ tests:
required: false required: false
min: -2.3 min: -2.3
max: max:
bool:
type: bool
required: false
response_headers: response_headers:
location: $SCHEME://$NETLOC/v1/resource_type/my_custom_resource location: $SCHEME://$NETLOC/v1/resource_type/my_custom_resource

View File

@ -87,6 +87,7 @@ gnocchi.indexer.sqlalchemy.resource_type_attribute =
string = gnocchi.indexer.sqlalchemy_extension:StringSchema string = gnocchi.indexer.sqlalchemy_extension:StringSchema
uuid = gnocchi.indexer.sqlalchemy_extension:UUIDSchema uuid = gnocchi.indexer.sqlalchemy_extension:UUIDSchema
number = gnocchi.indexer.sqlalchemy_extension:NumberSchema number = gnocchi.indexer.sqlalchemy_extension:NumberSchema
bool = gnocchi.indexer.sqlalchemy_extension:BoolSchema
gnocchi.indexer.resources = gnocchi.indexer.resources =
generic = gnocchi.indexer.sqlalchemy_base:Resource generic = gnocchi.indexer.sqlalchemy_base:Resource