Files
trove/reddwarf/extensions/mysql/service.py
Michael Basnight 0af6afb76f Adding list_users for mysql users
* Added MVC for mysql users
* Hooked up the MVC to the guest
* Fixed a dual import bug in dbaas.py
2012-03-26 17:14:41 -05:00

51 lines
1.6 KiB
Python

# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# 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 logging
from reddwarf.common import context as rd_context
from reddwarf.common import wsgi
from reddwarf.extensions.mysql import models
from reddwarf.extensions.mysql import views
LOG = logging.getLogger(__name__)
class BaseController(wsgi.Controller):
"""Base controller class."""
class UserController(BaseController):
"""Controller for instance functionality"""
def index(self, req, tenant_id, instance_id):
"""Return all users."""
context = rd_context.ReddwarfContext(
auth_tok=req.headers["X-Auth-Token"],
tenant=tenant_id)
users = models.Users.load(context, instance_id)
# Not exactly sure why we cant return a wsgi.Result() here
return views.UsersView(users).data()
class SchemaController(BaseController):
"""Controller for instance functionality"""
def index(self, req, tenant_id):
"""Return all schemas."""
return "Schema list"