Api support for service delete

This patch adds support for service delete at api layer.

Change-Id: Ie8559eee9c3a1bb5fffb627ad85d0421934db24d
Partially-Implements: blueprint enhance-service-api
This commit is contained in:
miaohb 2017-04-26 16:40:58 +08:00
parent 1ab12584cb
commit 894aa015e8
2 changed files with 15 additions and 0 deletions

View File

@ -32,5 +32,6 @@
"image:search": "rule:default",
"zun-service:delete": "rule:admin_api",
"zun-service:get_all": "rule:admin_api"
}

View File

@ -71,3 +71,17 @@ class ZunServiceController(base.Controller):
sort_dir='asc')
return ZunServiceCollection.convert_db_rec_list_to_collection(
self.servicegroup_api, hsvcs)
@pecan.expose('json')
@exception.wrap_pecan_controller_exception
def delete(self, host, binary):
"""Delete the specified service.
:param host: The host on which the binary is running.
:param binary: The name of the binary.
"""
context = pecan.request.context
policy.enforce(context, "zun-service:delete",
action="zun-service:delete")
objects.ZunService.get_by_host_and_binary(
context, host, binary).destroy(context)