VMWare Engine 프라이빗 클라우드 만들기

VMWare Engine을 사용하여 새 프라이빗 클라우드를 만듭니다. 새 프라이빗 클라우드 만들기는 장기 실행 작업이며 1시간 이상 걸릴 수 있습니다.

더 살펴보기

이 코드 샘플이 포함된 자세한 문서는 다음을 참조하세요.

코드 샘플

Python

VMware Engine에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

from google.api_core import operation
from google.cloud import vmwareengine_v1

DEFAULT_MANAGEMENT_CIDR = "192.168.0.0/24"
DEFAULT_NODE_COUNT = 3


def create_private_cloud(
    project_id: str, zone: str, network_name: str, cloud_name: str, cluster_name: str
) -> operation.Operation:
    """
    Creates a new Private Cloud using VMware Engine.

    Creating a new Private Cloud is a long-running operation and it may take over an hour.

    Args:
        project_id: name of the project you want to use.
        zone: the zone you want to use, i.e. "us-central1-a"
        network_name: name of the VMWareNetwork to use for the new Private Cloud
        cloud_name: name of the new Private Cloud
        cluster_name: name for the new cluster in this Private Cloud

    Returns:
        An operation object representing the started operation. You can call its .result() method to wait for it to finish.
    """
    request = vmwareengine_v1.CreatePrivateCloudRequest()
    request.parent = f"projects/{project_id}/locations/{zone}"
    request.private_cloud_id = cloud_name

    request.private_cloud = vmwareengine_v1.PrivateCloud()
    request.private_cloud.management_cluster = (
        vmwareengine_v1.PrivateCloud.ManagementCluster()
    )
    request.private_cloud.management_cluster.cluster_id = cluster_name

    node_config = vmwareengine_v1.NodeTypeConfig()
    node_config.node_count = DEFAULT_NODE_COUNT

    # Currently standard-72 is the only supported node type.
    request.private_cloud.management_cluster.node_type_configs = {
        "standard-72": node_config
    }

    request.private_cloud.network_config = vmwareengine_v1.NetworkConfig()
    request.private_cloud.network_config.vmware_engine_network = network_name
    request.private_cloud.network_config.management_cidr = DEFAULT_MANAGEMENT_CIDR

    client = vmwareengine_v1.VmwareEngineClient()
    return client.create_private_cloud(request)

다음 단계

다른 Google Cloud 제품의 코드 샘플을 검색하고 필터링하려면 Google Cloud 샘플 브라우저를 참조하세요.