def configure(group, count): """Create, get or modify identity group configuration""" zkclient = context.GLOBAL.zk.conn if count is not None: masterapi.update_identity_group(zkclient, group, count) cli.out(formatter(masterapi.get_identity_group(zkclient, group)))
def _list(): """List all configured identity groups""" zkclient = context.GLOBAL.zk.conn groups = [ masterapi.get_identity_group(zkclient, group) for group in masterapi.identity_groups(zkclient) ] cli.out(formatter(groups))
def _list(match=None): """List configured identity groups.""" if match is None: match = '*' zkclient = context.GLOBAL.zk.conn groups = [ masterapi.get_identity_group(zkclient, group) for group in masterapi.identity_groups(zkclient) ] filtered = [ group for group in groups if group is not None and fnmatch.fnmatch(group['_id'], match) ] return sorted(filtered, key=lambda item: item['_id'])
def update(rsrc_id, rsrc): """Update application configuration.""" zkclient = context.GLOBAL.zk.conn masterapi.update_identity_group(zkclient, rsrc_id, rsrc['count']) return masterapi.get_identity_group(zkclient, rsrc_id)
def create(rsrc_id, rsrc): """Create (configure) application group.""" zkclient = context.GLOBAL.zk.conn masterapi.update_identity_group(zkclient, rsrc_id, rsrc['count']) return masterapi.get_identity_group(zkclient, rsrc_id)
def get(rsrc_id): """Get application group configuration.""" zkclient = context.GLOBAL.zk.conn return masterapi.get_identity_group(zkclient, rsrc_id)