From 9eb30efbf3ee9105520e857fbd16363523ae44ee Mon Sep 17 00:00:00 2001
From: Dean Troyer <dtroyer@gmail.com>
Date: Mon, 17 Nov 2014 17:52:37 -0600
Subject: [PATCH] Command object docs: aggregate, console *, keypair

aggregate
console log
console url
keypair

Change-Id: Iec9b8404ed5febd061a5dfd674b76aaa8aba67bc
---
 doc/source/command-objects/aggregate.rst   | 150 +++++++++++++++++++++
 doc/source/command-objects/console-log.rst |  25 ++++
 doc/source/command-objects/console-url.rst |  33 +++++
 doc/source/command-objects/keypair.rst     |  71 ++++++++++
 doc/source/commands.rst                    |   8 +-
 openstackclient/compute/v2/aggregate.py    |  22 +--
 openstackclient/compute/v2/console.py      |   4 +-
 openstackclient/compute/v2/keypair.py      |  20 +--
 8 files changed, 306 insertions(+), 27 deletions(-)
 create mode 100644 doc/source/command-objects/aggregate.rst
 create mode 100644 doc/source/command-objects/console-log.rst
 create mode 100644 doc/source/command-objects/console-url.rst
 create mode 100644 doc/source/command-objects/keypair.rst

diff --git a/doc/source/command-objects/aggregate.rst b/doc/source/command-objects/aggregate.rst
new file mode 100644
index 0000000000..474d811f88
--- /dev/null
+++ b/doc/source/command-objects/aggregate.rst
@@ -0,0 +1,150 @@
+=========
+aggregate
+=========
+
+Server aggregates provide a mechanism to group servers according to certain
+criteria.
+
+aggregate add host
+------------------
+
+Add host to aggregate
+
+.. program aggregate add host
+.. code:: bash
+
+    os aggregate add host
+        <aggregate>
+        <host>
+
+.. _aggregate_add_host-aggregate:
+.. describe:: <aggregate>
+
+    Aggregate (name or ID)
+
+.. describe:: <host>
+
+    Host to add to :ref:`\<aggregate\> <aggregate_add_host-aggregate>`
+
+aggregate create
+----------------
+
+Create a new aggregate
+
+.. program aggregate create
+.. code:: bash
+
+    os aggregate create
+        [--zone <availability-zone>]
+        [--property <key=value>]
+        <name>
+
+.. option:: --zone <availability-zone>
+
+    Availability zone name
+
+.. option:: --property <key=value>
+
+    Property to add to this aggregate (repeat option to set multiple properties)
+
+.. describe:: <name>
+
+    New aggregate name
+
+aggregate delete
+----------------
+
+Delete an existing aggregate
+
+.. program aggregate delete
+.. code:: bash
+
+    os aggregate delete
+        <aggregate>
+
+.. describe:: <aggregate>
+
+    Aggregate to delete (name or ID)
+
+aggregate list
+--------------
+
+List all aggregates
+
+.. program aggregate list
+.. code:: bash
+
+    os aggregate list
+        [--long]
+
+.. option:: --long
+
+    List additional fields in output
+
+aggregate remove host
+---------------------
+
+Remove host from aggregate
+
+.. program aggregate remove host
+.. code:: bash
+
+    os aggregate remove host
+        <aggregate>
+        <host>
+
+.. _aggregate_remove_host-aggregate:
+.. describe:: <aggregate>
+
+    Aggregate (name or ID)
+
+.. option:: <host>
+
+    Host to remove from :ref:`\<aggregate\> <aggregate_remove_host-aggregate>`
+
+aggregate set
+-------------
+
+Set aggregate properties
+
+.. program aggregate set
+.. code:: bash
+
+    os aggregate set
+        [--name <new-name>]
+        [--zone <availability-zone>]
+        [--property <key=value>]
+        <aggregate>
+
+.. option:: --name <name>
+
+    Set aggregate name
+
+.. option:: --zone <availability-zone>
+
+    Set availability zone name
+
+.. option:: --property <key=value>
+
+    Property to set on :ref:`\<aggregate\> <aggregate_set-aggregate>`
+    (repeat option to set multiple properties)
+
+.. _aggregate_set-aggregate:
+.. describe:: <aggregate>
+
+    Aggregate to modify (name or ID)
+
+aggregate show
+--------------
+
+Show a specific aggregate
+
+.. program aggregate show
+.. code:: bash
+
+    os aggregate show
+        <aggregate>
+
+.. describe:: <aggregate>
+
+    Aggregate to show (name or ID)
diff --git a/doc/source/command-objects/console-log.rst b/doc/source/command-objects/console-log.rst
new file mode 100644
index 0000000000..8e56a07382
--- /dev/null
+++ b/doc/source/command-objects/console-log.rst
@@ -0,0 +1,25 @@
+===========
+console log
+===========
+
+Server console text dump
+
+console log show
+----------------
+
+Show server's console output
+
+.. program:: console log show
+.. code:: bash
+
+    os console log show
+        [--lines <num-lines>]
+        <server>
+
+.. option:: --lines <num-lines>
+
+    Number of lines to display from the end of the log (default=all)
+
+.. describe:: <server>
+
+    Server to show log console log (name or ID)
diff --git a/doc/source/command-objects/console-url.rst b/doc/source/command-objects/console-url.rst
new file mode 100644
index 0000000000..45a0a52717
--- /dev/null
+++ b/doc/source/command-objects/console-url.rst
@@ -0,0 +1,33 @@
+===========
+console url
+===========
+
+Server remote console URL
+
+console url show
+----------------
+
+Show server's remote console URL
+
+.. program:: console url show
+.. code:: bash
+
+    os console url show
+        [--novnc | --xvpvnc | --spice]
+        <server>
+
+.. option:: --novnc
+
+    Show noVNC console URL (default)
+
+.. option:: --xvpvnc
+
+    Show xpvnc console URL
+
+.. option:: --spice
+
+    Show SPICE console URL
+
+.. describe:: <server>
+
+    Server to show URL (name or ID)
diff --git a/doc/source/command-objects/keypair.rst b/doc/source/command-objects/keypair.rst
new file mode 100644
index 0000000000..9ba0ee8f04
--- /dev/null
+++ b/doc/source/command-objects/keypair.rst
@@ -0,0 +1,71 @@
+=======
+keypair
+=======
+
+The badly named keypair is really the public key of an OpenSSH key pair to be
+used for access to created servers.
+
+keypair create
+--------------
+
+Create new public key
+
+.. program keypair create
+.. code:: bash
+
+    os keypair create
+        [--public-key <file>]
+        <name>
+
+.. option:: --public-key <file>
+
+    Filename for public key to add
+
+.. describe:: <name>
+
+    New public key name
+
+keypair delete
+--------------
+
+Delete a public key
+
+.. program keypair delete
+.. code:: bash
+
+    os keypair delete
+        <key>
+
+.. describe:: <key>
+
+    Public key to delete
+
+keypair list
+------------
+
+List public key fingerprints
+
+.. program keypair list
+.. code:: bash
+
+    os keypair list
+
+keypair show
+------------
+
+Show public key details
+
+.. program keypair show
+.. code:: bash
+
+    os keypair show
+        [--public-key]
+        <key>
+
+.. option:: --public-key
+
+    Show only bare public key
+
+.. describe:: <key>
+
+    Public key to show
diff --git a/doc/source/commands.rst b/doc/source/commands.rst
index 37c62e8ec3..506fbfc28f 100644
--- a/doc/source/commands.rst
+++ b/doc/source/commands.rst
@@ -70,10 +70,10 @@ the API resources will be merged, as in the ``quota`` object that has options
 referring to both Compute and Volume quotas.
 
 * ``access token``: Identity - long-lived OAuth-based token
-* ``aggregate``: Compute - a grouping of servers
+* ``aggregate``: (**Compute**) a grouping of servers
 * ``backup``: Volume - a volume copy
-* ``console log``: Compute - a text dump of a server's console
-* ``console url``: Compute - a URL to a server's remote console
+* ``console log``: (**Compute**) server console text dump
+* ``console url``: (**Compute**) server remote console URL
 * ``consumer``: Identity - OAuth-based delegatee
 * ``container``: Object Store - a grouping of objects
 * ``credential``: Identity - specific to identity providers
@@ -88,7 +88,7 @@ referring to both Compute and Volume quotas.
 * ``image``: Image - a disk image
 * ``ip fixed``: Compute, Network - an internal IP address assigned to a server
 * ``ip floating``: Compute, Network - a public IP address that can be mapped to a server
-* ``keypair``: Compute - an SSH public key
+* ``keypair``: (**Compute**) an SSH public key
 * ``limits``: (**Compute**, **Volume**) resource usage limits
 * ``module``: internal - installed Python modules in the OSC process
 * ``network``: Network - a virtual network for connecting servers and other resources
diff --git a/openstackclient/compute/v2/aggregate.py b/openstackclient/compute/v2/aggregate.py
index 8fff4e6fcf..bfc2b115aa 100644
--- a/openstackclient/compute/v2/aggregate.py
+++ b/openstackclient/compute/v2/aggregate.py
@@ -37,12 +37,12 @@ class AddAggregateHost(show.ShowOne):
         parser.add_argument(
             'aggregate',
             metavar='<aggregate>',
-            help='Name or ID of aggregate',
+            help='Aggregate (name or ID)',
         )
         parser.add_argument(
             'host',
             metavar='<host>',
-            help='Host to add to aggregate',
+            help='Host to add to <aggregate>',
         )
         return parser
 
@@ -119,7 +119,7 @@ class DeleteAggregate(command.Command):
         parser.add_argument(
             'aggregate',
             metavar='<aggregate>',
-            help='Name or ID of aggregate to delete',
+            help='Aggregate to delete (name or ID)',
         )
         return parser
 
@@ -197,12 +197,12 @@ class RemoveAggregateHost(show.ShowOne):
         parser.add_argument(
             'aggregate',
             metavar='<aggregate>',
-            help='Name or ID of aggregate',
+            help='Aggregate (name or ID)',
         )
         parser.add_argument(
             'host',
             metavar='<host>',
-            help='Host to remove from aggregate',
+            help='Host to remove from <aggregate>',
         )
         return parser
 
@@ -235,23 +235,23 @@ class SetAggregate(show.ShowOne):
         parser.add_argument(
             'aggregate',
             metavar='<aggregate>',
-            help='Name or ID of aggregate to display',
+            help='Aggregate to modify (name or ID)',
         )
         parser.add_argument(
             '--name',
-            metavar='<new-name>',
-            help='New aggregate name',
+            metavar='<name>',
+            help='Set aggregate name',
         )
         parser.add_argument(
             "--zone",
             metavar="<availability-zone>",
-            help="Availability zone name",
+            help="Set availability zone name",
         )
         parser.add_argument(
             "--property",
             metavar="<key=value>",
             action=parseractions.KeyValueAction,
-            help='Property to add/change for this aggregate '
+            help='Property to set on <aggregate> '
                  '(repeat option to set multiple properties)',
         )
         return parser
@@ -299,7 +299,7 @@ class ShowAggregate(show.ShowOne):
         parser.add_argument(
             'aggregate',
             metavar='<aggregate>',
-            help='Name or ID of aggregate to display',
+            help='Aggregate to show (name or ID)',
         )
         return parser
 
diff --git a/openstackclient/compute/v2/console.py b/openstackclient/compute/v2/console.py
index 8206f3024b..082a3a0c0f 100644
--- a/openstackclient/compute/v2/console.py
+++ b/openstackclient/compute/v2/console.py
@@ -35,7 +35,7 @@ class ShowConsoleLog(command.Command):
         parser.add_argument(
             'server',
             metavar='<server>',
-            help='Server (name or ID)',
+            help='Server to show console log (name or ID)',
         )
         parser.add_argument(
             '--lines',
@@ -76,7 +76,7 @@ class ShowConsoleURL(show.ShowOne):
         parser.add_argument(
             'server',
             metavar='<server>',
-            help='Server (name or ID)',
+            help='Server to show URL (name or ID)',
         )
         type_group = parser.add_mutually_exclusive_group()
         type_group.add_argument(
diff --git a/openstackclient/compute/v2/keypair.py b/openstackclient/compute/v2/keypair.py
index 22c07ef7f3..6a158d86ff 100644
--- a/openstackclient/compute/v2/keypair.py
+++ b/openstackclient/compute/v2/keypair.py
@@ -29,7 +29,7 @@ from openstackclient.common import utils
 
 
 class CreateKeypair(show.ShowOne):
-    """Create new keypair"""
+    """Create new public key"""
 
     log = logging.getLogger(__name__ + '.CreateKeypair')
 
@@ -38,7 +38,7 @@ class CreateKeypair(show.ShowOne):
         parser.add_argument(
             'name',
             metavar='<name>',
-            help='New keypair name',
+            help='New public key name',
         )
         parser.add_argument(
             '--public-key',
@@ -80,7 +80,7 @@ class CreateKeypair(show.ShowOne):
 
 
 class DeleteKeypair(command.Command):
-    """Delete a keypair"""
+    """Delete a public key"""
 
     log = logging.getLogger(__name__ + '.DeleteKeypair')
 
@@ -88,8 +88,8 @@ class DeleteKeypair(command.Command):
         parser = super(DeleteKeypair, self).get_parser(prog_name)
         parser.add_argument(
             'name',
-            metavar='<name>',
-            help='Name of keypair to delete',
+            metavar='<key>',
+            help='Public key to delete',
         )
         return parser
 
@@ -101,7 +101,7 @@ class DeleteKeypair(command.Command):
 
 
 class ListKeypair(lister.Lister):
-    """List keypairs"""
+    """List public key fingerprints"""
 
     log = logging.getLogger(__name__ + ".ListKeypair")
 
@@ -121,7 +121,7 @@ class ListKeypair(lister.Lister):
 
 
 class ShowKeypair(show.ShowOne):
-    """Show keypair details"""
+    """Show public key details"""
 
     log = logging.getLogger(__name__ + '.ShowKeypair')
 
@@ -129,14 +129,14 @@ class ShowKeypair(show.ShowOne):
         parser = super(ShowKeypair, self).get_parser(prog_name)
         parser.add_argument(
             'name',
-            metavar='<name>',
-            help='Name of keypair to display',
+            metavar='<key>',
+            help='Public key to show',
         )
         parser.add_argument(
             '--public-key',
             action='store_true',
             default=False,
-            help='Include public key in output',
+            help='Show only bare public key',
         )
         return parser