Various bug fixes. (#314)
This commit is contained in:
@ -5,27 +5,32 @@
|
||||
:license: Apache, see LICENSE for more details.
|
||||
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
|
||||
"""
|
||||
from marshmallow import fields
|
||||
from marshmallow import fields, post_dump
|
||||
|
||||
from lemur.schemas import PluginSchema
|
||||
from lemur.schemas import PluginInputSchema, PluginOutputSchema
|
||||
from lemur.common.schema import LemurInputSchema, LemurOutputSchema
|
||||
|
||||
|
||||
class SourceInputSchema(LemurInputSchema):
|
||||
id = fields.Integer()
|
||||
label = fields.String(required=True)
|
||||
options = fields.Dict(load_from='sourceOptions', required=True)
|
||||
description = fields.String()
|
||||
plugin = fields.Nested(PluginSchema)
|
||||
plugin = fields.Nested(PluginInputSchema)
|
||||
active = fields.Boolean()
|
||||
|
||||
|
||||
class SourceOutputSchema(LemurOutputSchema):
|
||||
id = fields.Integer()
|
||||
label = fields.String()
|
||||
options = fields.Dict(dump_to='sourceOptions')
|
||||
description = fields.String()
|
||||
plugin = fields.Nested(PluginSchema)
|
||||
plugin = fields.Nested(PluginOutputSchema)
|
||||
options = fields.List(fields.Dict())
|
||||
fields.Boolean()
|
||||
|
||||
@post_dump
|
||||
def fill_object(self, data):
|
||||
data['plugin']['pluginOptions'] = data['options']
|
||||
return data
|
||||
|
||||
source_input_schema = SourceInputSchema()
|
||||
sources_output_schema = SourceOutputSchema(many=True)
|
||||
|
@ -151,7 +151,7 @@ class SourcesList(AuthenticatedResource):
|
||||
:reqheader Authorization: OAuth token to authenticate
|
||||
:statuscode 200: no error
|
||||
"""
|
||||
return service.create(data['label'], data['plugin']['slug'], data['plugin']['pluginOptions'], data['description'])
|
||||
return service.create(data['label'], data['plugin']['slug'], data['plugin']['plugin_options'], data['description'])
|
||||
|
||||
|
||||
class Sources(AuthenticatedResource):
|
||||
@ -271,7 +271,7 @@ class Sources(AuthenticatedResource):
|
||||
:reqheader Authorization: OAuth token to authenticate
|
||||
:statuscode 200: no error
|
||||
"""
|
||||
return service.update(source_id, data['label'], data['plugin']['pluginOptions'], data['description'])
|
||||
return service.update(source_id, data['label'], data['plugin']['plugin_options'], data['description'])
|
||||
|
||||
@admin_permission.require(http_exception=403)
|
||||
def delete(self, source_id):
|
||||
|
Reference in New Issue
Block a user