# Path: magnum_ui/api/heat.py
# LOG = logging.getLogger(__name__)
# def heatclient(request, password=None):
# def format_parameters(params):
# def stack_get(request, stack_id):
# 
# Path: magnum_ui/api/magnum.py
# LOG = logging.getLogger(__name__)
# CLUSTER_TEMPLATE_CREATE_ATTRS = cluster_templates.CREATION_ATTRIBUTES
# CLUSTER_CREATE_ATTRS = clusters.CREATION_ATTRIBUTES
# CERTIFICATE_CREATE_ATTRS = certificates.CREATION_ATTRIBUTES
# QUOTA_CREATION_ATTRIBUTES = quotas.CREATION_ATTRIBUTES
# CLUSTER_UPDATE_ALLOWED_PROPERTIES = set(['/node_count'])
# DEFAULT_API_VERSION = '1.10'
# def _cleanup_params(attrs, create, **params):
# def _create_patches(old, new):
# def magnumclient(request):
# def cluster_template_create(request, **kwargs):
# def cluster_template_update(request, id, **kwargs):
# def cluster_template_delete(request, id):
# def cluster_template_list(request, limit=None, marker=None, sort_key=None,
#                           sort_dir=None, detail=True):
# def cluster_template_show(request, id):
# def cluster_create(request, **kwargs):
# def cluster_update(request, id, **kwargs):
# def cluster_delete(request, id):
# def cluster_list(request, limit=None, marker=None, sort_key=None,
#                  sort_dir=None, detail=True):
# def cluster_show(request, id):
# def cluster_resize(request, cluster_id, node_count,
#                    nodes_to_remove=None, nodegroup=None):
# def cluster_upgrade(request, cluster_uuid, cluster_template,
#                     max_batch_size=1, nodegroup=None):
# def certificate_create(request, **kwargs):
# def certificate_show(request, id):
# def certificate_rotate(request, id):
# def stats_list(request, project_id=None):
# def quotas_list(request, limit=None, marker=None, sort_key=None,
#                 sort_dir=None, all_tenants=True):
# def quotas_show(request, project_id, resource):
# def quotas_create(request, **kwargs):
# def quotas_update(request, project_id, resource, **kwargs):
# def quotas_delete(request, project_id, resource):


import logging
import re
from collections import defaultdict
from django.conf import settings
from django.http import HttpResponse
from django.http import HttpResponseNotFound
from django.views import generic
from magnum_ui.api import heat
from magnum_ui.api import magnum
from openstack_dashboard import api
from openstack_dashboard.api import neutron
from openstack_dashboard.api.rest import urls
from openstack_dashboard.api.rest import utils as rest_utils
        available_addons = []

        configured_addons = getattr(
            settings, "MAGNUM_AVAILABLE_ADDONS", [])

        for configured_addon in configured_addons:
            addon = {}
            try:
                addon["name"] = configured_addon["name"]
                addon["selected"] = configured_addon["selected"]
                assert type(addon["selected"]) is bool
                addon["labels"] = configured_addon["labels"]
                assert type(addon["labels"]) is dict
                available_addons.append(addon)
            except KeyError as e:
                LOG.exception(e)
            except AssertionError as e:
                LOG.exception(e)

        return {"addons": available_addons}


@urls.register
class ClusterTemplate(generic.View):
    """API for retrieving a single cluster template"""
    url_regex = r'container_infra/cluster_templates/(?P<template_id>[^/]+)$'

    @rest_utils.ajax()
    def get(self, request, template_id):
        """Get a specific cluster template"""

# Path: magnum_ui/api/heat.py
# LOG = logging.getLogger(__name__)
# def heatclient(request, password=None):
# def format_parameters(params):
# def stack_get(request, stack_id):
# 
# Path: magnum_ui/api/magnum.py
# LOG = logging.getLogger(__name__)
# CLUSTER_TEMPLATE_CREATE_ATTRS = cluster_templates.CREATION_ATTRIBUTES
# CLUSTER_CREATE_ATTRS = clusters.CREATION_ATTRIBUTES
# CERTIFICATE_CREATE_ATTRS = certificates.CREATION_ATTRIBUTES
# QUOTA_CREATION_ATTRIBUTES = quotas.CREATION_ATTRIBUTES
# CLUSTER_UPDATE_ALLOWED_PROPERTIES = set(['/node_count'])
# DEFAULT_API_VERSION = '1.10'
# def _cleanup_params(attrs, create, **params):
# def _create_patches(old, new):
# def magnumclient(request):
# def cluster_template_create(request, **kwargs):
# def cluster_template_update(request, id, **kwargs):
# def cluster_template_delete(request, id):
# def cluster_template_list(request, limit=None, marker=None, sort_key=None,
#                           sort_dir=None, detail=True):
# def cluster_template_show(request, id):
# def cluster_create(request, **kwargs):
# def cluster_update(request, id, **kwargs):
# def cluster_delete(request, id):
# def cluster_list(request, limit=None, marker=None, sort_key=None,
#                  sort_dir=None, detail=True):
# def cluster_show(request, id):
# def cluster_resize(request, cluster_id, node_count,
#                    nodes_to_remove=None, nodegroup=None):
# def cluster_upgrade(request, cluster_uuid, cluster_template,
#                     max_batch_size=1, nodegroup=None):
# def certificate_create(request, **kwargs):
# def certificate_show(request, id):
# def certificate_rotate(request, id):
# def stats_list(request, project_id=None):
# def quotas_list(request, limit=None, marker=None, sort_key=None,
#                 sort_dir=None, all_tenants=True):
# def quotas_show(request, project_id, resource):
# def quotas_create(request, **kwargs):
# def quotas_update(request, project_id, resource, **kwargs):
# def quotas_delete(request, project_id, resource):


# Path: magnum_ui/api/rest/magnum.py
import logging
import re
from collections import defaultdict
from django.conf import settings
from django.http import HttpResponse
from django.http import HttpResponseNotFound
from django.views import generic
from magnum_ui.api import heat
from magnum_ui.api import magnum
from openstack_dashboard import api
from openstack_dashboard.api import neutron
from openstack_dashboard.api.rest import urls
from openstack_dashboard.api.rest import utils as rest_utils

        available_addons = []

        configured_addons = getattr(
            settings, "MAGNUM_AVAILABLE_ADDONS", [])

        for configured_addon in configured_addons:
            addon = {}
            try:
                addon["name"] = configured_addon["name"]
                addon["selected"] = configured_addon["selected"]
                assert type(addon["selected"]) is bool
                addon["labels"] = configured_addon["labels"]
                assert type(addon["labels"]) is dict
                available_addons.append(addon)
            except KeyError as e:
                LOG.exception(e)
            except AssertionError as e:
                LOG.exception(e)

        return {"addons": available_addons}


@urls.register
class ClusterTemplate(generic.View):
    """API for retrieving a single cluster template"""
    url_regex = r'container_infra/cluster_templates/(?P<template_id>[^/]+)$'

    @rest_utils.ajax()
    def get(self, request, template_id):
        """Get a specific cluster template"""

        return change_to_id(magnum.cluster_template_show(request, template_id)