当前位置: 首页>>代码示例>>Python>>正文


Python fields.String方法代码示例

本文整理汇总了Python中flask_restplus.fields.String方法的典型用法代码示例。如果您正苦于以下问题:Python fields.String方法的具体用法?Python fields.String怎么用?Python fields.String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask_restplus.fields的用法示例。


在下文中一共展示了fields.String方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init

# 需要导入模块: from flask_restplus import fields [as 别名]
# 或者: from flask_restplus.fields import String [as 别名]
def init(api, cors, impl):
    """Configures REST handlers for state resource."""
    namespace = webutils.namespace(
        api, __name__, 'Trace REST operations'
    )

    model = {
        'name': fields.String(description='Application name'),
        'instances': fields.List(
            fields.String(description='Instance IDs')
        ),
    }
    trace_model = api.model(
        'Trace', model
    )

    @namespace.route('/<app_name>')
    @api.doc(params={'app_name': 'Application name'})
    class _TraceAppResource(restplus.Resource):
        """Treadmill application trace information resource.
        """

        @webutils.get_api(api, cors,
                          marshal=api.marshal_with,
                          resp_model=trace_model)
        def get(self, app_name):
            """Return trace information of a Treadmill application.
            """
            trace_info = impl.get(app_name)
            if trace_info is None:
                raise exc.NotFoundError(
                    'No trace information available for {}'.format(app_name)
                )
            return trace_info 
开发者ID:Morgan-Stanley,项目名称:treadmill,代码行数:36,代码来源:trace.py

示例2: init

# 需要导入模块: from flask_restplus import fields [as 别名]
# 或者: from flask_restplus.fields import String [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 
开发者ID:Morgan-Stanley,项目名称:treadmill,代码行数:55,代码来源:endpoint.py

示例3: init

# 需要导入模块: from flask_restplus import fields [as 别名]
# 或者: from flask_restplus.fields import String [as 别名]
def init(api, cors, impl):
    """Configures REST handlers for DNS resource."""

    namespace = webutils.namespace(
        api, __name__, 'DNS REST operations'
    )

    server_model = fields.String(description='Server')

    model = {
        '_id': fields.String(
            description='Name',
            max_length=32),
        'location': fields.String(description='Location'),
        'nameservers': fields.List(server_model),
        'rest-server': fields.List(server_model),
        'zkurl': fields.String(description='Zookeeper URL'),
        'fqdn': fields.String(description='FQDN'),
        'ttl': fields.String(description='Time To Live'),
    }

    dns_model = api.model(
        'DNS', model
    )

    @namespace.route('/')
    class _DNSList(restplus.Resource):
        """Treadmill DNS resource"""

        @webutils.get_api(api, cors,
                          marshal=api.marshal_list_with,
                          resp_model=dns_model)
        def get(self):
            """Returns list of configured DNS servers."""
            return impl.list()

    @namespace.route('/<dns>')
    @api.doc(params={'dns': 'DNS ID/name or FQDN'})
    class _DNSResource(restplus.Resource):
        """Treadmill DNS resource."""

        @webutils.get_api(api, cors,
                          marshal=api.marshal_with,
                          resp_model=dns_model)
        def get(self, dns):
            """Return Treadmill cell configuration."""
            return impl.get(dns) 
开发者ID:Morgan-Stanley,项目名称:treadmill,代码行数:49,代码来源:dns.py


注:本文中的flask_restplus.fields.String方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。