@webob.dec.wsgify
@util.check_accept('application/json')
def list_for_resource_provider(req):
 context = req.environ['placement.context']
 uuid = util.wsgi_path_item(req.environ, 'uuid')
 try:
  resource_provider = objects.ResourceProvider.get_by_uuid(context, uuid)
 except exception.NotFound as exc:
  raise webob.exc.HTTPNotFound((_("Resource provider '%(rp_uuid)s' not found: %(error)s") % {'rp_uuid': uuid, 'error': exc}), json_formatter=util.json_error_formatter)
 allocations = objects.AllocationList.get_all_by_resource_provider_uuid(context, uuid)
 allocations_json = jsonutils.dumps(_serialize_allocations_for_resource_provider(allocations, resource_provider))
 req.response.status = 200
 req.response.body = encodeutils.to_utf8(allocations_json)
 req.response.content_type = 'application/json'
 return req.response

@ webob . dec . wsgify @ util . check_accept ( 'application/json' ) def list_for_resource_provider ( req ) : context = req . environ [ 'placement.context' ] uuid = util . wsgi_path_item ( req . environ , 'uuid' ) try : resource_provider = objects . ResourceProvider . get_by_uuid ( context , uuid ) except exception . NotFound as exc : raise webob . exc . HTTPNotFound ( ( _ ( "Resource provider '%(rp_uuid)s' not found: %(error)s" ) % { 'rp_uuid' : uuid , 'error' : exc } ) , json_formatter = util . json_error_formatter ) allocations = objects . AllocationList . get_all_by_resource_provider_uuid ( context , uuid ) allocations_json = jsonutils . dumps ( _serialize_allocations_for_resource_provider ( allocations , resource_provider ) ) req . response . status = 200 req . response . body = encodeutils . to_utf8 ( allocations_json ) req . response . content_type = 'application/json' return req . response
list allocations associated with a resource provider .