Exemplo n.º 1
0
    def ips(self, req, id):
        try:
            instance = self.compute_api.get(req.environ['nova.context'], id)
        except exception.NotFound:
            return faults.Fault(exc.HTTPNotFound())

        builder = addresses_views.get_view_builder(req)
        return builder.build(instance)
Exemplo n.º 2
0
    def ips(self, req, id):
        try:
            instance = self.compute_api.get(req.environ['nova.context'], id)
        except exception.NotFound:
            return faults.Fault(exc.HTTPNotFound())

        builder = addresses_views.get_view_builder(req)
        return builder.build(instance)
Exemplo n.º 3
0
def get_view_builder(req):
    '''
    A factory method that returns the correct builder based on the version of
    the api requested.
    '''
    version = common.get_api_version(req)
    addresses_builder = addresses_view.get_view_builder(req)
    if version == '1.1':
        flavor_builder = flavors_view.get_view_builder(req)
        image_builder = images_view.get_view_builder(req)
        return ViewBuilder_1_1(addresses_builder, flavor_builder,
                               image_builder)
    else:
        return ViewBuilder_1_0(addresses_builder)
Exemplo n.º 4
0
def get_view_builder(req):
    '''
    A factory method that returns the correct builder based on the version of
    the api requested.
    '''
    version = common.get_api_version(req)
    addresses_builder = addresses_view.get_view_builder(req)
    if version == '1.1':
        flavor_builder = flavors_view.get_view_builder(req)
        image_builder = images_view.get_view_builder(req)
        return ViewBuilder_1_1(addresses_builder, flavor_builder,
                               image_builder)
    else:
        return ViewBuilder_1_0(addresses_builder)