def list_clusters()

in webinars/snowflake_2021-09/finspace.py [0:0]


    def list_clusters(self, status: str = None):
        """
        Lists current clusters and their statuses

        :param status: status to filter for

        :return dict: list of clusters
        """

        resp = self.client.list_clusters()

        clusters = []

        if 'clusters' not in resp:
            return (clusters)

        for c in resp['clusters']:
            if status is None:
                clusters.append(c)
            else:
                if c['clusterStatus']['state'] in status:
                    clusters.append(c)

        return (clusters)