Skip to content

Commit

Permalink
chore: generated code for commit 30d54e7. [skip ci]
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
algolia-bot and millotp committed Jan 18, 2024
1 parent 30d54e7 commit b27441b
Showing 1 changed file with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@
import com.algolia.utils.*;
import com.fasterxml.jackson.core.type.TypeReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nonnull;

public class MonitoringClient extends ApiClient {
Expand All @@ -28,22 +24,13 @@ public MonitoringClient(String appId, String apiKey) {
}

public MonitoringClient(String appId, String apiKey, ClientOptions options) {
super(appId, apiKey, "Monitoring", options, getDefaultHosts(appId));
super(appId, apiKey, "Monitoring", options, getDefaultHosts());
}

private static List<Host> getDefaultHosts(String appId) {
private static List<Host> getDefaultHosts() {
List<Host> hosts = new ArrayList<>();
hosts.add(new Host(appId + "-dsn.algolia.net", EnumSet.of(CallType.READ)));
hosts.add(new Host(appId + ".algolia.net", EnumSet.of(CallType.WRITE)));

List<Host> commonHosts = new ArrayList<>();
hosts.add(new Host(appId + "-1.algolianet.net", EnumSet.of(CallType.READ, CallType.WRITE)));
hosts.add(new Host(appId + "-2.algolianet.net", EnumSet.of(CallType.READ, CallType.WRITE)));
hosts.add(new Host(appId + "-3.algolianet.net", EnumSet.of(CallType.READ, CallType.WRITE)));

Collections.shuffle(commonHosts, new Random());

return Stream.concat(hosts.stream(), commonHosts.stream()).collect(Collectors.toList());
hosts.add(new Host("status.algolia.com", EnumSet.of(CallType.READ, CallType.WRITE)));
return hosts;
}

/**
Expand Down

0 comments on commit b27441b

Please sign in to comment.