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


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

  
  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
## Code Before:

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

## Instruction:
Add example commands for the Systeminfo api
## Code After:

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