Unbind all devices

Unbind all devices.

Code sample


public static object UnbindAllDevices(
    string projectId, string cloudRegion, string registryId)
    var cloudIot = CreateAuthorizedClient();
    // The resource name of the location associated with the key rings.
    var parent = $"projects/{projectId}/locations/{cloudRegion}/registries/{registryId}";
        var devices = cloudIot
        Console.WriteLine("Devices: {0}", parent);

        if (devices != null)
            foreach (var response in devices)
                UnbindDeviceFromAllGateways(cloudIot, projectId,
                cloudRegion, registryId, response.Id);
            Console.WriteLine("No bound device found.");
    catch (Google.GoogleApiException e)
        return e.Error.Code;
    return 0;

What's next

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