本文整理汇总了Python中monasca.v2.reference.helpers.get_tenant_id函数的典型用法代码示例。如果您正苦于以下问题:Python get_tenant_id函数的具体用法?Python get_tenant_id怎么用?Python get_tenant_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_tenant_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例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
示例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
示例4: 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
示例5: 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
示例6: 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
示例7: 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
示例8: 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
示例9: 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
示例10: 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
示例11: 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
示例12: 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
示例13: 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
示例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
示例15: 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