GCP Cloud Function Code

from googleapiclient import discovery

def main(self):
    service = discovery.build('compute', 'v1')    #making connection to Google API Client
    project='whizlabs-admin'  #TODO, mention your project id   
    zone='us-central1-a' #TODO, keep the zone as us-central1-a
    request = service.instances().list(project=project, zone=zone) #list API for the VM instances
    while request is not None:             #Checking if VM Instances exists
        response = request.execute()       #Getting the response from API
        for instance in response['items']:  # Looping each VM Instance in the Project
            return instance['name']         #Returing first VM Instance in the Project