Mencantumkan grup akun terkait

Menampilkan daftar grup akun terkait dalam sebuah project.

Jelajahi lebih lanjut

Untuk dokumentasi mendetail yang menyertakan contoh kode ini, lihat artikel berikut:

Contoh kode

Untuk melakukan autentikasi reCAPTCHA Enterprise, siapkan Kredensial Default Aplikasi. Untuk mengetahui informasi selengkapnya, baca Menyiapkan autentikasi untuk lingkungan pengembangan lokal.


import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient;
import com.google.recaptchaenterprise.v1.ListRelatedAccountGroupsRequest;
import com.google.recaptchaenterprise.v1.RelatedAccountGroup;
import java.io.IOException;

public class ListRelatedAccountGroups {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // projectId : Google Cloud Project Id.
    String projectId = "project-id";

    listRelatedAccountGroups(projectId);
  }

  // List related account groups in the project.
  public static void listRelatedAccountGroups(String projectId) throws IOException {
    try (RecaptchaEnterpriseServiceClient client = RecaptchaEnterpriseServiceClient.create()) {

      ListRelatedAccountGroupsRequest request =
          ListRelatedAccountGroupsRequest.newBuilder().setParent("projects/" + projectId).build();

      System.out.println("Listing related account groups..");
      for (RelatedAccountGroup group : client.listRelatedAccountGroups(request).iterateAll()) {
        System.out.println(group.getName());
      }
    }
  }
}

Langkah selanjutnya

Untuk menelusuri dan memfilter contoh kode untuk produk Google Cloud lainnya, lihat browser contoh Google Cloud.