.. program-output:: lftools openstack --os-cloud docs image list --help
+object
+------
+
+Command for managing objects.
+
+.. program-output:: lftools openstack --os-cloud docs object --help
+
+list-containers
+^^^^^^^^^^^^^^^
+
+.. program-output:: lftools openstack --os-cloud docs object list-containers --help
+
stack
-----
import click
from lftools.openstack import image as os_image
+from lftools.openstack import object as os_object
from lftools.openstack import server as os_server
from lftools.openstack import stack as os_stack
from lftools.openstack import volume as os_volume
image.add_command(upload)
+@openstack.group()
+@click.pass_context
+def object(ctx):
+ """Command for manipulating objects."""
+ pass
+
+
+@click.command()
+@click.pass_context
+def list_containers(ctx):
+ """List available containers."""
+ os_object.list_containers(ctx.obj['os_cloud'])
+
+
+object.add_command(list_containers)
+
+
@openstack.group()
@click.pass_context
def server(ctx):
--- /dev/null
+# -*- code: utf-8 -*-
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2019 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+"""Object related sub-commands for openstack command."""
+
+__author__ = 'Thanh Ha'
+
+import shade
+
+
+def list_containers(os_cloud):
+ """List volumes found according to parameters."""
+ cloud = shade.openstack_cloud(cloud=os_cloud)
+ containers = cloud.list_containers()
+
+ for container in containers:
+ print(container)
--- /dev/null
+---
+features:
+ - |
+ Add command to list openstack containers.
+
+ Usage:
+
+ .. code-block:: bash
+
+ lftools openstack --os-cloud example object list-containers