Membuat daftar cluster VMWare Engine

Mengambil daftar cluster di cloud pribadi.

Mempelajari lebih lanjut

Untuk dokumentasi mendetail yang menyertakan contoh kode ini, lihat artikel berikut:

Contoh kode

Python

Untuk melakukan autentikasi ke VMware Engine, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, baca Menyiapkan autentikasi untuk lingkungan pengembangan lokal.

from typing import Iterable

from google.cloud import vmwareengine_v1


def list_clusters(
    project_id: str, zone: str, private_cloud_name: str
) -> Iterable[vmwareengine_v1.Cluster]:
    """
    Retrieves a list of clusters in private cloud.

    Args:
        project_id: name of the project hosting the private cloud.
        zone: zone in which the private cloud is located.
        private_cloud_name: name of the cloud of which you want to list cluster.

    Returns:
        An iterable collection of Cluster objects.
    """
    client = vmwareengine_v1.VmwareEngineClient()
    return client.list_clusters(
        parent=f"projects/{project_id}/locations/{zone}/privateClouds/{private_cloud_name}"
    )

Langkah berikutnya

Untuk menelusuri dan memfilter contoh kode untuk produk Google Cloud lainnya, lihat Google Cloud browser contoh.