add template show api
Change-Id: If84fea76667acf0735d38adf0073a53cb5f4775d
This commit is contained in:
parent
c046551caa
commit
55a21d2fd8
@ -47,6 +47,7 @@ class VitrageCommandManager(commandmanager.CommandManager):
|
|||||||
'rca show': rca.RcaShow,
|
'rca show': rca.RcaShow,
|
||||||
'template validate': template.TemplateValidate,
|
'template validate': template.TemplateValidate,
|
||||||
'template list': template.TemplateList,
|
'template list': template.TemplateList,
|
||||||
|
'template show': template.TemplateShow,
|
||||||
}
|
}
|
||||||
|
|
||||||
def load_commands(self, namespace):
|
def load_commands(self, namespace):
|
||||||
|
@ -54,7 +54,25 @@ class TemplateList(lister.Lister):
|
|||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
templates = self.app.client.template.list()
|
templates = self.app.client.template.list()
|
||||||
return utils.list2cols(('name',
|
return utils.list2cols(('uuid',
|
||||||
|
'name',
|
||||||
'status',
|
'status',
|
||||||
'status details',
|
'status details',
|
||||||
'date'), templates)
|
'date'), templates)
|
||||||
|
|
||||||
|
|
||||||
|
class TemplateShow(show.ShowOne):
|
||||||
|
"""Template show"""
|
||||||
|
|
||||||
|
def get_parser(self, prog_name):
|
||||||
|
parser = super(TemplateShow, self).get_parser(prog_name)
|
||||||
|
parser.add_argument('uuid', help='Template UUID')
|
||||||
|
return parser
|
||||||
|
|
||||||
|
def formatter_default(self):
|
||||||
|
return 'json'
|
||||||
|
|
||||||
|
def take_action(self, parsed_args):
|
||||||
|
uuid = parsed_args.uuid
|
||||||
|
template = self.app.client.template.show(uuid=uuid)
|
||||||
|
return self.dict2columns(template)
|
||||||
|
@ -31,6 +31,12 @@ class Template(object):
|
|||||||
"""Get templates list"""
|
"""Get templates list"""
|
||||||
return self.api.get(self.url).json()
|
return self.api.get(self.url).json()
|
||||||
|
|
||||||
|
def show(self, uuid):
|
||||||
|
"""Show template content"""
|
||||||
|
|
||||||
|
url = self.url + uuid
|
||||||
|
return self.api.get(url).json()
|
||||||
|
|
||||||
def validate(self, path=None):
|
def validate(self, path=None):
|
||||||
"""Template validation
|
"""Template validation
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user