Search in sources :

Example 1 with NginxFrontend

use of org.openstack.service.nginx.model.NginxFrontend in project platformlayer by platformlayer.

the class NginxFrontendDns method buildItemTemplate.

@Override
protected DnsRecord buildItemTemplate() throws OpsException {
    // TODO: Idempotency etc
    // Machine machine = OpsContext.get().getInstance(Machine.class);
    NginxService nginxService = OpsContext.get().getInstance(NginxService.class);
    NginxFrontend nginxFrontend = OpsContext.get().getInstance(NginxFrontend.class);
    Machine machine = instanceHelpers.getMachine(nginxService);
    String address = machine.getNetworkPoint().getBestAddress(NetworkPoint.forPublicInternet());
    DnsRecord record = new DnsRecord();
    record.setDnsName(nginxFrontend.hostname);
    record.getAddress().add(address);
    Tag parentTag = Tag.buildParentTag(nginxFrontend.getKey());
    record.getTags().add(parentTag);
    Tag uniqueTag = UniqueTag.build(nginxService, nginxFrontend);
    record.getTags().add(uniqueTag);
    record.key = PlatformLayerKey.fromId(nginxFrontend.hostname);
    return record;
}
Also used : NginxFrontend(org.openstack.service.nginx.model.NginxFrontend) UniqueTag(org.platformlayer.ops.UniqueTag) Tag(org.platformlayer.core.model.Tag) DnsRecord(org.platformlayer.dns.model.DnsRecord) Machine(org.platformlayer.ops.Machine) NginxService(org.openstack.service.nginx.model.NginxService)

Example 2 with NginxFrontend

use of org.openstack.service.nginx.model.NginxFrontend in project platformlayer by platformlayer.

the class SiteTemplateData method buildTemplateModel.

@Override
public void buildTemplateModel(Map<String, Object> model) throws OpsException {
    NginxFrontend nginxFrontend = getNginxFrontend();
    model.put("uniqueKey", getUniqueKey());
    model.put("hostname", getHostname());
    model.put("httpPort", httpPort);
    model.put("httpsPort", httpsPort);
    model.put("useSsl", false);
    List<NginxBackend> backends = getBackends(nginxFrontend.hostname);
    List<BackendModel> resolvedBackends = resolveBackends(backends);
    model.put("backends", resolvedBackends);
}
Also used : NginxFrontend(org.openstack.service.nginx.model.NginxFrontend) NginxBackend(org.openstack.service.nginx.model.NginxBackend)

Aggregations

NginxFrontend (org.openstack.service.nginx.model.NginxFrontend)2 NginxBackend (org.openstack.service.nginx.model.NginxBackend)1 NginxService (org.openstack.service.nginx.model.NginxService)1 Tag (org.platformlayer.core.model.Tag)1 DnsRecord (org.platformlayer.dns.model.DnsRecord)1 Machine (org.platformlayer.ops.Machine)1 UniqueTag (org.platformlayer.ops.UniqueTag)1