List related account group membership

For a group name, list memberships in the group.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

To authenticate to reCAPTCHA Enterprise, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.


public class ListRelatedAccountGroupMemberships {

  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";

    // relatedAccountGroup: Name of the account group.
    String relatedAccountGroup = "related-account-group-name";

    listRelatedAccountGroupMemberships(projectId, relatedAccountGroup);

  /** Given a group name, list memberships in the group. */
  public static void listRelatedAccountGroupMemberships(
      String projectId, String relatedAccountGroup) throws IOException {
    try (RecaptchaEnterpriseServiceClient client = RecaptchaEnterpriseServiceClient.create()) {

      // Construct the request.
      ListRelatedAccountGroupMembershipsRequest request =
                      "projects/%s/relatedaccountgroups/%s", projectId, relatedAccountGroup))

      for (RelatedAccountGroupMembership relatedAccountGroupMembership :
          client.listRelatedAccountGroupMemberships(request).iterateAll()) {
      System.out.println("Finished listing related account group memberships.");

What's next

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