Add some help messages of Gnocchi commands
Change-Id: Ia86fd759cf032ff1e50fb51e0d5e88dbc8ac3a97
This commit is contained in:
parent
641fd184b2
commit
13ba38a880
|
@ -164,6 +164,8 @@ class CliBenchmarkBase(show.ShowOne):
|
|||
|
||||
class CliBenchmarkMetricShow(CliBenchmarkBase,
|
||||
metric_cli.CliMetricWithResourceID):
|
||||
"""Do benchmark testing of metric show"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliBenchmarkMetricShow, self).get_parser(prog_name)
|
||||
parser.add_argument("metric", nargs='+',
|
||||
|
@ -186,6 +188,8 @@ class CliBenchmarkMetricShow(CliBenchmarkBase,
|
|||
|
||||
class CliBenchmarkMetricCreate(CliBenchmarkBase,
|
||||
metric_cli.CliMetricCreateBase):
|
||||
"""Do benchmark testing of metric creation"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliBenchmarkMetricCreate, self).get_parser(prog_name)
|
||||
parser.add_argument("--count", "-n",
|
||||
|
@ -219,6 +223,8 @@ class CliBenchmarkMetricCreate(CliBenchmarkBase,
|
|||
|
||||
class CliBenchmarkMeasuresAdd(CliBenchmarkBase,
|
||||
metric_cli.CliMeasuresAddBase):
|
||||
"""Do benchmark testing of adding measurements"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliBenchmarkMeasuresAdd, self).get_parser(prog_name)
|
||||
parser.add_argument("--count", "-n",
|
||||
|
@ -291,6 +297,8 @@ class CliBenchmarkMeasuresAdd(CliBenchmarkBase,
|
|||
|
||||
class CliBenchmarkMeasuresShow(CliBenchmarkBase,
|
||||
metric_cli.CliMeasuresShow):
|
||||
"""Do benchmark testing of measurements show"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliBenchmarkMeasuresShow, self).get_parser(prog_name)
|
||||
parser.add_argument("--count", "-n",
|
||||
|
|
|
@ -19,6 +19,8 @@ from gnocchiclient import utils
|
|||
|
||||
|
||||
class CliArchivePolicyList(lister.Lister):
|
||||
"""List archive policies"""
|
||||
|
||||
COLS = ('name',
|
||||
'back_window', 'definition', 'aggregation_methods')
|
||||
|
||||
|
@ -30,6 +32,8 @@ class CliArchivePolicyList(lister.Lister):
|
|||
|
||||
|
||||
class CliArchivePolicyShow(show.ShowOne):
|
||||
"""Show an archive policy"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliArchivePolicyShow, self).get_parser(prog_name)
|
||||
parser.add_argument("name",
|
||||
|
@ -58,6 +62,7 @@ def archive_policy_definition(string):
|
|||
|
||||
|
||||
class CliArchivePolicyCreate(show.ShowOne):
|
||||
"""Create an archive policy"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliArchivePolicyCreate, self).get_parser(prog_name)
|
||||
|
@ -88,6 +93,8 @@ class CliArchivePolicyCreate(show.ShowOne):
|
|||
|
||||
|
||||
class CliArchivePolicyDelete(command.Command):
|
||||
"""Delete an archive policy"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliArchivePolicyDelete, self).get_parser(prog_name)
|
||||
parser.add_argument("name",
|
||||
|
|
|
@ -19,6 +19,8 @@ from gnocchiclient import utils
|
|||
|
||||
|
||||
class CliArchivePolicyRuleList(lister.Lister):
|
||||
"""List archive policy rules"""
|
||||
|
||||
COLS = ('name', 'archive_policy_name', 'metric_pattern')
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
|
@ -27,6 +29,8 @@ class CliArchivePolicyRuleList(lister.Lister):
|
|||
|
||||
|
||||
class CliArchivePolicyRuleShow(show.ShowOne):
|
||||
"""Show an archive policy rule"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliArchivePolicyRuleShow, self).get_parser(prog_name)
|
||||
parser.add_argument("name",
|
||||
|
@ -40,6 +44,8 @@ class CliArchivePolicyRuleShow(show.ShowOne):
|
|||
|
||||
|
||||
class CliArchivePolicyRuleCreate(show.ShowOne):
|
||||
"""Create an archive policy rule"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliArchivePolicyRuleCreate, self).get_parser(prog_name)
|
||||
parser.add_argument("name",
|
||||
|
@ -61,6 +67,8 @@ class CliArchivePolicyRuleCreate(show.ShowOne):
|
|||
|
||||
|
||||
class CliArchivePolicyRuleDelete(command.Command):
|
||||
"""Delete an archive policy rule"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliArchivePolicyRuleDelete, self).get_parser(prog_name)
|
||||
parser.add_argument("name",
|
||||
|
|
|
@ -15,6 +15,7 @@ from cliff import show
|
|||
|
||||
|
||||
class CliCapabilitiesList(show.ShowOne):
|
||||
"""List capabilities"""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
caps = self.app.client.capabilities.list()
|
||||
|
|
|
@ -27,6 +27,8 @@ class CliMetricWithResourceID(command.Command):
|
|||
|
||||
|
||||
class CliMetricList(lister.Lister):
|
||||
"""List metrics"""
|
||||
|
||||
COLS = ('id', 'archive_policy/name', 'name', 'resource_id')
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
|
@ -38,6 +40,8 @@ class CliMetricList(lister.Lister):
|
|||
|
||||
|
||||
class CliMetricShow(CliMetricWithResourceID, show.ShowOne):
|
||||
"""Show a metric"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliMetricShow, self).get_parser(prog_name)
|
||||
parser.add_argument("metric",
|
||||
|
@ -69,6 +73,7 @@ class CliMetricCreateBase(show.ShowOne, CliMetricWithResourceID):
|
|||
|
||||
|
||||
class CliMetricCreate(CliMetricCreateBase):
|
||||
"""Create a metric"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliMetricCreate, self).get_parser(prog_name)
|
||||
|
@ -87,6 +92,8 @@ class CliMetricCreate(CliMetricCreateBase):
|
|||
|
||||
|
||||
class CliMetricDelete(CliMetricWithResourceID):
|
||||
"""Delete a metric"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliMetricDelete, self).get_parser(prog_name)
|
||||
parser.add_argument("metric", nargs='+',
|
||||
|
@ -100,6 +107,8 @@ class CliMetricDelete(CliMetricWithResourceID):
|
|||
|
||||
|
||||
class CliMeasuresShow(CliMetricWithResourceID, lister.Lister):
|
||||
"""Get measurements of a metric"""
|
||||
|
||||
COLS = ('timestamp', 'granularity', 'value')
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
|
@ -133,6 +142,8 @@ class CliMeasuresAddBase(CliMetricWithResourceID):
|
|||
|
||||
|
||||
class CliMeasuresAdd(CliMeasuresAddBase):
|
||||
"""Add measurements to a metric"""
|
||||
|
||||
def measure(self, measure):
|
||||
timestamp, __, value = measure.rpartition("@")
|
||||
return {'timestamp': timestamp, 'value': float(value)}
|
||||
|
@ -154,6 +165,8 @@ class CliMeasuresAdd(CliMeasuresAddBase):
|
|||
|
||||
|
||||
class CliMeasuresAggregation(lister.Lister):
|
||||
"""Get measurements of aggregated metrics"""
|
||||
|
||||
COLS = ('timestamp', 'granularity', 'value')
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
|
|
|
@ -21,6 +21,8 @@ from gnocchiclient import utils
|
|||
|
||||
|
||||
class CliResourceList(lister.Lister):
|
||||
"""List resources"""
|
||||
|
||||
COLS = ('id', 'type',
|
||||
'project_id', 'user_id',
|
||||
'started_at', 'ended_at',
|
||||
|
@ -66,6 +68,8 @@ class CliResourceList(lister.Lister):
|
|||
|
||||
|
||||
class CliResourceHistory(CliResourceList):
|
||||
"""Show the history of a resource"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliResourceHistory, self).get_parser(prog_name,
|
||||
history=False)
|
||||
|
@ -82,6 +86,8 @@ class CliResourceHistory(CliResourceList):
|
|||
|
||||
|
||||
class CliResourceSearch(CliResourceList):
|
||||
"""Search resources with specified query rules"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliResourceSearch, self).get_parser(prog_name)
|
||||
parser.add_argument("--query", help="Query"),
|
||||
|
@ -102,6 +108,8 @@ def normalize_metrics(res):
|
|||
|
||||
|
||||
class CliResourceShow(show.ShowOne):
|
||||
"""Show a resource"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliResourceShow, self).get_parser(prog_name)
|
||||
parser.add_argument("--type", "-t", dest="resource_type",
|
||||
|
@ -119,6 +127,8 @@ class CliResourceShow(show.ShowOne):
|
|||
|
||||
|
||||
class CliResourceCreate(show.ShowOne):
|
||||
"""Create a resource"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliResourceCreate, self).get_parser(prog_name)
|
||||
parser.add_argument("--type", "-t", dest="resource_type",
|
||||
|
@ -171,6 +181,8 @@ class CliResourceCreate(show.ShowOne):
|
|||
|
||||
|
||||
class CliResourceUpdate(CliResourceCreate):
|
||||
"""Update a resource"""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
resource = self._resource_from_args(parsed_args, update=True)
|
||||
res = self.app.client.resource.update(
|
||||
|
@ -182,6 +194,8 @@ class CliResourceUpdate(CliResourceCreate):
|
|||
|
||||
|
||||
class CliResourceDelete(command.Command):
|
||||
"""Delete a resource"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliResourceDelete, self).get_parser(prog_name)
|
||||
parser.add_argument("resource_id",
|
||||
|
|
|
@ -15,6 +15,8 @@ from cliff import show
|
|||
|
||||
|
||||
class CliStatusShow(show.ShowOne):
|
||||
"""Show the status of measurements processing"""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
status = self.app.client.status.get()
|
||||
|
||||
|
|
Loading…
Reference in New Issue