'Deletes an existing agent build.'

@extensions.expected_errors((400, 404))
@wsgi.response(200)
def delete(self, req, id):

    context = req.environ['nova.context']
    context.can(agents_policies.BASE_POLICY_NAME)
    try:
        utils.validate_integer(id, 'id')
    except exception.InvalidInput as exc:
        raise webob.exc.HTTPBadRequest(explanation=exc.format_message())
    try:
        agent = objects.Agent(context=context, id=id)
        agent.destroy()
    except exception.AgentBuildNotFound as ex:
        raise webob.exc.HTTPNotFound(explanation=ex.format_message())
