diff --git a/setup.cfg b/setup.cfg index 02a5bb8e..4c71518d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -102,6 +102,7 @@ openstack.messaging.v2 = queue_signed_url = zaqarclient.queues.v2.cli:CreateSignedUrl messaging_ping = zaqarclient.queues.v2.cli:Ping messaging_health = zaqarclient.queues.v2.cli:Health + messaging_homedoc = zaqarclient.queues.v2.cli:HomeDoc message_post = zaqarclient.queues.v2.cli:PostMessages message_list = zaqarclient.queues.v2.cli:ListMessages diff --git a/zaqarclient/queues/v2/api.py b/zaqarclient/queues/v2/api.py index df560e4d..955e8740 100644 --- a/zaqarclient/queues/v2/api.py +++ b/zaqarclient/queues/v2/api.py @@ -92,4 +92,9 @@ V2.schema.update({ 'ref': 'health', 'method': 'GET', }, + + 'homedoc': { + 'ref': '', + 'method': 'GET', + }, }) diff --git a/zaqarclient/queues/v2/cli.py b/zaqarclient/queues/v2/cli.py index 7596f4e6..f4072bfd 100644 --- a/zaqarclient/queues/v2/cli.py +++ b/zaqarclient/queues/v2/cli.py @@ -559,3 +559,15 @@ class Health(command.Command): client = _get_client(self, parsed_args) health = client.health() print(json.dumps(health, indent=4, sort_keys=True)) + + +class HomeDoc(command.Command): + """Display the resource doc of Zaqar server""" + + _description = _("Display detailed resource doc of Zaqar server") + log = logging.getLogger(__name__ + ".HomeDoc") + + def take_action(self, parsed_args): + client = _get_client(self, parsed_args) + homedoc = client.homedoc() + print(json.dumps(homedoc, indent=4, sort_keys=True)) diff --git a/zaqarclient/queues/v2/client.py b/zaqarclient/queues/v2/client.py index f66078ca..2371c8e6 100644 --- a/zaqarclient/queues/v2/client.py +++ b/zaqarclient/queues/v2/client.py @@ -104,3 +104,9 @@ class Client(client.Client): """Gets the detailed health status of Zaqar server.""" req, trans = self._request_and_transport() return core.health(trans, req) + + @decorators.version(min_version=1.1) + def homedoc(self): + """Get the detailed resource doc of Zaqar server""" + req, trans = self._request_and_transport() + return core.homedoc(trans, req) diff --git a/zaqarclient/queues/v2/core.py b/zaqarclient/queues/v2/core.py index a82003a0..8cf7857b 100644 --- a/zaqarclient/queues/v2/core.py +++ b/zaqarclient/queues/v2/core.py @@ -305,3 +305,21 @@ def health(transport, request, callback=None): request.operation = 'health' resp = transport.send(request) return resp.deserialized_content + + +def homedoc(transport, request, callback=None): + """Get the detailed resource doc of Zaqar server + + :param transport: Transport instance to use + :type transport: `transport.base.Transport` + :param request: Request instance ready to be sent. + :type request: `transport.request.Request` + :param callback: Optional callable to use as callback. + If specified, this request will be sent asynchronously. + (IGNORED UNTIL ASYNC SUPPORT IS COMPLETE) + :type callback: Callable object. + """ + + request.operation = 'homedoc' + resp = transport.send(request) + return resp.deserialized_content