def list_clusters(self): """List the clusters in the project. For example: .. literalinclude:: snippets.py :start-after: [START bigtable_list_clusters_in_project] :end-before: [END bigtable_list_clusters_in_project] :rtype: tuple :returns: (clusters, failed_locations), where 'clusters' is list of :class:`google.cloud.bigtable.instance.Cluster`, and 'failed_locations' is a list of strings representing locations which could not be resolved. """ resp = (self.instance_admin_client.list_clusters( self.instance_admin_client.instance_path(self.project, '-'))) clusters = [] instances = {} for cluster in resp.clusters: match_cluster_name = _CLUSTER_NAME_RE.match(cluster.name) instance_id = match_cluster_name.group('instance') if instance_id not in instances: instances[instance_id] = self.instance(instance_id) clusters.append(Cluster.from_pb(cluster, instances[instance_id])) return clusters, resp.failed_locations
def list_clusters(self): """List the clusters in the project. For example: .. literalinclude:: snippets.py :start-after: [START bigtable_list_clusters_in_project] :end-before: [END bigtable_list_clusters_in_project] :rtype: tuple :returns: (clusters, failed_locations), where 'clusters' is list of :class:`google.cloud.bigtable.instance.Cluster`, and 'failed_locations' is a list of strings representing locations which could not be resolved. """ resp = self.instance_admin_client.list_clusters( self.instance_admin_client.instance_path(self.project, "-") ) clusters = [] instances = {} for cluster in resp.clusters: match_cluster_name = _CLUSTER_NAME_RE.match(cluster.name) instance_id = match_cluster_name.group("instance") if instance_id not in instances: instances[instance_id] = self.instance(instance_id) clusters.append(Cluster.from_pb(cluster, instances[instance_id])) return clusters, resp.failed_locations
def list_clusters(self): """List the clusters in the project. :rtype: tuple :returns: (clusters, failed_locations), where 'clusters' is list of :class:`google.cloud.bigtable.instance.Cluster`, and 'failed_locations' is a list of strings representing locations which could not be resolved. """ resp = (self.instance_admin_client.list_clusters( self.instance_admin_client.instance_path(self.project, '-'))) clusters = [] instances = {} for cluster in resp.clusters: match_cluster_name = _CLUSTER_NAME_RE.match(cluster.name) instance_id = match_cluster_name.group('instance') if instance_id not in instances: instances[instance_id] = self.instance(instance_id) clusters.append(Cluster.from_pb(cluster, instances[instance_id])) return clusters, resp.failed_locations