List available VMWare Engine locations

Prints a list of available locations for use in VMWare Engine.

Code sample

Python

To authenticate to VMware Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.

from google.cloud import vmwareengine_v1
from google.cloud.location.locations_pb2 import ListLocationsRequest


def list_locations(project_id: str) -> str:
    """
    Prints a list of available locations for use in VMWare Engine.

    Args:
        project_id: name of the project you want to use.

    Returns:
        String containing the list of all available locations.
    """
    client = vmwareengine_v1.VmwareEngineClient()
    request = ListLocationsRequest()
    request.name = f"projects/{project_id}"
    locations = client.list_locations(request)
    print(locations)
    return str(locations)

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.