diff --git a/heat/engine/api/__init__.py b/heat/engine/api/__init__.py deleted file mode 100644 index 85ff39c36d..0000000000 --- a/heat/engine/api/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# -# 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. - diff --git a/heat/engine/api/v1/__init__.py b/heat/engine/api/v1/__init__.py deleted file mode 100644 index 170f7af8b4..0000000000 --- a/heat/engine/api/v1/__init__.py +++ /dev/null @@ -1,38 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# -# 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. - -import routes - -from heat.common import wsgi -from heat.engine.api.v1 import stacks -from heat.engine.api.v1 import events - -class API(wsgi.Router): - """WSGI entry point for all stac requests.""" - - def __init__(self, conf, **local_conf): - mapper = routes.Mapper() - - stacks_resource = stacks.create_resource(conf) - mapper.resource("stack", "stacks", controller=stacks_resource, - collection={'detail': 'GET'}) - mapper.connect("/", controller=stacks_resource, action="index") - - events_resource = events.create_resource(conf) - mapper.resource("event", "events", controller=events_resource, - parent_resource=dict(member_name='stack', - collection_name='stacks')) - - super(API, self).__init__(mapper) diff --git a/heat/engine/api/v1/events.py b/heat/engine/api/v1/events.py deleted file mode 100644 index 941fa744ff..0000000000 --- a/heat/engine/api/v1/events.py +++ /dev/null @@ -1,52 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# -# 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. - -""" -Implementation of the stacks server WSGI controller. -""" -import json -import logging - -import webob -from webob.exc import (HTTPNotFound, - HTTPConflict, - HTTPBadRequest) - -from heat.common import exception -from heat.common import wsgi - -from heat.engine import parser -from heat.engine import simpledb - -logger = logging.getLogger('heat.engine.api.v1.events') - - -class EventsController(object): - ''' - The controller for the events child "resource" - stacks/events - ''' - - def __init__(self, conf): - self.conf = conf - - def index(self, req, stack_id): - return simpledb.events_get(stack_id) - -def create_resource(conf): - """Events resource factory method.""" - deserializer = wsgi.JSONRequestDeserializer() - serializer = wsgi.JSONResponseSerializer() - return wsgi.Resource(EventsController(conf), deserializer, serializer) diff --git a/heat/engine/api/v1/stacks.py b/heat/engine/api/v1/stacks.py deleted file mode 100644 index 698435f790..0000000000 --- a/heat/engine/api/v1/stacks.py +++ /dev/null @@ -1,115 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# -# 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. - -""" -Reference implementation stacks server WSGI controller -""" -import json -import logging - -import webob -from webob.exc import (HTTPNotFound, - HTTPConflict, - HTTPBadRequest) - -from heat.common import exception -from heat.common import wsgi - -from heat.engine import parser - - -logger = logging.getLogger('heat.engine.api.v1.stacks') - -stack_db = {} - -class StacksController(object): - ''' - bla - ''' - - def __init__(self, conf): - self.conf = conf - - def index(self, req, format='json'): - logger.info('format is %s' % format) - res = {'stacks': [] } - for s in stack_db: - mem = {} - mem['StackId'] = stack_db[s]['StackId'] - mem['StackName'] = s - mem['CreationTime'] = 'now' - try: - mem['TemplateDescription'] = stack_db[s]['Description'] - mem['StackStatus'] = stack_db[s]['StackStatus'] - except: - mem['TemplateDescription'] = 'No description' - mem['StackStatus'] = 'unknown' - res['stacks'].append(mem) - - return res - - def show(self, req, id): - res = {'stacks': [] } - if stack_db.has_key(id): - mem = {} - mem['StackId'] = stack_db[id]['StackId'] - mem['StackName'] = id - mem['CreationTime'] = 'TODO' - mem['LastUpdatedTime'] = 'TODO' - mem['NotificationARNs'] = 'TODO' - mem['Outputs'] = [{'Description': 'TODO', 'OutputKey': 'TODO', 'OutputValue': 'TODO' }] - mem['Parameters'] = stack_db[id]['Parameters'] - mem['StackStatusReason'] = 'TODO' - mem['TimeoutInMinutes'] = 'TODO' - try: - mem['TemplateDescription'] = stack_db[id]['Description'] - mem['StackStatus'] = stack_db[id]['StackStatus'] - except: - mem['TemplateDescription'] = 'No description' - mem['StackStatus'] = 'unknown' - res['stacks'].append(mem) - else: - return webob.exc.HTTPNotFound('No stack by that name') - - return res - - def create(self, req, body=None): - - if body is None: - msg = _("No Template provided.") - return webob.exc.HTTPBadRequest(explanation=msg) - - if stack_db.has_key(body['StackName']): - msg = _("Stack already exists with that name.") - return webob.exc.HTTPConflict(msg) - - stack_db[body['StackName']] = parser.Stack(body['StackName'], body) - stack_db[body['StackName']].start() - - return {'stack': {'id': body['StackName']}} - - def delete(self, req, id): - if not stack_db.has_key(id): - return webob.exc.HTTPNotFound('No stack by that name') - - logger.info('deleting stack %s' % id) - del stack_db[id] - return None - -def create_resource(conf): - """Stacks resource factory method.""" - deserializer = wsgi.JSONRequestDeserializer() - serializer = wsgi.JSONResponseSerializer() - return wsgi.Resource(StacksController(conf), deserializer, serializer)