cloud_clients/gcp.py
async def list_running(
            self, project: str, zone: str, next_page_token: str = None
    ) -> Tuple[List[Instance], Optional[str]]:
        """
        list all running instances in project
        next page token is for getting the next page of results
        """
        path = self.list_instances_path.format(project=project, zone=zone)
        query_params = {"filter": f"status = {InstanceState.running}"}
        if next_page_token:
            query_params["pageToken"] = next_page_token

        data = await self.client.get(
            path=path,
            query_params=query_params,
            response_type=dict,
        )

        running_instances = []
        for instance_data in data.get("items", []):

            instance_state = instance_data["status"]
            if instance_state != InstanceState.running:
                raise ValueError(f"Got an instance that is not in RUNNING state. instance_state={instance_state}")

            instance = Instance(
                 id=instance_data["id"],
                 name=instance_data["name"],
                 zone=zone,
                 project=project,
                 state=instance_state,
            )
            running_instances.append(instance)

        return running_instances, data.get("nextPageToken")

        list all running instances in project
        next page token is for getting the next page of results
        
list all running instances in project
next page token is for getting the next page of results
list all running instances in project next page token is for getting the next page of results
async def list_running(
            self, project: str, zone: str, next_page_token: str = None
    ) -> Tuple[List[Instance], Optional[str]]:
        path = self.list_instances_path.format(project=project, zone=zone)
        query_params = {"filter": f"status = {InstanceState.running}"}
        if next_page_token:
            query_params["pageToken"] = next_page_token
        data = await self.client.get(
            path=path,
            query_params=query_params,
            response_type=dict,
        )
        running_instances = []
        for instance_data in data.get("items", []):
            instance_state = instance_data["status"]
            if instance_state != InstanceState.running:
                raise ValueError(f"Got an instance that is not in RUNNING state. instance_state={instance_state}")
            instance = Instance(
                 id=instance_data["id"],
                 name=instance_data["name"],
                 zone=zone,
                 project=project,
                 state=instance_state,
            )
            running_instances.append(instance)
        return running_instances, data.get("nextPageToken")
async def list_running ( self , project : str , zone : str , next_page_token : str = None ) -> Tuple [ List [ Instance ] , Optional [ str ] ] : path = self . list_instances_path . format ( project = project , zone = zone ) query_params = { "filter" : f"status = {InstanceState.running}" } if next_page_token : query_params [ "pageToken" ] = next_page_token data = await self . client . get ( path = path , query_params = query_params , response_type = dict , ) running_instances = [ ] for instance_data in data . get ( "items" , [ ] ) : instance_state = instance_data [ "status" ] if instance_state != InstanceState . running : raise ValueError ( f"Got an instance that is not in RUNNING state. instance_state={instance_state}" ) instance = Instance ( id = instance_data [ "id" ] , name = instance_data [ "name" ] , zone = zone , project = project , state = instance_state , ) running_instances . append ( instance ) return running_instances , data . get ( "nextPageToken" )
list all running instances in project
next page token is for getting the next page of results
list all running instances in project next page token is for getting the next page of results
"""
        list all running instances in project
        next page token is for getting the next page of results
        """
self
project
str
zone
str
next_page_token
str