io.kubernetes.client.openapi.models.V1IngressSpecFluentImpl 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.Deprecated;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import java.lang.StringBuffer;
import java.util.Collection;
import java.lang.Object;
public class V1IngressSpecFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1IngressSpecFluent {
private V1IngressBackendBuilder defaultBackend;
private String ingressClassName;
private List rules;
private List tls;
public V1IngressSpecFluentImpl() {
}
public V1IngressSpecFluentImpl(V1IngressSpec instance) {
this.withDefaultBackend(instance.getDefaultBackend());
this.withIngressClassName(instance.getIngressClassName());
this.withRules(instance.getRules());
this.withTls(instance.getTls());
}
/**
* This method has been deprecated, please use method buildDefaultBackend instead.
* @return The buildable object.
*/
@Deprecated public V1IngressBackend getDefaultBackend() {
return this.defaultBackend!=null?this.defaultBackend.build():null;
}
public V1IngressBackend buildDefaultBackend() {
return this.defaultBackend!=null?this.defaultBackend.build():null;
}
public A withDefaultBackend(V1IngressBackend defaultBackend) {
_visitables.get("defaultBackend").remove(this.defaultBackend);
if (defaultBackend!=null){ this.defaultBackend= new V1IngressBackendBuilder(defaultBackend); _visitables.get("defaultBackend").add(this.defaultBackend);} return (A) this;
}
public Boolean hasDefaultBackend() {
return this.defaultBackend != null;
}
public V1IngressSpecFluent.DefaultBackendNested withNewDefaultBackend() {
return new DefaultBackendNestedImpl();
}
public V1IngressSpecFluent.DefaultBackendNested withNewDefaultBackendLike(V1IngressBackend item) {
return new DefaultBackendNestedImpl(item);
}
public V1IngressSpecFluent.DefaultBackendNested editDefaultBackend() {
return withNewDefaultBackendLike(getDefaultBackend());
}
public V1IngressSpecFluent.DefaultBackendNested editOrNewDefaultBackend() {
return withNewDefaultBackendLike(getDefaultBackend() != null ? getDefaultBackend(): new V1IngressBackendBuilder().build());
}
public V1IngressSpecFluent.DefaultBackendNested editOrNewDefaultBackendLike(V1IngressBackend item) {
return withNewDefaultBackendLike(getDefaultBackend() != null ? getDefaultBackend(): item);
}
public String getIngressClassName() {
return this.ingressClassName;
}
public A withIngressClassName(String ingressClassName) {
this.ingressClassName=ingressClassName; return (A) this;
}
public Boolean hasIngressClassName() {
return this.ingressClassName != null;
}
public A withNewIngressClassName(String arg1) {
return (A)withIngressClassName(new String(arg1));
}
public A withNewIngressClassName(StringBuilder arg1) {
return (A)withIngressClassName(new String(arg1));
}
public A withNewIngressClassName(StringBuffer arg1) {
return (A)withIngressClassName(new String(arg1));
}
public A addToRules(int index,V1IngressRule item) {
if (this.rules == null) {this.rules = new ArrayList();}
V1IngressRuleBuilder builder = new V1IngressRuleBuilder(item);_visitables.get("rules").add(index >= 0 ? index : _visitables.get("rules").size(), builder);this.rules.add(index >= 0 ? index : rules.size(), builder); return (A)this;
}
public A setToRules(int index,V1IngressRule item) {
if (this.rules == null) {this.rules = new ArrayList();}
V1IngressRuleBuilder builder = new V1IngressRuleBuilder(item);
if (index < 0 || index >= _visitables.get("rules").size()) { _visitables.get("rules").add(builder); } else { _visitables.get("rules").set(index, builder);}
if (index < 0 || index >= rules.size()) { rules.add(builder); } else { rules.set(index, builder);}
return (A)this;
}
public A addToRules(V1IngressRule... items) {
if (this.rules == null) {this.rules = new ArrayList();}
for (V1IngressRule item : items) {V1IngressRuleBuilder builder = new V1IngressRuleBuilder(item);_visitables.get("rules").add(builder);this.rules.add(builder);} return (A)this;
}
public A addAllToRules(Collection items) {
if (this.rules == null) {this.rules = new ArrayList();}
for (V1IngressRule item : items) {V1IngressRuleBuilder builder = new V1IngressRuleBuilder(item);_visitables.get("rules").add(builder);this.rules.add(builder);} return (A)this;
}
public A removeFromRules(V1IngressRule... items) {
for (V1IngressRule item : items) {V1IngressRuleBuilder builder = new V1IngressRuleBuilder(item);_visitables.get("rules").remove(builder);if (this.rules != null) {this.rules.remove(builder);}} return (A)this;
}
public A removeAllFromRules(Collection items) {
for (V1IngressRule item : items) {V1IngressRuleBuilder builder = new V1IngressRuleBuilder(item);_visitables.get("rules").remove(builder);if (this.rules != null) {this.rules.remove(builder);}} return (A)this;
}
public A removeMatchingFromRules(io.kubernetes.client.fluent.Predicate predicate) {
if (rules == null) return (A) this;
final Iterator each = rules.iterator();
final List visitables = _visitables.get("rules");
while (each.hasNext()) {
V1IngressRuleBuilder builder = each.next();
if (predicate.apply(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildRules instead.
* @return The buildable object.
*/
@Deprecated public List getRules() {
return build(rules);
}
public List buildRules() {
return build(rules);
}
public V1IngressRule buildRule(int index) {
return this.rules.get(index).build();
}
public V1IngressRule buildFirstRule() {
return this.rules.get(0).build();
}
public V1IngressRule buildLastRule() {
return this.rules.get(rules.size() - 1).build();
}
public V1IngressRule buildMatchingRule(io.kubernetes.client.fluent.Predicate predicate) {
for (V1IngressRuleBuilder item: rules) { if(predicate.apply(item)){ return item.build();} } return null;
}
public Boolean hasMatchingRule(io.kubernetes.client.fluent.Predicate predicate) {
for (V1IngressRuleBuilder item: rules) { if(predicate.apply(item)){ return true;} } return false;
}
public A withRules(List rules) {
if (this.rules != null) { _visitables.get("rules").removeAll(this.rules);}
if (rules != null) {this.rules = new ArrayList(); for (V1IngressRule item : rules){this.addToRules(item);}} else { this.rules = null;} return (A) this;
}
public A withRules(V1IngressRule... rules) {
if (this.rules != null) {this.rules.clear();}
if (rules != null) {for (V1IngressRule item :rules){ this.addToRules(item);}} return (A) this;
}
public Boolean hasRules() {
return rules != null && !rules.isEmpty();
}
public V1IngressSpecFluent.RulesNested addNewRule() {
return new RulesNestedImpl();
}
public V1IngressSpecFluent.RulesNested addNewRuleLike(V1IngressRule item) {
return new RulesNestedImpl(-1, item);
}
public V1IngressSpecFluent.RulesNested setNewRuleLike(int index,V1IngressRule item) {
return new RulesNestedImpl(index, item);
}
public V1IngressSpecFluent.RulesNested editRule(int index) {
if (rules.size() <= index) throw new RuntimeException("Can't edit rules. Index exceeds size.");
return setNewRuleLike(index, buildRule(index));
}
public V1IngressSpecFluent.RulesNested editFirstRule() {
if (rules.size() == 0) throw new RuntimeException("Can't edit first rules. The list is empty.");
return setNewRuleLike(0, buildRule(0));
}
public V1IngressSpecFluent.RulesNested editLastRule() {
int index = rules.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last rules. The list is empty.");
return setNewRuleLike(index, buildRule(index));
}
public V1IngressSpecFluent.RulesNested editMatchingRule(io.kubernetes.client.fluent.Predicate predicate) {
int index = -1;
for (int i=0;i();}
V1IngressTLSBuilder builder = new V1IngressTLSBuilder(item);_visitables.get("tls").add(index >= 0 ? index : _visitables.get("tls").size(), builder);this.tls.add(index >= 0 ? index : tls.size(), builder); return (A)this;
}
public A setToTls(int index,V1IngressTLS item) {
if (this.tls == null) {this.tls = new ArrayList();}
V1IngressTLSBuilder builder = new V1IngressTLSBuilder(item);
if (index < 0 || index >= _visitables.get("tls").size()) { _visitables.get("tls").add(builder); } else { _visitables.get("tls").set(index, builder);}
if (index < 0 || index >= tls.size()) { tls.add(builder); } else { tls.set(index, builder);}
return (A)this;
}
public A addToTls(V1IngressTLS... items) {
if (this.tls == null) {this.tls = new ArrayList();}
for (V1IngressTLS item : items) {V1IngressTLSBuilder builder = new V1IngressTLSBuilder(item);_visitables.get("tls").add(builder);this.tls.add(builder);} return (A)this;
}
public A addAllToTls(Collection items) {
if (this.tls == null) {this.tls = new ArrayList();}
for (V1IngressTLS item : items) {V1IngressTLSBuilder builder = new V1IngressTLSBuilder(item);_visitables.get("tls").add(builder);this.tls.add(builder);} return (A)this;
}
public A removeFromTls(V1IngressTLS... items) {
for (V1IngressTLS item : items) {V1IngressTLSBuilder builder = new V1IngressTLSBuilder(item);_visitables.get("tls").remove(builder);if (this.tls != null) {this.tls.remove(builder);}} return (A)this;
}
public A removeAllFromTls(Collection items) {
for (V1IngressTLS item : items) {V1IngressTLSBuilder builder = new V1IngressTLSBuilder(item);_visitables.get("tls").remove(builder);if (this.tls != null) {this.tls.remove(builder);}} return (A)this;
}
public A removeMatchingFromTls(io.kubernetes.client.fluent.Predicate predicate) {
if (tls == null) return (A) this;
final Iterator each = tls.iterator();
final List visitables = _visitables.get("tls");
while (each.hasNext()) {
V1IngressTLSBuilder builder = each.next();
if (predicate.apply(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildTls instead.
* @return The buildable object.
*/
@Deprecated public List getTls() {
return build(tls);
}
public List buildTls() {
return build(tls);
}
public V1IngressTLS buildTl(int index) {
return this.tls.get(index).build();
}
public V1IngressTLS buildFirstTl() {
return this.tls.get(0).build();
}
public V1IngressTLS buildLastTl() {
return this.tls.get(tls.size() - 1).build();
}
public V1IngressTLS buildMatchingTl(io.kubernetes.client.fluent.Predicate predicate) {
for (V1IngressTLSBuilder item: tls) { if(predicate.apply(item)){ return item.build();} } return null;
}
public Boolean hasMatchingTl(io.kubernetes.client.fluent.Predicate predicate) {
for (V1IngressTLSBuilder item: tls) { if(predicate.apply(item)){ return true;} } return false;
}
public A withTls(List tls) {
if (this.tls != null) { _visitables.get("tls").removeAll(this.tls);}
if (tls != null) {this.tls = new ArrayList(); for (V1IngressTLS item : tls){this.addToTls(item);}} else { this.tls = null;} return (A) this;
}
public A withTls(V1IngressTLS... tls) {
if (this.tls != null) {this.tls.clear();}
if (tls != null) {for (V1IngressTLS item :tls){ this.addToTls(item);}} return (A) this;
}
public Boolean hasTls() {
return tls != null && !tls.isEmpty();
}
public V1IngressSpecFluent.TlsNested addNewTl() {
return new TlsNestedImpl();
}
public V1IngressSpecFluent.TlsNested addNewTlLike(V1IngressTLS item) {
return new TlsNestedImpl(-1, item);
}
public V1IngressSpecFluent.TlsNested setNewTlLike(int index,V1IngressTLS item) {
return new TlsNestedImpl(index, item);
}
public V1IngressSpecFluent.TlsNested editTl(int index) {
if (tls.size() <= index) throw new RuntimeException("Can't edit tls. Index exceeds size.");
return setNewTlLike(index, buildTl(index));
}
public V1IngressSpecFluent.TlsNested editFirstTl() {
if (tls.size() == 0) throw new RuntimeException("Can't edit first tls. The list is empty.");
return setNewTlLike(0, buildTl(0));
}
public V1IngressSpecFluent.TlsNested editLastTl() {
int index = tls.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last tls. The list is empty.");
return setNewTlLike(index, buildTl(index));
}
public V1IngressSpecFluent.TlsNested editMatchingTl(io.kubernetes.client.fluent.Predicate predicate) {
int index = -1;
for (int i=0;i extends V1IngressBackendFluentImpl> implements V1IngressSpecFluent.DefaultBackendNested,io.kubernetes.client.fluent.Nested {
private final V1IngressBackendBuilder builder;
DefaultBackendNestedImpl(V1IngressBackend item) {
this.builder = new V1IngressBackendBuilder(this, item);
}
DefaultBackendNestedImpl() {
this.builder = new V1IngressBackendBuilder(this);
}
public N and() {
return (N) V1IngressSpecFluentImpl.this.withDefaultBackend(builder.build());
}
public N endDefaultBackend() {
return and();
}
}
public class RulesNestedImpl extends V1IngressRuleFluentImpl> implements V1IngressSpecFluent.RulesNested,io.kubernetes.client.fluent.Nested {
private final V1IngressRuleBuilder builder;
private final int index;
RulesNestedImpl(int index,V1IngressRule item) {
this.index = index;
this.builder = new V1IngressRuleBuilder(this, item);
}
RulesNestedImpl() {
this.index = -1;
this.builder = new V1IngressRuleBuilder(this);
}
public N and() {
return (N) V1IngressSpecFluentImpl.this.setToRules(index,builder.build());
}
public N endRule() {
return and();
}
}
public class TlsNestedImpl extends V1IngressTLSFluentImpl> implements V1IngressSpecFluent.TlsNested,io.kubernetes.client.fluent.Nested {
private final V1IngressTLSBuilder builder;
private final int index;
TlsNestedImpl(int index,V1IngressTLS item) {
this.index = index;
this.builder = new V1IngressTLSBuilder(this, item);
}
TlsNestedImpl() {
this.index = -1;
this.builder = new V1IngressTLSBuilder(this);
}
public N and() {
return (N) V1IngressSpecFluentImpl.this.setToTls(index,builder.build());
}
public N endTl() {
return and();
}
}
}