def show(self, req, id):
     context = req.environ['nova.context']
     authorize(context)
     try:
         if '.' in id:
             before_date = datetime.datetime.strptime(
                 str(id), "%Y-%m-%d %H:%M:%S.%f")
         else:
             before_date = datetime.datetime.strptime(
                 str(id), "%Y-%m-%d %H:%M:%S")
     except ValueError:
         msg = _("Invalid timestamp for date %s") % id
         raise webob.exc.HTTPBadRequest(explanation=msg)
     task_log = compute_utils.get_audit_task_logs(context,
                                                  before=before_date)
     return {'instance_usage_audit_log': task_log}
 def show(self, req, id):
     context = req.environ['nova.context']
     authorize(context)
     try:
         if '.' in id:
             before_date = datetime.datetime.strptime(str(id),
                                             "%Y-%m-%d %H:%M:%S.%f")
         else:
             before_date = datetime.datetime.strptime(str(id),
                                             "%Y-%m-%d %H:%M:%S")
     except ValueError:
         msg = _("Invalid timestamp for date %s") % id
         raise webob.exc.HTTPBadRequest(explanation=msg)
     task_log = compute_utils.get_audit_task_logs(context,
                                                  before=before_date)
     return {'instance_usage_audit_log': task_log}
 def index(self, req):
     context = req.environ['nova.context']
     authorize(context)
     task_log = compute_utils.get_audit_task_logs(context)
     return {'instance_usage_audit_logs': task_log}
 def index(self, req):
     context = req.environ['nova.context']
     authorize(context)
     task_log = compute_utils.get_audit_task_logs(context)
     return {'instance_usage_audit_logs': task_log}