Add new api to list template versions supported

Will print also the status which can be CURRENT, SUPPORTED
or DEPRECATED

Change-Id: I6c7aa8ee92136b8cea9eb4e431f86381dc79206a
This commit is contained in:
Eyal 2019-06-10 15:14:18 +03:00
parent cc07041fc4
commit 0d93ef1d78
7 changed files with 45 additions and 5 deletions

View File

@ -1019,6 +1019,20 @@ Templates with parameters
| 1a18a38b-99ee-4835-964d-a3fe2f17d4cd | Template1 | LOADING | Template validation is OK | 2019-02-11 11:57:31.077176 | standard |
+--------------------------------------+-----------+---------+---------------------------+----------------------------+----------+
template versions
^^^^^^^^^^^^^^^^^
::
vitrage template versions
+---------+-----------+
| Version | Status |
+---------+-----------+
| v1 | SUPPORTED |
| v2 | SUPPORTED |
| v3 | CURRENT |
+---------+-----------+
Event Examples
--------------

View File

@ -0,0 +1,3 @@
---
features:
- Added a new API to list all vitrage template versions supported.

View File

@ -51,6 +51,7 @@ openstack.rca.v1 =
rca_resource_show = vitrageclient.v1.cli.resource:ResourceShow
rca_resource_count = vitrageclient.v1.cli.resource:ResourceCount
rca_template_list = vitrageclient.v1.cli.template:TemplateList
rca_template_versions = vitrageclient.v1.cli.template:TemplateVersions
rca_template_show = vitrageclient.v1.cli.template:TemplateShow
rca_template_validate = vitrageclient.v1.cli.template:TemplateValidate
rca_template_add = vitrageclient.v1.cli.template:TemplateAdd

View File

@ -24,12 +24,13 @@ _vitrage()
cmds_resource_show='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty'
cmds_service='list'
cmds_service_list='-h --help -f --format -c --column --quote --noindent --max-width --fit-width --print-empty --sort-column'
cmds_template='add delete list show validate'
cmds_template_add='-h --help -f --format -c --column --quote --noindent --max-width --fit-width --print-empty --sort-column --path --type'
cmds_template_delete='-h --help'
cmds_template='add delete list show validate versions'
cmds_template_add='-h --help -f --format -c --column --quote --noindent --max-width --fit-width --print-empty --sort-column --path --type --params --wait'
cmds_template_delete='-h --help --wait'
cmds_template_list='-h --help -f --format -c --column --quote --noindent --max-width --fit-width --print-empty --sort-column'
cmds_template_show='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty'
cmds_template_validate='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty --path --type'
cmds_template_validate='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty --path --type --params'
cmds_template_versions='-h --help -f --format -c --column --quote --noindent --max-width --fit-width --print-empty --sort-column'
cmds_topology='show'
cmds_topology_show='-h --help -f --format -c --column --noindent --variable --prefix --max-width --fit-width --print-empty --filter --limit --root --graph-type --all-tenants'
cmds_webhook='add delete list show'
@ -76,4 +77,4 @@ _vitrage()
fi
return 0
}
complete -F _vitrage vitrage
complete -F _vitrage vitrage

View File

@ -60,6 +60,7 @@ class VitrageCommandManager(commandmanager.CommandManager):
'rca show': rca.RcaShow,
'template validate': template.TemplateValidate,
'template list': template.TemplateList,
'template versions': template.TemplateVersions,
'template show': template.TemplateShow,
'template add': template.TemplateAdd,
'template delete': template.TemplateDelete,

View File

@ -68,6 +68,22 @@ class TemplateValidate(show.ShowOne):
return self.dict2columns(result)
class TemplateVersions(lister.Lister):
"""List all template versions"""
def get_parser(self, prog_name):
parser = super(TemplateVersions, self).get_parser(prog_name)
return parser
def take_action(self, parsed_args):
templates = utils.get_client(self).template.versions()
return utils.list2cols_with_rename(
(
('Version', 'version'),
('Status', 'status'),
), templates)
class TemplateList(lister.Lister):
"""List all templates"""

View File

@ -29,6 +29,10 @@ class Template(object):
"""Get templates list"""
return self.api.get(self.url).json()
def versions(self):
"""Get templates versions"""
return self.api.get(self.url + 'versions').json()
def show(self, _id):
"""Show template content"""