use of org.platformlayer.service.network.v1.NetworkConnection 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.service.network.v1.NetworkConnection in project platformlayer by platformlayer.
the class PlatformLayerTestContext method openFirewall.
public NetworkConnection openFirewall(ItemBase item, int port) throws OpsException, IOException {
NetworkConnection firewallRule = new NetworkConnection();
firewallRule.setSourceCidr("0.0.0.0/0");
firewallRule.setDestItem(item.getKey());
firewallRule.setPort(port);
String id = item.getId() + "-global";
firewallRule = putItem(id, firewallRule);
waitForHealthy(firewallRule);
return firewallRule;
}
Aggregations