
This depends on ansible-monasca-schema changes here: https://github.com/hpcloud-mon/ansible-monasca-schema/pull/17 Here are sample curl commands for POST, GET, and DELETE: curl -i -X POST -H 'X-Auth-User: mini-mon' -H 'X-Auth-Token: 8c959d0296344c27a47b8e78dbf912ac' -H 'X-Auth-Key: password' -H 'Accept: application/json' -H 'User-Agent: python-monascaclient' -H 'Content-Tye: application/json' -d '{"fire_criteria": [{"event_type": "compute.instance.create.start"}, {"event_type": "compute.instance.create.end"}], "description": "provisioning duration", "name": "panda", "group_by": ["instance_id"], "expiration": 3, "select": [{"traits": {"tenant_id": "406904"}, "event_type": "compute.instance.create.*"}], "fire_actions": ["ed469bb9-2b4a-457a-9926-9da9f6ac75da"], "expire_actions":["ed469bb9-2b4a-457a-9926-9da9f6ac75da"]}' http://127.0.0.1:8080/v2.0/events/stream-definitions curl -i -X GET -H 'X-Auth-User: mini-mon' -H 'X-Auth-Token: 8c959d0296344c27a47b8e78dbf912ac' -H 'X-Auth-Key: password' -H 'Accept: application/json' -H 'User-Agent: python-monascaclient' -H 'Content-Type: application/json' http://127.0.0.1:8080/v2.0/events/stream-definitions/ curl -i -X DELETE -H 'X-Auth-User: mini-mon' -H 'X-Auth-Token: 8c959d0296344c27a47b8e78dbf912ac' -H 'X-Auth-Key: password' -H 'Accept: application/json' -H 'User-Agent: python-monascaclient' -H 'Content-Type: application/json' http://127.0.0.1:8080/v2.0/events/stream-definitions/86177f0e-f811-4c42-a91a-1813251bf93f Note: the limit parameter is passed into the streams_repository method for listing streams, but not yet used. We will open a separate Jira to to handle pagination with a user input limit parameter. Note: fixed a few events problems. stevedore wasn't loading the driver, and missing some abstact function defs. I tested stream-defintions and events, they both work now. Had to change the URI for stream-definitions because it conflicted with events, and now is more RESTful. Change-Id: I0b6dc385e1d095c1bd33867a038fe170ca277bfe
43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
# Copyright 2015 Hewlett-Packard
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
from monasca.common import resource_api
|
|
from monasca.openstack.common import log
|
|
|
|
LOG = log.getLogger(__name__)
|
|
|
|
|
|
class StreamDefinitionsV2API(object):
|
|
|
|
def __init__(self, global_conf):
|
|
|
|
LOG.debug('initializing StreamDefinitionsV2API!')
|
|
self.global_conf = global_conf
|
|
|
|
@resource_api.Restify('/v2.0/stream-definitions', method='post')
|
|
def do_post_stream_definitions(self, req, res):
|
|
res.status = '501 Not Implemented'
|
|
|
|
@resource_api.Restify('/v2.0/stream-definitions/{id}', method='get')
|
|
def do_get_stream_definition(self, req, res, id):
|
|
res.status = '501 Not Implemented'
|
|
|
|
@resource_api.Restify('/v2.0/stream-definitions', method='get')
|
|
def do_get_stream_definitions(self, req, res):
|
|
res.status = '501 Not Implemented'
|
|
|
|
@resource_api.Restify(
|
|
'/v2.0/stream-definitions/{id}', method='delete')
|
|
def do_delete_stream_definitions(self, req, res, id):
|
|
res.status = '501 Not Implemented'
|