# Path: watcher_dashboard/api/watcher.py
# LOG = logging.getLogger(__name__)
# WATCHER_SERVICE = 'infra-optim'
# def watcherclient(request, password=None):
# def insert_watcher_policy_file():
#     def __init__(self, apiresource, request=None):
#     def create(cls, request, audit_template_uuid, audit_type, name=None,
#                auto_trigger=False, interval=None):
#     def list(cls, request, **filters):
#     def get(cls, request, audit_id):
#     def delete(cls, request, audit_id):
#     def id(self):
#     def __init__(self, apiresource, request=None):
#     def create(cls, request, name, goal, strategy,
#                description, scope):
#     def patch(cls, request, audit_template_id, parameters):
#     def list(cls, request, **filters):
#     def get(cls, request, audit_template_id):
#     def delete(cls, request, audit_template_id):
#     def id(self):
#     def __init__(self, apiresource, request=None):
#     def list(cls, request, **filters):
#     def get(cls, request, action_plan_id):
#     def delete(cls, request, action_plan_id):
#     def start(cls, request, action_plan_id):
#     def id(self):
#     def __init__(self, apiresource, request=None):
#     def list(cls, request, **filters):
#     def get(cls, request, action_id):
#     def delete(cls, request, action_id):
#     def start(cls, request, action_id):
#     def id(self):
#     def __init__(self, apiresource, request=None):
#     def list(cls, request, **filters):
#     def get(cls, request, goal):
#     def id(self):
#     def __init__(self, apiresource, request=None):
#     def list(cls, request, **filters):
#     def get(cls, request, strategy):
#     def id(self):
#     def __init__(self, indicator):
# class Audit(base.APIDictWrapper):
# class AuditTemplate(base.APIDictWrapper):
# class ActionPlan(base.APIDictWrapper):
# class Action(base.APIDictWrapper):
# class Goal(base.APIDictWrapper):
# class Strategy(base.APIDictWrapper):
# class EfficacyIndicatorSpec(base.APIDictWrapper):
# class EfficacyIndicator(base.APIDictWrapper):
# 
# Path: watcher_dashboard/content/audit_templates/forms.py
# LOG = logging.getLogger(__name__)
# class YamlValidator(object):
# class CreateForm(forms.SelfHandlingForm):
#     def __init__(self, message=None):
#     def __call__(self, value):
#     def __init__(self, request, *args, **kwargs):
#     def _get_goal_list(self, request):
#     def _get_strategy_list(self, request, goals):
#     def handle(self, request, data):
# 
# Path: watcher_dashboard/content/audit_templates/tables.py
# class CreateAuditTemplates(horizon.tables.LinkAction):
# class AuditTemplatesFilterAction(horizon.tables.FilterAction):
# class LaunchAudit(horizon.tables.BatchAction):
# class ArchiveAuditTemplates(horizon.tables.DeleteAction):
# class AuditTemplatesTable(horizon.tables.DataTable):
#     class Meta(object):
#     def action_present(count):
#     def action_past(count):
#     def action(self, request, obj_id):
#     def action_present(count):
#     def action_past(count):
#     def delete(self, request, obj_id):
#     def get_object_id(self, datum):
# 
# Path: watcher_dashboard/content/audit_templates/tabs.py
# class OverviewTab(tabs.Tab):
# class AuditTemplateDetailTabs(tabs.TabGroup):
#     def get_context_data(self, request):


import json
import logging
import horizon.exceptions
import horizon.tables
import horizon.tabs
import horizon.workflows
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import forms
from watcher_dashboard.api import watcher
from watcher_dashboard.content.audit_templates import forms as wforms
from watcher_dashboard.content.audit_templates import tables
from watcher_dashboard.content.audit_templates import tabs as wtabs
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.




LOG = logging.getLogger(__name__)


class IndexView(horizon.tables.DataTableView):
    table_class = tables.AuditTemplatesTable
    template_name = 'infra_optim/audit_templates/index.html'
    page_title = _("Audit Templates")

    def get_context_data(self, **kwargs):
        context = super(IndexView, self).get_context_data(**kwargs)
        context['audit_templates_count'] = self.get_count()
        return context

    def get_data(self):
        audit_templates = []
        search_opts = self.get_filters()
        try:
            audit_templates = watcher.AuditTemplate.list(
                self.request, **search_opts)
        except Exception as exc:
            LOG.exception(exc)
            horizon.exceptions.handle(
                self.request,

# Path: watcher_dashboard/api/watcher.py
# LOG = logging.getLogger(__name__)
# WATCHER_SERVICE = 'infra-optim'
# def watcherclient(request, password=None):
# def insert_watcher_policy_file():
#     def __init__(self, apiresource, request=None):
#     def create(cls, request, audit_template_uuid, audit_type, name=None,
#                auto_trigger=False, interval=None):
#     def list(cls, request, **filters):
#     def get(cls, request, audit_id):
#     def delete(cls, request, audit_id):
#     def id(self):
#     def __init__(self, apiresource, request=None):
#     def create(cls, request, name, goal, strategy,
#                description, scope):
#     def patch(cls, request, audit_template_id, parameters):
#     def list(cls, request, **filters):
#     def get(cls, request, audit_template_id):
#     def delete(cls, request, audit_template_id):
#     def id(self):
#     def __init__(self, apiresource, request=None):
#     def list(cls, request, **filters):
#     def get(cls, request, action_plan_id):
#     def delete(cls, request, action_plan_id):
#     def start(cls, request, action_plan_id):
#     def id(self):
#     def __init__(self, apiresource, request=None):
#     def list(cls, request, **filters):
#     def get(cls, request, action_id):
#     def delete(cls, request, action_id):
#     def start(cls, request, action_id):
#     def id(self):
#     def __init__(self, apiresource, request=None):
#     def list(cls, request, **filters):
#     def get(cls, request, goal):
#     def id(self):
#     def __init__(self, apiresource, request=None):
#     def list(cls, request, **filters):
#     def get(cls, request, strategy):
#     def id(self):
#     def __init__(self, indicator):
# class Audit(base.APIDictWrapper):
# class AuditTemplate(base.APIDictWrapper):
# class ActionPlan(base.APIDictWrapper):
# class Action(base.APIDictWrapper):
# class Goal(base.APIDictWrapper):
# class Strategy(base.APIDictWrapper):
# class EfficacyIndicatorSpec(base.APIDictWrapper):
# class EfficacyIndicator(base.APIDictWrapper):
# 
# Path: watcher_dashboard/content/audit_templates/forms.py
# LOG = logging.getLogger(__name__)
# class YamlValidator(object):
# class CreateForm(forms.SelfHandlingForm):
#     def __init__(self, message=None):
#     def __call__(self, value):
#     def __init__(self, request, *args, **kwargs):
#     def _get_goal_list(self, request):
#     def _get_strategy_list(self, request, goals):
#     def handle(self, request, data):
# 
# Path: watcher_dashboard/content/audit_templates/tables.py
# class CreateAuditTemplates(horizon.tables.LinkAction):
# class AuditTemplatesFilterAction(horizon.tables.FilterAction):
# class LaunchAudit(horizon.tables.BatchAction):
# class ArchiveAuditTemplates(horizon.tables.DeleteAction):
# class AuditTemplatesTable(horizon.tables.DataTable):
#     class Meta(object):
#     def action_present(count):
#     def action_past(count):
#     def action(self, request, obj_id):
#     def action_present(count):
#     def action_past(count):
#     def delete(self, request, obj_id):
#     def get_object_id(self, datum):
# 
# Path: watcher_dashboard/content/audit_templates/tabs.py
# class OverviewTab(tabs.Tab):
# class AuditTemplateDetailTabs(tabs.TabGroup):
#     def get_context_data(self, request):


# Path: watcher_dashboard/content/audit_templates/views.py
import json
import logging
import horizon.exceptions
import horizon.tables
import horizon.tabs
import horizon.workflows
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import forms
from watcher_dashboard.api import watcher
from watcher_dashboard.content.audit_templates import forms as wforms
from watcher_dashboard.content.audit_templates import tables
from watcher_dashboard.content.audit_templates import tabs as wtabs

# implied.
# See the License for the specific language governing permissions and
# limitations under the License.




LOG = logging.getLogger(__name__)


class IndexView(horizon.tables.DataTableView):
    table_class = tables.AuditTemplatesTable
    template_name = 'infra_optim/audit_templates/index.html'
    page_title = _("Audit Templates")

    def get_context_data(self, **kwargs):
        context = super(IndexView, self).get_context_data(**kwargs)
        context['audit_templates_count'] = self.get_count()
        return context

    def get_data(self):
        audit_templates = []
        search_opts = self.get_filters()
        try:
            audit_templates = watcher.AuditTemplate.list(
                self.request, **search_opts)
        except Exception as exc:
            LOG.exception(exc)
            horizon.exceptions.handle(
                self.request,

                _("Unable to retrieve audit template information."))