in gcloud/clouddomains.go [207:233]
func (c Client) DomainIsVerified(project, domain string) (bool, error) {
svc, err := c.getDomainsClient(project)
if err != nil {
return false, fmt.Errorf("cannot get domains client: %s", err)
}
req := &domainspb.ListRegistrationsRequest{
Filter: fmt.Sprintf("domainName=\"%s\"", domain),
Parent: fmt.Sprintf("projects/%s/locations/global", project),
}
it := svc.ListRegistrations(c.ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
return false, fmt.Errorf("listing domains failed: %s", err)
}
if resp.DomainName == domain {
return true, nil
}
}
return false, nil
}