Merge "CLI: support homedoc in client"

This commit is contained in:
Jenkins 2017-05-19 01:31:41 +00:00 committed by Gerrit Code Review
commit 6f4b6e30ad
5 changed files with 42 additions and 0 deletions

View File

@ -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

View File

@ -92,4 +92,9 @@ V2.schema.update({
'ref': 'health',
'method': 'GET',
},
'homedoc': {
'ref': '',
'method': 'GET',
},
})

View File

@ -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))

View File

@ -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)

View File

@ -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