Search in sources :

Example 1 with DnsHostEntryDto

use of io.datarouter.aws.rds.service.AuroraDnsService.DnsHostEntryDto in project datarouter by hotpads.

the class AuroraInstancesHandler method inspectClientUrl.

@Handler(defaultHandler = true)
public Mav inspectClientUrl() {
    List<DnsHostEntryDto> otherReaderInstances = new ArrayList<>();
    List<ClientId> clientsMissingOtherInstances = new ArrayList<>();
    for (ClientId primaryClientId : dnsService.getPrimaryClientIds()) {
        DnsHostEntryDto otherEntry = dnsService.getOtherReader(primaryClientId.getName());
        if (otherEntry == null) {
            clientsMissingOtherInstances.add(primaryClientId);
        } else {
            otherReaderInstances.add(otherEntry);
        }
    }
    List<DomContent> fragments = new ArrayList<>();
    fragments.add(makeAuroraClientsTable("Aurora Clients", dnsService.checkClientEndpoint().getLeft()));
    if (otherReaderInstances.size() != 0) {
        fragments.add(makeAuroraClientsTable("Aurora Other Instances", otherReaderInstances));
    }
    if (clientsMissingOtherInstances.size() != 0) {
        fragments.add(makeForm(clientsMissingOtherInstances));
    }
    ContainerTag<?> content = div(each(fragments.stream())).withClass("container my-4");
    return pageFactory.startBuilder(request).withTitle("Aurora Clients").withContent(content).buildMav();
}
Also used : ArrayList(java.util.ArrayList) ClientId(io.datarouter.storage.client.ClientId) DomContent(j2html.tags.DomContent) DnsHostEntryDto(io.datarouter.aws.rds.service.AuroraDnsService.DnsHostEntryDto) BaseHandler(io.datarouter.web.handler.BaseHandler)

Aggregations

DnsHostEntryDto (io.datarouter.aws.rds.service.AuroraDnsService.DnsHostEntryDto)1 ClientId (io.datarouter.storage.client.ClientId)1 BaseHandler (io.datarouter.web.handler.BaseHandler)1 DomContent (j2html.tags.DomContent)1 ArrayList (java.util.ArrayList)1