Function/Runtime list

Change-Id: Ied04cd2fb6c3a0f16a37707bb1ba2db21ab7c191
This commit is contained in:
Lingxian Kong
2017-06-18 22:09:00 +12:00
parent 1c2f029c22
commit 727b716510
7 changed files with 79 additions and 52 deletions

View File

@@ -1,43 +1,17 @@
Qinling Qinling
======= =======
.. image:: https://img.shields.io/pypi/v/python-muranoclient.svg Qinling is Function as a Service for OpenStack. This project aims to provide a
:target: https://pypi.python.org/pypi/python-muranoclient/ platform to support serverless functions (like AWS Lambda). Qinling supports
:alt: Latest Version different container orchestration platforms (Kubernetes/Swarm, etc.) and
different function package storage backends (local/Swift/S3) by nature using
.. image:: https://img.shields.io/pypi/dm/python-muranoclient.svg plugin mechanism.
:target: https://pypi.python.org/pypi/python-muranoclient/
:alt: Downloads
Murano Project introduces an application catalog, which allows application
developers and cloud administrators to publish various cloud-ready
applications in a browsable categorised catalog, which may be used by the
cloud users (including the inexperienced ones) to pick-up the needed
applications and services and composes the reliable environments out of them
in a "push-the-button" manner.
* `PyPi`_ - package installation
* `Launchpad project`_ - release management
* `Blueprints`_ - feature specifications
* `Bugs`_ - issue tracking
* `Source`_
* `Specs`_
* `How to Contribute`_
.. _PyPi: https://pypi.python.org/pypi/python-muranoclient
.. _Launchpad project: https://launchpad.net/python-muranoclient
.. _Blueprints: https://blueprints.launchpad.net/python-muranoclient
.. _Bugs: https://bugs.launchpad.net/python-muranoclient
.. _Source: https://git.openstack.org/cgit/openstack/python-muranoclient
.. _How to Contribute: http://docs.openstack.org/infra/manual/developers.html
.. _Specs: http://specs.openstack.org/openstack/murano-specs/
Python Muranoclient
-------------------
python-muranoclient is a client library for Murano built on the Murano API.
It provides a Python API (the ``muranoclient`` module) and a command-line tool
(``murano``).
Python Qinlingclient
--------------------
python-qinlingclient is a client library for Qinling built on the Qinling API.
It provides a Python API (the ``qinlingclient`` module) and an openstack
command-line tool.
Project Resources Project Resources
----------------- -----------------
@@ -45,18 +19,10 @@ Project Resources
Project status, bugs, and blueprints are tracked on Launchpad: Project status, bugs, and blueprints are tracked on Launchpad:
* Client bug tracker * Client bug tracker
* https://launchpad.net/python-muranoclient * https://launchpad.net/python-qinlingclient
* Murano bug tracker * Qinling bug tracker
* https://launchpad.net/murano * https://launchpad.net/qinling
Developer documentation can be found here:
http://docs.openstack.org/developer/murano/
Additional resources are linked from the project wiki page:
https://wiki.openstack.org/wiki/Murano
License License
------- -------

View File

@@ -71,7 +71,7 @@ def wrap(string, width=25):
def get_filters(parsed_args): def get_filters(parsed_args):
filters = {} filters = {}
if parsed_args.filters: if hasattr(parsed_args, 'filters') and parsed_args.filters:
for f in parsed_args.filters: for f in parsed_args.filters:
arr = f.split('=') arr = f.split('=')

View File

@@ -0,0 +1,30 @@
# Copyright 2017 Catalyst IT Limited
#
# 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 v1 function action implementation"""
from qinlingclient.osc.v1 import base
class List(base.QinlingLister):
"""List available runtimes."""
def _get_resources(self, parsed_args):
client = self.app.client_manager.function_engine
return client.functions.list(**base.get_filters(parsed_args))
def _list_columns(self):
return ('id', 'name', 'count', 'code', 'runtime_id', 'entry',
'created_at', 'updated_at')

View File

@@ -19,10 +19,12 @@ from qinlingclient.osc.v1 import base
class List(base.QinlingLister): class List(base.QinlingLister):
"""List available runtimes.""" """List available runtimes."""
def _get_resources(self, parsed_args): def _get_resources(self, parsed_args):
client = self.app.client_manager.function_engine client = self.app.client_manager.function_engine
return client.runtimes.list(**base.get_filters(parsed_args)) return client.runtimes.list(**base.get_filters(parsed_args))
def _list_columns(self): def _list_columns(self):
pass return ('id', 'name', 'image', 'status', 'project_id', 'created_at',
'updated_at')

View File

@@ -13,7 +13,8 @@
# limitations under the License. # limitations under the License.
from qinlingclient.common import http from qinlingclient.common import http
from qinlingclient.v1 import runtimes from qinlingclient.v1 import function
from qinlingclient.v1 import runtime
class Client(object): class Client(object):
@@ -29,7 +30,7 @@ class Client(object):
"""Initialize a new client for the Qinling v1 API.""" """Initialize a new client for the Qinling v1 API."""
self.http_client = http._construct_http_client(*args, **kwargs) self.http_client = http._construct_http_client(*args, **kwargs)
self.runtimes = runtimes.RuntimeManager(self.http_client) self.runtimes = runtime.RuntimeManager(self.http_client)
# self.functions = functions.FunctionManager(self.http_client) self.functions = function.FunctionManager(self.http_client)
# self.function_executions = function_executions.ExecutionManager( # self.function_executions = function_executions.ExecutionManager(
# self.http_client) # self.http_client)

View File

@@ -0,0 +1,26 @@
# Copyright 2017 Catalyst IT Limited
#
# 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.
from qinlingclient.common import base
class Function(base.Resource):
pass
class FunctionManager(base.Manager):
resource_class = Function
def list(self, **kwargs):
return self._list("/v1/functions", response_key='functions')

View File

@@ -36,6 +36,8 @@ openstack.cli.extension =
openstack.function_engine.v1 = openstack.function_engine.v1 =
runtime_list = qinlingclient.osc.v1.runtime:List runtime_list = qinlingclient.osc.v1.runtime:List
function_list = qinlingclient.osc.v1.function:List
[global] [global]
setup-hooks = setup-hooks =
pbr.hooks.setup_hook pbr.hooks.setup_hook