예제 #1
0
 def convert():
     root = Root()
     root.name = "OpenStack Ironic API"
     root.description = ("Ironic is an OpenStack project which aims to "
                         "provision baremetal machines.")
     root.default_version = version.default_version()
     root.versions = [root.default_version]
     return root
예제 #2
0
파일: root.py 프로젝트: younkun/ironic
def root():
    return {
        'name': "OpenStack Ironic API",
        'description': ("Ironic is an OpenStack project which aims to "
                        "provision baremetal machines."),
        'default_version': version.default_version(),
        'versions': version.all_versions()
    }
예제 #3
0
 def convert():
     root = Root()
     root.name = "OpenStack Ironic API"
     root.description = ("Ironic is an OpenStack project which aims to "
                         "provision baremetal machines.")
     root.default_version = version.default_version()
     root.versions = [root.default_version]
     return root
예제 #4
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
예제 #5
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