Cleanup api-ref

Remove useage of old os-api-ref version and replace with current version.

Follow other repositories and merge v1 and v2 in a single document.

Note that we need to have a single document so that preview of the
document works properly in our CI.

Change-Id: I82c8b9ca317298b3dc1f7133ce8c0e9b3503730d
This commit is contained in:
Andreas Jaeger 2016-08-27 16:55:32 +02:00
parent 7f2131e3a1
commit f589c6e2d1
23 changed files with 89 additions and 686 deletions

View File

@ -28,6 +28,8 @@ import os
import subprocess
import sys
import openstackdocstheme # noqa
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
@ -41,8 +43,7 @@ sys.path.insert(0, os.path.abspath('./'))
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'os_api_ref',
'oslosphinx',
'os_api_ref'
]
# The suffix of source filenames.
@ -56,7 +57,7 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'Cinder API Reference'
project = u'Block Storage API Reference'
copyright = u'OpenStack Foundation'
# The version info for the project you're documenting, acts as replacement for
@ -111,6 +112,13 @@ pygments_style = 'sphinx'
# html_theme_path = ["."]
# html_theme = '_theme'
html_theme = 'openstackdocs'
html_theme_path = [openstackdocstheme.get_html_theme_path()]
html_theme_options = {
"sidebar_mode": "toc",
}
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.

18
api-ref/source/index.rst Normal file
View File

@ -0,0 +1,18 @@
=================
Block Storage API
=================
Contents:
.. toctree::
:maxdepth: 1
v1/index
v2/index
Indices and tables
==================
* :ref:`genindex`
* :ref:`search`

View File

@ -1,81 +0,0 @@
tt.literal {
padding: 2px 4px;
font-size: 90%;
color: #c7254e;
white-space: nowrap;
background-color: #f9f2f4;
border-radius: 4px;
}
/* bootstrap users blockquote for pull quotes, so they are much
larger, we need them smaller */
blockquote { font-size: 1em; }
pre {
display: block;
padding: 9.5px;
margin: 0 0 10px;
font-size: 13px;
line-height: 1.428571429;
color: #333;
word-break: break-all;
word-wrap: break-word;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 4px;
}
tbody>tr:nth-child(odd)>td,
tbody>tr:nth-child(odd)>th {
background-color: #f9f9f9;
}
table>thead>tr>th, table>tbody>tr>th, table>tfoot>tr>th, table>thead>tr>td, table>tbody>tr>td, table>tfoot>tr>td {
padding: 8px;
line-height: 1.428571429;
vertical-align: top;
border-top: 1px solid #ddd;
}
td>p {
margin: 0 0 0.5em;
}
div.document {
width: 80% !important;
}
@media (max-width: 1200px) {
div.document {
width: 960px !important;
}
}
.operation-grp {
padding-top: 0.5em;
padding-bottom: 1em;
}
/* Ensure the method buttons and their links don't split lines when
the page is narrower */
.operation {
/* this moves the link icon into the gutter */
margin-left: -1.25em;
margin-right: 1.25em;
white-space: nowrap;
}
/* These make the links only show up on hover */
a.operation-anchor {
visibility: hidden;
}
.operation-grp:hover a.operation-anchor {
visibility: visible;
}
/* All tables for requests should be full width */
.api-detail table.docutils {
width: 100%;
}

View File

@ -1,110 +0,0 @@
(function() {
var pageCache;
$(document).ready(function() {
pageCache = $('.api-documentation').html();
// Show the proper JSON/XML example when toggled
$('.example-select').on('change', function(e) {
$(e.currentTarget).find(':selected').tab('show')
});
// Change the text on the expando buttons when appropriate
$('.api-detail')
.on('hide.bs.collapse', function(e) {
processButton(this, 'detail');
})
.on('show.bs.collapse', function(e) {
processButton(this, 'close');
});
var expandAllActive = true;
// Expand the world
$('#expand-all').click(function () {
if (expandAllActive) {
expandAllActive = false;
$('.api-detail').collapse('show');
$('#expand-all').attr('data-toggle', '');
$(this).text('Hide All');
} else {
expandAllActive = true;
$('.api-detail').collapse('hide');
$('#expand-all').attr('data-toggle', 'collapse');
$(this).text('Show All');
}});
// Wire up the search button
$('#search-btn').on('click', function(e) {
searchPage();
});
// Wire up the search box enter
$('#search-box').on('keydown', function(e) {
if (e.keyCode === 13) {
searchPage();
return false;
}
});
});
/**
* highlight terms based on the regex in the provided $element
*/
function highlightTextNodes($element, regex) {
var markup = $element.html();
// Do regex replace
// Inject span with class of 'highlighted termX' for google style highlighting
$element.html(markup.replace(regex, '>$1<span class="highlight">$2</span>$3<'));
}
function searchPage() {
$(".api-documentation").html(pageCache);
//make sure that all div's are expanded/hidden accordingly
$('.api-detail.in').each(function (e) {
$(this).collapse('hide');
});
var startTime = new Date().getTime(),
searchTerm = $('#search-box').val();
// The regex is the secret, it prevents text within tag declarations to be affected
var regex = new RegExp(">([^<]*)?(" + searchTerm + ")([^>]*)?<", "ig");
highlightTextNodes($('.api-documentation'), regex);
// Once we've highlighted the node, lets expand any with a search match in them
$('.api-detail').each(function () {
var $elem = $(this);
if ($elem.html().indexOf('<span class="highlight">') !== -1) {
$elem.collapse('show');
processButton($elem, 'close');
}
});
// log the results
if (console.log) {
console.log("search completed in: " + ((new Date().getTime()) - startTime) + "ms");
}
$('.api-detail')
.on('hide.bs.collapse', function (e) {
processButton(this, 'detail');
})
.on('show.bs.collapse', function (e) {
processButton(this, 'close');
});
}
/**
* Helper function for setting the text, styles for expandos
*/
function processButton(button, text) {
$('#' + $(button).attr('id') + '-btn').text(text)
.toggleClass('btn-info')
.toggleClass('btn-default');
}
})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,8 @@
:tocdepth: 2
===============
Cinder API V1
===============
====================
Block Storage API V1
====================
.. rest_expand_all::

View File

@ -9,8 +9,8 @@ Administrators only, depending on policy settings.
Shows, updates, and deletes quotas for a tenant.
Show quota details for user
===========================
Show quota details for user (v1)
================================
.. rest_method:: GET /v1/{tenant_id}/os-quota-sets/{tenant_id}/detail/{user_id}
@ -106,8 +106,8 @@ Response Example
:language: javascript
Show quotas
===========
Show quotas (v1)
================
.. rest_method:: GET /v1/{tenant_id}/os-quota-sets/{tenant_id}
@ -157,8 +157,8 @@ Response Example
:language: javascript
Update quotas
=============
Update quotas (v1)
==================
.. rest_method:: PUT /v1/{tenant_id}/os-quota-sets/{tenant_id}
@ -227,8 +227,8 @@ Response Example
:language: javascript
Delete quotas
=============
Delete quotas (v1)
==================
.. rest_method:: DELETE /v1/{tenant_id}/os-quota-sets/{tenant_id}
@ -250,8 +250,8 @@ Response Example
.. literalinclude:: ./samples/user-quotas-delete-response.json
:language: javascript
Show quotas for user
====================
Show quotas for user (v1)
=========================
.. rest_method:: GET /v1/{tenant_id}/os-quota-sets/{tenant_id}/{user_id}
@ -304,8 +304,8 @@ Response Example
Update quotas for user
======================
Update quotas for user (v1)
===========================
.. rest_method:: POST /v1/{tenant_id}/os-quota-sets/{tenant_id}/{user_id}
@ -375,8 +375,8 @@ Response Example
:language: javascript
Delete quotas for user
======================
Delete quotas for user (v1)
===========================
.. rest_method:: DELETE /v1/{tenant_id}/os-quota-sets/{tenant_id}/{user_id}

View File

@ -8,8 +8,8 @@ Creates, lists, shows information for, and deletes snapshots. Shows
and updates snapshot metadata.
Show snapshot details
=====================
Show snapshot details (v1)
==========================
.. rest_method:: GET /v1/{tenant_id}/snapshots/{snapshot_id}
@ -34,8 +34,8 @@ Response Example
:language: javascript
Delete snapshot
===============
Delete snapshot (v1)
====================
.. rest_method:: DELETE /v1/{tenant_id}/snapshots/{snapshot_id}
@ -53,8 +53,8 @@ Request
- snapshot_id: snapshot_id
List snapshots with details
===========================
List snapshots with details (v1)
================================
.. rest_method:: GET /v1/{tenant_id}/snapshots/detail
@ -78,8 +78,8 @@ Response Example
:language: javascript
Create snapshot
===============
Create snapshot (v1)
====================
.. rest_method:: POST /v1/{tenant_id}/snapshots
@ -101,8 +101,8 @@ Request Example
.. literalinclude:: ./samples/snapshot-create-request.json
:language: javascript
List snapshots
==============
List snapshots (v1)
===================
.. rest_method:: GET /v1/{tenant_id}/snapshots
@ -128,8 +128,8 @@ Response Example
:language: javascript
Show snapshot metadata
======================
Show snapshot metadata (v1)
===========================
.. rest_method:: GET /v1/{tenant_id}/snapshots/{snapshot_id}/metadata
@ -156,8 +156,8 @@ Response Example
:language: javascript
Update snapshot metadata
========================
Update snapshot metadata (v1)
=============================
.. rest_method:: PUT /v1/{tenant_id}/snapshots/{snapshot_id}/metadata

View File

@ -8,8 +8,8 @@ Lists, creates, updates, shows information for, and deletes volume
types.
List volume types
=================
List volume types (v1)
======================
.. rest_method:: GET /v1/{tenant_id}/types
@ -34,8 +34,8 @@ Response Example
:language: javascript
Create volume type
==================
Create volume type (v1)
=======================
.. rest_method:: POST /v1/{tenant_id}/types
@ -78,8 +78,8 @@ Response Example
:language: javascript
Update volume type
==================
Update volume type (v1)
=======================
.. rest_method:: PUT /v1/{tenant_id}/types/{volume_type_id}
@ -125,8 +125,8 @@ Response Example
:language: javascript
Update extra specs for a volume type
====================================
Update extra specs for a volume type (v1)
=========================================
.. rest_method:: PUT /v1/{tenant_id}/types/{volume_type_id}
@ -171,8 +171,8 @@ Response Example
:language: javascript
Show volume type details
========================
Show volume type details (v1)
=============================
.. rest_method:: GET /v1/{tenant_id}/types/{volume_type_id}
@ -199,8 +199,8 @@ Response Example
:language: javascript
Delete volume type
==================
Delete volume type (v1)
=======================
.. rest_method:: DELETE /v1/{tenant_id}/types/{volume_type_id}

View File

@ -30,8 +30,8 @@ Response Example
:language: javascript
List API versions
=================
List API versions (v1)
======================
.. rest_method:: GET /

View File

@ -10,8 +10,8 @@ volume was not created from a snapshot or source volume, these
values are null.
List volumes, with details
==========================
List volumes, with details (v1)
===============================
.. rest_method:: GET /v1/{tenant_id}/volumes/detail
@ -65,8 +65,8 @@ Response Example
:language: javascript
Create volume
=============
Create volume (v1)
==================
.. rest_method:: POST /v1/{tenant_id}/volumes
@ -122,8 +122,8 @@ Response Parameters
- metadata: metadata
List volumes
============
List volumes (v1)
=================
.. rest_method:: GET /v1/{tenant_id}/volumes
@ -160,8 +160,8 @@ Response Example
:language: javascript
Show volume details
===================
Show volume details (v1)
========================
.. rest_method:: GET /v1/{tenant_id}/volumes/{volume_id}
@ -215,8 +215,8 @@ Response Example
.. literalinclude:: ./samples/volume-show-response.json
:language: javascript
Delete volume
=============
Delete volume (v1)
==================
.. rest_method:: DELETE /v1/{tenant_id}/volumes/{volume_id}

View File

@ -1,81 +0,0 @@
tt.literal {
padding: 2px 4px;
font-size: 90%;
color: #c7254e;
white-space: nowrap;
background-color: #f9f2f4;
border-radius: 4px;
}
/* bootstrap users blockquote for pull quotes, so they are much
larger, we need them smaller */
blockquote { font-size: 1em; }
pre {
display: block;
padding: 9.5px;
margin: 0 0 10px;
font-size: 13px;
line-height: 1.428571429;
color: #333;
word-break: break-all;
word-wrap: break-word;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 4px;
}
tbody>tr:nth-child(odd)>td,
tbody>tr:nth-child(odd)>th {
background-color: #f9f9f9;
}
table>thead>tr>th, table>tbody>tr>th, table>tfoot>tr>th, table>thead>tr>td, table>tbody>tr>td, table>tfoot>tr>td {
padding: 8px;
line-height: 1.428571429;
vertical-align: top;
border-top: 1px solid #ddd;
}
td>p {
margin: 0 0 0.5em;
}
div.document {
width: 80% !important;
}
@media (max-width: 1200px) {
div.document {
width: 960px !important;
}
}
.operation-grp {
padding-top: 0.5em;
padding-bottom: 1em;
}
/* Ensure the method buttons and their links don't split lines when
the page is narrower */
.operation {
/* this moves the link icon into the gutter */
margin-left: -1.25em;
margin-right: 1.25em;
white-space: nowrap;
}
/* These make the links only show up on hover */
a.operation-anchor {
visibility: hidden;
}
.operation-grp:hover a.operation-anchor {
visibility: visible;
}
/* All tables for requests should be full width */
.api-detail table.docutils {
width: 100%;
}

View File

@ -1,110 +0,0 @@
(function() {
var pageCache;
$(document).ready(function() {
pageCache = $('.api-documentation').html();
// Show the proper JSON/XML example when toggled
$('.example-select').on('change', function(e) {
$(e.currentTarget).find(':selected').tab('show')
});
// Change the text on the expando buttons when appropriate
$('.api-detail')
.on('hide.bs.collapse', function(e) {
processButton(this, 'detail');
})
.on('show.bs.collapse', function(e) {
processButton(this, 'close');
});
var expandAllActive = true;
// Expand the world
$('#expand-all').click(function () {
if (expandAllActive) {
expandAllActive = false;
$('.api-detail').collapse('show');
$('#expand-all').attr('data-toggle', '');
$(this).text('Hide All');
} else {
expandAllActive = true;
$('.api-detail').collapse('hide');
$('#expand-all').attr('data-toggle', 'collapse');
$(this).text('Show All');
}});
// Wire up the search button
$('#search-btn').on('click', function(e) {
searchPage();
});
// Wire up the search box enter
$('#search-box').on('keydown', function(e) {
if (e.keyCode === 13) {
searchPage();
return false;
}
});
});
/**
* highlight terms based on the regex in the provided $element
*/
function highlightTextNodes($element, regex) {
var markup = $element.html();
// Do regex replace
// Inject span with class of 'highlighted termX' for google style highlighting
$element.html(markup.replace(regex, '>$1<span class="highlight">$2</span>$3<'));
}
function searchPage() {
$(".api-documentation").html(pageCache);
//make sure that all div's are expanded/hidden accordingly
$('.api-detail.in').each(function (e) {
$(this).collapse('hide');
});
var startTime = new Date().getTime(),
searchTerm = $('#search-box').val();
// The regex is the secret, it prevents text within tag declarations to be affected
var regex = new RegExp(">([^<]*)?(" + searchTerm + ")([^>]*)?<", "ig");
highlightTextNodes($('.api-documentation'), regex);
// Once we've highlighted the node, lets expand any with a search match in them
$('.api-detail').each(function () {
var $elem = $(this);
if ($elem.html().indexOf('<span class="highlight">') !== -1) {
$elem.collapse('show');
processButton($elem, 'close');
}
});
// log the results
if (console.log) {
console.log("search completed in: " + ((new Date().getTime()) - startTime) + "ms");
}
$('.api-detail')
.on('hide.bs.collapse', function (e) {
processButton(this, 'detail');
})
.on('show.bs.collapse', function (e) {
processButton(this, 'close');
});
}
/**
* Helper function for setting the text, styles for expandos
*/
function processButton(button, text) {
$('#' + $(button).attr('id') + '-btn').text(text)
.toggleClass('btn-info')
.toggleClass('btn-default');
}
})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,217 +0,0 @@
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# cinder documentation build configuration file, created by
# sphinx-quickstart on Sat May 1 15:17:47 2010.
#
# This file is execfile()d with the current directory set to
# its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import os
import subprocess
import sys
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../../'))
sys.path.insert(0, os.path.abspath('../'))
sys.path.insert(0, os.path.abspath('./'))
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'os_api_ref',
'oslosphinx',
]
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#
# source_encoding = 'utf-8'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'Cinder API Reference'
copyright = u'OpenStack Foundation'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
from cinder.version import version_info
# The full version, including alpha/beta/rc tags.
release = version_info.release_string()
# The short X.Y version.
version = version_info.version_string()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y'
# The reST default role (used for this markup: `text`) to use
# for all documents.
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
add_module_names = False
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for man page output ----------------------------------------------
# Grouping the document tree for man pages.
# List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual'
# -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
# html_theme_path = ["."]
# html_theme = '_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
# html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
# html_last_updated_fmt = '%b %d, %Y'
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
"-n1"]
html_last_updated_fmt = subprocess.Popen(
git_cmd, stdout=subprocess.PIPE).communicate()[0]
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
# html_additional_pages = {}
# If false, no module index is generated.
# html_use_modindex = True
# If false, no index is generated.
# html_use_index = True
# If true, the index is split into individual pages for each letter.
# html_split_index = False
# If true, links to the reST sources are added to the pages.
# html_show_sourcelink = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
# html_use_opensearch = ''
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = ''
# Output file base name for HTML help builder.
htmlhelp_basename = 'cinderdoc'
# -- Options for LaTeX output -------------------------------------------------
# The paper size ('letter' or 'a4').
# latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
# latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
('index', 'Cinder.tex', u'OpenStack Block Storage API Documentation',
u'OpenStack Foundation', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
# latex_use_parts = False
# Additional stuff for the LaTeX preamble.
# latex_preamble = ''
# Documents to append as an appendix to all manuals.
# latex_appendices = []
# If false, no module index is generated.
# latex_use_modindex = True

View File

@ -1,8 +1,8 @@
:tocdepth: 2
==============
Volume API V2
==============
====================
Block Storage API V2
====================
.. rest_expand_all::

View File

@ -37,8 +37,7 @@ deps = -r{toxinidir}/test-requirements.txt
install_command = pip install -U --force-reinstall {opts} {packages}
commands =
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/v1/doctrees api-ref/v1/source api-ref/build/html/v1/
sphinx-build -W -b html -d api-ref/build/v2/doctrees api-ref/v2/source api-ref/build/html/v2/
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html/
[testenv:releasenotes]
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
@ -100,8 +99,7 @@ commands = {posargs}
commands =
python setup.py build_sphinx
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/v1/doctrees api-ref/v1/source api-ref/build/html/v1/
sphinx-build -W -b html -d api-ref/build/v2/doctrees api-ref/v2/source api-ref/build/html/v2/
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html/
[testenv:gendriverlist]
sitepackages = False