• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python helpers.validate_authorization函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中monasca.v2.reference.helpers.validate_authorization函数的典型用法代码示例。如果您正苦于以下问题:Python validate_authorization函数的具体用法?Python validate_authorization怎么用?Python validate_authorization使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: do_post_stream_definitions

    def do_post_stream_definitions(self, req, res):
        helpers.validate_authorization(req, self._default_authorized_roles)

        stream_definition = helpers.read_json_msg_body(req)

        self._validate_stream_definition(stream_definition)

        tenant_id = helpers.get_tenant_id(req)
        name = get_query_stream_definition_name(stream_definition)
        description = get_query_stream_definition_description(
            stream_definition)
        select = stream_definition['select']
        group_by = stream_definition['group_by']
        fire_criteria = stream_definition['fire_criteria']
        expiration = stream_definition['expiration']
        fire_actions = get_query_stream_definition_fire_actions(
            stream_definition)
        expire_actions = get_query_stream_definition_expire_actions(
            stream_definition)

        result = self._stream_definition_create(tenant_id, name, description,
                                                select, group_by,
                                                fire_criteria, expiration,
                                                fire_actions, expire_actions)

        helpers.add_links_to_resource(result, req.uri)
        res.body = helpers.dumpit_utf8(result)
        res.status = falcon.HTTP_201
开发者ID:tprakash,项目名称:monasca-api,代码行数:28,代码来源:stream_definitions.py


示例2: do_post_alarm_definitions

    def do_post_alarm_definitions(self, req, res):
        helpers.validate_authorization(req, self._default_authorized_roles)

        alarm_definition = read_json_msg_body(req)

        self._validate_alarm_definition(alarm_definition)

        tenant_id = helpers.get_tenant_id(req)
        name = get_query_alarm_definition_name(alarm_definition)
        expression = get_query_alarm_definition_expression(alarm_definition)
        description = get_query_alarm_definition_description(alarm_definition)
        severity = get_query_alarm_definition_severity(alarm_definition)
        match_by = get_query_alarm_definition_match_by(alarm_definition)
        alarm_actions = get_query_alarm_definition_alarm_actions(
            alarm_definition)
        undetermined_actions = get_query_alarm_definition_undetermined_actions(
            alarm_definition)
        ok_actions = get_query_ok_actions(alarm_definition)

        result = self._alarm_definition_create(tenant_id, name, expression,
                                               description, severity, match_by,
                                               alarm_actions,
                                               undetermined_actions,
                                               ok_actions)

        helpers.add_links_to_resource(result, req.uri)
        res.body = helpers.dumpit_utf8(result)
        res.status = falcon.HTTP_201
开发者ID:carriercomm,项目名称:monasca-api,代码行数:28,代码来源:alarm_definitions.py


示例3: do_get_notification_methods

 def do_get_notification_methods(self, req, res):
     helpers.validate_authorization(req, self._default_authorized_roles)
     tenant_id = helpers.get_tenant_id(req)
     offset = helpers.normalize_offset(helpers.get_query_param(req,
                                                               'offset'))
     result = self._list_notifications(tenant_id, req.uri, offset)
     res.body = helpers.dumpit_utf8(result)
     res.status = falcon.HTTP_200
开发者ID:tprakash,项目名称:monasca-api,代码行数:8,代码来源:notifications.py


示例4: do_get_alarm_state_history

    def do_get_alarm_state_history(self, req, res, id):

        helpers.validate_authorization(req, self._default_authorized_roles)
        tenant_id = helpers.get_tenant_id(req)

        result = self._alarm_history(tenant_id, [id])

        res.body = json.dumps(result, ensure_ascii=False).encode('utf8')
        res.status = falcon.HTTP_200
开发者ID:eyalken,项目名称:monasca-api,代码行数:9,代码来源:alarms.py


示例5: do_delete_alarms

    def do_delete_alarms(self, req, res, id):

        helpers.validate_authorization(req, self._default_authorized_roles)

        tenant_id = helpers.get_tenant_id(req)

        self._alarm_delete(tenant_id, id)

        res.status = falcon.HTTP_204
开发者ID:tprakash,项目名称:monasca-api,代码行数:9,代码来源:alarms.py


示例6: do_post_notification_methods

 def do_post_notification_methods(self, req, res):
     helpers.validate_json_content_type(req)
     helpers.validate_authorization(req, self._default_authorized_roles)
     notification = helpers.read_http_resource(req)
     self._validate_notification(notification)
     tenant_id = helpers.get_tenant_id(req)
     result = self._create_notification(tenant_id, notification, req.uri)
     res.body = helpers.dumpit_utf8(result)
     res.status = falcon.HTTP_201
开发者ID:tprakash,项目名称:monasca-api,代码行数:9,代码来源:notifications.py


示例7: do_put_notification_methods

 def do_put_notification_methods(self, req, res, id):
     helpers.validate_json_content_type(req)
     helpers.validate_authorization(req, self._default_authorized_roles)
     notification = helpers.read_http_resource(req)
     self._validate_notification(notification)
     tenant_id = helpers.get_tenant_id(req)
     self._update_notification(id, tenant_id, notification)
     res.body = self._create_notification_response(id, notification,
                                                   req.uri)
     res.status = falcon.HTTP_200
开发者ID:angelomendonca,项目名称:monasca-api,代码行数:10,代码来源:notifications.py


示例8: do_post_events

 def do_post_events(self, req, res):
     helpers.validate_json_content_type(req)
     helpers.validate_authorization(req, self._post_events_authorized_roles)
     event = helpers.read_http_resource(req)
     self._validate_event(event)
     tenant_id = helpers.get_tenant_id(req)
     transformed_event = self._event_transform(event, tenant_id,
                                               self._region)
     self._send_event(transformed_event)
     res.status = falcon.HTTP_204
开发者ID:angelomendonca,项目名称:monasca-api,代码行数:10,代码来源:events.py


示例9: do_get_metrics

 def do_get_metrics(self, req, res):
     helpers.validate_authorization(req, self._default_authorized_roles)
     tenant_id = helpers.get_tenant_id(req)
     name = helpers.get_query_name(req)
     helpers.validate_query_name(name)
     dimensions = helpers.get_query_dimensions(req)
     helpers.validate_query_dimensions(dimensions)
     result = self._list_metrics(tenant_id, name, dimensions)
     res.body = json.dumps(result, ensure_ascii=False).encode('utf8')
     res.status = falcon.HTTP_200
开发者ID:hughwphamill,项目名称:monasca-api,代码行数:10,代码来源:metrics.py


示例10: do_post_transforms

 def do_post_transforms(self, req, res):
     helpers.validate_json_content_type(req)
     helpers.validate_authorization(req, self._default_authorized_roles)
     transform = helpers.read_http_resource(req)
     self._validate_transform(transform)
     id = uuidutils.generate_uuid()
     tenant_id = helpers.get_tenant_id(req)
     self._create_transform(id, tenant_id, transform)
     res.body = self._create_transform_response(id, transform)
     res.status = falcon.HTTP_200
开发者ID:hughwphamill,项目名称:monasca-api,代码行数:10,代码来源:transforms.py


示例11: do_get_alarm_definition

    def do_get_alarm_definition(self, req, res, id):

        helpers.validate_authorization(req, self._default_authorized_roles)
        tenant_id = helpers.get_tenant_id(req)

        result = self._alarm_definition_show(tenant_id, id)

        helpers.add_links_to_resource(result, re.sub('/' + id, '', req.uri))
        res.body = helpers.dumpit_utf8(result)
        res.status = falcon.HTTP_200
开发者ID:carriercomm,项目名称:monasca-api,代码行数:10,代码来源:alarm_definitions.py


示例12: do_get_alarms

    def do_get_alarms(self, req, res):

        helpers.validate_authorization(req, self._default_authorized_roles)
        tenant_id = helpers.get_tenant_id(req)

        query_parms = falcon.uri.parse_query_string(req.query_string)

        result = self._alarm_list(req.uri, tenant_id, query_parms)

        res.body = json.dumps(result, ensure_ascii=False).encode('utf8')
        res.status = falcon.HTTP_200
开发者ID:eyalken,项目名称:monasca-api,代码行数:11,代码来源:alarms.py


示例13: do_get_alarm_state_history

    def do_get_alarm_state_history(self, req, res, id):

        helpers.validate_authorization(req, self._default_authorized_roles)
        tenant_id = helpers.get_tenant_id(req)
        offset = helpers.normalize_offset(helpers.get_query_param(req,
                                                                  'offset'))

        result = self._alarm_history(tenant_id, [id], req.uri, offset)

        res.body = helpers.dumpit_utf8(result)
        res.status = falcon.HTTP_200
开发者ID:tprakash,项目名称:monasca-api,代码行数:11,代码来源:alarms.py


示例14: do_get_metrics

 def do_get_metrics(self, req, res):
     helpers.validate_authorization(req, self._default_authorized_roles)
     tenant_id = helpers.get_tenant_id(req)
     name = helpers.get_query_name(req)
     helpers.validate_query_name(name)
     dimensions = helpers.get_query_dimensions(req)
     helpers.validate_query_dimensions(dimensions)
     offset = helpers.normalize_offset(helpers.get_query_param(req,
                                                               'offset'))
     result = self._list_metrics(tenant_id, name, dimensions,
                                 req.uri, offset)
     res.body = helpers.dumpit_utf8(result)
     res.status = falcon.HTTP_200
开发者ID:carriercomm,项目名称:monasca-api,代码行数:13,代码来源:metrics.py


示例15: do_post_metrics

 def do_post_metrics(self, req, res):
     helpers.validate_json_content_type(req)
     helpers.validate_authorization(req,
                                    self._post_metrics_authorized_roles)
     metrics = helpers.read_http_resource(req)
     self._validate_metrics(metrics)
     tenant_id = \
         helpers.get_x_tenant_or_tenant_id(req,
                                           self._delegate_authorized_roles)
     transformed_metrics = self._metrics_transform(metrics, tenant_id,
                                                   self._region)
     self._send_metrics(transformed_metrics)
     res.status = falcon.HTTP_204
开发者ID:hughwphamill,项目名称:monasca-api,代码行数:13,代码来源:metrics.py


示例16: do_get_alarms_state_history

    def do_get_alarms_state_history(self, req, res):

        helpers.validate_authorization(req, self._default_authorized_roles)
        tenant_id = helpers.get_tenant_id(req)
        start_timestamp = helpers.get_query_starttime_timestamp(req, False)
        end_timestamp = helpers.get_query_endtime_timestamp(req, False)
        query_parms = falcon.uri.parse_query_string(req.query_string)

        result = self._alarm_history_list(tenant_id, start_timestamp,
                                          end_timestamp, query_parms)

        res.body = json.dumps(result, ensure_ascii=False).encode('utf8')
        res.status = falcon.HTTP_200
开发者ID:eyalken,项目名称:monasca-api,代码行数:13,代码来源:alarms.py


示例17: do_get_stream_definitions

    def do_get_stream_definitions(self, req, res):

        helpers.validate_authorization(req, self._default_authorized_roles)
        tenant_id = helpers.get_tenant_id(req)
        name = helpers.get_query_name(req)
        offset = helpers.normalize_offset(helpers.get_query_param(req,
                                                                  'offset'))
        limit = helpers.get_query_param(req, 'limit')
        result = self._stream_definition_list(tenant_id, name,
                                              req.uri, offset, limit)

        res.body = helpers.dumpit_utf8(result)
        res.status = falcon.HTTP_200
开发者ID:tprakash,项目名称:monasca-api,代码行数:13,代码来源:stream_definitions.py


示例18: do_get_measurements

 def do_get_measurements(self, req, res):
     helpers.validate_authorization(req, self._default_authorized_roles)
     tenant_id = helpers.get_tenant_id(req)
     name = helpers.get_query_name(req)
     helpers.validate_query_name(name)
     dimensions = helpers.get_query_dimensions(req)
     helpers.validate_query_dimensions(dimensions)
     start_timestamp = helpers.get_query_starttime_timestamp(req)
     end_timestamp = helpers.get_query_endtime_timestamp(req)
     result = self._measurement_list(tenant_id, name, dimensions,
                                     start_timestamp, end_timestamp)
     res.body = json.dumps(result, ensure_ascii=False).encode('utf8')
     res.status = falcon.HTTP_200
开发者ID:hughwphamill,项目名称:monasca-api,代码行数:13,代码来源:metrics.py


示例19: do_put_alarm_definitions

    def do_put_alarm_definitions(self, req, res, id):

        helpers.validate_authorization(req, self._default_authorized_roles)

        alarm_definition = read_json_msg_body(req)

        self._validate_alarm_definition(alarm_definition)

        tenant_id = helpers.get_tenant_id(req)

        # Mandatory positional args
        name = get_query_alarm_definition_name(alarm_definition)
        expression = get_query_alarm_definition_expression(alarm_definition)
        actions_enabled = (
            get_query_alarm_definition_actions_enabled(alarm_definition,
                                                       required=True))

        # Validator makes actions_enabled optional. So, check it here.
        if not actions_enabled:
            raise falcon.HTTPBadRequest('Bad request', 'Missing '
                                                       'actions_enabled')

        # Optional args
        description = get_query_alarm_definition_description(alarm_definition,
                                                             return_none=True)
        alarm_actions = get_query_alarm_definition_alarm_actions(
            alarm_definition, return_none=True)
        ok_actions = get_query_ok_actions(alarm_definition, return_none=True)
        undetermined_actions = get_query_alarm_definition_undetermined_actions(
            alarm_definition, return_none=True)
        match_by = get_query_alarm_definition_match_by(alarm_definition,
                                                       return_none=True)
        severity = get_query_alarm_definition_severity(alarm_definition,
                                                       return_none=True)

        result = self._alarm_definition_update_or_patch(tenant_id,
                                                        id,
                                                        name,
                                                        expression,
                                                        actions_enabled,
                                                        description,
                                                        alarm_actions,
                                                        ok_actions,
                                                        undetermined_actions,
                                                        match_by,
                                                        severity,
                                                        patch=False)

        helpers.add_links_to_resource(result, req.uri)
        res.body = helpers.dumpit_utf8(result)
        res.status = falcon.HTTP_200
开发者ID:carriercomm,项目名称:monasca-api,代码行数:51,代码来源:alarm_definitions.py


示例20: do_put_alarms

    def do_put_alarms(self, req, res, id):

        helpers.validate_authorization(req, self._default_authorized_roles)

        tenant_id = helpers.get_tenant_id(req)

        state = self._get_alarm_state(req)

        self._alarm_update(tenant_id, id, state)

        result = self._alarm_show(req.uri, tenant_id, id)

        res.body = json.dumps(result, ensure_ascii=False).encode('utf8')
        res.status = falcon.HTTP_200
开发者ID:eyalken,项目名称:monasca-api,代码行数:14,代码来源:alarms.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python checks.AgentCheck类代码示例发布时间:2022-05-27
下一篇:
Python helpers.get_tenant_id函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap