Commit d8260842 authored by Michael Hanselmann's avatar Michael Hanselmann

rapi: Add /2/instances/[instance_name]/info resource

Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 552c8dff
......@@ -283,6 +283,20 @@ Deletes an instance.
It supports the ``dry-run`` argument.
``/2/instances/[instance_name]/info``
+++++++++++++++++++++++++++++++++++++++
It supports the following commands: ``GET``.
``GET``
~~~~~~~
Requests detailed information about the instance. An optional parameter,
``static`` (bool), can be set to return only static information from the
configuration without querying the instance's nodes. The result will be a job
id.
``/2/instances/[instance_name]/reboot``
+++++++++++++++++++++++++++++++++++++++
......
......@@ -167,6 +167,8 @@ CONNECTOR.update({
rlib2.R_2_nodes_name_storage_repair,
"/2/instances": rlib2.R_2_instances,
re.compile(r'^/2/instances/([\w\._-]+)$'): rlib2.R_2_instances_name,
re.compile(r'^/2/instances/([\w\._-]+)/info$'):
rlib2.R_2_instances_name_info,
re.compile(r'^/2/instances/([\w\._-]+)/tags$'): rlib2.R_2_instances_name_tags,
re.compile(r'^/2/instances/([\w\._-]+)/reboot$'):
rlib2.R_2_instances_name_reboot,
......
......@@ -481,6 +481,22 @@ class R_2_instances_name(baserlib.R_Generic):
return baserlib.SubmitJob([op])
class R_2_instances_name_info(baserlib.R_Generic):
"""/2/instances/[instance_name]/info resource.
"""
def GET(self):
"""Request detailed instance information.
"""
instance_name = self.items[0]
static = bool(self._checkIntVariable("static", default=0))
op = opcodes.OpQueryInstanceData(instances=[instance_name],
static=static)
return baserlib.SubmitJob([op])
class R_2_instances_name_reboot(baserlib.R_Generic):
"""/2/instances/[instance_name]/reboot resource.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment