me.snowdrop.istio.api.model.v1.networking.TrafficPolicyFluentImpl Maven / Gradle / Ivy
package me.snowdrop.istio.api.model.v1.networking;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import io.fabric8.kubernetes.api.builder.Predicate;
import java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import javax.validation.Valid;
import java.util.Collection;
import java.lang.Object;
public class TrafficPolicyFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements TrafficPolicyFluent{
private ConnectionPoolSettingsBuilder connectionPool;
private LoadBalancerSettingsBuilder loadBalancer;
private OutlierDetectionBuilder outlierDetection;
private List portLevelSettings;
private TLSSettingsBuilder tls;
public TrafficPolicyFluentImpl(){
}
public TrafficPolicyFluentImpl(TrafficPolicy instance){
this.withConnectionPool(instance.getConnectionPool());
this.withLoadBalancer(instance.getLoadBalancer());
this.withOutlierDetection(instance.getOutlierDetection());
this.withPortLevelSettings(instance.getPortLevelSettings());
this.withTls(instance.getTls());
}
/**
* This method has been deprecated, please use method buildConnectionPool instead.
*/
@Deprecated public ConnectionPoolSettings getConnectionPool(){
return this.connectionPool!=null?this.connectionPool.build():null;
}
public ConnectionPoolSettings buildConnectionPool(){
return this.connectionPool!=null?this.connectionPool.build():null;
}
public A withConnectionPool(ConnectionPoolSettings connectionPool){
_visitables.remove(this.connectionPool);
if (connectionPool!=null){ this.connectionPool= new ConnectionPoolSettingsBuilder(connectionPool); _visitables.add(this.connectionPool);} return (A) this;
}
public Boolean hasConnectionPool(){
return this.connectionPool != null;
}
public TrafficPolicyFluent.ConnectionPoolNested withNewConnectionPool(){
return new ConnectionPoolNestedImpl();
}
public TrafficPolicyFluent.ConnectionPoolNested withNewConnectionPoolLike(ConnectionPoolSettings item){
return new ConnectionPoolNestedImpl(item);
}
public TrafficPolicyFluent.ConnectionPoolNested editConnectionPool(){
return withNewConnectionPoolLike(getConnectionPool());
}
public TrafficPolicyFluent.ConnectionPoolNested editOrNewConnectionPool(){
return withNewConnectionPoolLike(getConnectionPool() != null ? getConnectionPool(): new ConnectionPoolSettingsBuilder().build());
}
public TrafficPolicyFluent.ConnectionPoolNested editOrNewConnectionPoolLike(ConnectionPoolSettings item){
return withNewConnectionPoolLike(getConnectionPool() != null ? getConnectionPool(): item);
}
/**
* This method has been deprecated, please use method buildLoadBalancer instead.
*/
@Deprecated public LoadBalancerSettings getLoadBalancer(){
return this.loadBalancer!=null?this.loadBalancer.build():null;
}
public LoadBalancerSettings buildLoadBalancer(){
return this.loadBalancer!=null?this.loadBalancer.build():null;
}
public A withLoadBalancer(LoadBalancerSettings loadBalancer){
_visitables.remove(this.loadBalancer);
if (loadBalancer!=null){ this.loadBalancer= new LoadBalancerSettingsBuilder(loadBalancer); _visitables.add(this.loadBalancer);} return (A) this;
}
public Boolean hasLoadBalancer(){
return this.loadBalancer != null;
}
public A withNewLoadBalancer(Object lbPolicy){
return (A)withLoadBalancer(new LoadBalancerSettings(lbPolicy));
}
public TrafficPolicyFluent.LoadBalancerNested withNewLoadBalancer(){
return new LoadBalancerNestedImpl();
}
public TrafficPolicyFluent.LoadBalancerNested withNewLoadBalancerLike(LoadBalancerSettings item){
return new LoadBalancerNestedImpl(item);
}
public TrafficPolicyFluent.LoadBalancerNested editLoadBalancer(){
return withNewLoadBalancerLike(getLoadBalancer());
}
public TrafficPolicyFluent.LoadBalancerNested editOrNewLoadBalancer(){
return withNewLoadBalancerLike(getLoadBalancer() != null ? getLoadBalancer(): new LoadBalancerSettingsBuilder().build());
}
public TrafficPolicyFluent.LoadBalancerNested editOrNewLoadBalancerLike(LoadBalancerSettings item){
return withNewLoadBalancerLike(getLoadBalancer() != null ? getLoadBalancer(): item);
}
/**
* This method has been deprecated, please use method buildOutlierDetection instead.
*/
@Deprecated public OutlierDetection getOutlierDetection(){
return this.outlierDetection!=null?this.outlierDetection.build():null;
}
public OutlierDetection buildOutlierDetection(){
return this.outlierDetection!=null?this.outlierDetection.build():null;
}
public A withOutlierDetection(OutlierDetection outlierDetection){
_visitables.remove(this.outlierDetection);
if (outlierDetection!=null){ this.outlierDetection= new OutlierDetectionBuilder(outlierDetection); _visitables.add(this.outlierDetection);} return (A) this;
}
public Boolean hasOutlierDetection(){
return this.outlierDetection != null;
}
public TrafficPolicyFluent.OutlierDetectionNested withNewOutlierDetection(){
return new OutlierDetectionNestedImpl();
}
public TrafficPolicyFluent.OutlierDetectionNested withNewOutlierDetectionLike(OutlierDetection item){
return new OutlierDetectionNestedImpl(item);
}
public TrafficPolicyFluent.OutlierDetectionNested editOutlierDetection(){
return withNewOutlierDetectionLike(getOutlierDetection());
}
public TrafficPolicyFluent.OutlierDetectionNested editOrNewOutlierDetection(){
return withNewOutlierDetectionLike(getOutlierDetection() != null ? getOutlierDetection(): new OutlierDetectionBuilder().build());
}
public TrafficPolicyFluent.OutlierDetectionNested editOrNewOutlierDetectionLike(OutlierDetection item){
return withNewOutlierDetectionLike(getOutlierDetection() != null ? getOutlierDetection(): item);
}
public A addToPortLevelSettings(int index,PortTrafficPolicy item){
if (this.portLevelSettings == null) {this.portLevelSettings = new ArrayList();}
PortTrafficPolicyBuilder builder = new PortTrafficPolicyBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.portLevelSettings.add(index >= 0 ? index : portLevelSettings.size(), builder); return (A)this;
}
public A setToPortLevelSettings(int index,PortTrafficPolicy item){
if (this.portLevelSettings == null) {this.portLevelSettings = new ArrayList();}
PortTrafficPolicyBuilder builder = new PortTrafficPolicyBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= portLevelSettings.size()) { portLevelSettings.add(builder); } else { portLevelSettings.set(index, builder);}
return (A)this;
}
public A addToPortLevelSettings(PortTrafficPolicy... items){
if (this.portLevelSettings == null) {this.portLevelSettings = new ArrayList();}
for (PortTrafficPolicy item : items) {PortTrafficPolicyBuilder builder = new PortTrafficPolicyBuilder(item);_visitables.add(builder);this.portLevelSettings.add(builder);} return (A)this;
}
public A addAllToPortLevelSettings(Collection items){
if (this.portLevelSettings == null) {this.portLevelSettings = new ArrayList();}
for (PortTrafficPolicy item : items) {PortTrafficPolicyBuilder builder = new PortTrafficPolicyBuilder(item);_visitables.add(builder);this.portLevelSettings.add(builder);} return (A)this;
}
public A removeFromPortLevelSettings(PortTrafficPolicy... items){
for (PortTrafficPolicy item : items) {PortTrafficPolicyBuilder builder = new PortTrafficPolicyBuilder(item);_visitables.remove(builder);if (this.portLevelSettings != null) {this.portLevelSettings.remove(builder);}} return (A)this;
}
public A removeAllFromPortLevelSettings(Collection items){
for (PortTrafficPolicy item : items) {PortTrafficPolicyBuilder builder = new PortTrafficPolicyBuilder(item);_visitables.remove(builder);if (this.portLevelSettings != null) {this.portLevelSettings.remove(builder);}} return (A)this;
}
/**
* This method has been deprecated, please use method buildPortLevelSettings instead.
*/
@Deprecated public List getPortLevelSettings(){
return build(portLevelSettings);
}
public List buildPortLevelSettings(){
return build(portLevelSettings);
}
public PortTrafficPolicy buildPortLevelSetting(int index){
return this.portLevelSettings.get(index).build();
}
public PortTrafficPolicy buildFirstPortLevelSetting(){
return this.portLevelSettings.get(0).build();
}
public PortTrafficPolicy buildLastPortLevelSetting(){
return this.portLevelSettings.get(portLevelSettings.size() - 1).build();
}
public PortTrafficPolicy buildMatchingPortLevelSetting(io.fabric8.kubernetes.api.builder.Predicate predicate){
for (PortTrafficPolicyBuilder item: portLevelSettings) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withPortLevelSettings(List portLevelSettings){
if (this.portLevelSettings != null) { _visitables.removeAll(this.portLevelSettings);}
if (portLevelSettings != null) {this.portLevelSettings = new ArrayList(); for (PortTrafficPolicy item : portLevelSettings){this.addToPortLevelSettings(item);}} else { this.portLevelSettings = null;} return (A) this;
}
public A withPortLevelSettings(PortTrafficPolicy... portLevelSettings){
this.portLevelSettings.clear(); if (portLevelSettings != null) {for (PortTrafficPolicy item :portLevelSettings){ this.addToPortLevelSettings(item);}} return (A) this;
}
public Boolean hasPortLevelSettings(){
return portLevelSettings != null && !portLevelSettings.isEmpty();
}
public TrafficPolicyFluent.PortLevelSettingsNested addNewPortLevelSetting(){
return new PortLevelSettingsNestedImpl();
}
public TrafficPolicyFluent.PortLevelSettingsNested addNewPortLevelSettingLike(PortTrafficPolicy item){
return new PortLevelSettingsNestedImpl(-1, item);
}
public TrafficPolicyFluent.PortLevelSettingsNested setNewPortLevelSettingLike(int index,PortTrafficPolicy item){
return new PortLevelSettingsNestedImpl(index, item);
}
public TrafficPolicyFluent.PortLevelSettingsNested editPortLevelSetting(int index){
if (portLevelSettings.size() <= index) throw new RuntimeException("Can't edit portLevelSettings. Index exceeds size.");
return setNewPortLevelSettingLike(index, buildPortLevelSetting(index));
}
public TrafficPolicyFluent.PortLevelSettingsNested editFirstPortLevelSetting(){
if (portLevelSettings.size() == 0) throw new RuntimeException("Can't edit first portLevelSettings. The list is empty.");
return setNewPortLevelSettingLike(0, buildPortLevelSetting(0));
}
public TrafficPolicyFluent.PortLevelSettingsNested editLastPortLevelSetting(){
int index = portLevelSettings.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last portLevelSettings. The list is empty.");
return setNewPortLevelSettingLike(index, buildPortLevelSetting(index));
}
public TrafficPolicyFluent.PortLevelSettingsNested editMatchingPortLevelSetting(io.fabric8.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i withNewTls(){
return new TlsNestedImpl();
}
public TrafficPolicyFluent.TlsNested withNewTlsLike(TLSSettings item){
return new TlsNestedImpl(item);
}
public TrafficPolicyFluent.TlsNested editTls(){
return withNewTlsLike(getTls());
}
public TrafficPolicyFluent.TlsNested editOrNewTls(){
return withNewTlsLike(getTls() != null ? getTls(): new TLSSettingsBuilder().build());
}
public TrafficPolicyFluent.TlsNested editOrNewTlsLike(TLSSettings item){
return withNewTlsLike(getTls() != null ? getTls(): item);
}
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
TrafficPolicyFluentImpl that = (TrafficPolicyFluentImpl) o;
if (connectionPool != null ? !connectionPool.equals(that.connectionPool) :that.connectionPool != null) return false;
if (loadBalancer != null ? !loadBalancer.equals(that.loadBalancer) :that.loadBalancer != null) return false;
if (outlierDetection != null ? !outlierDetection.equals(that.outlierDetection) :that.outlierDetection != null) return false;
if (portLevelSettings != null ? !portLevelSettings.equals(that.portLevelSettings) :that.portLevelSettings != null) return false;
if (tls != null ? !tls.equals(that.tls) :that.tls != null) return false;
return true;
}
public class ConnectionPoolNestedImpl extends ConnectionPoolSettingsFluentImpl> implements TrafficPolicyFluent.ConnectionPoolNested,io.fabric8.kubernetes.api.builder.Nested{
private final ConnectionPoolSettingsBuilder builder;
ConnectionPoolNestedImpl(ConnectionPoolSettings item){
this.builder = new ConnectionPoolSettingsBuilder(this, item);
}
ConnectionPoolNestedImpl(){
this.builder = new ConnectionPoolSettingsBuilder(this);
}
public N and(){
return (N) TrafficPolicyFluentImpl.this.withConnectionPool(builder.build());
}
public N endConnectionPool(){
return and();
}
}
public class LoadBalancerNestedImpl extends LoadBalancerSettingsFluentImpl> implements TrafficPolicyFluent.LoadBalancerNested,io.fabric8.kubernetes.api.builder.Nested{
private final LoadBalancerSettingsBuilder builder;
LoadBalancerNestedImpl(LoadBalancerSettings item){
this.builder = new LoadBalancerSettingsBuilder(this, item);
}
LoadBalancerNestedImpl(){
this.builder = new LoadBalancerSettingsBuilder(this);
}
public N and(){
return (N) TrafficPolicyFluentImpl.this.withLoadBalancer(builder.build());
}
public N endLoadBalancer(){
return and();
}
}
public class OutlierDetectionNestedImpl extends OutlierDetectionFluentImpl> implements TrafficPolicyFluent.OutlierDetectionNested,io.fabric8.kubernetes.api.builder.Nested{
private final OutlierDetectionBuilder builder;
OutlierDetectionNestedImpl(OutlierDetection item){
this.builder = new OutlierDetectionBuilder(this, item);
}
OutlierDetectionNestedImpl(){
this.builder = new OutlierDetectionBuilder(this);
}
public N and(){
return (N) TrafficPolicyFluentImpl.this.withOutlierDetection(builder.build());
}
public N endOutlierDetection(){
return and();
}
}
public class PortLevelSettingsNestedImpl extends PortTrafficPolicyFluentImpl> implements TrafficPolicyFluent.PortLevelSettingsNested,io.fabric8.kubernetes.api.builder.Nested{
private final PortTrafficPolicyBuilder builder;
private final int index;
PortLevelSettingsNestedImpl(int index,PortTrafficPolicy item){
this.index = index;
this.builder = new PortTrafficPolicyBuilder(this, item);
}
PortLevelSettingsNestedImpl(){
this.index = -1;
this.builder = new PortTrafficPolicyBuilder(this);
}
public N and(){
return (N) TrafficPolicyFluentImpl.this.setToPortLevelSettings(index, builder.build());
}
public N endPortLevelSetting(){
return and();
}
}
public class TlsNestedImpl extends TLSSettingsFluentImpl> implements TrafficPolicyFluent.TlsNested,io.fabric8.kubernetes.api.builder.Nested{
private final TLSSettingsBuilder builder;
TlsNestedImpl(TLSSettings item){
this.builder = new TLSSettingsBuilder(this, item);
}
TlsNestedImpl(){
this.builder = new TLSSettingsBuilder(this);
}
public N and(){
return (N) TrafficPolicyFluentImpl.this.withTls(builder.build());
}
public N endTls(){
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy