Define CLI commands and arguments for entire API.
Should match the legacy client except for how resource id is specified for resource subcommand
This commit is contained in:
@@ -21,9 +21,101 @@ import sys
|
|||||||
from heatclient.common import utils
|
from heatclient.common import utils
|
||||||
|
|
||||||
|
|
||||||
|
@utils.arg('-u', '--template-url', metavar='<URL>',
|
||||||
|
help='URL of template.')
|
||||||
|
@utils.arg('-f', '--template-file', metavar='<FILE>',
|
||||||
|
help='Path to the template.')
|
||||||
|
@utils.arg('-c', '--create-timeout', metavar='<TIMEOUT>',
|
||||||
|
default=60, type=int,
|
||||||
|
help='Stack creation timeout in minutes. Default: 60')
|
||||||
|
@utils.arg('-P', '--parameters', metavar='<KEY1=VALUE1;KEY2=VALUE2...>',
|
||||||
|
help='Parameter values used to create the stack.')
|
||||||
|
def do_create(hc, args):
|
||||||
|
'''Create the stack'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@utils.arg('id', metavar='<STACK_ID>', help='ID of stack to delete.')
|
||||||
|
def do_delete(hc, args):
|
||||||
|
'''Delete the stack'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@utils.arg('id', metavar='<STACK_ID>', help='ID of stack to describe.')
|
||||||
|
def do_describe(hc, args):
|
||||||
|
'''Describe the stack'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@utils.arg('-u', '--template-url', metavar='<URL>',
|
||||||
|
help='URL of template.')
|
||||||
|
@utils.arg('-f', '--template-file', metavar='<FILE>',
|
||||||
|
help='Path to the template.')
|
||||||
|
@utils.arg('-P', '--parameters', metavar='<KEY1=VALUE1;KEY2=VALUE2...>',
|
||||||
|
help='Parameter values used to create the stack.')
|
||||||
|
def do_update(hc, args):
|
||||||
|
'''Update the stack'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def do_list(hc, args):
|
def do_list(hc, args):
|
||||||
print args
|
'''List the user's stacks'''
|
||||||
kwargs = {'tenant_id': args.os_tenant_name}
|
kwargs = {}
|
||||||
stacks = hc.stacks.list(**kwargs)
|
stacks = hc.stacks.list(**kwargs)
|
||||||
columns = ['ID', 'Name', 'Status']
|
columns = ['ID', 'Name', 'Status']
|
||||||
utils.print_list(stacks, columns)
|
utils.print_list(stacks, columns)
|
||||||
|
|
||||||
|
|
||||||
|
@utils.arg('id', metavar='<STACK_ID>',
|
||||||
|
help='ID of stack to get the template for.')
|
||||||
|
def do_gettemplate(hc, args):
|
||||||
|
'''Get the template'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@utils.arg('-u', '--template-url', metavar='<URL>',
|
||||||
|
help='URL of template.')
|
||||||
|
@utils.arg('-f', '--template-file', metavar='<FILE>',
|
||||||
|
help='Path to the template.')
|
||||||
|
def do_estimate_template_cost(hc, args):
|
||||||
|
'''Returns the estimated monthly cost of a template'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@utils.arg('-u', '--template-url', metavar='<URL>',
|
||||||
|
help='URL of template.')
|
||||||
|
@utils.arg('-f', '--template-file', metavar='<FILE>',
|
||||||
|
help='Path to the template.')
|
||||||
|
def do_validate(hc, args):
|
||||||
|
'''Validate a template'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@utils.arg('id', metavar='<STACK_ID>',
|
||||||
|
help='ID of stack to show the events for.')
|
||||||
|
def do_event_list(hc, args):
|
||||||
|
'''List events for a stack'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@utils.arg('-r', '--resource', metavar='<RESOURCE_ID>',
|
||||||
|
help='ID of the resource to show the details for.')
|
||||||
|
@utils.arg('id', metavar='<STACK_ID>',
|
||||||
|
help='ID of stack to show the resource for.')
|
||||||
|
def do_resource(hc, args):
|
||||||
|
'''Describe the resource'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@utils.arg('id', metavar='<STACK_ID>',
|
||||||
|
help='ID of stack to show the resources for.')
|
||||||
|
def do_resource_list(hc, args):
|
||||||
|
'''Show list of resources belonging to a stack'''
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@utils.arg('id', metavar='<STACK_ID>',
|
||||||
|
help='ID of stack to show the resource details for.')
|
||||||
|
def do_resource_list_details(hc, args):
|
||||||
|
'''Detailed view of resources belonging to a stack'''
|
||||||
|
pass
|
||||||
|
@@ -22,22 +22,12 @@ import urllib
|
|||||||
from heatclient.common import base
|
from heatclient.common import base
|
||||||
from heatclient.common import utils
|
from heatclient.common import utils
|
||||||
|
|
||||||
UPDATE_PARAMS = ('name', 'disk_format', 'container_format', 'min_disk',
|
|
||||||
'min_ram', 'owner', 'size', 'is_public', 'protected',
|
|
||||||
'location', 'checksum', 'copy_from', 'properties',
|
|
||||||
#NOTE(bcwaldon: an attempt to update 'deleted' will be
|
|
||||||
# ignored, but we need to support it for backwards-
|
|
||||||
# compatibility with the legacy client library
|
|
||||||
'deleted')
|
|
||||||
|
|
||||||
CREATE_PARAMS = UPDATE_PARAMS + ('id',)
|
|
||||||
|
|
||||||
DEFAULT_PAGE_SIZE = 20
|
DEFAULT_PAGE_SIZE = 20
|
||||||
|
|
||||||
|
|
||||||
class Stack(base.Resource):
|
class Stack(base.Resource):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<Image %s>" % self._info
|
return "<Stack %s>" % self._info
|
||||||
|
|
||||||
def update(self, **fields):
|
def update(self, **fields):
|
||||||
self.manager.update(self, **fields)
|
self.manager.update(self, **fields)
|
||||||
@@ -52,31 +42,6 @@ class Stack(base.Resource):
|
|||||||
class StackManager(base.Manager):
|
class StackManager(base.Manager):
|
||||||
resource_class = Stack
|
resource_class = Stack
|
||||||
|
|
||||||
# def get(self, image_id):
|
|
||||||
# """Get the metadata for a specific stack.
|
|
||||||
#
|
|
||||||
# :param image: image object or id to look up
|
|
||||||
# :rtype: :class:`Image`
|
|
||||||
# """
|
|
||||||
# resp, body = self.api.raw_request('HEAD', '/v1/images/%s' % image_id)
|
|
||||||
# meta = self._image_meta_from_headers(dict(resp.getheaders()))
|
|
||||||
# return Stack(self, meta)
|
|
||||||
#
|
|
||||||
# def data(self, image, do_checksum=True):
|
|
||||||
# """Get the raw data for a specific image.
|
|
||||||
#
|
|
||||||
# :param image: image object or id to look up
|
|
||||||
# :param do_checksum: Enable/disable checksum validation
|
|
||||||
# :rtype: iterable containing image data
|
|
||||||
# """
|
|
||||||
# image_id = base.getid(image)
|
|
||||||
# resp, body = self.api.raw_request('GET', '/v1/images/%s' % image_id)
|
|
||||||
# checksum = resp.getheader('x-image-meta-checksum', None)
|
|
||||||
# if do_checksum and checksum is not None:
|
|
||||||
# return utils.integrity_iter(body, checksum)
|
|
||||||
# else:
|
|
||||||
# return body
|
|
||||||
|
|
||||||
def list(self, **kwargs):
|
def list(self, **kwargs):
|
||||||
"""Get a list of stacks.
|
"""Get a list of stacks.
|
||||||
|
|
||||||
@@ -121,6 +86,31 @@ class StackManager(base.Manager):
|
|||||||
|
|
||||||
return paginate(params)
|
return paginate(params)
|
||||||
|
|
||||||
|
# def get(self, image_id):
|
||||||
|
# """Get the metadata for a specific stack.
|
||||||
|
#
|
||||||
|
# :param image: image object or id to look up
|
||||||
|
# :rtype: :class:`Image`
|
||||||
|
# """
|
||||||
|
# resp, body = self.api.raw_request('HEAD', '/v1/images/%s' % image_id)
|
||||||
|
# meta = self._image_meta_from_headers(dict(resp.getheaders()))
|
||||||
|
# return Stack(self, meta)
|
||||||
|
#
|
||||||
|
# def data(self, image, do_checksum=True):
|
||||||
|
# """Get the raw data for a specific image.
|
||||||
|
#
|
||||||
|
# :param image: image object or id to look up
|
||||||
|
# :param do_checksum: Enable/disable checksum validation
|
||||||
|
# :rtype: iterable containing image data
|
||||||
|
# """
|
||||||
|
# image_id = base.getid(image)
|
||||||
|
# resp, body = self.api.raw_request('GET', '/v1/images/%s' % image_id)
|
||||||
|
# checksum = resp.getheader('x-image-meta-checksum', None)
|
||||||
|
# if do_checksum and checksum is not None:
|
||||||
|
# return utils.integrity_iter(body, checksum)
|
||||||
|
# else:
|
||||||
|
# return body
|
||||||
|
#
|
||||||
# def delete(self, image):
|
# def delete(self, image):
|
||||||
# """Delete an image."""
|
# """Delete an image."""
|
||||||
# self._delete("/v1/images/%s" % base.getid(image))
|
# self._delete("/v1/images/%s" % base.getid(image))
|
||||||
|
Reference in New Issue
Block a user