Add a rest endpoint to retreive system information
The only information retreived in this change is the storyboard version. Keeping the object broad so additional info can piggy back down the road. Change-Id: I86a2bbdc367b9abb179937d74f4aa5ed937b077e
This commit is contained in:
parent
77e9949eeb
commit
35bc126876
@ -42,6 +42,10 @@ Users
|
|||||||
.. rest-controller:: storyboard.api.v1.users:UsersController
|
.. rest-controller:: storyboard.api.v1.users:UsersController
|
||||||
:webprefix: /v1/users
|
:webprefix: /v1/users
|
||||||
|
|
||||||
|
System Info
|
||||||
|
===========
|
||||||
|
.. rest-controller:: storyboard.api.v1.system_info:SystemInfoController
|
||||||
|
:webprefix: /v1/systeminfo
|
||||||
|
|
||||||
############
|
############
|
||||||
Object model
|
Object model
|
||||||
@ -81,3 +85,8 @@ User
|
|||||||
====
|
====
|
||||||
.. autotype:: storyboard.api.v1.users.User
|
.. autotype:: storyboard.api.v1.users.User
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
SystemInfo
|
||||||
|
==========
|
||||||
|
.. autotype:: storyboard.api.v1.system_info.SystemInfo
|
||||||
|
:members:
|
||||||
|
40
storyboard/api/v1/system_info.py
Normal file
40
storyboard/api/v1/system_info.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# 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 oslo.config import cfg
|
||||||
|
from pbr.version import VersionInfo
|
||||||
|
from pecan import rest
|
||||||
|
from pecan.secure import secure
|
||||||
|
from storyboard.api.auth import authorization_checks as checks
|
||||||
|
from storyboard.api.v1 import wmodels
|
||||||
|
import wsmeext.pecan as wsme_pecan
|
||||||
|
|
||||||
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
|
||||||
|
class SystemInfoController(rest.RestController):
|
||||||
|
"""REST controller for sysinfo endpoint.
|
||||||
|
|
||||||
|
Provides Get methods for System information.
|
||||||
|
"""
|
||||||
|
|
||||||
|
@secure(checks.guest)
|
||||||
|
@wsme_pecan.wsexpose(wmodels.SystemInfo)
|
||||||
|
def get(self):
|
||||||
|
"""Retrieve the Storyboard system information.
|
||||||
|
"""
|
||||||
|
sb_ver = VersionInfo('storyboard')
|
||||||
|
|
||||||
|
return wmodels.SystemInfo(version=sb_ver.version_string())
|
@ -19,6 +19,7 @@ from storyboard.api.v1.projects import ProjectsController
|
|||||||
from storyboard.api.v1.stories import StoriesController
|
from storyboard.api.v1.stories import StoriesController
|
||||||
from storyboard.api.v1.subscription_events import SubscriptionEventsController
|
from storyboard.api.v1.subscription_events import SubscriptionEventsController
|
||||||
from storyboard.api.v1.subscriptions import SubscriptionsController
|
from storyboard.api.v1.subscriptions import SubscriptionsController
|
||||||
|
from storyboard.api.v1.system_info import SystemInfoController
|
||||||
from storyboard.api.v1.tasks import TasksController
|
from storyboard.api.v1.tasks import TasksController
|
||||||
from storyboard.api.v1.teams import TeamsController
|
from storyboard.api.v1.teams import TeamsController
|
||||||
from storyboard.api.v1.users import UsersController
|
from storyboard.api.v1.users import UsersController
|
||||||
@ -34,5 +35,6 @@ class V1Controller(object):
|
|||||||
tasks = TasksController()
|
tasks = TasksController()
|
||||||
subscriptions = SubscriptionsController()
|
subscriptions = SubscriptionsController()
|
||||||
subscription_events = SubscriptionEventsController()
|
subscription_events = SubscriptionEventsController()
|
||||||
|
systeminfo = SystemInfoController()
|
||||||
|
|
||||||
openid = AuthController()
|
openid = AuthController()
|
||||||
|
@ -36,6 +36,19 @@ class Comment(base.APIBase):
|
|||||||
"""Is this an active comment, or has it been deleted?"""
|
"""Is this an active comment, or has it been deleted?"""
|
||||||
|
|
||||||
|
|
||||||
|
class SystemInfo(base.APIBase):
|
||||||
|
"""Represents the system information for Storyboard
|
||||||
|
"""
|
||||||
|
|
||||||
|
version = wtypes.text
|
||||||
|
"""The application version."""
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def sample(cls):
|
||||||
|
return cls(
|
||||||
|
version="338c2d6")
|
||||||
|
|
||||||
|
|
||||||
class Project(base.APIBase):
|
class Project(base.APIBase):
|
||||||
"""The Storyboard Registry describes the open source world as ProjectGroups
|
"""The Storyboard Registry describes the open source world as ProjectGroups
|
||||||
and Projects. Each ProjectGroup may be responsible for several Projects.
|
and Projects. Each ProjectGroup may be responsible for several Projects.
|
||||||
|
Loading…
Reference in New Issue
Block a user