# 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())

# 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.

        Example::

          curl https://my.example.org/api/v1/systeminfo

        """
        sb_ver = VersionInfo('storyboard')

        return wmodels.SystemInfo(version=sb_ver.version_string())

Add example commands for the Systeminfo api
Add example commands for the Systeminfo api

Currently the api documentation does not include example commands.
It would be very friendly for our users to have some example commands
to follow and use the api.

This patch adds examples to the Systeminfo section of the api documentation.

Change-Id: Ic3d56d207db696100754a5a1fd5764f2f3f0a7f3
