本文整理匯總了Python中flask_restplus.fields.Boolean方法的典型用法代碼示例。如果您正苦於以下問題:Python fields.Boolean方法的具體用法?Python fields.Boolean怎麽用?Python fields.Boolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類flask_restplus.fields
的用法示例。
在下文中一共展示了fields.Boolean方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: init
# 需要導入模塊: from flask_restplus import fields [as 別名]
# 或者: from flask_restplus.fields import Boolean [as 別名]
def init(api, cors, impl):
"""Configures REST handlers for endpoint resource."""
# Disable too many branches warning.
#
# pylint: disable=R0912
namespace = webutils.namespace(
api, __name__, 'Endpoint state REST operations'
)
endpoint_model = {
'endpoint': fields.String(description='Endpoint name'),
'name': fields.String(description='Application name'),
'port': fields.Integer(description='Endpoint port'),
'proto': fields.String(description='Application endpoint protocol'),
'host': fields.String(description='Endpoint host'),
'state': fields.Boolean(description='Endpoint state'),
}
response_model = api.model(
'Endpoint', endpoint_model
)
@namespace.route(
'/<pattern>',
)
@api.doc(params={'pattern': 'Application pattern'})
class _EndpointList(restplus.Resource):
"""Treadmill Endpoint resource"""
@webutils.get_api(api, cors,
marshal=api.marshal_list_with,
resp_model=response_model)
def get(self, pattern):
"""Return all endpoints"""
ret = impl.list(pattern, None, None)
return ret
@namespace.route('/<pattern>/<proto>/<endpoint>')
@api.doc(params={
'pattern': 'Application pattern',
'proto': 'Application endpoint protocol',
'endpoint': 'Application endpoint name',
})
class _EndpointResource(restplus.Resource):
"""Treadmill Endpoint resource"""
@webutils.get_api(api, cors,
marshal=api.marshal_list_with,
resp_model=response_model)
def get(self, pattern, proto, endpoint):
"""Return Treadmill app endpoint state"""
ret = impl.list(pattern, proto, endpoint)
return ret