summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDoug Hellmann <doug@doughellmann.com>2017-06-15 16:54:52 -0400
committerDoug Hellmann <doug@doughellmann.com>2017-06-28 12:24:48 -0400
commite8acf5e7367821625ee8e94866b117990d207c9f (patch)
treedd93ed509133564ed05738380efab9914ee338c7 /doc
parentd6e936cd14f0954751dfc1b754f08deb166a53bf (diff)
downloadpython-glanceclient-e8acf5e7367821625ee8e94866b117990d207c9f.tar.gz
move existing content into the new standard structure
This patch rearranges and reformats existing content. It replaces the home-grown autodoc feature with the one built into pbr, for consistency with other OpenStack projects. It depends on the doc-migration spec and a pbr feature to allow us to specify where the autodoc content should go in the source tree during the build. Change-Id: I8d2bb11b5ef3e46fcd22c8bed8f84060d8ab6f03 Depends-On: Ia750cb049c0f53a234ea70ce1f2bbbb7a2aa9454 Depends-On: I2bd5652bb59cbd9c939931ba2e7db1b37d2b30bb Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/source/cli/glance.rst (renamed from doc/source/man/glance.rst)0
-rw-r--r--doc/source/cli/index.rst31
-rw-r--r--doc/source/conf.py43
-rw-r--r--doc/source/index.rst64
-rw-r--r--doc/source/reference/api/index.rst8
-rw-r--r--doc/source/reference/apiv2.rst (renamed from doc/source/apiv2.rst)0
-rw-r--r--doc/source/reference/index.rst27
7 files changed, 75 insertions, 98 deletions
diff --git a/doc/source/man/glance.rst b/doc/source/cli/glance.rst
index 8d3cac0..8d3cac0 100644
--- a/doc/source/man/glance.rst
+++ b/doc/source/cli/glance.rst
diff --git a/doc/source/cli/index.rst b/doc/source/cli/index.rst
new file mode 100644
index 0000000..01b594c
--- /dev/null
+++ b/doc/source/cli/index.rst
@@ -0,0 +1,31 @@
+=============================
+ Command-line Tool Reference
+=============================
+
+In order to use the CLI, you must provide your OpenStack username,
+password, tenant, and auth endpoint. Use the corresponding
+configuration options (``--os-username``, ``--os-password``,
+``--os-tenant-id``, and ``--os-auth-url``) or set them in environment
+variables::
+
+ export OS_USERNAME=user
+ export OS_PASSWORD=pass
+ export OS_TENANT_ID=b363706f891f48019483f8bd6503c54b
+ export OS_AUTH_URL=http://auth.example.com:5000/v2.0
+
+The command line tool will attempt to reauthenticate using your
+provided credentials for every request. You can override this behavior
+by manually supplying an auth token using ``--os-image-url`` and
+``--os-auth-token``. You can alternatively set these environment
+variables::
+
+ export OS_IMAGE_URL=http://glance.example.org:9292/
+ export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155
+
+Once you've configured your authentication parameters, you can run
+``glance help`` to see a complete listing of available commands.
+
+.. toctree::
+
+ glance
+
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 4c22042..0056074 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -19,49 +19,6 @@ import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', '..')))
-BASE_DIR = os.path.dirname(os.path.abspath(__file__))
-ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", ".."))
-
-
-def gen_ref(ver, title, names):
- refdir = os.path.join(BASE_DIR, "ref")
- pkg = "glanceclient"
- if ver:
- pkg = "%s.%s" % (pkg, ver)
- refdir = os.path.join(refdir, ver)
- if not os.path.exists(refdir):
- os.makedirs(refdir)
- idxpath = os.path.join(refdir, "index.rst")
- with open(idxpath, "w") as idx:
- idx.write(("%(title)s\n"
- "%(signs)s\n"
- "\n"
- ".. toctree::\n"
- " :maxdepth: 1\n"
- "\n") % {"title": title, "signs": "=" * len(title)})
- for name in names:
- idx.write(" %s\n" % name)
- rstpath = os.path.join(refdir, "%s.rst" % name)
- with open(rstpath, "w") as rst:
- rst.write(("%(title)s\n"
- "%(signs)s\n"
- "\n"
- ".. automodule:: %(pkg)s.%(name)s\n"
- " :members:\n"
- " :undoc-members:\n"
- " :show-inheritance:\n"
- " :noindex:\n")
- % {"title": name.capitalize(),
- "signs": "=" * len(name),
- "pkg": pkg, "name": name})
-
-gen_ref(None, "API", ["client", "exc"])
-gen_ref("v1", "OpenStack Images Version 1 Client Reference",
- ["client", "images", "image_members"])
-gen_ref("v2", "OpenStack Images Version 2 Client Reference",
- ["client", "images", "image_tags",
- "image_members", "tasks", "metadefs"])
-
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
diff --git a/doc/source/index.rst b/doc/source/index.rst
index b75bc6a..1be7eff 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -1,61 +1,15 @@
-Python Bindings for the OpenStack Images API
-============================================
+==============================================
+ Python Bindings for the OpenStack Images API
+==============================================
-This is a client for the OpenStack Images API. There's :doc:`a Python API <ref/index>` (the :mod:`glanceclient` module) and a :doc:`command-line script<man/glance>` (installed as :program:`glance`).
+This is a client for the OpenStack Images API. There's :doc:`a Python
+API <library/api/index>` (the :mod:`glanceclient` module) and a
+:doc:`command-line script <cli/glance>` (installed as
+:program:`glance`).
-Python API
-----------
-In order to use the python api directly, you must first obtain an auth token and identify which endpoint you wish to speak to. Once you have done so, you can use the API like so::
-
- >>> from glanceclient import Client
- >>> glance = Client('1', endpoint=OS_IMAGE_ENDPOINT, token=OS_AUTH_TOKEN)
- >>> image = glance.images.create(name="My Test Image")
- >>> print image.status
- 'queued'
- >>> image.update(data=open('/tmp/myimage.iso', 'rb'))
- >>> print image.status
- 'active'
- >>> image.update(properties=dict(my_custom_property='value'))
- >>> with open('/tmp/copyimage.iso', 'wb') as f:
- for chunk in image.data():
- f.write(chunk)
- >>> image.delete()
-
-Python API Reference
-~~~~~~~~~~~~~~~~~~~~
.. toctree::
:maxdepth: 2
- ref/index
- ref/v1/index
- ref/v2/index
-
-.. toctree::
- :maxdepth: 1
-
- How to use the v2 API <apiv2>
-
-Command-line Tool Reference
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.. toctree::
- :maxdepth: 1
-
- man/glance
-
-Command-line Tool
------------------
-In order to use the CLI, you must provide your OpenStack username, password, tenant, and auth endpoint. Use the corresponding configuration options (``--os-username``, ``--os-password``, ``--os-tenant-id``, and ``--os-auth-url``) or set them in environment variables::
-
- export OS_USERNAME=user
- export OS_PASSWORD=pass
- export OS_TENANT_ID=b363706f891f48019483f8bd6503c54b
- export OS_AUTH_URL=http://auth.example.com:5000/v2.0
-
-The command line tool will attempt to reauthenticate using your provided credentials for every request. You can override this behavior by manually supplying an auth token using ``--os-image-url`` and ``--os-auth-token``. You can alternatively set these environment variables::
-
- export OS_IMAGE_URL=http://glance.example.org:9292/
- export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155
-
-Once you've configured your authentication parameters, you can run ``glance help`` to see a complete listing of available commands.
+ reference/index
+ cli/index
-See also :doc:`/man/glance`.
diff --git a/doc/source/reference/api/index.rst b/doc/source/reference/api/index.rst
new file mode 100644
index 0000000..df916b6
--- /dev/null
+++ b/doc/source/reference/api/index.rst
@@ -0,0 +1,8 @@
+======================
+ Python API Reference
+======================
+
+.. toctree::
+ :maxdepth: 2
+
+ autoindex
diff --git a/doc/source/apiv2.rst b/doc/source/reference/apiv2.rst
index 3f75bc6..3f75bc6 100644
--- a/doc/source/apiv2.rst
+++ b/doc/source/reference/apiv2.rst
diff --git a/doc/source/reference/index.rst b/doc/source/reference/index.rst
new file mode 100644
index 0000000..33ce8b2
--- /dev/null
+++ b/doc/source/reference/index.rst
@@ -0,0 +1,27 @@
+==========================
+ Python Library Reference
+==========================
+
+In order to use the python api directly, you must first obtain an auth
+token and identify which endpoint you wish to speak to. Once you have
+done so, you can use the API like so::
+
+ >>> from glanceclient import Client
+ >>> glance = Client('1', endpoint=OS_IMAGE_ENDPOINT, token=OS_AUTH_TOKEN)
+ >>> image = glance.images.create(name="My Test Image")
+ >>> print image.status
+ 'queued'
+ >>> image.update(data=open('/tmp/myimage.iso', 'rb'))
+ >>> print image.status
+ 'active'
+ >>> image.update(properties=dict(my_custom_property='value'))
+ >>> with open('/tmp/copyimage.iso', 'wb') as f:
+ for chunk in image.data():
+ f.write(chunk)
+ >>> image.delete()
+
+.. toctree::
+ :maxdepth: 2
+
+ api/index
+ apiv2