# 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
        max_batch_size = request.DATA.get("max_batch_size", 1)
        nodegroup = request.DATA.get("nodegroup", None)

        return magnum.cluster_upgrade(
            request, cluster_id, cluster_template,
            max_batch_size=max_batch_size, nodegroup=nodegroup).to_dict()


@urls.register
class Clusters(generic.View):
    """API for Magnum Clusters"""
    url_regex = r'container_infra/clusters/$'

    @rest_utils.ajax()
    def get(self, request):
        """Get a list of the Clusters for a project.

        The returned result is an object with property 'items' and each
        item under this is a Cluster.
        """
        result = magnum.cluster_list(request)
        return {'items': [change_to_id(n.to_dict()) for n in result]}

    @rest_utils.ajax(data_required=True)
    def delete(self, request):
        """Delete one or more Clusters by id.

        Returns HTTP 204 (no content) on successful deletion.
        """
        for cluster_id in request.DATA:

# 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

        max_batch_size = request.DATA.get("max_batch_size", 1)
        nodegroup = request.DATA.get("nodegroup", None)

        return magnum.cluster_upgrade(
            request, cluster_id, cluster_template,
            max_batch_size=max_batch_size, nodegroup=nodegroup).to_dict()


@urls.register
class Clusters(generic.View):
    """API for Magnum Clusters"""
    url_regex = r'container_infra/clusters/$'

    @rest_utils.ajax()
    def get(self, request):
        """Get a list of the Clusters for a project.

        The returned result is an object with property 'items' and each
        item under this is a Cluster.
        """
        result = magnum.cluster_list(request)
        return {'items': [change_to_id(n.to_dict()) for n in result]}

    @rest_utils.ajax(data_required=True)
    def delete(self, request):
        """Delete one or more Clusters by id.

        Returns HTTP 204 (no content) on successful deletion.
        """
        for cluster_id in request.DATA:

            magnum.cluster_delete(request, cluster_id)