Use this API to count clusterinstance_clusternode_binding resources configued on NetScaler.
493569
public static long count(nitro_service service, Long clid) throws Exception{
		clusterinstance_clusternode_binding obj = new clusterinstance_clusternode_binding();
		obj.set_clid(clid);
		options option = new options();
		option.set_count(true);
		clusterinstance_clusternode_binding response[] = (clusterinstance_clusternode_binding[]) obj.get_resources(service,option);
		if (response != null) {
			return response[0].__count;
		}
		return 0;
	}
557615
public static ns_clusternode[] get_filtered(nitro_service service, String filter) throws Exception
	{
		ns_clusternode obj = new ns_clusternode();
		options option = new options();
		option.set_filter(filter);
		ns_clusternode[] response = (ns_clusternode[]) obj.getfiltered(service, option);
		return response;
	}
85459
public static clusternode get(nitro_service service, Long nodeid) throws Exception{
		clusternode obj = new clusternode();
		obj.set_nodeid(nodeid);
		clusternode response = (clusternode) obj.get_resource(service);
		return response;
	}
113992
public static base_responses update(nitro_service client, clusterinstance resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			clusterinstance updateresources[] = new clusterinstance[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new clusterinstance();
				updateresources[i].clid = resources[i].clid;
				updateresources[i].deadinterval = resources[i].deadinterval;
				updateresources[i].hellointerval = resources[i].hellointerval;
				updateresources[i].preemption = resources[i].preemption;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
988936
def _find_usage_clusters(self):
        
        count = 0
        fargate_task_count = 0
        paginator = self.conn.get_paginator('list_clusters')
        for page in paginator.paginate():
            for cluster_arn in page['clusterArns']:
                count += 1
                resp = self.conn.describe_clusters(
                    clusters=[cluster_arn], include=['STATISTICS']
                )
                cluster = resp['clusters'][0]
                self.limits[
                    'Container Instances per Cluster'
                ]._add_current_usage(
                    cluster['registeredContainerInstancesCount'],
                    aws_type='AWS::ECS::ContainerInstance',
                    resource_id=cluster['clusterName']
                )
                self.limits['Services per Cluster']._add_current_usage(
                    cluster['activeServicesCount'],
                    aws_type='AWS::ECS::Service',
                    resource_id=cluster['clusterName']
                )
                # Note: 'statistics' is not always present in API responses,
                # even if requested. As far as I can tell, it's omitted if
                # a cluster has no Fargate tasks.
                for stat in cluster.get('statistics', []):
                    if stat['name'] != 'runningFargateTasksCount':
                        continue
                    logger.debug(
                        'Found %s Fargate tasks in cluster %s',
                        stat['value'], cluster_arn
                    )
                    fargate_task_count += int(stat['value'])
                self._find_usage_one_cluster(cluster['clusterName'])
        self.limits['Fargate Tasks']._add_current_usage(
            fargate_task_count, aws_type='AWS::ECS::Task'
        )
        self.limits['Clusters']._add_current_usage(
            count, aws_type='AWS::ECS::Cluster'
        )
1070806
public static base_responses add(nitro_service client, clusterinstance resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			clusterinstance addresources[] = new clusterinstance[resources.length];
			for (int i=0;i<resources.length;i++){
				addresources[i] = new clusterinstance();
				addresources[i].clid = resources[i].clid;
				addresources[i].deadinterval = resources[i].deadinterval;
				addresources[i].hellointerval = resources[i].hellointerval;
				addresources[i].preemption = resources[i].preemption;
			}
			result = add_bulk_request(client, addresources);
		}
		return result;
	}
76144
public static clusterinstance_stats get(nitro_service service, Long clid) throws Exception{
		clusterinstance_stats obj = new clusterinstance_stats();
		obj.set_clid(clid);
		clusterinstance_stats response = (clusterinstance_stats) obj.stat_resource(service);
		return response;
	}
1172456
public static base_response add(nitro_service client, clusternode resource) throws Exception {
		clusternode addresource = new clusternode();
		addresource.nodeid = resource.nodeid;
		addresource.ipaddress = resource.ipaddress;
		addresource.state = resource.state;
		addresource.backplane = resource.backplane;
		addresource.priority = resource.priority;
		return addresource.add_resource(client);
	}
1370548
def get_resources_nodes(call=None, resFilter=None):
    '''
    
    '''
    log.debug('Getting resource: nodes.. (filter: %s)', resFilter)
    resources = query('get', 'cluster/resources')

    ret = {}
    for resource in resources:
        if 'type' in resource and resource['type'] == 'node':
            name = resource['node']
            ret[name] = resource

    if resFilter is not None:
        log.debug('Filter given: %s, returning requested '
                  'resource: nodes', resFilter)
        return ret[resFilter]

    log.debug('Filter not given: %s, returning all resource: nodes', ret)
    return ret
1284008
def _find_usage_nodes(self):
        """"""
        nodes = 0
        paginator = self.conn.get_paginator('describe_cache_clusters')
        for page in paginator.paginate(ShowCacheNodeInfo=True):
            for cluster in page['CacheClusters']:
                try:
                    num_nodes = len(cluster['CacheNodes'])
                except (IndexError, TypeError, KeyError):
                    # sometimes CacheNodes is None...
                    logger.debug(
                        "Cache Cluster '%s' returned dict with CacheNodes "
                        "None", cluster['CacheClusterId'])
                    num_nodes = cluster['NumCacheNodes']
                nodes += num_nodes
                if cluster['Engine'] == 'memcached':
                    self.limits['Nodes per Cluster']._add_current_usage(
                        num_nodes,
                        aws_type='AWS::ElastiCache::CacheCluster',
                        resource_id=cluster['CacheClusterId'],
                    )

        self.limits['Nodes']._add_current_usage(
            nodes,
            aws_type='AWS::ElastiCache::CacheNode'
        )
856582
public static base_responses add(nitro_service client, clusternode resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			clusternode addresources[] = new clusternode[resources.length];
			for (int i=0;i<resources.length;i++){
				addresources[i] = new clusternode();
				addresources[i].nodeid = resources[i].nodeid;
				addresources[i].ipaddress = resources[i].ipaddress;
				addresources[i].state = resources[i].state;
				addresources[i].backplane = resources[i].backplane;
				addresources[i].priority = resources[i].priority;
			}
			result = add_bulk_request(client, addresources);
		}
		return result;
	}
751197
public static ns_cluster[] get_filtered(nitro_service service, String filter) throws Exception
	{
		ns_cluster obj = new ns_cluster();
		options option = new options();
		option.set_filter(filter);
		ns_cluster[] response = (ns_cluster[]) obj.getfiltered(service, option);
		return response;
	}
86376
def scale(cluster, count)
      Ecs.update_service_desired_count(cluster.name, name, count)
      name
    end
1068476
public static base_responses update(nitro_service client, clusternode resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			clusternode updateresources[] = new clusternode[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new clusternode();
				updateresources[i].nodeid = resources[i].nodeid;
				updateresources[i].state = resources[i].state;
				updateresources[i].backplane = resources[i].backplane;
				updateresources[i].priority = resources[i].priority;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
958262
public int getHighestClusterCount() {
    int maxClusters = 0;

    for(int i = 0; i < numclusters.length; i++) {
      maxClusters = Math.max(maxClusters, numclusters[i]);
    }
    return maxClusters;
  }
375709
private void deployInstance(final Node node, final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
    data.put(instance.address(), Contexts.serialize(instance).encode(), new Handler<AsyncResult<String>>() {
      @Override
      public void handle(AsyncResult<String> result) {
        if (result.failed()) {
          counter.fail(result.cause());
        } else {
          if (!watchHandlers.containsKey(instance.address())) {
            final Handler<MapEvent<String, String>> watchHandler = new Handler<MapEvent<String, String>>() {
              @Override
              public void handle(MapEvent<String, String> event) {
                if (event.type().equals(MapEvent.Type.CREATE) || event.type().equals(MapEvent.Type.UPDATE)) {
                  handleReady(instance.address());
                } else if (event.type().equals(MapEvent.Type.DELETE)) {
                  handleUnready(instance.address());
                }
              }
            };
            // Watch the instance's status for changes. Once the instance has started
            // up, the component coordinator will set the instance's status key in the
            // cluster, indicating that the instance has completed started. Once all
            // instances in the network have completed startup the network will be started.
            data.watch(instance.status(), watchHandler, new Handler<AsyncResult<Void>>() {
              @Override
              public void handle(AsyncResult<Void> result) {
                if (result.failed()) {
                  counter.fail(result.cause());
                } else {
                  watchHandlers.put(instance.address(), watchHandler);
                  if (instance.component().isModule()) {
                    deployModule(node, instance, counter);
                  } else if (instance.component().isVerticle() && !instance.component().asVerticle().isWorker()) {
                    deployVerticle(node, instance, counter);
                  } else if (instance.component().isVerticle() && instance.component().asVerticle().isWorker()) {
                    deployWorkerVerticle(node, instance, counter);
                  }
                }
              }
            });
          } else {
            if (instance.component().isModule()) {
              deployModule(node, instance, counter);
            } else if (instance.component().isVerticle() && !instance.component().asVerticle().isWorker()) {
              deployVerticle(node, instance, counter);
            } else if (instance.component().isVerticle() && instance.component().asVerticle().isWorker()) {
              deployWorkerVerticle(node, instance, counter);
            }
          }
        }
      }
    });
  }
56369
public static clusterinstance[] get_filtered(nitro_service service, String filter) throws Exception{
		clusterinstance obj = new clusterinstance();
		options option = new options();
		option.set_filter(filter);
		clusterinstance[] response = (clusterinstance[]) obj.getfiltered(service, option);
		return response;
	}