Example #1
0
 def post(self, evts):
     if not api_utils.allow_expose_events():
         raise exception.NotFound()
     cdict = pecan.request.context.to_policy_values()
     policy.authorize('baremetal:events:post', cdict, cdict)
     for e in evts.events:
         LOG.debug("Received external event: %s", e)
Example #2
0
 def convert():
     v1 = V1()
     v1.id = "v1"
     v1.links = [link.Link.make_link('self', pecan.request.public_url,
                                     'v1', '', bookmark=True),
                 link.Link.make_link('describedby',
                                     'https://docs.openstack.org',
                                     '/ironic/latest/contributor/',
                                     'webapi.html',
                                     bookmark=True, type='text/html')
                 ]
     v1.media_types = [MediaType('application/json',
                       'application/vnd.openstack.ironic.v1+json')]
     v1.chassis = [link.Link.make_link('self', pecan.request.public_url,
                                       'chassis', ''),
                   link.Link.make_link('bookmark',
                                       pecan.request.public_url,
                                       'chassis', '',
                                       bookmark=True)
                   ]
     v1.nodes = [link.Link.make_link('self', pecan.request.public_url,
                                     'nodes', ''),
                 link.Link.make_link('bookmark',
                                     pecan.request.public_url,
                                     'nodes', '',
                                     bookmark=True)
                 ]
     v1.ports = [link.Link.make_link('self', pecan.request.public_url,
                                     'ports', ''),
                 link.Link.make_link('bookmark',
                                     pecan.request.public_url,
                                     'ports', '',
                                     bookmark=True)
                 ]
     if utils.allow_portgroups():
         v1.portgroups = [
             link.Link.make_link('self', pecan.request.public_url,
                                 'portgroups', ''),
             link.Link.make_link('bookmark', pecan.request.public_url,
                                 'portgroups', '', bookmark=True)
         ]
     v1.drivers = [link.Link.make_link('self', pecan.request.public_url,
                                       'drivers', ''),
                   link.Link.make_link('bookmark',
                                       pecan.request.public_url,
                                       'drivers', '',
                                       bookmark=True)
                   ]
     if utils.allow_volume():
         v1.volume = [
             link.Link.make_link('self',
                                 pecan.request.public_url,
                                 'volume', ''),
             link.Link.make_link('bookmark',
                                 pecan.request.public_url,
                                 'volume', '',
                                 bookmark=True)
         ]
     if utils.allow_ramdisk_endpoints():
         v1.lookup = [link.Link.make_link('self', pecan.request.public_url,
                                          'lookup', ''),
                      link.Link.make_link('bookmark',
                                          pecan.request.public_url,
                                          'lookup', '',
                                          bookmark=True)
                      ]
         v1.heartbeat = [link.Link.make_link('self',
                                             pecan.request.public_url,
                                             'heartbeat', ''),
                         link.Link.make_link('bookmark',
                                             pecan.request.public_url,
                                             'heartbeat', '',
                                             bookmark=True)
                         ]
     if utils.allow_expose_conductors():
         v1.conductors = [link.Link.make_link('self',
                                              pecan.request.public_url,
                                              'conductors', ''),
                          link.Link.make_link('bookmark',
                                              pecan.request.public_url,
                                              'conductors', '',
                                              bookmark=True)
                          ]
     if utils.allow_allocations():
         v1.allocations = [link.Link.make_link('self',
                                               pecan.request.public_url,
                                               'allocations', ''),
                           link.Link.make_link('bookmark',
                                               pecan.request.public_url,
                                               'allocations', '',
                                               bookmark=True)
                           ]
     if utils.allow_expose_events():
         v1.events = [link.Link.make_link('self', pecan.request.public_url,
                                          'events', ''),
                      link.Link.make_link('bookmark',
                                          pecan.request.public_url,
                                          'events', '',
                                          bookmark=True)
                      ]
     if utils.allow_deploy_templates():
         v1.deploy_templates = [
             link.Link.make_link('self',
                                 pecan.request.public_url,
                                 'deploy_templates', ''),
             link.Link.make_link('bookmark',
                                 pecan.request.public_url,
                                 'deploy_templates', '',
                                 bookmark=True)
         ]
     v1.version = version.default_version()
     return v1
Example #3
0
def v1():
    v1 = {
        'id':
        "v1",
        'links': [
            link.make_link('self',
                           api.request.public_url,
                           'v1',
                           '',
                           bookmark=True),
            link.make_link('describedby',
                           'https://docs.openstack.org',
                           '/ironic/latest/contributor/',
                           'webapi.html',
                           bookmark=True,
                           type='text/html')
        ],
        'media_types': {
            'base': 'application/json',
            'type': 'application/vnd.openstack.ironic.v1+json'
        },
        'chassis': [
            link.make_link('self', api.request.public_url, 'chassis', ''),
            link.make_link('bookmark',
                           api.request.public_url,
                           'chassis',
                           '',
                           bookmark=True)
        ],
        'nodes': [
            link.make_link('self', api.request.public_url, 'nodes', ''),
            link.make_link('bookmark',
                           api.request.public_url,
                           'nodes',
                           '',
                           bookmark=True)
        ],
        'ports': [
            link.make_link('self', api.request.public_url, 'ports', ''),
            link.make_link('bookmark',
                           api.request.public_url,
                           'ports',
                           '',
                           bookmark=True)
        ],
        'drivers': [
            link.make_link('self', api.request.public_url, 'drivers', ''),
            link.make_link('bookmark',
                           api.request.public_url,
                           'drivers',
                           '',
                           bookmark=True)
        ],
        'version':
        version.default_version()
    }
    if utils.allow_portgroups():
        v1['portgroups'] = [
            link.make_link('self', api.request.public_url, 'portgroups', ''),
            link.make_link('bookmark',
                           api.request.public_url,
                           'portgroups',
                           '',
                           bookmark=True)
        ]
    if utils.allow_volume():
        v1['volume'] = [
            link.make_link('self', api.request.public_url, 'volume', ''),
            link.make_link('bookmark',
                           api.request.public_url,
                           'volume',
                           '',
                           bookmark=True)
        ]
    if utils.allow_ramdisk_endpoints():
        v1['lookup'] = [
            link.make_link('self', api.request.public_url, 'lookup', ''),
            link.make_link('bookmark',
                           api.request.public_url,
                           'lookup',
                           '',
                           bookmark=True)
        ]
        v1['heartbeat'] = [
            link.make_link('self', api.request.public_url, 'heartbeat', ''),
            link.make_link('bookmark',
                           api.request.public_url,
                           'heartbeat',
                           '',
                           bookmark=True)
        ]
    if utils.allow_expose_conductors():
        v1['conductors'] = [
            link.make_link('self', api.request.public_url, 'conductors', ''),
            link.make_link('bookmark',
                           api.request.public_url,
                           'conductors',
                           '',
                           bookmark=True)
        ]
    if utils.allow_allocations():
        v1['allocations'] = [
            link.make_link('self', api.request.public_url, 'allocations', ''),
            link.make_link('bookmark',
                           api.request.public_url,
                           'allocations',
                           '',
                           bookmark=True)
        ]
    if utils.allow_expose_events():
        v1['events'] = [
            link.make_link('self', api.request.public_url, 'events', ''),
            link.make_link('bookmark',
                           api.request.public_url,
                           'events',
                           '',
                           bookmark=True)
        ]
    if utils.allow_deploy_templates():
        v1['deploy_templates'] = [
            link.make_link('self', api.request.public_url, 'deploy_templates',
                           ''),
            link.make_link('bookmark',
                           api.request.public_url,
                           'deploy_templates',
                           '',
                           bookmark=True)
        ]
    return v1
Example #4
0
 def _lookup(self):
     if not api_utils.allow_expose_events():
         pecan.abort(http_client.NOT_FOUND)
Example #5
0
 def post(self, evts):
     if not api_utils.allow_expose_events():
         raise exception.NotFound()
     api_utils.check_policy('baremetal:events:post')
     for e in evts['events']:
         LOG.debug("Received external event: %s", e)