use of org.platformlayer.ops.UniqueTag in project platformlayer by platformlayer.
the class OwnedEndpoint method buildItemTemplate.
@Override
protected PublicEndpointBase buildItemTemplate() throws OpsException {
InstanceBase instance = OpsContext.get().getInstance(InstanceBase.class);
PlatformLayerKey instanceKey = instance.getKey();
PublicEndpointBase publicEndpoint = platformLayerCloudHelpers.createPublicEndpoint(instance, parentItem);
// publicEndpoint.network = network;
publicEndpoint.publicPort = publicPort;
publicEndpoint.publicPortCluster = publicPortCluster;
publicEndpoint.backendPort = backendPort;
publicEndpoint.instance = instanceKey;
publicEndpoint.key = PlatformLayerKey.fromId(instance.getId() + "_" + publicPort);
if (transport != null) {
publicEndpoint.transport = transport.toString();
}
// publicEndpoint.getTags().add(OpsSystem.get().createParentTag(instance));
Tag uniqueTag = UniqueTag.build(instance, String.valueOf(publicPort));
publicEndpoint.getTags().add(uniqueTag);
return publicEndpoint;
}
use of org.platformlayer.ops.UniqueTag in project platformlayer by platformlayer.
the class NginxBackendFirewall method buildItemTemplate.
@Override
protected ItemBase buildItemTemplate() {
NginxService nginxService = OpsContext.get().getInstance(NginxService.class);
NginxBackend nginxBackend = OpsContext.get().getInstance(NginxBackend.class);
NetworkConnection networkConnection = new NetworkConnection();
networkConnection.setDestItem(nginxBackend.backend);
networkConnection.setSourceItem(nginxService.getKey());
networkConnection.setPort(port);
networkConnection.setProtocol(protocol.toString());
Tag parentTag = Tag.buildParentTag(nginxBackend.getKey());
networkConnection.getTags().add(parentTag);
Tag uniqueTag = UniqueTag.build(nginxService, nginxBackend);
networkConnection.getTags().add(uniqueTag);
String id = nginxBackend.getId();
if (Strings.isNullOrEmpty(id)) {
id = "nginx";
}
networkConnection.key = PlatformLayerKey.fromId(id);
return networkConnection;
}
use of org.platformlayer.ops.UniqueTag 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;
}
Aggregations