Delete legacy network

Deletes a legacy VMWare Network.

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.api_core import operation
from google.cloud import vmwareengine_v1


def delete_legacy_network(project_id: str, region: str) -> operation.Operation:
    """
    Deletes a legacy VMware Network.

    Args:
        project_id: name of the project hosting the network.
        region: region in which the legacy network is located in.

    Returns:
        An Operation object related to started network deletion operation.
    """
    client = vmwareengine_v1.VmwareEngineClient()
    return client.delete_vmware_engine_network(
        name=f"projects/{project_id}/"
        f"locations/{region}/"
        f"vmwareEngineNetworks/{region}-default"
    )

What's next

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