googleapis / python-compute

This library has moved to https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-compute
Apache License 2.0
39 stars 26 forks source link

Provide Sample Code for InstanceGroupsClient #344

Closed parthea closed 1 year ago

parthea commented 2 years ago

This repository doesn't have sample code for InstanceGroupsClient. This issue tracks providing sample code similar to the following snippet.

from google.cloud import compute_v1

project = "project-xxx"
zone = "us-central1-a"
instance_group = "test"

instance_groups_list_instances_request_resource = compute_v1.InstanceGroupsListInstancesRequest()
instance_groups_list_instances_request_resource.instance_state = "RUNNING"
instance_groups_client = compute_v1.InstanceGroupsClient()

instance_groups_list = instance_groups_client.list_instances(project=project, zone=zone, instance_group=instance_group, instance_groups_list_instances_request_resource=instance_groups_list_instances_request_resource)

for instance in instance_groups_list:
    print(instance.name, instance.labels)
parthea commented 1 year ago

The samples have moved to python-docs-samples