# Path: magnumclient/common/utils.py
# def common_filters(marker=None, limit=None, sort_key=None, sort_dir=None):
# def split_and_deserialize(string):
# def args_array_to_patch(op, attributes):
# def handle_labels(labels):
# def format_labels(lbls, parse_comma=True):
# def print_list_field(field):
# def handle_json_from_file(json_arg):
# def config_cluster(cluster, cluster_template, cfg_dir, force=False,
#                    certs=None, use_keystone=False):
# def _config_cluster_kubernetes(cluster, cluster_template, cfg_dir,
#                                force=False, certs=None, use_keystone=False):
# def _config_cluster_swarm(cluster, cluster_template, cfg_dir,
#                           force=False, certs=None):
# def generate_csr_and_key():
# 
# Path: magnumclient/exceptions.py
# class AmbiguousAuthSystem(exceptions.ClientException):
# class InvalidAttribute(exceptions.ClientException):
# def from_response(response, message=None, traceback=None, method=None,
#                   url=None):
# 
# Path: magnumclient/v1/baseunit.py
# CREATION_ATTRIBUTES = ['name', 'node_count', 'discovery_url', 'master_count']
# class BaseTemplate(base.Resource):
# class BaseTemplateManager(base.Manager):
#     def __repr__(self):
#     def _path(cls, id=None):
#     def list(self, limit=None, marker=None, sort_key=None,
#              sort_dir=None, detail=False):
#     def get(self, id):
#     def create(self, **kwargs):
#     def delete(self, id):
#     def update(self, id, patch, rollback=False):


from magnumclient.common import utils
from magnumclient import exceptions
from magnumclient.v1 import baseunit
    template_name = 'nodegroups'
    api_name = 'nodegroups'

    @classmethod
    def _path(cls, cluster_id, id=None):
        path = '/v1/clusters/%s/%s/' % (cluster_id, cls.template_name)
        if id:
            path += str(id)
        return path

    def list(self, cluster_id, limit=None, marker=None, sort_key=None,
             sort_dir=None, role=None, detail=False):
        if limit is not None:
            limit = int(limit)

        filters = utils.common_filters(marker, limit, sort_key, sort_dir)
        path = ''
        if role:
            filters.append('role=%s' % role)
        if detail:
            path += 'detail'
        if filters:
            path += '?' + '&'.join(filters)

        if limit is None:
            return self._list(self._path(cluster_id, id=path),
                              self.__class__.api_name)
        else:
            return self._list_pagination(self._path(cluster_id, id=path),
                                         self.__class__.api_name,

# Path: magnumclient/common/utils.py
# def common_filters(marker=None, limit=None, sort_key=None, sort_dir=None):
# def split_and_deserialize(string):
# def args_array_to_patch(op, attributes):
# def handle_labels(labels):
# def format_labels(lbls, parse_comma=True):
# def print_list_field(field):
# def handle_json_from_file(json_arg):
# def config_cluster(cluster, cluster_template, cfg_dir, force=False,
#                    certs=None, use_keystone=False):
# def _config_cluster_kubernetes(cluster, cluster_template, cfg_dir,
#                                force=False, certs=None, use_keystone=False):
# def _config_cluster_swarm(cluster, cluster_template, cfg_dir,
#                           force=False, certs=None):
# def generate_csr_and_key():
# 
# Path: magnumclient/exceptions.py
# class AmbiguousAuthSystem(exceptions.ClientException):
# class InvalidAttribute(exceptions.ClientException):
# def from_response(response, message=None, traceback=None, method=None,
#                   url=None):
# 
# Path: magnumclient/v1/baseunit.py
# CREATION_ATTRIBUTES = ['name', 'node_count', 'discovery_url', 'master_count']
# class BaseTemplate(base.Resource):
# class BaseTemplateManager(base.Manager):
#     def __repr__(self):
#     def _path(cls, id=None):
#     def list(self, limit=None, marker=None, sort_key=None,
#              sort_dir=None, detail=False):
#     def get(self, id):
#     def create(self, **kwargs):
#     def delete(self, id):
#     def update(self, id, patch, rollback=False):


# Path: magnumclient/v1/nodegroups.py
from magnumclient.common import utils
from magnumclient import exceptions
from magnumclient.v1 import baseunit

    template_name = 'nodegroups'
    api_name = 'nodegroups'

    @classmethod
    def _path(cls, cluster_id, id=None):
        path = '/v1/clusters/%s/%s/' % (cluster_id, cls.template_name)
        if id:
            path += str(id)
        return path

    def list(self, cluster_id, limit=None, marker=None, sort_key=None,
             sort_dir=None, role=None, detail=False):
        if limit is not None:
            limit = int(limit)

        filters = utils.common_filters(marker, limit, sort_key, sort_dir)
        path = ''
        if role:
            filters.append('role=%s' % role)
        if detail:
            path += 'detail'
        if filters:
            path += '?' + '&'.join(filters)

        if limit is None:
            return self._list(self._path(cluster_id, id=path),
                              self.__class__.api_name)
        else:
            return self._list_pagination(self._path(cluster_id, id=path),
                                         self.__class__.api_name,

                                         limit=limit)