Skip to content

Migrate IoT to Cloud Client library #2396

Closed
@gguuss

Description

@gguuss

It's easier to instantiate the client using the newer Cloud Client library so it's a good idea to migrate.

The following example code shows how to do it:

def list_registries(service_account_json, project_id, cloud_region):
    """List all registries in the project."""
    # [START iot_list_registries]
    print('Listing Registries')
    client = iot_v1.DeviceManagerClient()

    parent = client.location_path(project_id, cloud_region)

    registries = client.list_device_registries(parent)

    for registry in registries:
        print('id: {}\n\tname: {}'.format(
            registry.id,
            registry.name))

    return registries
    # [END iot_list_registries]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions