diff --git a/README.rst b/README.rst index 02ad034..fdc0582 100644 --- a/README.rst +++ b/README.rst @@ -1,43 +1,17 @@ Qinling ======= -.. image:: https://img.shields.io/pypi/v/python-muranoclient.svg - :target: https://pypi.python.org/pypi/python-muranoclient/ - :alt: Latest Version - -.. image:: https://img.shields.io/pypi/dm/python-muranoclient.svg - :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``). +Qinling is Function as a Service for OpenStack. This project aims to provide a +platform to support serverless functions (like AWS Lambda). Qinling supports +different container orchestration platforms (Kubernetes/Swarm, etc.) and +different function package storage backends (local/Swift/S3) by nature using +plugin mechanism. +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 ----------------- @@ -45,18 +19,10 @@ Project Resources Project status, bugs, and blueprints are tracked on Launchpad: * Client bug tracker - * https://launchpad.net/python-muranoclient + * https://launchpad.net/python-qinlingclient -* Murano bug tracker - * https://launchpad.net/murano - -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 +* Qinling bug tracker + * https://launchpad.net/qinling License ------- diff --git a/qinlingclient/osc/v1/base.py b/qinlingclient/osc/v1/base.py index 9a9255a..c8c07ce 100644 --- a/qinlingclient/osc/v1/base.py +++ b/qinlingclient/osc/v1/base.py @@ -71,7 +71,7 @@ def wrap(string, width=25): def get_filters(parsed_args): filters = {} - if parsed_args.filters: + if hasattr(parsed_args, 'filters') and parsed_args.filters: for f in parsed_args.filters: arr = f.split('=') diff --git a/qinlingclient/osc/v1/function.py b/qinlingclient/osc/v1/function.py index e69de29..b0cc8d6 100644 --- a/qinlingclient/osc/v1/function.py +++ b/qinlingclient/osc/v1/function.py @@ -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') diff --git a/qinlingclient/osc/v1/runtime.py b/qinlingclient/osc/v1/runtime.py index 89bea2e..c911b81 100644 --- a/qinlingclient/osc/v1/runtime.py +++ b/qinlingclient/osc/v1/runtime.py @@ -19,10 +19,12 @@ 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.runtimes.list(**base.get_filters(parsed_args)) def _list_columns(self): - pass + return ('id', 'name', 'image', 'status', 'project_id', 'created_at', + 'updated_at') diff --git a/qinlingclient/v1/client.py b/qinlingclient/v1/client.py index 67f6c8c..4297644 100644 --- a/qinlingclient/v1/client.py +++ b/qinlingclient/v1/client.py @@ -13,7 +13,8 @@ # limitations under the License. from qinlingclient.common import http -from qinlingclient.v1 import runtimes +from qinlingclient.v1 import function +from qinlingclient.v1 import runtime class Client(object): @@ -29,7 +30,7 @@ class Client(object): """Initialize a new client for the Qinling v1 API.""" self.http_client = http._construct_http_client(*args, **kwargs) - self.runtimes = runtimes.RuntimeManager(self.http_client) - # self.functions = functions.FunctionManager(self.http_client) + self.runtimes = runtime.RuntimeManager(self.http_client) + self.functions = function.FunctionManager(self.http_client) # self.function_executions = function_executions.ExecutionManager( # self.http_client) diff --git a/qinlingclient/v1/function.py b/qinlingclient/v1/function.py index e69de29..beb09a4 100644 --- a/qinlingclient/v1/function.py +++ b/qinlingclient/v1/function.py @@ -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') diff --git a/setup.cfg b/setup.cfg index 12be774..e007db9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,6 +36,8 @@ openstack.cli.extension = openstack.function_engine.v1 = runtime_list = qinlingclient.osc.v1.runtime:List + function_list = qinlingclient.osc.v1.function:List + [global] setup-hooks = pbr.hooks.setup_hook