Builder(NetworkConfig source) { this.name = source.name(); this.driver = source.driver(); this.ipam = source.ipam(); this.options = source.options(); this.checkDuplicate = source.checkDuplicate(); this.internal = source.internal(); this.enableIPv6 = source.enableIPv6(); this.attachable = source.attachable(); this.labels = source.labels(); } @Override
private void createNetworkIfDoesntExist(String networkName) throws Exception { synchronized (DockerTaskRunner.class) { if (!this.client.hasNetwork(networkName)) { com.spotify.docker.client.messages.NetworkConfig.Builder networkConfig = NetworkConfig.builder(); networkConfig.name(networkName); networkConfig.attachable(true); docker.createNetwork(networkConfig.build()); } } }
/** * Sets up a docker network. * * @throws UniverseException will be thrown if cannot set up a docker network */ void setup() { String networkName = universeParams.getNetworkName(); log.info("Setup network: {}", networkName); NetworkConfig networkConfig = NetworkConfig.builder() .checkDuplicate(true) .attachable(true) .name(networkName) .build(); try { docker.createNetwork(networkConfig); } catch (Exception e) { throw new UniverseException("Cannot setup docker network.", e); } }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof NetworkConfig) { NetworkConfig that = (NetworkConfig) o; return (this.name.equals(that.name())) && ((this.driver == null) ? (that.driver() == null) : this.driver.equals(that.driver())) && ((this.ipam == null) ? (that.ipam() == null) : this.ipam.equals(that.ipam())) && (this.options.equals(that.options())) && ((this.checkDuplicate == null) ? (that.checkDuplicate() == null) : this.checkDuplicate.equals(that.checkDuplicate())) && ((this.internal == null) ? (that.internal() == null) : this.internal.equals(that.internal())) && ((this.enableIPv6 == null) ? (that.enableIPv6() == null) : this.enableIPv6.equals(that.enableIPv6())) && ((this.attachable == null) ? (that.attachable() == null) : this.attachable.equals(that.attachable())) && ((this.labels == null) ? (that.labels() == null) : this.labels.equals(that.labels())); } return false; }
Builder(NetworkConfig source) { this.name = source.name(); this.driver = source.driver(); this.ipam = source.ipam(); this.options = source.options(); this.checkDuplicate = source.checkDuplicate(); this.internal = source.internal(); this.enableIPv6 = source.enableIPv6(); this.attachable = source.attachable(); this.labels = source.labels(); } @Override
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof NetworkConfig) { NetworkConfig that = (NetworkConfig) o; return (this.name.equals(that.name())) && ((this.driver == null) ? (that.driver() == null) : this.driver.equals(that.driver())) && ((this.ipam == null) ? (that.ipam() == null) : this.ipam.equals(that.ipam())) && (this.options.equals(that.options())) && ((this.checkDuplicate == null) ? (that.checkDuplicate() == null) : this.checkDuplicate.equals(that.checkDuplicate())) && ((this.internal == null) ? (that.internal() == null) : this.internal.equals(that.internal())) && ((this.enableIPv6 == null) ? (that.enableIPv6() == null) : this.enableIPv6.equals(that.enableIPv6())) && ((this.attachable == null) ? (that.attachable() == null) : this.attachable.equals(that.attachable())) && ((this.labels == null) ? (that.labels() == null) : this.labels.equals(that.labels())); } return false; }