
io.kubernetes.client.openapi.models.V1LoadBalancerIngressFluentImpl Maven / Gradle / Ivy
package io.kubernetes.client.openapi.models;
import io.kubernetes.client.fluent.VisitableBuilder;
import java.lang.StringBuilder;
import com.google.gson.annotations.SerializedName;
import io.kubernetes.client.fluent.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.kubernetes.client.fluent.Predicate;
import java.lang.StringBuffer;
import java.lang.Deprecated;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
public class V1LoadBalancerIngressFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1LoadBalancerIngressFluent {
private String hostname;
private String ip;
private List ports;
public V1LoadBalancerIngressFluentImpl() {
}
public V1LoadBalancerIngressFluentImpl(V1LoadBalancerIngress instance) {
this.withHostname(instance.getHostname());
this.withIp(instance.getIp());
this.withPorts(instance.getPorts());
}
public String getHostname() {
return this.hostname;
}
public A withHostname(String hostname) {
this.hostname=hostname; return (A) this;
}
public Boolean hasHostname() {
return this.hostname != null;
}
public A withNewHostname(String arg1) {
return (A)withHostname(new String(arg1));
}
public A withNewHostname(StringBuilder arg1) {
return (A)withHostname(new String(arg1));
}
public A withNewHostname(StringBuffer arg1) {
return (A)withHostname(new String(arg1));
}
public String getIp() {
return this.ip;
}
public A withIp(String ip) {
this.ip=ip; return (A) this;
}
public Boolean hasIp() {
return this.ip != null;
}
public A withNewIp(String arg1) {
return (A)withIp(new String(arg1));
}
public A withNewIp(StringBuilder arg1) {
return (A)withIp(new String(arg1));
}
public A withNewIp(StringBuffer arg1) {
return (A)withIp(new String(arg1));
}
public A addToPorts(int index,V1PortStatus item) {
if (this.ports == null) {this.ports = new ArrayList();}
V1PortStatusBuilder builder = new V1PortStatusBuilder(item);_visitables.get("ports").add(index >= 0 ? index : _visitables.get("ports").size(), builder);this.ports.add(index >= 0 ? index : ports.size(), builder); return (A)this;
}
public A setToPorts(int index,V1PortStatus item) {
if (this.ports == null) {this.ports = new ArrayList();}
V1PortStatusBuilder builder = new V1PortStatusBuilder(item);
if (index < 0 || index >= _visitables.get("ports").size()) { _visitables.get("ports").add(builder); } else { _visitables.get("ports").set(index, builder);}
if (index < 0 || index >= ports.size()) { ports.add(builder); } else { ports.set(index, builder);}
return (A)this;
}
public A addToPorts(V1PortStatus... items) {
if (this.ports == null) {this.ports = new ArrayList();}
for (V1PortStatus item : items) {V1PortStatusBuilder builder = new V1PortStatusBuilder(item);_visitables.get("ports").add(builder);this.ports.add(builder);} return (A)this;
}
public A addAllToPorts(Collection items) {
if (this.ports == null) {this.ports = new ArrayList();}
for (V1PortStatus item : items) {V1PortStatusBuilder builder = new V1PortStatusBuilder(item);_visitables.get("ports").add(builder);this.ports.add(builder);} return (A)this;
}
public A removeFromPorts(V1PortStatus... items) {
for (V1PortStatus item : items) {V1PortStatusBuilder builder = new V1PortStatusBuilder(item);_visitables.get("ports").remove(builder);if (this.ports != null) {this.ports.remove(builder);}} return (A)this;
}
public A removeAllFromPorts(Collection items) {
for (V1PortStatus item : items) {V1PortStatusBuilder builder = new V1PortStatusBuilder(item);_visitables.get("ports").remove(builder);if (this.ports != null) {this.ports.remove(builder);}} return (A)this;
}
public A removeMatchingFromPorts(io.kubernetes.client.fluent.Predicate predicate) {
if (ports == null) return (A) this;
final Iterator each = ports.iterator();
final List visitables = _visitables.get("ports");
while (each.hasNext()) {
V1PortStatusBuilder builder = each.next();
if (predicate.apply(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildPorts instead.
* @return The buildable object.
*/
@Deprecated public List getPorts() {
return build(ports);
}
public List buildPorts() {
return build(ports);
}
public V1PortStatus buildPort(int index) {
return this.ports.get(index).build();
}
public V1PortStatus buildFirstPort() {
return this.ports.get(0).build();
}
public V1PortStatus buildLastPort() {
return this.ports.get(ports.size() - 1).build();
}
public V1PortStatus buildMatchingPort(io.kubernetes.client.fluent.Predicate predicate) {
for (V1PortStatusBuilder item: ports) { if(predicate.apply(item)){ return item.build();} } return null;
}
public Boolean hasMatchingPort(io.kubernetes.client.fluent.Predicate predicate) {
for (V1PortStatusBuilder item: ports) { if(predicate.apply(item)){ return true;} } return false;
}
public A withPorts(List ports) {
if (this.ports != null) { _visitables.get("ports").removeAll(this.ports);}
if (ports != null) {this.ports = new ArrayList(); for (V1PortStatus item : ports){this.addToPorts(item);}} else { this.ports = null;} return (A) this;
}
public A withPorts(V1PortStatus... ports) {
if (this.ports != null) {this.ports.clear();}
if (ports != null) {for (V1PortStatus item :ports){ this.addToPorts(item);}} return (A) this;
}
public Boolean hasPorts() {
return ports != null && !ports.isEmpty();
}
public V1LoadBalancerIngressFluent.PortsNested addNewPort() {
return new PortsNestedImpl();
}
public V1LoadBalancerIngressFluent.PortsNested addNewPortLike(V1PortStatus item) {
return new PortsNestedImpl(-1, item);
}
public V1LoadBalancerIngressFluent.PortsNested setNewPortLike(int index,V1PortStatus item) {
return new PortsNestedImpl(index, item);
}
public V1LoadBalancerIngressFluent.PortsNested editPort(int index) {
if (ports.size() <= index) throw new RuntimeException("Can't edit ports. Index exceeds size.");
return setNewPortLike(index, buildPort(index));
}
public V1LoadBalancerIngressFluent.PortsNested editFirstPort() {
if (ports.size() == 0) throw new RuntimeException("Can't edit first ports. The list is empty.");
return setNewPortLike(0, buildPort(0));
}
public V1LoadBalancerIngressFluent.PortsNested editLastPort() {
int index = ports.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last ports. The list is empty.");
return setNewPortLike(index, buildPort(index));
}
public V1LoadBalancerIngressFluent.PortsNested editMatchingPort(io.kubernetes.client.fluent.Predicate predicate) {
int index = -1;
for (int i=0;i extends V1PortStatusFluentImpl> implements V1LoadBalancerIngressFluent.PortsNested,io.kubernetes.client.fluent.Nested {
private final V1PortStatusBuilder builder;
private final int index;
PortsNestedImpl(int index,V1PortStatus item) {
this.index = index;
this.builder = new V1PortStatusBuilder(this, item);
}
PortsNestedImpl() {
this.index = -1;
this.builder = new V1PortStatusBuilder(this);
}
public N and() {
return (N) V1LoadBalancerIngressFluentImpl.this.setToPorts(index,builder.build());
}
public N endPort() {
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy