Create config object use now PUT
Change-Id: Id339b36e202c09c3b2eaa43674a4a5a2319be2a6
This commit is contained in:
parent
4ee06a6c93
commit
4b2538b37e
@ -10,7 +10,7 @@ keystonemiddleware
|
||||
PasteDeploy
|
||||
influxdb==2.7.3
|
||||
pika
|
||||
python-surveilclient==0.12.0
|
||||
python-surveilclient==0.13.2
|
||||
six
|
||||
docker-py
|
||||
mongoengine
|
||||
|
@ -46,5 +46,5 @@ class ConfigController(rest.RestController):
|
||||
BusinessImpactModulationsController())
|
||||
notificationways = notificationways.NotificationWaysController()
|
||||
checkmodulations = checkmodulations.CheckModulationsController()
|
||||
macromodulations = macromodulations.MacroModulationController()
|
||||
macromodulations = macromodulations.MacroModulationsController()
|
||||
# engine = EngineController()
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
import pecan
|
||||
from pecan import rest
|
||||
import wsme.types as wtypes
|
||||
import wsmeext.pecan as wsme_pecan
|
||||
|
||||
from surveil.api.datamodel.config import businessimpactmodulation as mod
|
||||
@ -25,6 +24,11 @@ from surveil.common import util
|
||||
|
||||
class BusinessImpactModulationsController(rest.RestController):
|
||||
|
||||
@pecan.expose()
|
||||
def _lookup(self, businessimpactmodulation_name, *remainder):
|
||||
return BusinessImpactModulationController(
|
||||
businessimpactmodulation_name), remainder
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose([mod.BusinessImpactModulation])
|
||||
def get_all(self):
|
||||
@ -34,18 +38,10 @@ class BusinessImpactModulationsController(rest.RestController):
|
||||
return modulations
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(mod.BusinessImpactModulation, wtypes.text)
|
||||
def get_one(self, modulation_name):
|
||||
"""Returns a specific business impact modulation."""
|
||||
handler = bh.BusinessImpactModulationHandler(pecan.request)
|
||||
modulation = handler.get(
|
||||
{"business_impact_modulation_name": modulation_name}
|
||||
)
|
||||
return modulation
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(body=mod.BusinessImpactModulation, status_code=201)
|
||||
def post(self, data):
|
||||
@wsme_pecan.wsexpose(mod.BusinessImpactModulation,
|
||||
body=mod.BusinessImpactModulation,
|
||||
status_code=201)
|
||||
def put(self, data):
|
||||
"""Create a new business impact modulation.
|
||||
|
||||
:param data: a business impact modulation within the request body.
|
||||
@ -53,26 +49,41 @@ class BusinessImpactModulationsController(rest.RestController):
|
||||
handler = bh.BusinessImpactModulationHandler(pecan.request)
|
||||
handler.create(data)
|
||||
|
||||
|
||||
class BusinessImpactModulationController(rest.RestController):
|
||||
|
||||
def __init__(self, business_impact_modulation_name):
|
||||
pecan.request.context['business_impact_modulation_name'] = (
|
||||
business_impact_modulation_name)
|
||||
self._id = business_impact_modulation_name
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(mod.BusinessImpactModulation,
|
||||
wtypes.text,
|
||||
status_code=204)
|
||||
def delete(self, modulation_name):
|
||||
@wsme_pecan.wsexpose(mod.BusinessImpactModulation)
|
||||
def get(self):
|
||||
"""Returns a specific business impact modulation."""
|
||||
handler = bh.BusinessImpactModulationHandler(pecan.request)
|
||||
modulation = handler.get(
|
||||
{"business_impact_modulation_name": self._id}
|
||||
)
|
||||
return modulation
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(None, status_code=204)
|
||||
def delete(self):
|
||||
"""Delete this business impact modulation."""
|
||||
handler = bh.BusinessImpactModulationHandler(pecan.request)
|
||||
handler.delete(
|
||||
{"business_impact_modulation_name": modulation_name}
|
||||
{"business_impact_modulation_name": self._id}
|
||||
)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(mod.BusinessImpactModulation,
|
||||
wtypes.text,
|
||||
@wsme_pecan.wsexpose(None,
|
||||
body=mod.BusinessImpactModulation,
|
||||
status_code=204)
|
||||
def put(self, modulaion_name, modulation):
|
||||
def put(self, modulation):
|
||||
"""Update a specific business impact modulation."""
|
||||
handler = bh.BusinessImpactModulationHandler(pecan.request)
|
||||
handler.update(
|
||||
{"business_impact_modulation_name": modulaion_name},
|
||||
{"business_impact_modulation_name": self._id},
|
||||
modulation
|
||||
)
|
||||
|
@ -25,6 +25,10 @@ from surveil.common import util
|
||||
|
||||
class CheckModulationsController(rest.RestController):
|
||||
|
||||
@pecan.expose()
|
||||
def _lookup(self, checkmodulation_name, *remainder):
|
||||
return CheckModulationController(checkmodulation_name), remainder
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose([checkmodulation.CheckModulation])
|
||||
def get_all(self):
|
||||
@ -33,19 +37,9 @@ class CheckModulationsController(rest.RestController):
|
||||
checkmodulations = handler.get_all()
|
||||
return checkmodulations
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(checkmodulation.CheckModulation, wtypes.text)
|
||||
def get_one(self, checkmodulation_name):
|
||||
"""Returns a specific check modulation."""
|
||||
handler = checkmodulation_handler.CheckModulationHandler(pecan.request)
|
||||
checkmodulation = handler.get(
|
||||
{"checkmodulation_name": checkmodulation_name}
|
||||
)
|
||||
return checkmodulation
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(body=checkmodulation.CheckModulation, status_code=201)
|
||||
def post(self, data):
|
||||
def put(self, data):
|
||||
"""Create a new check modulation.
|
||||
|
||||
:param data: a check modulation within the request body.
|
||||
@ -53,23 +47,38 @@ class CheckModulationsController(rest.RestController):
|
||||
handler = checkmodulation_handler.CheckModulationHandler(pecan.request)
|
||||
handler.create(data)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(checkmodulation.CheckModulation,
|
||||
wtypes.text, status_code=204)
|
||||
def delete(self, checkmodulation_name):
|
||||
"""Returns a specific check modulation."""
|
||||
handler = checkmodulation_handler.CheckModulationHandler(pecan.request)
|
||||
handler.delete({"checkmodulation_name": checkmodulation_name})
|
||||
|
||||
class CheckModulationController(rest.RestController):
|
||||
|
||||
def __init__(self, check_modulation_name):
|
||||
pecan.request.context['check_modulation_name'] = check_modulation_name
|
||||
self._id = check_modulation_name
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(checkmodulation.CheckModulation,
|
||||
wtypes.text,
|
||||
@wsme_pecan.wsexpose(None, status_code=204)
|
||||
def delete(self):
|
||||
"""Returns a specific check modulation."""
|
||||
handler = checkmodulation_handler.CheckModulationHandler(pecan.request)
|
||||
handler.delete({"checkmodulation_name": self._id})
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(None,
|
||||
body=checkmodulation.CheckModulation,
|
||||
status_code=204)
|
||||
def put(self, checkmodulation_name, checkmodulation):
|
||||
def put(self, checkmodulation):
|
||||
"""Update a specific check modulation."""
|
||||
handler = checkmodulation_handler.CheckModulationHandler(pecan.request)
|
||||
handler.update(
|
||||
{"checkmodulation_name": checkmodulation_name},
|
||||
{"checkmodulation_name": self._id},
|
||||
checkmodulation
|
||||
)
|
||||
)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(checkmodulation.CheckModulation, wtypes.text)
|
||||
def get(self):
|
||||
"""Returns a specific check modulation."""
|
||||
handler = checkmodulation_handler.CheckModulationHandler(pecan.request)
|
||||
checkmodulation = handler.get(
|
||||
{"checkmodulation_name": self._id}
|
||||
)
|
||||
return checkmodulation
|
@ -71,7 +71,7 @@ class CommandsController(rest.RestController):
|
||||
@wsme_pecan.wsexpose(command.Command,
|
||||
body=command.Command,
|
||||
status_code=201)
|
||||
def post(self, data):
|
||||
def put(self, data):
|
||||
"""Create a new command.
|
||||
|
||||
:param data: a command within the request body.
|
||||
|
@ -25,6 +25,10 @@ from surveil.common import util
|
||||
|
||||
class ContactGroupsController(rest.RestController):
|
||||
|
||||
@pecan.expose()
|
||||
def _lookup(self, contactgroup_name, *remainder):
|
||||
return ContactGroupController(contactgroup_name), remainder
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose([contactgroup.ContactGroup])
|
||||
def get_all(self):
|
||||
@ -33,17 +37,9 @@ class ContactGroupsController(rest.RestController):
|
||||
contact_groups = handler.get_all()
|
||||
return contact_groups
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(contactgroup.ContactGroup, wtypes.text)
|
||||
def get_one(self, group_name):
|
||||
"""Returns a contact group."""
|
||||
handler = contactgroup_handler.ContactGroupHandler(pecan.request)
|
||||
contactgroup = handler.get({"contactgroup_name": group_name})
|
||||
return contactgroup
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(body=contactgroup.ContactGroup, status_code=201)
|
||||
def post(self, data):
|
||||
def put(self, data):
|
||||
"""Create a new contact group.
|
||||
|
||||
:param data: a contact group within the request body.
|
||||
@ -51,20 +47,33 @@ class ContactGroupsController(rest.RestController):
|
||||
handler = contactgroup_handler.ContactGroupHandler(pecan.request)
|
||||
handler.create(data)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(contactgroup.ContactGroup, wtypes.text,
|
||||
status_code=204)
|
||||
def delete(self, group_name):
|
||||
"""Delete a specific contact group."""
|
||||
handler = contactgroup_handler.ContactGroupHandler(pecan.request)
|
||||
handler.delete({"contactgroup_name": group_name})
|
||||
|
||||
class ContactGroupController(rest.RestController):
|
||||
|
||||
def __init__(self, contactgroup_name):
|
||||
pecan.request.context['contactgroup_name'] = contactgroup_name
|
||||
self._id = contactgroup_name
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(contactgroup.ContactGroup,
|
||||
wtypes.text,
|
||||
@wsme_pecan.wsexpose(None, status_code=204)
|
||||
def delete(self):
|
||||
"""Delete a specific contact group."""
|
||||
handler = contactgroup_handler.ContactGroupHandler(pecan.request)
|
||||
handler.delete({"contactgroup_name": self._id})
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(None,
|
||||
body=contactgroup.ContactGroup,
|
||||
status_code=204)
|
||||
def put(self, group_name, contactgroup):
|
||||
def put(self, contactgroup):
|
||||
"""Update a specific contact group."""
|
||||
handler = contactgroup_handler.ContactGroupHandler(pecan.request)
|
||||
handler.update({"contactgroup_name": group_name}, contactgroup)
|
||||
handler.update({"contactgroup_name": self._id}, contactgroup)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(contactgroup.ContactGroup, wtypes.text)
|
||||
def get(self):
|
||||
"""Returns a contact group."""
|
||||
handler = contactgroup_handler.ContactGroupHandler(pecan.request)
|
||||
contactgroup = handler.get({"contactgroup_name": self._id})
|
||||
return contactgroup
|
||||
|
@ -25,25 +25,21 @@ from surveil.common import util
|
||||
|
||||
class ContactsController(rest.RestController):
|
||||
|
||||
@pecan.expose()
|
||||
def _lookup(self, contact_name, *remainder):
|
||||
return ContactController(contact_name), remainder
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose([contact.Contact])
|
||||
def get_all(self):
|
||||
"""Returns all hosts."""
|
||||
"""Returns all contacts."""
|
||||
handler = contact_handler.ContactHandler(pecan.request)
|
||||
hosts = handler.get_all()
|
||||
return hosts
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(contact.Contact, wtypes.text)
|
||||
def get_one(self, contact_name):
|
||||
"""Returns a specific contact."""
|
||||
handler = contact_handler.ContactHandler(pecan.request)
|
||||
contact = handler.get({"contact_name": contact_name})
|
||||
return contact
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(body=contact.Contact, status_code=201)
|
||||
def post(self, data):
|
||||
def put(self, data):
|
||||
"""Create a new contact.
|
||||
|
||||
:param data: a contact within the request body.
|
||||
@ -51,19 +47,33 @@ class ContactsController(rest.RestController):
|
||||
handler = contact_handler.ContactHandler(pecan.request)
|
||||
handler.create(data)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(contact.Contact, wtypes.text, status_code=204)
|
||||
def delete(self, contact_name):
|
||||
"""Returns a specific contact."""
|
||||
handler = contact_handler.ContactHandler(pecan.request)
|
||||
handler.delete({"contact_name": contact_name})
|
||||
|
||||
class ContactController(rest.RestController):
|
||||
|
||||
def __init__(self, contact_name):
|
||||
pecan.request.context['contact_name'] = contact_name
|
||||
self._id = contact_name
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(contact.Contact,
|
||||
wtypes.text,
|
||||
body=contact.Contact,
|
||||
status_code=204)
|
||||
def put(self, contact_name, contact):
|
||||
@wsme_pecan.wsexpose(None, status_code=204)
|
||||
def delete(self):
|
||||
"""Returns a specific contact."""
|
||||
handler = contact_handler.ContactHandler(pecan.request)
|
||||
handler.update({"contact_name": contact_name}, contact)
|
||||
handler.delete({"contact_name": self._id})
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(None,
|
||||
body=contact.Contact,
|
||||
status_code=204)
|
||||
def put(self, contact):
|
||||
"""Returns a specific contact."""
|
||||
handler = contact_handler.ContactHandler(pecan.request)
|
||||
handler.update({"contact_name": self._id}, contact)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(contact.Contact, wtypes.text)
|
||||
def get(self):
|
||||
"""Returns a specific contact."""
|
||||
handler = contact_handler.ContactHandler(pecan.request)
|
||||
contact = handler.get({"contact_name": self._id})
|
||||
return contact
|
@ -25,6 +25,10 @@ from surveil.common import util
|
||||
|
||||
class HostGroupsController(rest.RestController):
|
||||
|
||||
@pecan.expose()
|
||||
def _lookup(self, hostgroup_name, *remainder):
|
||||
return HostGroupController(hostgroup_name), remainder
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose([hostgroup.HostGroup])
|
||||
def get_all(self):
|
||||
@ -33,17 +37,9 @@ class HostGroupsController(rest.RestController):
|
||||
host_groups = handler.get_all()
|
||||
return host_groups
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(hostgroup.HostGroup, wtypes.text)
|
||||
def get_one(self, group_name):
|
||||
"""Returns a host group."""
|
||||
handler = hostgroup_handler.HostGroupHandler(pecan.request)
|
||||
hostgroup = handler.get({"hostgroup_name": group_name})
|
||||
return hostgroup
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(body=hostgroup.HostGroup, status_code=201)
|
||||
def post(self, data):
|
||||
def put(self, data):
|
||||
"""Create a new host group.
|
||||
|
||||
:param data: a host group within the request body.
|
||||
@ -51,19 +47,33 @@ class HostGroupsController(rest.RestController):
|
||||
handler = hostgroup_handler.HostGroupHandler(pecan.request)
|
||||
handler.create(data)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(hostgroup.HostGroup, wtypes.text, status_code=204)
|
||||
def delete(self, group_name):
|
||||
"""Returns a specific host group."""
|
||||
handler = hostgroup_handler.HostGroupHandler(pecan.request)
|
||||
handler.delete({"hostgroup_name": group_name})
|
||||
|
||||
class HostGroupController(rest.RestController):
|
||||
|
||||
def __init__(self, hostgroup_name):
|
||||
pecan.request.context['hostgroup_name'] = hostgroup_name
|
||||
self._id = hostgroup_name
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(hostgroup.HostGroup,
|
||||
wtypes.text,
|
||||
@wsme_pecan.wsexpose(None, status_code=204)
|
||||
def delete(self):
|
||||
"""Returns a specific host group."""
|
||||
handler = hostgroup_handler.HostGroupHandler(pecan.request)
|
||||
handler.delete({"hostgroup_name": self._id})
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(None,
|
||||
body=hostgroup.HostGroup,
|
||||
status_code=204)
|
||||
def put(self, group_name, hostgroup):
|
||||
def put(self, hostgroup):
|
||||
"""Update a specific host group."""
|
||||
handler = hostgroup_handler.HostGroupHandler(pecan.request)
|
||||
handler.update({"hostgroup_name": group_name}, hostgroup)
|
||||
handler.update({"hostgroup_name": self._id}, hostgroup)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(hostgroup.HostGroup, wtypes.text)
|
||||
def get(self):
|
||||
"""Returns a host group."""
|
||||
handler = hostgroup_handler.HostGroupHandler(pecan.request)
|
||||
hostgroup = handler.get({"hostgroup_name": self._id})
|
||||
return hostgroup
|
@ -134,7 +134,7 @@ class HostsController(rest.RestController):
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(host.Host, body=host.Host, status_code=201)
|
||||
def post(self, data):
|
||||
def put(self, data):
|
||||
"""Create a new host.
|
||||
|
||||
:param data: a host within the request body.
|
||||
|
@ -23,7 +23,11 @@ from surveil.api.handlers.config import macromodulation_handler
|
||||
from surveil.common import util
|
||||
|
||||
|
||||
class MacroModulationController(rest.RestController):
|
||||
class MacroModulationsController(rest.RestController):
|
||||
|
||||
@pecan.expose()
|
||||
def _lookup(self, macromodulation_name, *remainder):
|
||||
return MacroModulationController(macromodulation_name), remainder
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose([macromodulation.MacroModulation])
|
||||
@ -33,19 +37,9 @@ class MacroModulationController(rest.RestController):
|
||||
modulations = handler.get_all()
|
||||
return modulations
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(macromodulation.MacroModulation, wtypes.text)
|
||||
def get_one(self, macromodulation_name):
|
||||
"""Returns a specific macro modulation."""
|
||||
handler = macromodulation_handler.MacroModulationHandler(pecan.request)
|
||||
modulation = handler.get(
|
||||
{"macromodulation_name": macromodulation_name}
|
||||
)
|
||||
return modulation
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(body=macromodulation.MacroModulation, status_code=201)
|
||||
def post(self, data):
|
||||
def put(self, data):
|
||||
"""Create a new macro modulation object.
|
||||
|
||||
:param data: a macro modulation within the request body.
|
||||
@ -53,21 +47,36 @@ class MacroModulationController(rest.RestController):
|
||||
handler = macromodulation_handler.MacroModulationHandler(pecan.request)
|
||||
handler.create(data)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(macromodulation.MacroModulation,
|
||||
wtypes.text,
|
||||
status_code=204)
|
||||
def delete(self, modulation_name):
|
||||
"""Returns a specific macro modulation."""
|
||||
handler = macromodulation_handler.MacroModulationHandler(pecan.request)
|
||||
handler.delete({"macromodulation_name": modulation_name})
|
||||
|
||||
class MacroModulationController(rest.RestController):
|
||||
|
||||
def __init__(self, macromodulation_name):
|
||||
pecan.request.context['macromodulation_name'] = macromodulation_name
|
||||
self._id = macromodulation_name
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(macromodulation.MacroModulation,
|
||||
wtypes.text,
|
||||
@wsme_pecan.wsexpose(None,
|
||||
status_code=204)
|
||||
def delete(self):
|
||||
"""Returns a specific macro modulation."""
|
||||
handler = macromodulation_handler.MacroModulationHandler(pecan.request)
|
||||
handler.delete({"macromodulation_name": self._id})
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(None,
|
||||
body=macromodulation.MacroModulation,
|
||||
status_code=204)
|
||||
def put(self, modulation_name, modulation):
|
||||
def put(self, modulation):
|
||||
"""Update a specific macro modulation."""
|
||||
handler = macromodulation_handler.MacroModulationHandler(pecan.request)
|
||||
handler.update({"macromodulation_name": modulation_name}, modulation)
|
||||
handler.update({"macromodulation_name": self._id}, modulation)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(macromodulation.MacroModulation, wtypes.text)
|
||||
def get(self):
|
||||
"""Returns a specific macro modulation."""
|
||||
handler = macromodulation_handler.MacroModulationHandler(pecan.request)
|
||||
modulation = handler.get(
|
||||
{"macromodulation_name": self._id}
|
||||
)
|
||||
return modulation
|
@ -25,6 +25,10 @@ from surveil.common import util
|
||||
|
||||
class NotificationWaysController(rest.RestController):
|
||||
|
||||
@pecan.expose()
|
||||
def _lookup(self, notificationway_name, *remainder):
|
||||
return NotificationWayController(notificationway_name), remainder
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose([notificationway.NotificationWay])
|
||||
def get_all(self):
|
||||
@ -33,19 +37,9 @@ class NotificationWaysController(rest.RestController):
|
||||
notificationsway = handler.get_all()
|
||||
return notificationsway
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(notificationway.NotificationWay, wtypes.text)
|
||||
def get_one(self, notificationway_name):
|
||||
"""Returns a specific notification way."""
|
||||
handler = notificationway_handler.NotificationWayHandler(pecan.request)
|
||||
notificationway = handler.get(
|
||||
{"notificationway_name": notificationway_name}
|
||||
)
|
||||
return notificationway
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(body=notificationway.NotificationWay, status_code=201)
|
||||
def post(self, data):
|
||||
def put(self, data):
|
||||
"""Create a new notification way.
|
||||
|
||||
:param data: a notification way within the request body.
|
||||
@ -53,26 +47,38 @@ class NotificationWaysController(rest.RestController):
|
||||
handler = notificationway_handler.NotificationWayHandler(pecan.request)
|
||||
handler.create(data)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(
|
||||
notificationway.NotificationWay,
|
||||
wtypes.text,
|
||||
status_code=204
|
||||
)
|
||||
def delete(self, notificationway_name):
|
||||
"""Returns a specific notification way."""
|
||||
handler = notificationway_handler.NotificationWayHandler(pecan.request)
|
||||
handler.delete({"notificationway_name": notificationway_name})
|
||||
|
||||
class NotificationWayController(rest.RestController):
|
||||
|
||||
def __init__(self, notificationway_name):
|
||||
pecan.request.context['notificationway_name'] = notificationway_name
|
||||
self._id = notificationway_name
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(notificationway.NotificationWay,
|
||||
wtypes.text,
|
||||
@wsme_pecan.wsexpose(None, status_code=204)
|
||||
def delete(self):
|
||||
"""Returns a specific notification way."""
|
||||
handler = notificationway_handler.NotificationWayHandler(pecan.request)
|
||||
handler.delete({"notificationway_name": self._id})
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(None,
|
||||
body=notificationway.NotificationWay,
|
||||
status_code=204)
|
||||
def put(self, notificationway_name, notificationway):
|
||||
def put(self, notificationway):
|
||||
"""Update a specific notification way."""
|
||||
handler = notificationway_handler.NotificationWayHandler(pecan.request)
|
||||
handler.update(
|
||||
{"notificationway_name": notificationway_name},
|
||||
{"notificationway_name": self._id},
|
||||
notificationway
|
||||
)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(notificationway.NotificationWay, wtypes.text)
|
||||
def get(self):
|
||||
"""Returns a specific notification way."""
|
||||
handler = notificationway_handler.NotificationWayHandler(pecan.request)
|
||||
notificationway = handler.get(
|
||||
{"notificationway_name": self._id}
|
||||
)
|
||||
return notificationway
|
@ -25,6 +25,10 @@ from surveil.common import util
|
||||
|
||||
class RealmsController(rest.RestController):
|
||||
|
||||
@pecan.expose()
|
||||
def _lookup(self, realm_name, *remainder):
|
||||
return RealmController(realm_name), remainder
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose([realm.Realm])
|
||||
def get_all(self):
|
||||
@ -33,17 +37,9 @@ class RealmsController(rest.RestController):
|
||||
realms = handler.get_all()
|
||||
return realms
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(realm.Realm, wtypes.text)
|
||||
def get_one(self, realm_name):
|
||||
"""Returns a specific realm."""
|
||||
handler = realm_handler.RealmHandler(pecan.request)
|
||||
realm = handler.get({"realm_name": realm_name})
|
||||
return realm
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(body=realm.Realm, status_code=201)
|
||||
def post(self, data):
|
||||
def put(self, data):
|
||||
"""Create a new realm.
|
||||
|
||||
:param data: a realm within the request body.
|
||||
@ -51,22 +47,36 @@ class RealmsController(rest.RestController):
|
||||
handler = realm_handler.RealmHandler(pecan.request)
|
||||
handler.create(data)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(realm.Realm, wtypes.text, status_code=204)
|
||||
def delete(self, realm_name):
|
||||
"""Deletes a specific realm."""
|
||||
handler = realm_handler.RealmHandler(pecan.request)
|
||||
handler.delete({"realm_name": realm_name})
|
||||
|
||||
class RealmController(rest.RestController):
|
||||
|
||||
def __init__(self, realm_name):
|
||||
pecan.request.context['realm_name'] = realm_name
|
||||
self._id = realm_name
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(realm.Realm,
|
||||
wtypes.text,
|
||||
@wsme_pecan.wsexpose(None, status_code=204)
|
||||
def delete(self):
|
||||
"""Deletes a specific realm."""
|
||||
handler = realm_handler.RealmHandler(pecan.request)
|
||||
handler.delete({"realm_name": self._id})
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(None,
|
||||
body=realm.Realm,
|
||||
status_code=204)
|
||||
def put(self, realm_name, realm):
|
||||
def put(self, realm):
|
||||
"""Updates a specific realm."""
|
||||
handler = realm_handler.RealmHandler(pecan.request)
|
||||
handler.update(
|
||||
{"realm_name": realm_name},
|
||||
{"realm_name": self._id},
|
||||
realm
|
||||
)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(realm.Realm, wtypes.text)
|
||||
def get(self):
|
||||
"""Returns a specific realm."""
|
||||
handler = realm_handler.RealmHandler(pecan.request)
|
||||
realm = handler.get({"realm_name": self._id})
|
||||
return realm
|
@ -25,6 +25,10 @@ from surveil.common import util
|
||||
|
||||
class ServiceGroupsController(rest.RestController):
|
||||
|
||||
@pecan.expose()
|
||||
def _lookup(self, servicegroup_name, *remainder):
|
||||
return ServiceGroupController(servicegroup_name), remainder
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose([servicegroup.ServiceGroup])
|
||||
def get_all(self):
|
||||
@ -33,17 +37,9 @@ class ServiceGroupsController(rest.RestController):
|
||||
service_groups = handler.get_all()
|
||||
return service_groups
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(servicegroup.ServiceGroup, wtypes.text)
|
||||
def get_one(self, group_name):
|
||||
"""Returns a service group."""
|
||||
handler = servicegroup_handler.ServiceGroupHandler(pecan.request)
|
||||
servicegroup = handler.get({"servicegroup_name": group_name})
|
||||
return servicegroup
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(body=servicegroup.ServiceGroup, status_code=201)
|
||||
def post(self, data):
|
||||
def put(self, data):
|
||||
"""Create a new service group.
|
||||
|
||||
:param data: a service group within the request body.
|
||||
@ -51,20 +47,33 @@ class ServiceGroupsController(rest.RestController):
|
||||
handler = servicegroup_handler.ServiceGroupHandler(pecan.request)
|
||||
handler.create(data)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(servicegroup.ServiceGroup, wtypes.text,
|
||||
status_code=204)
|
||||
def delete(self, group_name):
|
||||
"""Returns a specific service group."""
|
||||
handler = servicegroup_handler.ServiceGroupHandler(pecan.request)
|
||||
handler.delete({"servicegroup_name": group_name})
|
||||
|
||||
class ServiceGroupController(rest.RestController):
|
||||
|
||||
def __init__(self, servicegroup_name):
|
||||
pecan.request.context['servicegroup_name'] = servicegroup_name
|
||||
self._id = servicegroup_name
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(servicegroup.ServiceGroup,
|
||||
wtypes.text,
|
||||
@wsme_pecan.wsexpose(None, status_code=204)
|
||||
def delete(self):
|
||||
"""Returns a specific service group."""
|
||||
handler = servicegroup_handler.ServiceGroupHandler(pecan.request)
|
||||
handler.delete({"servicegroup_name": self._id})
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(None,
|
||||
body=servicegroup.ServiceGroup,
|
||||
status_code=204)
|
||||
def put(self, group_name, servicegroup):
|
||||
def put(self, servicegroup):
|
||||
"""Update a specific service group."""
|
||||
handler = servicegroup_handler.ServiceGroupHandler(pecan.request)
|
||||
handler.update({"servicegroup_name": group_name}, servicegroup)
|
||||
handler.update({"servicegroup_name": self._id}, servicegroup)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(servicegroup.ServiceGroup, wtypes.text)
|
||||
def get(self):
|
||||
"""Returns a service group."""
|
||||
handler = servicegroup_handler.ServiceGroupHandler(pecan.request)
|
||||
servicegroup = handler.get({"servicegroup_name": self._id})
|
||||
return servicegroup
|
@ -37,7 +37,7 @@ class ServicesController(rest.RestController):
|
||||
@wsme_pecan.wsexpose(service.Service,
|
||||
body=service.Service,
|
||||
status_code=201)
|
||||
def post(self, data):
|
||||
def put(self, data):
|
||||
"""Create a new service.
|
||||
|
||||
:param data: a service within the request body.
|
||||
|
@ -25,6 +25,10 @@ from surveil.common import util
|
||||
|
||||
class TimePeriodsController(rest.RestController):
|
||||
|
||||
@pecan.expose()
|
||||
def _lookup(self, timeperiod_name, *remainder):
|
||||
return TimePeriodController(timeperiod_name), remainder
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose([timeperiod.TimePeriod])
|
||||
def get_all(self):
|
||||
@ -33,17 +37,9 @@ class TimePeriodsController(rest.RestController):
|
||||
time_periods = handler.get_all()
|
||||
return time_periods
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(timeperiod.TimePeriod, wtypes.text)
|
||||
def get_one(self, timeperiod_name):
|
||||
"""Returns a specific time period."""
|
||||
handler = timeperiod_handler.TimePeriodHandler(pecan.request)
|
||||
timeperiod = handler.get({"timeperiod_name": timeperiod_name})
|
||||
return timeperiod
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(body=timeperiod.TimePeriod, status_code=201)
|
||||
def post(self, data):
|
||||
def put(self, data):
|
||||
"""Create a new time period.
|
||||
|
||||
:param data: a time period within the request body.
|
||||
@ -51,19 +47,32 @@ class TimePeriodsController(rest.RestController):
|
||||
handler = timeperiod_handler.TimePeriodHandler(pecan.request)
|
||||
handler.create(data)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(timeperiod.TimePeriod, wtypes.text, status_code=204)
|
||||
def delete(self, timeperiod_name):
|
||||
"""Returns a specific time period."""
|
||||
handler = timeperiod_handler.TimePeriodHandler(pecan.request)
|
||||
handler.delete({"timeperiod_name": timeperiod_name})
|
||||
|
||||
class TimePeriodController(rest.RestController):
|
||||
|
||||
def __init__(self, timeperiod_name):
|
||||
pecan.request.context['timeperiod_name'] = timeperiod_name
|
||||
self._id = timeperiod_name
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(timeperiod.TimePeriod,
|
||||
wtypes.text,
|
||||
body=timeperiod.TimePeriod,
|
||||
@wsme_pecan.wsexpose(None, status_code=204)
|
||||
def delete(self):
|
||||
"""Returns a specific time period."""
|
||||
handler = timeperiod_handler.TimePeriodHandler(pecan.request)
|
||||
handler.delete({"timeperiod_name": self._id})
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(None, body=timeperiod.TimePeriod,
|
||||
status_code=204)
|
||||
def put(self, timeperiod_name, timeperiod):
|
||||
def put(self, timeperiod):
|
||||
"""Update a specific time period."""
|
||||
handler = timeperiod_handler.TimePeriodHandler(pecan.request)
|
||||
handler.update({"timeperiod_name": timeperiod_name}, timeperiod)
|
||||
handler.update({"timeperiod_name": self._id}, timeperiod)
|
||||
|
||||
@util.policy_enforce(['authenticated'])
|
||||
@wsme_pecan.wsexpose(timeperiod.TimePeriod, wtypes.text)
|
||||
def get(self):
|
||||
"""Returns a specific time period."""
|
||||
handler = timeperiod_handler.TimePeriodHandler(pecan.request)
|
||||
timeperiod = handler.get({"timeperiod_name": self._id})
|
||||
return timeperiod
|
@ -76,7 +76,7 @@ class TestBusinessImpactModulationController(functionalTest.FunctionalTest):
|
||||
self.mongoconnection.shinken.businessimpactmodulations.find_one(m)
|
||||
)
|
||||
|
||||
self.post_json('/v2/config/businessimpactmodulations', m)
|
||||
self.put_json('/v2/config/businessimpactmodulations', m)
|
||||
|
||||
self.assertIsNotNone(
|
||||
self.mongoconnection.shinken.businessimpactmodulations.find_one(m)
|
||||
|
@ -71,7 +71,7 @@ class TestCheckModulationsController(functionalTest.FunctionalTest):
|
||||
"check_period": "evening"
|
||||
}
|
||||
|
||||
self.post_json('/v2/config/checkmodulations', t)
|
||||
self.put_json('/v2/config/checkmodulations', t)
|
||||
self.assertIsNotNone(
|
||||
self.mongoconnection.shinken.checkmodulations.find_one(
|
||||
{"checkmodulation_name": 'ping_evening',
|
||||
|
@ -89,7 +89,7 @@ class TestCommandController(functionalTest.FunctionalTest):
|
||||
"command_name": "newcommand",
|
||||
"command_line": "/usr/bin/newcommand -hello"
|
||||
}
|
||||
response = self.post_json(
|
||||
response = self.put_json(
|
||||
"/v2/config/commands",
|
||||
params=new_command
|
||||
)
|
||||
|
@ -71,7 +71,7 @@ class TestContactGroupsController(functionalTest.FunctionalTest):
|
||||
members=["bob", "alice"],
|
||||
)
|
||||
|
||||
self.post_json('/v2/config/contactgroups', g.as_dict())
|
||||
self.put_json('/v2/config/contactgroups', g.as_dict())
|
||||
|
||||
self.assertIsNotNone(
|
||||
self.mongoconnection.shinken.contactgroups.find_one(g.as_dict())
|
||||
|
@ -68,7 +68,7 @@ class TestContactsController(functionalTest.FunctionalTest):
|
||||
contact_name='John'
|
||||
)
|
||||
|
||||
self.post_json('/v2/config/contacts', c.as_dict())
|
||||
self.put_json('/v2/config/contacts', c.as_dict())
|
||||
|
||||
self.assertIsNotNone(
|
||||
self.mongoconnection.shinken.contacts.find_one(c.as_dict())
|
||||
|
@ -71,7 +71,7 @@ class TestHostGroupsController(functionalTest.FunctionalTest):
|
||||
members=['host1', 'host2'],
|
||||
)
|
||||
|
||||
self.post_json('/v2/config/hostgroups', s.as_dict())
|
||||
self.put_json('/v2/config/hostgroups', s.as_dict())
|
||||
|
||||
self.assertIsNotNone(
|
||||
self.mongoconnection.shinken.hostgroups.find_one(s.as_dict())
|
||||
|
@ -189,7 +189,7 @@ class TestHostController(functionalTest.FunctionalTest):
|
||||
"custom_fields": {},
|
||||
"use": []
|
||||
}
|
||||
response = self.post_json("/v2/config/hosts", params=new_host)
|
||||
response = self.put_json("/v2/config/hosts", params=new_host)
|
||||
|
||||
hosts = [host.Host(**h).as_dict() for h
|
||||
in self.mongoconnection.shinken.hosts.find(None, {'_id': 0})]
|
||||
|
@ -97,7 +97,7 @@ class TestMacroModulationController(functionalTest.FunctionalTest):
|
||||
}
|
||||
}
|
||||
|
||||
self.post_json('/v2/config/macromodulations', m)
|
||||
self.put_json('/v2/config/macromodulations', m)
|
||||
|
||||
self.assertIsNotNone(
|
||||
self.mongoconnection.shinken.macromodulations.find_one(
|
||||
|
@ -106,7 +106,7 @@ class TestNotificationWayController(functionalTest.FunctionalTest):
|
||||
'min_business_impact': 5
|
||||
}
|
||||
|
||||
self.post_json('/v2/config/notificationways', notificationway)
|
||||
self.put_json('/v2/config/notificationways', notificationway)
|
||||
|
||||
self.assertIsNotNone(
|
||||
self.mongoconnection.
|
||||
|
@ -64,7 +64,7 @@ class TestRealmsController(functionalTest.FunctionalTest):
|
||||
default=1
|
||||
)
|
||||
|
||||
self.post_json('/v2/config/realms', r.as_dict())
|
||||
self.put_json('/v2/config/realms', r.as_dict())
|
||||
|
||||
self.assertIsNotNone(
|
||||
self.mongoconnection.shinken.realms.find_one(r.as_dict())
|
||||
|
@ -72,7 +72,7 @@ class TestServiceGroupsController(functionalTest.FunctionalTest):
|
||||
members=['service1'],
|
||||
)
|
||||
|
||||
self.post_json('/v2/config/servicegroups', s.as_dict())
|
||||
self.put_json('/v2/config/servicegroups', s.as_dict())
|
||||
|
||||
self.assertIsNotNone(
|
||||
self.mongoconnection.shinken.servicegroups.find_one(s.as_dict())
|
||||
|
@ -135,7 +135,7 @@ class TestServiceController(functionalTest.FunctionalTest):
|
||||
"contact_groups": ["linux-admins"],
|
||||
"use": []
|
||||
}
|
||||
response = self.post_json(
|
||||
response = self.put_json(
|
||||
"/v2/config/services",
|
||||
params=new_service
|
||||
)
|
||||
|
@ -76,7 +76,7 @@ class TestTimePeriodsController(functionalTest.FunctionalTest):
|
||||
"tuesday": "pizza day"
|
||||
}}
|
||||
|
||||
self.post_json('/v2/config/timeperiods', t)
|
||||
self.put_json('/v2/config/timeperiods', t)
|
||||
|
||||
self.assertIsNotNone(
|
||||
self.mongoconnection.shinken.timeperiods.find_one(
|
||||
|
@ -32,7 +32,7 @@ RUN cd /tmp && \
|
||||
rm -rfv /tmp/mod-booster-nrpe*
|
||||
|
||||
# mod-surveil
|
||||
RUN pip install python-surveilclient==0.11.0
|
||||
RUN pip install python-surveilclient==0.13.2
|
||||
RUN cd /tmp && \
|
||||
wget -O mod-surveil-config.tar.gz https://github.com/Alignak-monitoring/mod-surveil/archive/fdc98b4fc036aa483ecb58459f11f9a87cf2254a.tar.gz && \
|
||||
tar -zxvf mod-surveil-config.tar.gz && \
|
||||
@ -78,7 +78,7 @@ RUN chmod u+s /bin/ping
|
||||
RUN chmod u+s /bin/ping6
|
||||
|
||||
# Download plugins
|
||||
ENV MONITORING_TOOLS_VERSION 0.3.2
|
||||
ENV MONITORING_TOOLS_VERSION 0.4.1
|
||||
RUN apt-get update && apt-get install -y subversion && \
|
||||
svn checkout https://github.com/savoirfairelinux/monitoring-tools/tags/${MONITORING_TOOLS_VERSION}/plugins/check-glance /plugins/check_glance && \
|
||||
svn checkout https://github.com/savoirfairelinux/monitoring-tools/tags/${MONITORING_TOOLS_VERSION}/plugins/check-keystone /plugins/check_keystone && \
|
||||
@ -92,7 +92,7 @@ RUN apt-get update && apt-get install -y subversion && \
|
||||
RUN mkdir -p /opt/surveilplugins
|
||||
RUN virtualenv /opt/surveilplugins/env
|
||||
ENV PATH=$PATH:/opt/surveilplugins/env/bin
|
||||
RUN /opt/surveilplugins/env/bin/pip install "pbr>=1.3,<2.0" shinkenplugins python-keystoneclient python-glanceclient
|
||||
RUN /opt/surveilplugins/env/bin/pip install -U "pbr>=1.3,<2.0" shinkenplugins python-keystoneclient python-glanceclient
|
||||
|
||||
## Install Plugins
|
||||
RUN mkdir -p /usr/lib/monitoring/plugins/sfl
|
||||
|
Loading…
x
Reference in New Issue
Block a user