Beispiel #1
0
 def __init__(self):
     super(RootController, self).__init__()
     self._versions = []
     v1_enabled = CONF.api_settings.api_v1_enabled
     v2_enabled = CONF.api_settings.api_v2_enabled
     if v1_enabled:
         self.v1 = v1_controller.V1Controller()
         self._versions.append(
             {
                 'status': 'SUPPORTED',
                 'updated': '2014-12-11T00:00:00Z',
                 'id': 'v1'
             })
     if v2_enabled:
         setattr(self, 'v2.0', v2_controller.V2Controller())
         self._versions.append(
             {
                 'status': 'CURRENT',
                 'updated': '2018-03-14T00:00:00Z',
                 'id': 'v2.0'
             })
     if not (v1_enabled or v2_enabled):
         LOG.warning("Both v1 and v2.0 API endpoints are disabled -- is "
                     "this intentional?")
     elif v1_enabled and v2_enabled:
         LOG.warning("Both v1 and v2.0 API endpoints are enabled -- it is "
                     "a security risk to expose the v1 endpoint publicly,"
                     "so please make sure access to it is secured.")
class RootController(rest.RestController):
    """The controller in which the pecan wsgi app should be created with."""
    v1 = v1_controller.V1Controller()

    @wsme_pecan.wsexpose(wtypes.text)
    def get(self):
        # TODO(blogan): once a decision is made on how to do versions, do that
        # here
        return {'versions': [{'status': 'CURRENT',
                              'updated': '2014-12-11T00:00:00Z',
                              'id': 'v1'},
                             {'status': 'EXPERIMENTAL',
                              'updated': '2016-12-11T00:00:00Z',
                              'id': 'v2.0'}
                             ]}
Beispiel #3
0
 def __init__(self):
     super(RootController, self).__init__()
     v1_enabled = CONF.api_settings.api_v1_enabled
     v2_enabled = CONF.api_settings.api_v2_enabled
     if v1_enabled:
         self.v1 = v1_controller.V1Controller()
     if v2_enabled:
         setattr(self, 'v2.0', v2_controller.V2Controller())
         setattr(self, 'v2', v2_controller.V2Controller())
     if not (v1_enabled or v2_enabled):
         LOG.warning("Both v1 and v2 API endpoints are disabled -- is "
                     "this intentional?")
     elif v1_enabled and v2_enabled:
         LOG.warning("Both v1 and v2 API endpoints are enabled -- it is "
                     "a security risk to expose the v1 endpoint publicly,"
                     "so please make sure access to it is secured.")
Beispiel #4
0
 def __init__(self):
     super(RootController, self).__init__()
     self.v1 = v1_controller.V1Controller()
     setattr(self, 'v2.0', v2_controller.V2Controller())