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>
This commit is contained in:
parent
d6e936cd14
commit
e8acf5e736
1
.gitignore
vendored
1
.gitignore
vendored
@ -24,3 +24,4 @@ glanceclient/versioninfo
|
||||
releasenotes/build
|
||||
# File created by docs build process
|
||||
/doc/source/ref
|
||||
/doc/source/reference/api/*
|
||||
|
31
doc/source/cli/index.rst
Normal file
31
doc/source/cli/index.rst
Normal file
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
reference/index
|
||||
cli/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.
|
||||
|
||||
See also :doc:`/man/glance`.
|
||||
|
8
doc/source/reference/api/index.rst
Normal file
8
doc/source/reference/api/index.rst
Normal file
@ -0,0 +1,8 @@
|
||||
======================
|
||||
Python API Reference
|
||||
======================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
autoindex
|
27
doc/source/reference/index.rst
Normal file
27
doc/source/reference/index.rst
Normal file
@ -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
|
@ -36,7 +36,6 @@ console_scripts =
|
||||
[build_sphinx]
|
||||
builders = html,man
|
||||
all-files = 1
|
||||
warning-is-error = 1
|
||||
source-dir = doc/source
|
||||
build-dir = doc/build
|
||||
|
||||
@ -45,3 +44,9 @@ upload-dir = doc/build/html
|
||||
|
||||
[wheel]
|
||||
universal = 1
|
||||
|
||||
[pbr]
|
||||
autodoc_index_modules = True
|
||||
autodoc_exclude_modules =
|
||||
glanceclient.tests.*
|
||||
api_doc_dir = reference/api
|
||||
|
Loading…
x
Reference in New Issue
Block a user