From 0b839d669b5bc0a6d7fff1e512b91472c6b8d67c Mon Sep 17 00:00:00 2001 From: Gaetan Trellu Date: Thu, 6 Jun 2019 13:27:47 -0400 Subject: [PATCH] Add API documentation - Add api-ref for runtimes - Add api-ref for functions - Add api-ref for executions - Add api-ref for versions - Add api-ref for aliases - Add api-ref for webhooks - Add api-ref for jobs Change-Id: Ie0f004e56aa906343788f305ac5a6571f862d272 Story: 2002632 Task: 22274 --- .zuul.yaml | 1 + api-ref/source/aliases.inc | 265 +++++++++ api-ref/source/api-versions.inc | 31 ++ api-ref/source/conf.py | 223 ++++++++ api-ref/source/executions.inc | 304 ++++++++++ api-ref/source/functions.inc | 524 ++++++++++++++++++ api-ref/source/index.rst | 17 + api-ref/source/jobs.inc | 275 +++++++++ api-ref/source/parameters.yaml | 472 ++++++++++++++++ api-ref/source/runtimes.inc | 317 +++++++++++ .../samples/aliases/create-alias-request.json | 6 + .../aliases/create-alias-response.json | 9 + .../aliases/delete-alias-response.text | 1 + .../aliases/list-aliases-response.json | 20 + .../samples/aliases/show-alias-response.json | 9 + .../samples/aliases/update-alias-request.json | 6 + .../aliases/update-alias-response.json | 9 + .../api-versions/get-versions-response.json | 15 + .../executions/create-execution-request.json | 7 + .../executions/create-execution-response.json | 13 + .../executions/delete-execution-response.text | 1 + .../list-executions-filters-response.json | 28 + .../executions/list-executions-response.json | 28 + .../show-execution-log-response.json | 3 + .../executions/show-execution-response.json | 13 + .../create-function-image-request.json | 12 + .../create-function-image-response.json | 19 + .../create-function-package-curl-request.text | 11 + .../create-function-package-request.json | 12 + .../create-function-package-response.json | 19 + .../create-function-swift-request.json | 16 + .../create-function-swift-response.json | 22 + .../functions/delete-function-response.text | 1 + .../functions/detach-function-response.text | 1 + .../functions/download-function-response.text | 1 + .../functions/list-functions-response.json | 32 ++ .../functions/scaledown-function-request.json | 3 + .../scaledown-function-response.text | 1 + .../functions/scaleup-function-request.json | 3 + .../functions/scaleup-function-response.text | 1 + .../functions/show-function-response.json | 15 + .../update-function-package-curl-request.text | 10 + .../update-function-package-request.json | 9 + .../update-function-package-response.json | 19 + .../update-function-swift-request.json | 16 + .../update-function-swift-response.json | 22 + .../samples/jobs/create-job-request.json | 8 + .../samples/jobs/create-job-response.json | 15 + .../samples/jobs/delete-job-response.text | 1 + .../samples/jobs/list-jobs-response.json | 32 ++ .../samples/jobs/show-job-response.json | 15 + .../samples/jobs/update-job-request.json | 7 + .../samples/jobs/update-job-response.json | 15 + .../runtimes/create-runtime-request.json | 7 + .../runtimes/create-runtime-response.json | 12 + .../runtimes/delete-runtime-response.text | 1 + .../runtimes/list-runtimes-response.json | 38 ++ .../runtimes/show-runtime-pool-response.json | 7 + .../runtimes/show-runtime-response.json | 12 + .../runtimes/update-runtime-request.json | 5 + .../runtimes/update-runtime-response.json | 12 + .../versions/create-version-request.json | 3 + .../versions/create-version-response.json | 10 + .../versions/detach-version-response.text | 1 + .../versions/list-versions-response.json | 22 + .../versions/show-version-response.json | 10 + .../webhooks/create-webhook-request.json | 5 + .../webhooks/create-webhook-response.json | 10 + .../webhooks/delete-webhook-response.text | 1 + .../webhooks/list-webhooks-response.json | 22 + .../webhooks/show-webhook-response.json | 10 + .../webhooks/update-webhook-request.json | 5 + .../webhooks/update-webhook-response.json | 10 + api-ref/source/status.yaml | 61 ++ api-ref/source/urls.inc | 31 ++ api-ref/source/versions.inc | 255 +++++++++ api-ref/source/webhooks.inc | 261 +++++++++ lower-constraints.txt | 4 +- tox.ini | 7 + 79 files changed, 3754 insertions(+), 3 deletions(-) create mode 100644 api-ref/source/aliases.inc create mode 100644 api-ref/source/api-versions.inc create mode 100644 api-ref/source/conf.py create mode 100644 api-ref/source/executions.inc create mode 100644 api-ref/source/functions.inc create mode 100644 api-ref/source/index.rst create mode 100644 api-ref/source/jobs.inc create mode 100644 api-ref/source/parameters.yaml create mode 100644 api-ref/source/runtimes.inc create mode 100644 api-ref/source/samples/aliases/create-alias-request.json create mode 100644 api-ref/source/samples/aliases/create-alias-response.json create mode 100644 api-ref/source/samples/aliases/delete-alias-response.text create mode 100644 api-ref/source/samples/aliases/list-aliases-response.json create mode 100644 api-ref/source/samples/aliases/show-alias-response.json create mode 100644 api-ref/source/samples/aliases/update-alias-request.json create mode 100644 api-ref/source/samples/aliases/update-alias-response.json create mode 100644 api-ref/source/samples/api-versions/get-versions-response.json create mode 100644 api-ref/source/samples/executions/create-execution-request.json create mode 100644 api-ref/source/samples/executions/create-execution-response.json create mode 100644 api-ref/source/samples/executions/delete-execution-response.text create mode 100644 api-ref/source/samples/executions/list-executions-filters-response.json create mode 100644 api-ref/source/samples/executions/list-executions-response.json create mode 100644 api-ref/source/samples/executions/show-execution-log-response.json create mode 100644 api-ref/source/samples/executions/show-execution-response.json create mode 100644 api-ref/source/samples/functions/create-function-image-request.json create mode 100644 api-ref/source/samples/functions/create-function-image-response.json create mode 100644 api-ref/source/samples/functions/create-function-package-curl-request.text create mode 100644 api-ref/source/samples/functions/create-function-package-request.json create mode 100644 api-ref/source/samples/functions/create-function-package-response.json create mode 100644 api-ref/source/samples/functions/create-function-swift-request.json create mode 100644 api-ref/source/samples/functions/create-function-swift-response.json create mode 100644 api-ref/source/samples/functions/delete-function-response.text create mode 100644 api-ref/source/samples/functions/detach-function-response.text create mode 100644 api-ref/source/samples/functions/download-function-response.text create mode 100644 api-ref/source/samples/functions/list-functions-response.json create mode 100644 api-ref/source/samples/functions/scaledown-function-request.json create mode 100644 api-ref/source/samples/functions/scaledown-function-response.text create mode 100644 api-ref/source/samples/functions/scaleup-function-request.json create mode 100644 api-ref/source/samples/functions/scaleup-function-response.text create mode 100644 api-ref/source/samples/functions/show-function-response.json create mode 100644 api-ref/source/samples/functions/update-function-package-curl-request.text create mode 100644 api-ref/source/samples/functions/update-function-package-request.json create mode 100644 api-ref/source/samples/functions/update-function-package-response.json create mode 100644 api-ref/source/samples/functions/update-function-swift-request.json create mode 100644 api-ref/source/samples/functions/update-function-swift-response.json create mode 100644 api-ref/source/samples/jobs/create-job-request.json create mode 100644 api-ref/source/samples/jobs/create-job-response.json create mode 100644 api-ref/source/samples/jobs/delete-job-response.text create mode 100644 api-ref/source/samples/jobs/list-jobs-response.json create mode 100644 api-ref/source/samples/jobs/show-job-response.json create mode 100644 api-ref/source/samples/jobs/update-job-request.json create mode 100644 api-ref/source/samples/jobs/update-job-response.json create mode 100644 api-ref/source/samples/runtimes/create-runtime-request.json create mode 100644 api-ref/source/samples/runtimes/create-runtime-response.json create mode 100644 api-ref/source/samples/runtimes/delete-runtime-response.text create mode 100644 api-ref/source/samples/runtimes/list-runtimes-response.json create mode 100644 api-ref/source/samples/runtimes/show-runtime-pool-response.json create mode 100644 api-ref/source/samples/runtimes/show-runtime-response.json create mode 100644 api-ref/source/samples/runtimes/update-runtime-request.json create mode 100644 api-ref/source/samples/runtimes/update-runtime-response.json create mode 100644 api-ref/source/samples/versions/create-version-request.json create mode 100644 api-ref/source/samples/versions/create-version-response.json create mode 100644 api-ref/source/samples/versions/detach-version-response.text create mode 100644 api-ref/source/samples/versions/list-versions-response.json create mode 100644 api-ref/source/samples/versions/show-version-response.json create mode 100644 api-ref/source/samples/webhooks/create-webhook-request.json create mode 100644 api-ref/source/samples/webhooks/create-webhook-response.json create mode 100644 api-ref/source/samples/webhooks/delete-webhook-response.text create mode 100644 api-ref/source/samples/webhooks/list-webhooks-response.json create mode 100644 api-ref/source/samples/webhooks/show-webhook-response.json create mode 100644 api-ref/source/samples/webhooks/update-webhook-request.json create mode 100644 api-ref/source/samples/webhooks/update-webhook-response.json create mode 100644 api-ref/source/status.yaml create mode 100644 api-ref/source/urls.inc create mode 100644 api-ref/source/versions.inc create mode 100644 api-ref/source/webhooks.inc diff --git a/.zuul.yaml b/.zuul.yaml index 5a755261..5bca4ad9 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -12,6 +12,7 @@ - ^doc/.* - ^qinling/tests/unit/.*$ - ^releasenotes/.*$ + - ^api-ref/.*$ pre-run: playbooks/pre.yaml post-run: playbooks/post.yaml vars: diff --git a/api-ref/source/aliases.inc b/api-ref/source/aliases.inc new file mode 100644 index 00000000..edc19101 --- /dev/null +++ b/api-ref/source/aliases.inc @@ -0,0 +1,265 @@ +.. -*- rst -*- + +======== + Aliases +======== + +Lists, creates, updates, shows details and deletes aliases. + +Function aliases are like pointers to the specific function versions. +By using aliases, you can access the specific version of a function an +alias is pointing to without having to know the specific version the alias +is pointing to. + + +Create an alias +=============== + +.. rest_method:: POST /v1/aliases + +Create ana alias. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 201 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: function_id + - version: alias_version + - description: alias_description + +Request Example +--------------- + +.. literalinclude:: samples/aliases/create-alias-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: alias_name + - description: alias_description + - function_id: function_id + - version_number: alias_version + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/aliases/create-alias-response.json + :language: javascript + + +List aliases +============ + +.. rest_method:: GET /v1/aliases + +List aliases. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: alias_name + - description: alias_description + - function_id: function_id + - version_number: alias_version + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/aliases/list-aliases-response.json + :language: javascript + + +Show an alias +============= + +.. rest_method:: GET /v1/aliases/{name} + +Show an alias. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - name: path_alias_name + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: alias_name + - description: alias_description + - function_id: function_id + - version_number: alias_version + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/aliases/show-alias-response.json + :language: javascript + + +Update an alias +=============== + +.. rest_method:: PUT /v1/aliases/{name} + +Update an alias. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 202 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - name: path_alias_name + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: alias_name + - description: alias_description + - function_id: function_id + - version_number: alias_version + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Request Example +--------------- + +.. literalinclude:: samples/aliases/update-alias-request.json + :language: javascript + +Response Example +---------------- + +.. literalinclude:: samples/aliases/update-alias-response.json + :language: text + + +Delete an alias +=============== + +.. rest_method:: DELETE /v1/aliases/{name} + +Delete an alias. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 204 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - name: path_alias_name + +Response Parameters +------------------- + +None + +Response Example +---------------- + +.. literalinclude:: samples/aliases/delete-alias-response.text + :language: text diff --git a/api-ref/source/api-versions.inc b/api-ref/source/api-versions.inc new file mode 100644 index 00000000..6759dd55 --- /dev/null +++ b/api-ref/source/api-versions.inc @@ -0,0 +1,31 @@ +============ +API Versions +============ + +Show all enabled API versions + +List all API versions +===================== + +.. rest_method:: GET / + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +No parameters needed + +Response Example +---------------- + +.. literalinclude:: samples/api-versions/get-versions-response.json + :language: javascript diff --git a/api-ref/source/conf.py b/api-ref/source/conf.py new file mode 100644 index 00000000..3d8c44dc --- /dev/null +++ b/api-ref/source/conf.py @@ -0,0 +1,223 @@ +# -*- 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. +# +# Qinling documentation build configuration file +# +# 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 sys + +extensions = [ + 'os_api_ref', + 'openstackdocstheme', +] + +html_theme = 'openstackdocs' +html_theme_options = { + "sidebar_mode": "toc", +} + +# 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. + +# 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'Function Engine API Reference' +copyright = u'2010-present, 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 qinling.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' + +# openstackdocstheme options +repository_name = 'openstack/qinling' +bug_project = 'qinling' +bug_tag = 'api-ref' + +# -- 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 +# " v 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' +html_last_updated_fmt = '%Y-%m-%d %H:%M' + +# 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 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 = 'qinlingdoc' + + +# -- 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', 'Qinling.tex', + u'OpenStack Function Engine 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 diff --git a/api-ref/source/executions.inc b/api-ref/source/executions.inc new file mode 100644 index 00000000..f2c883b8 --- /dev/null +++ b/api-ref/source/executions.inc @@ -0,0 +1,304 @@ +.. -*- rst -*- + +=========== + Executions +=========== + +Lists, creates, shows details for, and deletes function executions. + +An execution runs the function and stores the return of the function. +The execution gets the returns and the prints. + + +Create an execution +==================== + +.. rest_method:: POST /v1/executions + +Create an execution. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 201 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: function_id + - input: execution_input + - description: execution_description + - function_version: execution_version + - sync: execution_sync + +Request Example +--------------- + +.. literalinclude:: samples/executions/create-execution-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - function_id: function_id + - input: execution_input + - description: execution_description + - function_version: execution_version + - sync: execution_sync + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/executions/create-execution-response.json + :language: javascript + + +List executions +=============== + +.. rest_method:: GET /v1/executions + +List executions. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - function_id: function_id + - input: execution_input + - description: execution_description + - function_version: execution_version + - sync: execution_sync + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/executions/list-executions-response.json + :language: javascript + + +List executions by filters +========================== + +.. rest_method:: GET /v1/executions?{filter}={function_id} + +List executions by filters.. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - filter: path_execution_filter + - function_id: path_function_id + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - function_id: function_id + - input: execution_input + - description: execution_description + - function_version: execution_version + - sync: execution_sync + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/executions/list-executions-filters-response.json + :language: javascript + + +Show an execution +================= + +.. rest_method:: GET /v1/executions/{execution_id} + +Show an execution. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - execution_id: path_execution_id + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - function_id: function_id + - input: execution_input + - description: execution_description + - function_version: execution_version + - sync: execution_sync + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/executions/show-execution-response.json + :language: javascript + + +Show an execution log +===================== + +.. rest_method:: GET /v1/executions/{execution_id}/log + +Show an execution log. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - execution_id: path_execution_id + +Response Parameters +------------------- + +None + +Response Example +---------------- + +.. literalinclude:: samples/executions/show-execution-log-response.json + :language: javascript + + +Delete an execution +=================== + +.. rest_method:: DELETE /v1/executions/{execution_id} + +Delete an execution. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 204 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - execution_id: path_execution_id + +Response Parameters +------------------- + +None + +Response Example +---------------- + +.. literalinclude:: samples/executions/delete-execution-response.text + :language: text diff --git a/api-ref/source/functions.inc b/api-ref/source/functions.inc new file mode 100644 index 00000000..1fa18329 --- /dev/null +++ b/api-ref/source/functions.inc @@ -0,0 +1,524 @@ +.. -*- rst -*- + +========== + Functions +========== + +Lists, creates, shows details for, downloads, detaches, updates, +scales and deletes functions. + +Function contains the source code that will be executed into the runtime. +The source code langage within the function should match the runtime. + + +Create a function +================= + +.. rest_method:: POST /v1/functions + +Create a function. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 201 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - name: function_name + - description: function_description + - runtime_id: function_runtime_id + - code: function_code + - entry: function_entry + - cpu: function_cpu + - memory: function_memory + - timeout: function_timeout + - package: function_package + +Request Example +--------------- + +Package +####### + +.. literalinclude:: samples/functions/create-function-package-request.json + :language: javascript + +.. literalinclude:: samples/functions/create-function-package-curl-request.text + :language: text + +Swift +##### + +.. literalinclude:: samples/functions/create-function-swift-request.json + :language: javascript + +Image +##### + +.. literalinclude:: samples/functions/create-function-image-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: function_name + - description: function_description + - runtime_id: function_runtime_id + - code: function_code + - entry: function_entry + - cpu: function_cpu + - memory: function_memory + - timeout: function_timeout + - package: function_package + - latest_version: function_latest_version + - count: function_count + - project_id: project_id + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +Package +####### + +.. literalinclude:: samples/functions/create-function-package-response.json + :language: javascript + +Swift +##### + +.. literalinclude:: samples/functions/create-function-swift-response.json + :language: javascript + +Image +##### + +.. literalinclude:: samples/functions/create-function-image-response.json + :language: javascript + + +List functions +============== + +.. rest_method:: GET /v1/functions + +List functions. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: function_name + - description: function_description + - runtime_id: function_runtime_id + - code: function_code + - count: function_count + - cpu: function_cpu + - memory: function_memory + - entry: function_entry + - timeout: function_timeout + - project_id: project_id + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/functions/list-functions-response.json + :language: javascript + + +Show a function +=============== + +.. rest_method:: GET /v1/functions/{function_id} + +Show a function. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: path_function_id + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: function_name + - description: function_description + - runtime_id: function_runtime_id + - code: function_code + - count: function_count + - cpu: function_cpu + - memory: function_memory + - entry: function_entry + - timeout: function_timeout + - project_id: project_id + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/functions/show-function-response.json + :language: javascript + + +Update a function +================= + +.. rest_method:: PUT /v1/functions/{function_id} + +Update a function. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: path_function_id + - name: function_name_update + - description: function_description + - runtime_id: function_runtime_id_update + - code: function_code_update + - entry: function_entry_update + - cpu: function_cpu + - memory: function_memory + - timeout: function_timeout + - package: function_package + - count: function_count + +Request Example +--------------- + +Package +####### + +.. literalinclude:: samples/functions/update-function-package-request.json + :language: javascript + +.. literalinclude:: samples/functions/update-function-package-curl-request.text + :language: text + +Swift +##### + +.. literalinclude:: samples/functions/update-function-swift-request.json + :language: javascript + +Image +##### + +It is not possible to update an ``image`` function. + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: function_name + - description: function_description + - runtime_id: function_runtime_id + - code: function_code + - count: function_count + - cpu: function_cpu + - memory: function_memory + - entry: function_entry + - timeout: function_timeout + - project_id: project_id + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +Package +####### + +.. literalinclude:: samples/functions/update-function-package-response.json + :language: javascript + +Swift +##### + +.. literalinclude:: samples/functions/update-function-swift-response.json + :language: javascript + +Image +##### + +None + + +Download a function +=================== + +.. rest_method:: GET /v1/functions/{function_id}?download=true + +Download a function. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: path_function_id + +Response Parameters +------------------- + +None + +Response Example +---------------- + +.. literalinclude:: samples/functions/download-function-response.text + :language: text + + +Detach a function from a worker +=============================== + +.. rest_method:: POST /v1/functions/{function_id}/detach + +Detach a function from a worker. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 202 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: path_function_id + +Response Parameters +------------------- + +None + +Response Example +---------------- + +.. literalinclude:: samples/functions/detach-function-response.text + :language: text + + +Scale up a function +=================== + +.. rest_method:: POST /v1/functions/{function_id}/scale_up + +Scale up a function. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 202 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: path_function_id + - count: function_scale_count_up + +Response Parameters +------------------- + +None + +Response Example +---------------- + +.. literalinclude:: samples/functions/scaleup-function-response.text + :language: text + + +Scale down a function +===================== + +.. rest_method:: POST /v1/functions/{function_id}/scale_down + +Scale down a function. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 202 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: path_function_id + - count: function_scale_count_down + +Response Parameters +------------------- + +None + +Response Example +---------------- + +.. literalinclude:: samples/functions/scaledown-function-response.text + :language: text + + +Delete a function +================= + +.. rest_method:: DELETE /v1/functions/{function_id} + +Delete a function. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 204 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: path_function_id + +Response Parameters +------------------- + +None + +Response Example +---------------- + +.. literalinclude:: samples/functions/delete-function-response.text + :language: text diff --git a/api-ref/source/index.rst b/api-ref/source/index.rst new file mode 100644 index 00000000..e74460d8 --- /dev/null +++ b/api-ref/source/index.rst @@ -0,0 +1,17 @@ +:tocdepth: 2 + +==================== + Function Engine API +==================== + +.. rest_expand_all:: + +.. include:: urls.inc +.. include:: api-versions.inc +.. include:: runtimes.inc +.. include:: functions.inc +.. include:: executions.inc +.. include:: versions.inc +.. include:: aliases.inc +.. include:: webhooks.inc +.. include:: jobs.inc diff --git a/api-ref/source/jobs.inc b/api-ref/source/jobs.inc new file mode 100644 index 00000000..fa322a9c --- /dev/null +++ b/api-ref/source/jobs.inc @@ -0,0 +1,275 @@ +.. -*- rst -*- + +===== + Jobs +===== + +Lists, creates, updates, shows details and deletes jobs. + +Jobs allows to run periodically functions based on time period. +Time period is based on cron syntax. + + +Create a job +============ + +.. rest_method:: POST /v1/jobs + +Create a job. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 201 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - name: job_name + - function_id: function_id + - function_version: job_version + - function_input: job_input + - pattern: job_pattern + - count: job_count + +Request Example +--------------- + +.. literalinclude:: samples/jobs/create-job-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: job_name + - function_id: function_id + - function_version: job_version + - function_input: job_input + - pattern: job_pattern + - count: job_count + - first_execution_time: job_first_execution + - next_execution_time: job_next_execution + - status: status + - project_id: project_id + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/jobs/create-job-response.json + :language: javascript + + +List jobs +========= + +.. rest_method:: GET /v1/jobs + +List jobs. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: job_name + - function_id: function_id + - function_version: job_version + - function_input: job_input + - pattern: job_pattern + - count: job_count + - first_execution_time: job_first_execution + - next_execution_time: job_next_execution + - status: status + - project_id: project_id + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/jobs/list-jobs-response.json + :language: javascript + + +Show a job +========== + +.. rest_method:: GET /v1/jobs/{job_id} + +Show a job. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - job_id: path_job_id + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: job_name + - function_id: function_id + - function_version: job_version + - function_input: job_input + - pattern: job_pattern + - count: job_count + - first_execution_time: job_first_execution + - next_execution_time: job_next_execution + - status: status + - project_id: project_id + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/jobs/show-job-response.json + :language: javascript + + +Update a job +============ + +.. rest_method:: PUT /v1/jobs/{job_id} + +Update a job. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 202 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - job_id: path_job_id + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: job_name + - function_input: job_input + - pattern: job_pattern_update + - next_execution_time: job_next_execution_update + - status: job_status_update + +Request Example +--------------- + +.. literalinclude:: samples/jobs/update-job-request.json + :language: javascript + +Response Example +---------------- + +.. literalinclude:: samples/jobs/update-job-response.json + :language: javascript + + +Delete a job +============ + +.. rest_method:: DELETE /v1/jobs/{job_id} + +Delete a job. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 204 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - job_id: path_job_id + +Response Parameters +------------------- + +None + +Response Example +---------------- + +.. literalinclude:: samples/jobs/delete-job-response.text + :language: text diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml new file mode 100644 index 00000000..efddd5a1 --- /dev/null +++ b/api-ref/source/parameters.yaml @@ -0,0 +1,472 @@ +#################### +# Header Variables # +#################### + +x-auth-token: + description: | + Token used to identify the user from Keystone + in: header + required: false + type: string + +#################### +# Path Variables # +#################### + +path_alias_name: + description: | + Name of the alias + in: path + required: true + type: string + +path_execution_filter: + description: | + Execution filter, e.g. "``function_id``, ``function_version``, etc..." + in: path + required: true + type: string + +path_execution_id: + description: | + ID for the execution + in: path + required: true + type: uuid + +path_function_id: + description: | + ID for the function + in: path + required: true + type: uuid + +path_job_id: + description: | + ID for the job + in: path + required: true + type: uuid + +path_runtime_id: + description: | + ID for the runtime + in: path + required: true + type: uuid + +path_version_number: + description: | + Version number + in: path + required: true + type: integer + +path_webhook_id: + description: | + ID for the webhook + in: path + required: true + type: uuid + +#################### +# Body Variables # +#################### + +alias_description: + description: | + Description for the alias + in: body + required: false + type: string + +alias_name: + description: | + Name of the alias + in: body + required: true + type: string + +alias_version: + description: | + Version of the function to point the alias + in: body + required: true + type: integer + +created_at: + description: | + Date / Time when resource was created + in: body + required: false + type: datestamp + +execution_description: + description: | + Description for the execution + in: body + required: false + type: string + +execution_input: + description: | + Input data to pass to the function, e.g. ``{"name": "foo"}`` + in: body + required: false + type: JSON + +execution_sync: + description: | + Execution is sync or async, default is ``true`` + in: body + required: false + type: bool + +execution_version: + description: | + Version of the function to execute, default is ``0`` + in: body + required: false + type: integer + +function_code: + description: | + Source code type, e.g. "``package``", "``swift``", "``image``" + in: body + required: true + type: JSON + +function_code_update: + description: | + Source code type, e.g. "``package``", "``swift``", "``image``" + + Package function can't have this value updated. + in: body + required: false + type: JSON + +function_count: + description: | + Total of time the function has been executed + in: body + required: true + type: integer + +function_cpu: + description: | + Max CPU usage during the execution + in: body + required: false + type: integer + +function_description: + description: | + Description for the function + in: body + required: false + type: string + +function_entry: + description: | + Function entry point, e.g. "``hello_world.main``" + + Not required if the source is "``image``" + in: body + required: true + type: string + +function_entry_update: + description: | + Function entry point, e.g. "``hello_world.main``" + in: body + required: false + type: string + +function_id: + description: | + ID for the function + in: body + required: true + type: uuid + +function_latest_version: + description: | + Latest version created based on this function + in: body + required: false + type: integer + +function_memory: + description: | + Max memory usage during the execution + in: body + required: false + type: integer + +function_name: + description: | + Function name + in: body + required: true + type: string + +function_name_update: + description: | + Function name + in: body + required: false + type: string + +function_package: + description: | + Package to upload, e.g. "``package=@./hello_world.zip``" + + Required only if '``"code": {"source": "package"}``' + in: body + required: false + type: string + +function_runtime_id: + description: | + Runtime ID used by the function + in: body + required: true + type: uuid + +function_runtime_id_update: + description: | + Runtime ID used by the function + in: body + required: false + type: uuid + +function_scale_count_down: + description: | + Number of workers to scale down a function, default is ``1`` + in: body + required: false + type: integer + +function_scale_count_up: + description: | + Number of workers to scale up a function, default is ``1`` + in: body + required: false + type: integer + +function_timeout: + description: | + Timeout in second before the execution fails + in: body + required: false + type: integer + +id: + description: | + ID for the resource + in: body + required: true + type: uuid + +job_count: + description: | + Number of time the function should be executed, default is ``unlimited`` + in: body + required: false + type: integer + +job_first_execution: + description: | + First time the function will be executed + in: body + required: true + type: string + +job_input: + description: | + Input data to pass to the function, e.g. ``{"name": "foo"}`` + in: body + required: false + type: JSON + +job_name: + description: | + Name of the job + in: body + required: true + type: string + +job_next_execution: + description: | + Next time the function will be executed + in: body + required: true + type: string + +job_next_execution_update: + description: | + Next time the function will be executed, e.g. "``2019-06-07 22:41:00``" + in: body + required: true + type: string + +job_pattern: + description: | + Cron pattern, e.g. "``* * * * *``" is equal to every minutes + in: body + required: true + type: string + +job_pattern_update: + description: | + Cron pattern, e.g. "``* * * * *``" is equal to every minutes + in: body + required: false + type: string + +job_status_update: + description: | + Status of the job, e.g. "``paused``, ``running``, ``canceled``, ``done``" + in: body + required: false + type: string + +job_version: + description: | + Version of the function to execute, default is ``0`` + in: body + required: false + type: integer + + + +project_id: + description: | + ID for the project that owns the resource + in: body + required: true + type: uuid + +runtime_capacity: + description: | + Number of workers available and currently used + in: body + required: false + type: string + +runtime_description: + description: | + Description for the runtime + in: body + required: false + type: string + +runtime_id: + description: | + ID for the runtime + in: body + required: true + type: uuid + +runtime_image: + description: | + Docker image used to build the runtime, e.g. "openstackqinling/python3-runtime" + in: body + required: true + type: string + +runtime_image_update: + description: | + Docker image used to build the runtime, e.g. "openstackqinling/python3-runtime" + in: body + required: false + type: string + +runtime_is_public: + description: | + Make the runtime public or not, if public then the runtime will be + available for all the tenant. + The runtime is public by default. + in: body + required: false + type: bool + +runtime_name: + description: | + Runtime name + in: body + required: true + type: string + +runtime_name_update: + description: | + Runtime name + in: body + required: false + type: string + +runtime_trusted: + description: | + Define the runtime as trusted or not, depending the value Kubernetes + will apply some annotations like ``io.kubernetes.cri-o.TrustedSandbox`` + in the pod specification to choose the underlying container runtime. + The runtime is trusted by default. + in: body + required: false + type: bool + +status: + description: | + Status of the resource + in: body + required: true + type: enum + +updated_at: + description: | + Date / Time when resource last updated + in: body + required: false + type: datestamp + +version_count: + description: | + Total of time the version has been executed + in: body + required: false + type: integer + +version_description: + description: | + Description for the version + in: body + required: false + type: string + +version_number: + description: | + Version of the function + in: body + required: false + type: integer + +webhook_description: + description: | + Description for the webhook + in: body + required: false + type: string + +webhook_url: + description: | + Webhook URL + in: body + required: true + type: string + +webhook_version: + description: | + Version of the function + in: body + required: false + type: integer diff --git a/api-ref/source/runtimes.inc b/api-ref/source/runtimes.inc new file mode 100644 index 00000000..cc1c6336 --- /dev/null +++ b/api-ref/source/runtimes.inc @@ -0,0 +1,317 @@ +.. -*- rst -*- + +========= + Runtimes +========= + +Lists, creates, updates, shows details and deletes runtimes. + +The runtime is programming language support. Each runtime is encapsulated +in a container image which is used for creating the runtime container. +Qinling communicates with the container by sending HTTP requests and runs +user function inside. + + +Create a runtime +================ + +.. rest_method:: POST /v1/runtimes + +Create a runtime. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 201 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - name: runtime_name + - image: runtime_image + - description: runtime_description + - is_public: runtime_is_public + - trusted: runtime_trusted + +Request Example +--------------- + +.. literalinclude:: samples/runtimes/create-runtime-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: runtime_name + - image: runtime_image + - description: runtime_description + - is_public: runtime_is_public + - trusted: runtime_trusted + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/runtimes/create-runtime-response.json + :language: javascript + + +List runtimes +============= + +.. rest_method:: GET /v1/runtimes + +List runtimes. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: runtime_name + - image: runtime_image + - description: runtime_description + - is_public: runtime_is_public + - trusted: runtime_trusted + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/runtimes/list-runtimes-response.json + :language: javascript + + +Show a runtime +============== + +.. rest_method:: GET /v1/runtimes/{runtime_id} + +Show a runtime. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - runtime_id: path_runtime_id + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: runtime_name + - image: runtime_image + - description: runtime_description + - is_public: runtime_is_public + - trusted: runtime_trusted + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/runtimes/show-runtime-response.json + :language: javascript + + +Show a runtime pool +=================== + +.. rest_method:: GET /v1/runtimes/{runtime_id}/pool + +Show a runtime pool. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - runtime_id: runtime_id + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - name: id + - capacity: runtime_capacity + +Response Example +---------------- + +.. literalinclude:: samples/runtimes/show-runtime-pool-response.json + :language: javascript + + +Update a runtime +================ + +.. rest_method:: PUT /v1/runtimes/{runtime_id} + +Update a runtime. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - runtime_id: path_runtime_id + - name: runtime_name_update + - image: runtime_image_update + - description: runtime_description + +Request Example +--------------- + +.. literalinclude:: samples/runtimes/update-runtime-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - name: runtime_name + - image: runtime_image + - description: runtime_description + - is_public: runtime_is_public + - trusted: runtime_trusted + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/runtimes/update-runtime-response.json + :language: javascript + + +Delete a runtime +================ + +.. rest_method:: DELETE /v1/runtimes/{runtime_id} + +Delete a runtime. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 204 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - runtime_id: path_runtime_id + +Response Parameters +------------------- + +None + +Response Example +---------------- + +.. literalinclude:: samples/runtimes/delete-runtime-response.text + :language: text diff --git a/api-ref/source/samples/aliases/create-alias-request.json b/api-ref/source/samples/aliases/create-alias-request.json new file mode 100644 index 00000000..08fd7cf5 --- /dev/null +++ b/api-ref/source/samples/aliases/create-alias-request.json @@ -0,0 +1,6 @@ +{ + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "name": "hw-v2", + "function_version": 2, + "description": "Hello World, version 2" +} diff --git a/api-ref/source/samples/aliases/create-alias-response.json b/api-ref/source/samples/aliases/create-alias-response.json new file mode 100644 index 00000000..3a00779f --- /dev/null +++ b/api-ref/source/samples/aliases/create-alias-response.json @@ -0,0 +1,9 @@ +{ + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "name": "hw-v2", + "created_at": "2019-06-07 02:07:06.572982", + "updated_at": null, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "function_version": 2, + "description": "Hello World, version 2" +} diff --git a/api-ref/source/samples/aliases/delete-alias-response.text b/api-ref/source/samples/aliases/delete-alias-response.text new file mode 100644 index 00000000..a117b121 --- /dev/null +++ b/api-ref/source/samples/aliases/delete-alias-response.text @@ -0,0 +1 @@ +Request to delete function_alias hw-v2 has been accepted. diff --git a/api-ref/source/samples/aliases/list-aliases-response.json b/api-ref/source/samples/aliases/list-aliases-response.json new file mode 100644 index 00000000..61dac25a --- /dev/null +++ b/api-ref/source/samples/aliases/list-aliases-response.json @@ -0,0 +1,20 @@ +[ + { + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "name": "hw-v2", + "created_at": "2019-06-07 02:07:06", + "updated_at": null, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "function_version": 2, + "description": "Hello World, version 2" + }, + { + "function_id": "ab003f7a-402a-4a2e-8f00-2f848bde800d", + "name": "hq-v1", + "created_at": "2019-06-07 02:15:16", + "updated_at": null, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "function_version": 37, + "description": "Hello Qinling, version 37" + } +] diff --git a/api-ref/source/samples/aliases/show-alias-response.json b/api-ref/source/samples/aliases/show-alias-response.json new file mode 100644 index 00000000..ff9800e4 --- /dev/null +++ b/api-ref/source/samples/aliases/show-alias-response.json @@ -0,0 +1,9 @@ +{ + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "name": "hw-v2", + "created_at": "2019-06-07 02:07:06", + "updated_at": null, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "function_version": 2, + "description": "Hello World, version 2" +} diff --git a/api-ref/source/samples/aliases/update-alias-request.json b/api-ref/source/samples/aliases/update-alias-request.json new file mode 100644 index 00000000..333f4a4e --- /dev/null +++ b/api-ref/source/samples/aliases/update-alias-request.json @@ -0,0 +1,6 @@ +{ + "function_id": "ab003f7a-402a-4a2e-8f00-2f848bde800d", + "name": "hq-v1", + "function_version": 38, + "description": "Hello Qinling, version 38" +} diff --git a/api-ref/source/samples/aliases/update-alias-response.json b/api-ref/source/samples/aliases/update-alias-response.json new file mode 100644 index 00000000..b6148b4d --- /dev/null +++ b/api-ref/source/samples/aliases/update-alias-response.json @@ -0,0 +1,9 @@ +{ + "function_id": "ab003f7a-402a-4a2e-8f00-2f848bde800d", + "name": "hq-v1", + "created_at": "2019-06-07 02:15:16", + "updated_at": "2019-06-07 02:32:14.097418", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "function_version": 38, + "description": "Hello Qinling, version 38" +} diff --git a/api-ref/source/samples/api-versions/get-versions-response.json b/api-ref/source/samples/api-versions/get-versions-response.json new file mode 100644 index 00000000..67bf31d2 --- /dev/null +++ b/api-ref/source/samples/api-versions/get-versions-response.json @@ -0,0 +1,15 @@ +{ + "versions": [ + { + "status": "CURRENT", + "id": "v1.0", + "links": [ + { + "href": "http://api-uat.ormuco.com:7070/v1", + "target": "v1", + "rel": "self" + } + ] + } + ] +} diff --git a/api-ref/source/samples/executions/create-execution-request.json b/api-ref/source/samples/executions/create-execution-request.json new file mode 100644 index 00000000..1dc482f5 --- /dev/null +++ b/api-ref/source/samples/executions/create-execution-request.json @@ -0,0 +1,7 @@ +{ + "description": "The world should know Foo!", + "sync": true, + "function_version": 0, + "input": "{\"name\": \"foo\"}", + "function_id": "3e0e5bf8-ee7a-4fc8-9641-d1cbd9c60f46" +} diff --git a/api-ref/source/samples/executions/create-execution-response.json b/api-ref/source/samples/executions/create-execution-response.json new file mode 100644 index 00000000..7a6a23a1 --- /dev/null +++ b/api-ref/source/samples/executions/create-execution-response.json @@ -0,0 +1,13 @@ +{ + "status": "success", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "description": "The world should know Foo!", + "updated_at": "2019-06-06 23:13:37", + "created_at": "2019-06-06 23:13:37", + "sync": true, + "function_version": 0, + "result": "{\"duration\": 0.044, \"output\": \"Hello, bar\"}", + "input": "{\"name\": \"foo\"}", + "function_id": "3e0e5bf8-ee7a-4fc8-9641-d1cbd9c60f46", + "id": "62033613-6f02-4a6d-b569-7ba7fd18f8f7" +} diff --git a/api-ref/source/samples/executions/delete-execution-response.text b/api-ref/source/samples/executions/delete-execution-response.text new file mode 100644 index 00000000..97106e94 --- /dev/null +++ b/api-ref/source/samples/executions/delete-execution-response.text @@ -0,0 +1 @@ +Request to delete execution 9b6d0e80-7c4b-49d1-bf11-f16999433337 has been accepted. diff --git a/api-ref/source/samples/executions/list-executions-filters-response.json b/api-ref/source/samples/executions/list-executions-filters-response.json new file mode 100644 index 00000000..8edb9065 --- /dev/null +++ b/api-ref/source/samples/executions/list-executions-filters-response.json @@ -0,0 +1,28 @@ +[ + { + "status": "success", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "description": null, + "created_at": "2019-06-06 21:05:39", + "sync": true, + "function_version": 0, + "result": "{\"duration\": 0.074, \"output\": \"Hello, World\"}", + "input": null, + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "updated_at": "2019-06-06 21:05:41", + "id": "7dbb2ebc-9096-4e8e-9ded-0af8cd6cef60" + }, + { + "status": "success", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "description": null, + "created_at": "2019-06-06 23:50:41", + "sync": true, + "function_version": 0, + "result": "{\"duration\": 0.183, \"output\": \"Hello, bar\"}", + "input": "{\"name\": \"bar\"}", + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "updated_at": "2019-06-06 23:50:42", + "id": "9b6d0e80-7c4b-49d1-bf11-f16999433337" + } +] diff --git a/api-ref/source/samples/executions/list-executions-response.json b/api-ref/source/samples/executions/list-executions-response.json new file mode 100644 index 00000000..66eebcbc --- /dev/null +++ b/api-ref/source/samples/executions/list-executions-response.json @@ -0,0 +1,28 @@ +[ + { + "status": "success", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "description": null, + "created_at": "2019-06-06 21:05:39", + "sync": true, + "function_version": 0, + "result": "{\"duration\": 0.074, \"output\": \"Hello, World\"}", + "input": null, + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "updated_at": "2019-06-06 21:05:41", + "id": "7dbb2ebc-9096-4e8e-9ded-0af8cd6cef60" + }, + { + "status": "success", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "description": "The world should know Foo!", + "created_at": "2019-06-06 23:15:30", + "sync": true, + "function_version": 0, + "result": "{\"duration\": 0.032, \"output\": \"Hello, bar\"}", + "input": "{\"name\": \"bar\"}", + "function_id": "3e0e5bf8-ee7a-4fc8-9641-d1cbd9c60f46", + "updated_at": "2019-06-06 23:15:30", + "id": "347bb366-95c9-49ab-8179-424c7b707124" + } +] diff --git a/api-ref/source/samples/executions/show-execution-log-response.json b/api-ref/source/samples/executions/show-execution-log-response.json new file mode 100644 index 00000000..2531fb28 --- /dev/null +++ b/api-ref/source/samples/executions/show-execution-log-response.json @@ -0,0 +1,3 @@ +Start execution: 347bb366-95c9-49ab-8179-424c7b707124 +Hello, World! +Finished execution: 347bb366-95c9-49ab-8179-424c7b707124 diff --git a/api-ref/source/samples/executions/show-execution-response.json b/api-ref/source/samples/executions/show-execution-response.json new file mode 100644 index 00000000..969a5cbd --- /dev/null +++ b/api-ref/source/samples/executions/show-execution-response.json @@ -0,0 +1,13 @@ +{ + "status": "success", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "description": "The world should know Foo!", + "created_at": "2019-06-06 23:15:30", + "sync": true, + "function_version": 0, + "result": "{\"duration\": 0.032, \"output\": \"Hello, bar\"}", + "input": "{\"name\": \"bar\"}", + "function_id": "3e0e5bf8-ee7a-4fc8-9641-d1cbd9c60f46", + "updated_at": "2019-06-06 23:15:30", + "id": "347bb366-95c9-49ab-8179-424c7b707124" +} diff --git a/api-ref/source/samples/functions/create-function-image-request.json b/api-ref/source/samples/functions/create-function-image-request.json new file mode 100644 index 00000000..a0cfe105 --- /dev/null +++ b/api-ref/source/samples/functions/create-function-image-request.json @@ -0,0 +1,12 @@ +{ + "code": { + "source": "image", + "image": "docker-registry/hello-world" + }, + "description": "Hello World from Docker image", + "memory_size": 33554432, + "timeout": 15, + "cpu": 200, + "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "name": "hello_world" +} diff --git a/api-ref/source/samples/functions/create-function-image-response.json b/api-ref/source/samples/functions/create-function-image-response.json new file mode 100644 index 00000000..6c0eba06 --- /dev/null +++ b/api-ref/source/samples/functions/create-function-image-response.json @@ -0,0 +1,19 @@ +{ + "count": 0, + "code": { + "source": "image", + "image": "docker-registry/hello-world" + }, + "description": "Hello World from Docker image", + "created_at": "2019-06-10 01:51:29.515424", + "updated_at": null, + "latest_version": 0, + "id": "28de9573-2397-4fa1-b627-60124395d1ff", + "memory_size": 33554432, + "timeout": 15, + "entry": null, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "cpu": 200, + "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "name": "hello_world" +} diff --git a/api-ref/source/samples/functions/create-function-package-curl-request.text b/api-ref/source/samples/functions/create-function-package-curl-request.text new file mode 100644 index 00000000..5c63cb7b --- /dev/null +++ b/api-ref/source/samples/functions/create-function-package-curl-request.text @@ -0,0 +1,11 @@ +curl -X POST http://127.0.0.1:7070/v1/functions \ + -H "X-Auth-Token: gAAAAAB..." \ + -F name=hello_world \ + -F runtime_id=cbd9e85f-a1b2-4120-a2c7-57c90809ce7d \ + -F code='{"source": "package"}' \ + -F entry=hello_world.main \ + -F cpu=200 \ + -F memory=33000000 \ + -F description="Hello World function based on a package" \ + -F timeout=15 \ + -F package=@/home/dev/hello_world.zip diff --git a/api-ref/source/samples/functions/create-function-package-request.json b/api-ref/source/samples/functions/create-function-package-request.json new file mode 100644 index 00000000..055e70e2 --- /dev/null +++ b/api-ref/source/samples/functions/create-function-package-request.json @@ -0,0 +1,12 @@ +{ + "code": { + "source": "package" + }, + "description": "Hello World function from local package archive", + "memory_size": 33554432, + "timeout": 15, + "entry": "hello_world.main", + "cpu": 200, + "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "name": "hello_world" +} diff --git a/api-ref/source/samples/functions/create-function-package-response.json b/api-ref/source/samples/functions/create-function-package-response.json new file mode 100644 index 00000000..5a672db8 --- /dev/null +++ b/api-ref/source/samples/functions/create-function-package-response.json @@ -0,0 +1,19 @@ +{ + "count": 0, + "code": { + "source": "package", + "md5sum": "e439d00bab001d7ad7d1e0e451567699" + }, + "description": "Hello World function from local package archive", + "created_at": "2019-06-10 01:15:02.108208", + "updated_at": null, + "latest_version": 0, + "id": "00f3b8ef-e794-4897-8a34-fa6a489d4ede", + "memory_size": 33554432, + "timeout": 15, + "entry": "hello_world.main", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "cpu": 200, + "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "name": "hello_world" +} diff --git a/api-ref/source/samples/functions/create-function-swift-request.json b/api-ref/source/samples/functions/create-function-swift-request.json new file mode 100644 index 00000000..05ab5650 --- /dev/null +++ b/api-ref/source/samples/functions/create-function-swift-request.json @@ -0,0 +1,16 @@ +{ + "code": { + "source": "swift", + "swift": { + "object": "hello_world.py", + "container": "functions" + } + }, + "description": "Hello World function from Swift", + "memory_size": 33554432, + "timeout": 15, + "entry": "hello_world.main", + "cpu": 200, + "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "name": "hello_world" +} diff --git a/api-ref/source/samples/functions/create-function-swift-response.json b/api-ref/source/samples/functions/create-function-swift-response.json new file mode 100644 index 00000000..5caa6f3a --- /dev/null +++ b/api-ref/source/samples/functions/create-function-swift-response.json @@ -0,0 +1,22 @@ +{ + "count": 0, + "code": { + "source": "swift", + "swift": { + "object": "hello_world.py", + "container": "functions" + } + }, + "description": "Hello World function from Swift", + "created_at": "2019-06-10 01:43:53.909146", + "updated_at": null, + "latest_version": 0, + "id": "1127cb1a-938e-4262-b22f-d88f182624f6", + "memory_size": 33554432, + "timeout": 15, + "entry": "hello_world.main", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "cpu": 200, + "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "name": "hello_world" +} diff --git a/api-ref/source/samples/functions/delete-function-response.text b/api-ref/source/samples/functions/delete-function-response.text new file mode 100644 index 00000000..480e0108 --- /dev/null +++ b/api-ref/source/samples/functions/delete-function-response.text @@ -0,0 +1 @@ +Request to delete function ff64180b-d41b-420e-9846-ee706c1548b0 has been accepted. diff --git a/api-ref/source/samples/functions/detach-function-response.text b/api-ref/source/samples/functions/detach-function-response.text new file mode 100644 index 00000000..327cef8d --- /dev/null +++ b/api-ref/source/samples/functions/detach-function-response.text @@ -0,0 +1 @@ +Request to detach function f8e7357f-af4a-4448-87d8-6fed4c7db5b5 has been accepted. diff --git a/api-ref/source/samples/functions/download-function-response.text b/api-ref/source/samples/functions/download-function-response.text new file mode 100644 index 00000000..98b5969b --- /dev/null +++ b/api-ref/source/samples/functions/download-function-response.text @@ -0,0 +1 @@ +Code package downloaded to /root/f8e7357f-af4a-4448-87d8-6fed4c7db5b5.zip diff --git a/api-ref/source/samples/functions/list-functions-response.json b/api-ref/source/samples/functions/list-functions-response.json new file mode 100644 index 00000000..b0f03765 --- /dev/null +++ b/api-ref/source/samples/functions/list-functions-response.json @@ -0,0 +1,32 @@ +[ + { + "count": 7, + "code": "{\"source\": \"package\", \"md5sum\": \"648926b8a9705d3bd77cefdeca46a254\"}", + "description": "Function Hello World :)", + "created_at": "2019-06-06 18:59:02", + "timeout": 10, + "updated_at": null, + "cpu": 250, + "memory_size": 134217728, + "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "entry": "hello_world.main", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "22f62e09-e361-4481-b2da-22e3a4ed9a43", + "name": "hello_world" + }, + { + "count": 0, + "code": "{\"source\": \"package\", \"md5sum\": \"e0309c12d355352cc92b5433bf293210\"}", + "description": "Function Goodbye World :(", + "created_at": "2019-06-06 19:04:30", + "timeout": 5, + "updated_at": "2019-06-06 19:04:30", + "cpu": 100, + "memory_size": 33554432, + "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "entry": "goodbye_world.main", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "2324a256-a249-4cec-968b-6ca7f99d805b", + "name": "goodbye_world" + } +] diff --git a/api-ref/source/samples/functions/scaledown-function-request.json b/api-ref/source/samples/functions/scaledown-function-request.json new file mode 100644 index 00000000..8f8b7682 --- /dev/null +++ b/api-ref/source/samples/functions/scaledown-function-request.json @@ -0,0 +1,3 @@ +{ + "count": 6 +} diff --git a/api-ref/source/samples/functions/scaledown-function-response.text b/api-ref/source/samples/functions/scaledown-function-response.text new file mode 100644 index 00000000..2aeb798c --- /dev/null +++ b/api-ref/source/samples/functions/scaledown-function-response.text @@ -0,0 +1 @@ +Request to scale down function 3e0e5bf8-ee7a-4fc8-9641-d1cbd9c60f46 has been accepted. diff --git a/api-ref/source/samples/functions/scaleup-function-request.json b/api-ref/source/samples/functions/scaleup-function-request.json new file mode 100644 index 00000000..8f8b7682 --- /dev/null +++ b/api-ref/source/samples/functions/scaleup-function-request.json @@ -0,0 +1,3 @@ +{ + "count": 6 +} diff --git a/api-ref/source/samples/functions/scaleup-function-response.text b/api-ref/source/samples/functions/scaleup-function-response.text new file mode 100644 index 00000000..5d2066d8 --- /dev/null +++ b/api-ref/source/samples/functions/scaleup-function-response.text @@ -0,0 +1 @@ +Request to scale up function 3e0e5bf8-ee7a-4fc8-9641-d1cbd9c60f46 has been accepted. diff --git a/api-ref/source/samples/functions/show-function-response.json b/api-ref/source/samples/functions/show-function-response.json new file mode 100644 index 00000000..f1cdc2ed --- /dev/null +++ b/api-ref/source/samples/functions/show-function-response.json @@ -0,0 +1,15 @@ +{ + "count": 7, + "code": "{\"source\": \"package\", \"md5sum\": \"648926b8a9705d3bd77cefdeca46a254\"}", + "description": "Function Hello World :)", + "created_at": "2019-06-06 18:59:02", + "timeout": 10, + "updated_at": null, + "cpu": 250, + "memory_size": 134217728, + "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "entry": "hello_world.main", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "22f62e09-e361-4481-b2da-22e3a4ed9a43", + "name": "hello_world" +} diff --git a/api-ref/source/samples/functions/update-function-package-curl-request.text b/api-ref/source/samples/functions/update-function-package-curl-request.text new file mode 100644 index 00000000..003baf01 --- /dev/null +++ b/api-ref/source/samples/functions/update-function-package-curl-request.text @@ -0,0 +1,10 @@ +curl -X PUT http://127.0.0.1:7070/v1/functions/{function_id} \ + -H "X-Auth-Token: gAAAAAB..." \ + -F name=hello_world \ + -F runtime_id=cbd9e85f-a1b2-4120-a2c7-57c90809ce7d \ + -F entry=hello_world.main \ + -F cpu=200 \ + -F memory=33000000 \ + -F description="Hello World function based on a package" \ + -F timeout=15 \ + -F package=@/home/dev/hello_world.zip diff --git a/api-ref/source/samples/functions/update-function-package-request.json b/api-ref/source/samples/functions/update-function-package-request.json new file mode 100644 index 00000000..7db2a32b --- /dev/null +++ b/api-ref/source/samples/functions/update-function-package-request.json @@ -0,0 +1,9 @@ +{ + "description": "Hello World function from local package archive", + "memory_size": 33554432, + "timeout": 15, + "entry": "hello_world.main", + "cpu": 200, + "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "name": "hello_world" +} diff --git a/api-ref/source/samples/functions/update-function-package-response.json b/api-ref/source/samples/functions/update-function-package-response.json new file mode 100644 index 00000000..de2f45c1 --- /dev/null +++ b/api-ref/source/samples/functions/update-function-package-response.json @@ -0,0 +1,19 @@ +{ + "count": 0, + "code": { + "source": "package", + "md5sum": "e439d00bab001d7ad7d1e0e451567699" + }, + "description": "Hello World function from local package archive", + "created_at": "2019-06-10 01:15:02.108208", + "updated_at": "2019-06-10 01:15:02.115438", + "latest_version": 0, + "id": "00f3b8ef-e794-4897-8a34-fa6a489d4ede", + "memory_size": 33554432, + "timeout": 15, + "entry": "hello_world.main", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "cpu": 200, + "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "name": "hello_world" +} diff --git a/api-ref/source/samples/functions/update-function-swift-request.json b/api-ref/source/samples/functions/update-function-swift-request.json new file mode 100644 index 00000000..05ab5650 --- /dev/null +++ b/api-ref/source/samples/functions/update-function-swift-request.json @@ -0,0 +1,16 @@ +{ + "code": { + "source": "swift", + "swift": { + "object": "hello_world.py", + "container": "functions" + } + }, + "description": "Hello World function from Swift", + "memory_size": 33554432, + "timeout": 15, + "entry": "hello_world.main", + "cpu": 200, + "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "name": "hello_world" +} diff --git a/api-ref/source/samples/functions/update-function-swift-response.json b/api-ref/source/samples/functions/update-function-swift-response.json new file mode 100644 index 00000000..717b2940 --- /dev/null +++ b/api-ref/source/samples/functions/update-function-swift-response.json @@ -0,0 +1,22 @@ +{ + "count": 0, + "code": { + "source": "swift", + "swift": { + "object": "hello_world.py", + "container": "functions" + } + }, + "description": "Hello World function from Swift", + "created_at": "2019-06-10 01:28:38", + "updated_at": "2019-06-10 02:22:27.663257", + "latest_version": 0, + "id": "ecdf3b0c-ac37-4ba8-a02c-5d60cf86cc8b", + "memory_size": 33554432, + "timeout": 15, + "entry": "hello_world.main", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "cpu": 200, + "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "name": "hello_world" +} diff --git a/api-ref/source/samples/jobs/create-job-request.json b/api-ref/source/samples/jobs/create-job-request.json new file mode 100644 index 00000000..2deefb88 --- /dev/null +++ b/api-ref/source/samples/jobs/create-job-request.json @@ -0,0 +1,8 @@ +{ + "count": 5, + "name": "every-minute", + "pattern": "* * * * *", + "function_version": 2, + "function_input": "{\"name\": \"Foo\"}", + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5" +} diff --git a/api-ref/source/samples/jobs/create-job-response.json b/api-ref/source/samples/jobs/create-job-response.json new file mode 100644 index 00000000..9016ffcb --- /dev/null +++ b/api-ref/source/samples/jobs/create-job-response.json @@ -0,0 +1,15 @@ +{ + "count": 5, + "status": "running", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "name": "every-minute", + "pattern": "* * * * *", + "created_at": "2019-06-07 19:11:08.375646", + "updated_at": null, + "function_version": 2, + "first_execution_time": "2019-06-07 19:12:00", + "function_input": "{\"name\": \"Foo\"}", + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "id": "dc7ef571-1f8d-4dc8-a659-fc86f80dd44c", + "next_execution_time": "2019-06-07 19:12:00" +} diff --git a/api-ref/source/samples/jobs/delete-job-response.text b/api-ref/source/samples/jobs/delete-job-response.text new file mode 100644 index 00000000..5dcf4c61 --- /dev/null +++ b/api-ref/source/samples/jobs/delete-job-response.text @@ -0,0 +1 @@ +Request to delete job 697546a1-090c-48de-8ecd-ef4cdb9da7a9 has been accepted. diff --git a/api-ref/source/samples/jobs/list-jobs-response.json b/api-ref/source/samples/jobs/list-jobs-response.json new file mode 100644 index 00000000..a6e5f50d --- /dev/null +++ b/api-ref/source/samples/jobs/list-jobs-response.json @@ -0,0 +1,32 @@ +[ + { + "count": null, + "status": "running", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "name": "every-minute", + "pattern": "0 0 * * SUN", + "created_at": "2019-06-07 19:18:50", + "updated_at": "2019-06-07 19:29:59", + "id": "697546a1-090c-48de-8ecd-ef4cdb9da7a9", + "first_execution_time": "2019-06-07 19:19:00", + "function_input": null, + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "function_version": 2, + "next_execution_time": "2019-06-07 19:31:00" + }, + { + "count": 0, + "status": "done", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "name": "every-minute", + "pattern": "* * * * *", + "created_at": "2019-06-07 19:21:33", + "updated_at": "2019-06-07 19:25:59", + "id": "4e435c84-ab06-4ff5-8f05-b7ffe25c1224", + "first_execution_time": "2019-06-07 19:22:00", + "function_input": "{\"name\": \"Foo\"}", + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "function_version": 0, + "next_execution_time": "2019-06-07 19:26:00" + } +] diff --git a/api-ref/source/samples/jobs/show-job-response.json b/api-ref/source/samples/jobs/show-job-response.json new file mode 100644 index 00000000..880f58ef --- /dev/null +++ b/api-ref/source/samples/jobs/show-job-response.json @@ -0,0 +1,15 @@ +{ + "count": 0, + "status": "done", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "name": "every-minute", + "pattern": "* * * * *", + "created_at": "2019-06-07 19:21:33", + "updated_at": "2019-06-07 19:25:59", + "id": "4e435c84-ab06-4ff5-8f05-b7ffe25c1224", + "first_execution_time": "2019-06-07 19:22:00", + "function_input": "{\"name\": \"Foo\"}", + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "function_version": 0, + "next_execution_time": "2019-06-07 19:26:00" +} diff --git a/api-ref/source/samples/jobs/update-job-request.json b/api-ref/source/samples/jobs/update-job-request.json new file mode 100644 index 00000000..55b0382c --- /dev/null +++ b/api-ref/source/samples/jobs/update-job-request.json @@ -0,0 +1,7 @@ +{ + "status": "paused", + "name": "every-minute", + "pattern": "* * * * *", + "function_input": "{\"name\": \"Foo\"}", + "next_execution_time": "2019-06-07 22:41:00" +} diff --git a/api-ref/source/samples/jobs/update-job-response.json b/api-ref/source/samples/jobs/update-job-response.json new file mode 100644 index 00000000..0fe25936 --- /dev/null +++ b/api-ref/source/samples/jobs/update-job-response.json @@ -0,0 +1,15 @@ +{ + "count": null, + "status": "paused", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "name": "every-minute", + "pattern": "* * * * *", + "created_at": "2019-06-07 19:18:50", + "updated_at": "2019-06-07 19:41:20.108254", + "function_version": 2, + "first_execution_time": "2019-06-07 19:19:00", + "function_input": "{\"name\": \"Foo\"}", + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "id": "697546a1-090c-48de-8ecd-ef4cdb9da7a9", + "next_execution_time": "2019-06-07 22:41:00" +} diff --git a/api-ref/source/samples/runtimes/create-runtime-request.json b/api-ref/source/samples/runtimes/create-runtime-request.json new file mode 100644 index 00000000..2cf3e39d --- /dev/null +++ b/api-ref/source/samples/runtimes/create-runtime-request.json @@ -0,0 +1,7 @@ +{ + "name": "python3", + "description": "Runtime Python3.7 ready for production.", + "image": "openstackqinling/python3-runtime", + "is_public:": true, + "trusted": true +} diff --git a/api-ref/source/samples/runtimes/create-runtime-response.json b/api-ref/source/samples/runtimes/create-runtime-response.json new file mode 100644 index 00000000..b0c71c05 --- /dev/null +++ b/api-ref/source/samples/runtimes/create-runtime-response.json @@ -0,0 +1,12 @@ +{ + "status": "creating", + "created_at": "2019-06-06 15:33:23.178645", + "description": "Runtime Python3.7 ready for production.", + "image": "openstackqinling/python3-runtime", + "updated_at": null, + "is_public": true, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "b351d3b6-8ccb-4f5b-b70f-58c72298a2ac", + "trusted": true, + "name": "python3" +} diff --git a/api-ref/source/samples/runtimes/delete-runtime-response.text b/api-ref/source/samples/runtimes/delete-runtime-response.text new file mode 100644 index 00000000..f3eabdc2 --- /dev/null +++ b/api-ref/source/samples/runtimes/delete-runtime-response.text @@ -0,0 +1 @@ +Request to delete runtime 63f8f51d-7270-4545-abdd-f767ef8b1882 has been accepted. diff --git a/api-ref/source/samples/runtimes/list-runtimes-response.json b/api-ref/source/samples/runtimes/list-runtimes-response.json new file mode 100644 index 00000000..7444b767 --- /dev/null +++ b/api-ref/source/samples/runtimes/list-runtimes-response.json @@ -0,0 +1,38 @@ +[ + { + "status": "available", + "description": "Runtime Python3.7 ready for production.", + "image": "openstackqinling/python3-runtime", + "updated_at": "2019-05-30 14:40:50", + "created_at": "2019-05-30 14:40:41", + "is_public": true, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "trusted": true, + "name": "python3" + }, + { + "status": "available", + "description": "Runtime Python2.7 ready for production.", + "image": "openstackqinling/python2-runtime", + "updated_at": "2019-06-03 19:01:37", + "created_at": "2019-06-03 19:00:33", + "is_public": true, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "c4682a12-1a82-424d-b299-9b238fb6b694", + "trusted": true, + "name": "python2.7" + }, + { + "status": "available", + "description": "Runtime Node.js 8.10 ready for production.", + "image": "openstackqinling/nodejs-runtime", + "updated_at": "2019-06-03 19:30:31", + "created_at": "2019-06-03 19:30:06", + "is_public": true, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "d3780197-d3a8-4961-8228-354ac7592e48", + "trusted": true, + "name": "nodejs8.10" + } +] diff --git a/api-ref/source/samples/runtimes/show-runtime-pool-response.json b/api-ref/source/samples/runtimes/show-runtime-pool-response.json new file mode 100644 index 00000000..36e8e0b2 --- /dev/null +++ b/api-ref/source/samples/runtimes/show-runtime-pool-response.json @@ -0,0 +1,7 @@ +{ + "capacity": { + "available": 3, + "total": 3 + }, + "name": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d" +} diff --git a/api-ref/source/samples/runtimes/show-runtime-response.json b/api-ref/source/samples/runtimes/show-runtime-response.json new file mode 100644 index 00000000..21a2c6ee --- /dev/null +++ b/api-ref/source/samples/runtimes/show-runtime-response.json @@ -0,0 +1,12 @@ +{ + "status": "available", + "description": "Runtime Python3.7 ready for production.", + "image": "openstackqinling/python3-runtime", + "updated_at": "2019-05-30 14:40:50", + "created_at": "2019-05-30 14:40:41", + "is_public": true, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "trusted": true, + "name": "python3" +} diff --git a/api-ref/source/samples/runtimes/update-runtime-request.json b/api-ref/source/samples/runtimes/update-runtime-request.json new file mode 100644 index 00000000..7cd0e37a --- /dev/null +++ b/api-ref/source/samples/runtimes/update-runtime-request.json @@ -0,0 +1,5 @@ +{ + "name": "python3", + "description": "Runtime Python3.7 ready for production.", + "image": "openstackqinling/python3-runtime" +} diff --git a/api-ref/source/samples/runtimes/update-runtime-response.json b/api-ref/source/samples/runtimes/update-runtime-response.json new file mode 100644 index 00000000..ea96575d --- /dev/null +++ b/api-ref/source/samples/runtimes/update-runtime-response.json @@ -0,0 +1,12 @@ +{ + "status": "available", + "description": "Runtime Python3.7 ready for production.", + "image": "openstackqinling/python3-runtime", + "updated_at": "2019-05-30 14:40:50", + "created_at": "2019-06-06 16:40:31", + "is_public": true, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", + "trusted": true, + "name": "python3" +} diff --git a/api-ref/source/samples/versions/create-version-request.json b/api-ref/source/samples/versions/create-version-request.json new file mode 100644 index 00000000..00cb1df6 --- /dev/null +++ b/api-ref/source/samples/versions/create-version-request.json @@ -0,0 +1,3 @@ +{ + "description": "This version is ready for production" +} diff --git a/api-ref/source/samples/versions/create-version-response.json b/api-ref/source/samples/versions/create-version-response.json new file mode 100644 index 00000000..d3eaf6a1 --- /dev/null +++ b/api-ref/source/samples/versions/create-version-response.json @@ -0,0 +1,10 @@ +{ + "count": 0, + "version_number": 1, + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "description": "This version is ready for production", + "created_at": "2019-06-07 01:23:16.278205", + "updated_at": null, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "45ebdcbf-6e2f-46c9-bd58-7f6ae01ecfcc" +} diff --git a/api-ref/source/samples/versions/detach-version-response.text b/api-ref/source/samples/versions/detach-version-response.text new file mode 100644 index 00000000..698dce95 --- /dev/null +++ b/api-ref/source/samples/versions/detach-version-response.text @@ -0,0 +1 @@ +Request to detach function f8e7357f-af4a-4448-87d8-6fed4c7db5b5(version 1) has been accepted. diff --git a/api-ref/source/samples/versions/list-versions-response.json b/api-ref/source/samples/versions/list-versions-response.json new file mode 100644 index 00000000..757f6749 --- /dev/null +++ b/api-ref/source/samples/versions/list-versions-response.json @@ -0,0 +1,22 @@ +[ + { + "count": 0, + "version_number": 1, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "description": "This version is ready for production", + "created_at": "2019-06-07 01:23:16", + "updated_at": null, + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "id": "45ebdcbf-6e2f-46c9-bd58-7f6ae01ecfcc" + }, + { + "count": 0, + "version_number": 2, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "description": "This version has not been tested yet", + "created_at": "2019-06-07 01:34:10", + "updated_at": null, + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "id": "9490f863-020b-4746-8f30-9324cff31678" + } +] diff --git a/api-ref/source/samples/versions/show-version-response.json b/api-ref/source/samples/versions/show-version-response.json new file mode 100644 index 00000000..4d15d119 --- /dev/null +++ b/api-ref/source/samples/versions/show-version-response.json @@ -0,0 +1,10 @@ +{ + "count": 0, + "version_number": 1, + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "description": "This version is ready for production", + "created_at": "2019-06-07 01:23:16", + "updated_at": null, + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "45ebdcbf-6e2f-46c9-bd58-7f6ae01ecfcc" +} diff --git a/api-ref/source/samples/webhooks/create-webhook-request.json b/api-ref/source/samples/webhooks/create-webhook-request.json new file mode 100644 index 00000000..bfd93a16 --- /dev/null +++ b/api-ref/source/samples/webhooks/create-webhook-request.json @@ -0,0 +1,5 @@ +{ + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "description": "Webhook triggered by Jenkins", + "function_version": 2 +} diff --git a/api-ref/source/samples/webhooks/create-webhook-response.json b/api-ref/source/samples/webhooks/create-webhook-response.json new file mode 100644 index 00000000..d8ef6606 --- /dev/null +++ b/api-ref/source/samples/webhooks/create-webhook-response.json @@ -0,0 +1,10 @@ +{ + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "description": "Webhook triggered by Jenkins", + "created_at": "2019-06-07 14:53:22.989283", + "updated_at": null, + "function_version": 2, + "webhook_url": "http://127.0.0.1:7070/v1/webhooks/2aac6d93-c4d3-4fc6-9d3b-8852be0c8c89/invoke", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "2aac6d93-c4d3-4fc6-9d3b-8852be0c8c89" +} diff --git a/api-ref/source/samples/webhooks/delete-webhook-response.text b/api-ref/source/samples/webhooks/delete-webhook-response.text new file mode 100644 index 00000000..9eb851a0 --- /dev/null +++ b/api-ref/source/samples/webhooks/delete-webhook-response.text @@ -0,0 +1 @@ +Request to delete webhook 2aac6d93-c4d3-4fc6-9d3b-8852be0c8c89 has been accepted. diff --git a/api-ref/source/samples/webhooks/list-webhooks-response.json b/api-ref/source/samples/webhooks/list-webhooks-response.json new file mode 100644 index 00000000..0aca0c54 --- /dev/null +++ b/api-ref/source/samples/webhooks/list-webhooks-response.json @@ -0,0 +1,22 @@ +[ + { + "function_id": "e47ca07c-b0cc-4501-901f-1c2e3df46724", + "description": "Webhook Hello World", + "created_at": "2019-06-07 02:48:16", + "updated_at": null, + "function_version": 0, + "webhook_url": "http://127.0.0.1:7070/v1/webhooks/726779f2-227f-43af-a891-4de85e8dadd5/invoke", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "726779f2-227f-43af-a891-4de85e8dadd5" + }, + { + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "description": "Webhook triggered by Jenkins", + "created_at": "2019-06-07 14:52:19", + "updated_at": null, + "function_version": 2, + "webhook_url": "http://127.0.0.1:7070/v1/webhooks/e3f34707-8fea-4d36-b558-e39b00b99105/invoke", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "e3f34707-8fea-4d36-b558-e39b00b99105" + } +] diff --git a/api-ref/source/samples/webhooks/show-webhook-response.json b/api-ref/source/samples/webhooks/show-webhook-response.json new file mode 100644 index 00000000..8818fdb4 --- /dev/null +++ b/api-ref/source/samples/webhooks/show-webhook-response.json @@ -0,0 +1,10 @@ +{ + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "description": "Webhook triggered by Jenkins", + "created_at": "2019-06-07 14:52:19", + "updated_at": null, + "function_version": 2, + "webhook_url": "http://127.0.0.1:7070/v1/webhooks/e3f34707-8fea-4d36-b558-e39b00b99105/invoke", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "e3f34707-8fea-4d36-b558-e39b00b99105" +} diff --git a/api-ref/source/samples/webhooks/update-webhook-request.json b/api-ref/source/samples/webhooks/update-webhook-request.json new file mode 100644 index 00000000..f85eda1d --- /dev/null +++ b/api-ref/source/samples/webhooks/update-webhook-request.json @@ -0,0 +1,5 @@ +{ + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "description": "Webhook triggered by Gitlab", + "function_version": 2 +} diff --git a/api-ref/source/samples/webhooks/update-webhook-response.json b/api-ref/source/samples/webhooks/update-webhook-response.json new file mode 100644 index 00000000..7f88d254 --- /dev/null +++ b/api-ref/source/samples/webhooks/update-webhook-response.json @@ -0,0 +1,10 @@ +{ + "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", + "description": "Webhook triggered by Gitlab", + "created_at": "2019-06-07 14:53:22", + "updated_at": "2019-06-07 18:06:42", + "function_version": 2, + "webhook_url": "http://127.0.0.1:7070/v1/webhooks/2aac6d93-c4d3-4fc6-9d3b-8852be0c8c89/invoke", + "project_id": "5eeb5916ae4b43699f06ea422e581b83", + "id": "2aac6d93-c4d3-4fc6-9d3b-8852be0c8c89" +} diff --git a/api-ref/source/status.yaml b/api-ref/source/status.yaml new file mode 100644 index 00000000..68fdae79 --- /dev/null +++ b/api-ref/source/status.yaml @@ -0,0 +1,61 @@ +################# +# Success Codes # +################# +200: + default: | + Request was successful. +201: + default: | + Resource was created and is ready to use. +202: + default: | + Request was accepted for processing, but the processing has not been + completed. A 'location' header is included in the response which contains + a link to check the progress of the request. +204: + default: | + The server has fulfilled the request by deleting the resource. +300: + default: | + There are multiple choices for resources. The request has to be more + specific to successfully retrieve one of these resources. +302: + default: | + The response is about a redirection hint. The header of the response + usually contains a 'location' value where requesters can check to track + the real location of the resource. +################# +# Error Codes # +################# + +400: + default: | + Some content in the request was invalid. + resource_signal: | + The target resource doesn't support receiving a signal. +401: + default: | + User must authenticate before making a request. +403: + default: | + Policy does not allow current user to do this operation. +404: + default: | + The requested resource could not be found. +405: + default: | + Method is not valid for this endpoint. +409: + default: | + This operation conflicted with another operation on this resource. + duplicate_zone: | + There is already a zone with this name. +500: + default: | + Something went wrong inside the service. This should not happen usually. + If it does happen, it means the server has experienced some serious + problems. +503: + default: | + Service is not available. This is mostly caused by service configuration + errors which prevents the service from successful start up. diff --git a/api-ref/source/urls.inc b/api-ref/source/urls.inc new file mode 100644 index 00000000..e568e9b7 --- /dev/null +++ b/api-ref/source/urls.inc @@ -0,0 +1,31 @@ +.. -*- rst -*- + +================== + Qinling Base URLs +================== + +All API calls through the rest of this document require authentication +with the OpenStack Identity service. They also required a ``url`` that +is extracted from the Identity token of type +``function-engine``. This will be the root url that every call below will be +added to build a full path. + +Note that if using OpenStack Identity service API v2, ``url`` can be +represented via ``adminURL``, ``internalURL`` or ``publicURL`` in endpoint +catalog. In Identity service API v3, ``url`` is represented with field +``interface`` including ``admin``, ``internal`` and ``public``. + +For instance, if the ``url`` is +``http://my-qinling-url.org/qinling/v1`` then the full API call for +``/functions`` is ``http://my-qinling-url.org/qinling/v1/functions``. + +Depending on the deployment the function engine url might be http or https, +a custom port, a custom path, and include your project id. The only way to +know the urls for your deployment is by using the service catalog. +The containers service URL should never be hard coded in applications, even +if they are only expected to work at a single site. It should always be +discovered from the Identity token. + +As such, for the rest of this document we will be using short hand +where ``GET /functions`` really means +``GET {your_qinling_url}/functions``. diff --git a/api-ref/source/versions.inc b/api-ref/source/versions.inc new file mode 100644 index 00000000..c3b594e8 --- /dev/null +++ b/api-ref/source/versions.inc @@ -0,0 +1,255 @@ +.. -*- rst -*- + +========= + Versions +========= + +Lists, creates, detaches, shows details and deletes versions. + +Function versions are like git commits, they’re snapshots of your +project history. Each version has a number that serves as its ID, +starting with 1 and incrementing up, and never reused. The code for +a published version of a function is immutable (i.e. cannot be changed). +So, a version number corresponds to a specific set of function code with +certainty. + + +Create a version +================ + +.. rest_method:: POST /v1/functions/{function_id}/versions + +Create a version. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 201 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: path_function_id + - description: version_description + +Request Example +--------------- + +.. literalinclude:: samples/versions/create-version-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - description: version_description + - function_id: function_id + - count: version_count + - version_number: version_number + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + + +Response Example +---------------- + +.. literalinclude:: samples/versions/create-version-response.json + :language: javascript + + +List versions +============= + +.. rest_method:: GET /v1/functions/{function_id}/versions + +List versions. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: path_function_id + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - description: version_description + - function_id: function_id + - count: version_count + - version_number: version_number + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/versions/list-versions-response.json + :language: javascript + + +Show a version +============== + +.. rest_method:: GET /v1/functions/{function_id}/versions/{version_number} + +Show a version. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: path_function_id + - version_number: path_version_number + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - description: version_description + - function_id: function_id + - count: version_count + - version_number: version_number + - project_id: project_id + - status: status + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/versions/show-version-response.json + :language: javascript + + +Detach a version +================ + +.. rest_method:: POST /v1/functions/{function_id}/versions/{version_number}/detach + +Detach a version. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 202 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: path_function_id + - version_number: path_version_number + +Response Parameters +------------------- + +None + +Response Example +---------------- + + +.. literalinclude:: samples/versions/detach-version-response.text + :language: text + + +Delete a version +================ + +.. rest_method:: DELETE /v1/functions/{function_id}/versions/{version_number} + +Delete a version. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 204 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: path_function_id + - version_number: path_version_number + +Response Parameters +------------------- + +None + +Response Example +---------------- + +None diff --git a/api-ref/source/webhooks.inc b/api-ref/source/webhooks.inc new file mode 100644 index 00000000..8ddbbb18 --- /dev/null +++ b/api-ref/source/webhooks.inc @@ -0,0 +1,261 @@ +.. -*- rst -*- + +========= + Webhooks +========= + +Lists, creates, updates, shows details and deletes webhooks. + +Webhooks are a low-effort way to invoke the functions. They do not +require a bot user or authentication to use. + + +Create a webhook +================ + +.. rest_method:: POST /v1/webhooks + +Create a webhook. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 201 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - function_id: function_id + - function_version: webhook_version + - description: webhook_description + +Request Example +--------------- + +.. literalinclude:: samples/webhooks/create-webhook-request.json + :language: javascript + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - description: webhook_description + - function_id: function_id + - version_number: webhook_version + - webhook_url: webhook_url + - project_id: project_id + - created_at: created_at + - updated_at: updated_at + + +Response Example +---------------- + +.. literalinclude:: samples/webhooks/create-webhook-response.json + :language: javascript + + +List webhooks +============= + +.. rest_method:: GET /v1/webhooks + +List webhooks. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - description: webhook_description + - function_id: function_id + - version_number: webhook_version + - webhook_url: webhook_url + - project_id: project_id + - created_at: created_at + - updated_at: updated_at + + +Response Example +---------------- + +.. literalinclude:: samples/webhooks/list-webhooks-response.json + :language: javascript + + +Show a webhook +============== + +.. rest_method:: GET /v1/webhooks/{webhook_id} + +Show a webhook. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - webhook_id: path_webhook_id + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - description: webhook_description + - function_id: function_id + - version_number: webhook_version + - webhook_url: webhook_url + - project_id: project_id + - created_at: created_at + - updated_at: updated_at + +Response Example +---------------- + +.. literalinclude:: samples/webhooks/show-webhook-response.json + :language: javascript + + +Update a webhook +================ + +.. rest_method:: PUT /v1/webhooks/{webhook_id} + +Update a webhook. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 202 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - webhook_id: path_webhook_id + +Response Parameters +------------------- + +.. rest_parameters:: parameters.yaml + + - id: id + - description: webhook_description + - function_id: function_id + - version_number: webhook_version + - webhook_url: webhook_url + - project_id: project_id + - created_at: created_at + - updated_at: updated_at + +Request Example +--------------- + +.. literalinclude:: samples/webhooks/update-webhook-request.json + :language: javascript + +Response Example +---------------- + +.. literalinclude:: samples/webhooks/update-webhook-response.json + :language: javascript + + +Delete a webhook +================ + +.. rest_method:: DELETE /v1/webhooks/{webhook_id} + +Delete a webhook. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 204 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - x-auth-token: x-auth-token + - webhook_id: path_webhook_id + +Response Parameters +------------------- + +None + +Response Example +---------------- + +.. literalinclude:: samples/webhooks/delete-webhook-response.text + :language: text diff --git a/lower-constraints.txt b/lower-constraints.txt index 6859fe7f..90318364 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -52,6 +52,7 @@ msgpack==0.5.6 netaddr==0.7.19 netifaces==0.10.6 oauthlib==2.0.6 +os-api-ref==1.4.0 os-client-config==1.29.0 oslo.cache==1.29.0 oslo.concurrency==3.26.0 @@ -67,7 +68,6 @@ oslo.serialization==2.18.0 oslo.service==1.24.0 oslo.upgradecheck==0.1.0 oslo.utils==3.33.0 -oslosphinx==4.7.0 oslotest==3.2.0 paramiko==2.4.1 Paste==2.0.3 @@ -108,8 +108,6 @@ setuptools==21.0.0 simplegeneric==0.8.1 six==1.10.0 Sphinx==1.6.2 -sphinxcontrib-httpdomain==1.3.0 -sphinxcontrib-pecanwsme==0.10.0 sphinxcontrib-websupport==1.0.1 SQLAlchemy==1.0.10 sqlalchemy-migrate==0.11.0 diff --git a/tox.ini b/tox.ini index bf115289..df880955 100644 --- a/tox.ini +++ b/tox.ini @@ -77,3 +77,10 @@ deps = -c{toxinidir}/lower-constraints.txt -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt + +[testenv:api-ref] +basepython = python3 +deps = -r{toxinidir}/doc/requirements.txt +commands = + rm -rf api-ref/build + sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html