/**
   * Checks if the provided zone is an option for the client to connect to.
   * Any zone provided must have previously been created by ZoneManagement.
   *
   * @param tenantId The tenantId of the connecting envoy.
   * @param zone The zone provided in the envoySummary.
   * @throws IllegalArgumentException if the zone is not found.
   */
private void validateZoneAvailable(String tenantId, String zone) throws IllegalArgumentException {
    List<ZoneDTO> zones;
    try {
      zones = zoneApi.getAvailableZones(tenantId);
    } catch (ResourceAccessException e) {
      // need to do something here to handle things more gracefully.
      throw new RuntimeException("Unable to validate zones.", e);
    }
    boolean found = zones.stream().anyMatch(z -> z.getName().equals(zone));
    log.debug("Found {} zones for tenant", zoneApi.getAvailableZones(tenantId).size());
    if (!found) throw new IllegalArgumentException("Provided zone does not exist: " + zone);
  }
private void validateZoneAvailable(String tenantId, String zone) throws IllegalArgumentException {
List<ZoneDTO> zones;
try {
zones = zoneApi.getAvailableZones(tenantId);
} catch (ResourceAccessException e) {
// need to do something here to handle things more gracefully.
throw new RuntimeException("Unable to validate zones.", e);
}
boolean found = zones.stream().anyMatch(z -> z.getName().equals(zone));
log.debug("Found {} zones for tenant", zoneApi.getAvailableZones(tenantId).size());
if (!found) throw new IllegalArgumentException("Provided zone does not exist: " + zone);
}
private void validateZoneAvailable(String tenantId, String zone) throws IllegalArgumentException {
List<ZoneDTO> zones;
try {
zones = zoneApi.getAvailableZones(tenantId);
} catch (ResourceAccessException e) {
// need to do something here to handle things more gracefully.
throw new RuntimeException("Unable to validate zones.", e);
}
boolean found = zones.stream().anyMatch(z -> z.getName().equals(zone));
log.debug("Found {} zones for tenant", zoneApi.getAvailableZones(tenantId).size());
if (!found) throw new IllegalArgumentException("Provided zone does not exist: " + zone);
}
private void validateZoneAvailable(String tenantId, String zone) throws IllegalArgumentException {
List<ZoneDTO> zones;
try {
zones = zoneApi.getAvailableZones(tenantId);
} catch (ResourceAccessException e) {
// need to do something here to handle things more gracefully.
throw new RuntimeException("Unable to validate zones.", e);
}
boolean found = zones.stream().anyMatch(z -> z.getName().equals(zone));
log.debug("Found {} zones for tenant", zoneApi.getAvailableZones(tenantId).size());
if (!found) throw new IllegalArgumentException("Provided zone does not exist: " + zone);
}