'Return all primary manifest datasets and all non-manifest datasets in
the cluster.
:return: A ``list`` containing all datasets in the cluster.'

@app.route('/state/datasets', methods=['GET'])
@user_documentation(u"\n                                The    result    reflects    the    control    service's    knowledge,    which    may    be\n                                out    of    date    or    incomplete.    E.g.    a    dataset    agent    has    not    connected\n                                or    updated    the    control    service    yet.\n                                ", header=u'Get    current    cluster    datasets', examples=[u'get    state    datasets'], section=u'dataset')
@structured(inputSchema={}, outputSchema={'$ref': '/v1/endpoints.json#/definitions/state_datasets_array'}, schema_store=SCHEMAS)
def state_datasets(self):

    response = []
    deployment_state = self.cluster_state_service.as_deployment()
    get_manifestation_path = self.cluster_state_service.manifestation_path
    for (dataset, node) in deployment_state.all_datasets():
        response_dataset = dict(dataset_id=dataset.dataset_id)
        if (node is not None):
            response_dataset[u'primary'] = unicode(node.uuid)
            response_dataset[u'path'] = get_manifestation_path(node.uuid, dataset.dataset_id).path.decode('utf-8')
        if (dataset.maximum_size is not None):
            response_dataset[u'maximum_size'] = dataset.maximum_size
        response.append(response_dataset)
    return response
