All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.kubernetes.client.openapi.models.NetworkingV1beta1IngressSpecFluentImpl Maven / Gradle / Ivy

There is a newer version: 22.0.0
Show newest version
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 NetworkingV1beta1IngressSpecFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements NetworkingV1beta1IngressSpecFluent {

    private NetworkingV1beta1IngressBackendBuilder backend;
    private String ingressClassName;
    private List rules;
    private List tls;

    public NetworkingV1beta1IngressSpecFluentImpl() { 
    }


    public NetworkingV1beta1IngressSpecFluentImpl(NetworkingV1beta1IngressSpec instance) { 
        this.withBackend(instance.getBackend());

        this.withIngressClassName(instance.getIngressClassName());

        this.withRules(instance.getRules());

        this.withTls(instance.getTls());

    }


    
/**
 * This method has been deprecated, please use method buildBackend instead.
 * @return The buildable object.
 */
@Deprecated public NetworkingV1beta1IngressBackend getBackend() {
        return this.backend!=null?this.backend.build():null;
    }

    public NetworkingV1beta1IngressBackend buildBackend() {
        return this.backend!=null?this.backend.build():null;
    }

    public A withBackend(NetworkingV1beta1IngressBackend backend) {
        _visitables.get("backend").remove(this.backend);
        if (backend!=null){ this.backend= new NetworkingV1beta1IngressBackendBuilder(backend); _visitables.get("backend").add(this.backend);} return (A) this;
    }

    public Boolean hasBackend() {
        return this.backend != null;
    }

    public NetworkingV1beta1IngressSpecFluent.BackendNested withNewBackend() {
        return new BackendNestedImpl();
    }

    public NetworkingV1beta1IngressSpecFluent.BackendNested withNewBackendLike(NetworkingV1beta1IngressBackend item) {
        return new BackendNestedImpl(item);
    }

    public NetworkingV1beta1IngressSpecFluent.BackendNested editBackend() {
        return withNewBackendLike(getBackend());
    }

    public NetworkingV1beta1IngressSpecFluent.BackendNested editOrNewBackend() {
        return withNewBackendLike(getBackend() != null ? getBackend(): new NetworkingV1beta1IngressBackendBuilder().build());
    }

    public NetworkingV1beta1IngressSpecFluent.BackendNested editOrNewBackendLike(NetworkingV1beta1IngressBackend item) {
        return withNewBackendLike(getBackend() != null ? getBackend(): 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,NetworkingV1beta1IngressRule item) {
        if (this.rules == null) {this.rules = new ArrayList();}
        NetworkingV1beta1IngressRuleBuilder builder = new NetworkingV1beta1IngressRuleBuilder(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,NetworkingV1beta1IngressRule item) {
        if (this.rules == null) {this.rules = new ArrayList();}
        NetworkingV1beta1IngressRuleBuilder builder = new NetworkingV1beta1IngressRuleBuilder(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(NetworkingV1beta1IngressRule... items) {
        if (this.rules == null) {this.rules = new ArrayList();}
        for (NetworkingV1beta1IngressRule item : items) {NetworkingV1beta1IngressRuleBuilder builder = new NetworkingV1beta1IngressRuleBuilder(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 (NetworkingV1beta1IngressRule item : items) {NetworkingV1beta1IngressRuleBuilder builder = new NetworkingV1beta1IngressRuleBuilder(item);_visitables.get("rules").add(builder);this.rules.add(builder);} return (A)this;
    }

    public A removeFromRules(NetworkingV1beta1IngressRule... items) {
        for (NetworkingV1beta1IngressRule item : items) {NetworkingV1beta1IngressRuleBuilder builder = new NetworkingV1beta1IngressRuleBuilder(item);_visitables.get("rules").remove(builder);if (this.rules != null) {this.rules.remove(builder);}} return (A)this;
    }

    public A removeAllFromRules(Collection items) {
        for (NetworkingV1beta1IngressRule item : items) {NetworkingV1beta1IngressRuleBuilder builder = new NetworkingV1beta1IngressRuleBuilder(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()) {
          NetworkingV1beta1IngressRuleBuilder 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 NetworkingV1beta1IngressRule buildRule(int index) {
        return this.rules.get(index).build();
    }

    public NetworkingV1beta1IngressRule buildFirstRule() {
        return this.rules.get(0).build();
    }

    public NetworkingV1beta1IngressRule buildLastRule() {
        return this.rules.get(rules.size() - 1).build();
    }

    public NetworkingV1beta1IngressRule buildMatchingRule(io.kubernetes.client.fluent.Predicate predicate) {
        for (NetworkingV1beta1IngressRuleBuilder item: rules) { if(predicate.apply(item)){ return item.build();} } return null;
    }

    public Boolean hasMatchingRule(io.kubernetes.client.fluent.Predicate predicate) {
        for (NetworkingV1beta1IngressRuleBuilder 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 (NetworkingV1beta1IngressRule item : rules){this.addToRules(item);}} else { this.rules = null;} return (A) this;
    }

    public A withRules(NetworkingV1beta1IngressRule... rules) {
        if (this.rules != null) {this.rules.clear();}
        if (rules != null) {for (NetworkingV1beta1IngressRule item :rules){ this.addToRules(item);}} return (A) this;
    }

    public Boolean hasRules() {
        return rules != null && !rules.isEmpty();
    }

    public NetworkingV1beta1IngressSpecFluent.RulesNested addNewRule() {
        return new RulesNestedImpl();
    }

    public NetworkingV1beta1IngressSpecFluent.RulesNested addNewRuleLike(NetworkingV1beta1IngressRule item) {
        return new RulesNestedImpl(-1, item);
    }

    public NetworkingV1beta1IngressSpecFluent.RulesNested setNewRuleLike(int index,NetworkingV1beta1IngressRule item) {
        return new RulesNestedImpl(index, item);
    }

    public NetworkingV1beta1IngressSpecFluent.RulesNested editRule(int index) {
        if (rules.size() <= index) throw new RuntimeException("Can't edit rules. Index exceeds size.");
        return setNewRuleLike(index, buildRule(index));
    }

    public NetworkingV1beta1IngressSpecFluent.RulesNested editFirstRule() {
        if (rules.size() == 0) throw new RuntimeException("Can't edit first rules. The list is empty.");
        return setNewRuleLike(0, buildRule(0));
    }

    public NetworkingV1beta1IngressSpecFluent.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 NetworkingV1beta1IngressSpecFluent.RulesNested editMatchingRule(io.kubernetes.client.fluent.Predicate predicate) {
        int index = -1;
        for (int i=0;i();}
        NetworkingV1beta1IngressTLSBuilder builder = new NetworkingV1beta1IngressTLSBuilder(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,NetworkingV1beta1IngressTLS item) {
        if (this.tls == null) {this.tls = new ArrayList();}
        NetworkingV1beta1IngressTLSBuilder builder = new NetworkingV1beta1IngressTLSBuilder(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(NetworkingV1beta1IngressTLS... items) {
        if (this.tls == null) {this.tls = new ArrayList();}
        for (NetworkingV1beta1IngressTLS item : items) {NetworkingV1beta1IngressTLSBuilder builder = new NetworkingV1beta1IngressTLSBuilder(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 (NetworkingV1beta1IngressTLS item : items) {NetworkingV1beta1IngressTLSBuilder builder = new NetworkingV1beta1IngressTLSBuilder(item);_visitables.get("tls").add(builder);this.tls.add(builder);} return (A)this;
    }

    public A removeFromTls(NetworkingV1beta1IngressTLS... items) {
        for (NetworkingV1beta1IngressTLS item : items) {NetworkingV1beta1IngressTLSBuilder builder = new NetworkingV1beta1IngressTLSBuilder(item);_visitables.get("tls").remove(builder);if (this.tls != null) {this.tls.remove(builder);}} return (A)this;
    }

    public A removeAllFromTls(Collection items) {
        for (NetworkingV1beta1IngressTLS item : items) {NetworkingV1beta1IngressTLSBuilder builder = new NetworkingV1beta1IngressTLSBuilder(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()) {
          NetworkingV1beta1IngressTLSBuilder 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 NetworkingV1beta1IngressTLS buildTl(int index) {
        return this.tls.get(index).build();
    }

    public NetworkingV1beta1IngressTLS buildFirstTl() {
        return this.tls.get(0).build();
    }

    public NetworkingV1beta1IngressTLS buildLastTl() {
        return this.tls.get(tls.size() - 1).build();
    }

    public NetworkingV1beta1IngressTLS buildMatchingTl(io.kubernetes.client.fluent.Predicate predicate) {
        for (NetworkingV1beta1IngressTLSBuilder item: tls) { if(predicate.apply(item)){ return item.build();} } return null;
    }

    public Boolean hasMatchingTl(io.kubernetes.client.fluent.Predicate predicate) {
        for (NetworkingV1beta1IngressTLSBuilder 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 (NetworkingV1beta1IngressTLS item : tls){this.addToTls(item);}} else { this.tls = null;} return (A) this;
    }

    public A withTls(NetworkingV1beta1IngressTLS... tls) {
        if (this.tls != null) {this.tls.clear();}
        if (tls != null) {for (NetworkingV1beta1IngressTLS item :tls){ this.addToTls(item);}} return (A) this;
    }

    public Boolean hasTls() {
        return tls != null && !tls.isEmpty();
    }

    public NetworkingV1beta1IngressSpecFluent.TlsNested addNewTl() {
        return new TlsNestedImpl();
    }

    public NetworkingV1beta1IngressSpecFluent.TlsNested addNewTlLike(NetworkingV1beta1IngressTLS item) {
        return new TlsNestedImpl(-1, item);
    }

    public NetworkingV1beta1IngressSpecFluent.TlsNested setNewTlLike(int index,NetworkingV1beta1IngressTLS item) {
        return new TlsNestedImpl(index, item);
    }

    public NetworkingV1beta1IngressSpecFluent.TlsNested editTl(int index) {
        if (tls.size() <= index) throw new RuntimeException("Can't edit tls. Index exceeds size.");
        return setNewTlLike(index, buildTl(index));
    }

    public NetworkingV1beta1IngressSpecFluent.TlsNested editFirstTl() {
        if (tls.size() == 0) throw new RuntimeException("Can't edit first tls. The list is empty.");
        return setNewTlLike(0, buildTl(0));
    }

    public NetworkingV1beta1IngressSpecFluent.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 NetworkingV1beta1IngressSpecFluent.TlsNested editMatchingTl(io.kubernetes.client.fluent.Predicate predicate) {
        int index = -1;
        for (int i=0;i extends NetworkingV1beta1IngressBackendFluentImpl> implements NetworkingV1beta1IngressSpecFluent.BackendNested,io.kubernetes.client.fluent.Nested {
        private final NetworkingV1beta1IngressBackendBuilder builder;

        BackendNestedImpl(NetworkingV1beta1IngressBackend item) {
            this.builder = new NetworkingV1beta1IngressBackendBuilder(this, item);
        }

        BackendNestedImpl() {
            this.builder = new NetworkingV1beta1IngressBackendBuilder(this);
        }

        public N and() {
             return (N) NetworkingV1beta1IngressSpecFluentImpl.this.withBackend(builder.build());
        }

        public N endBackend() {
             return and();
        }
    }


    public class RulesNestedImpl extends NetworkingV1beta1IngressRuleFluentImpl> implements NetworkingV1beta1IngressSpecFluent.RulesNested,io.kubernetes.client.fluent.Nested {
        private final NetworkingV1beta1IngressRuleBuilder builder;
        private final int index;

        RulesNestedImpl(int index,NetworkingV1beta1IngressRule item) {
            this.index = index;
            this.builder = new NetworkingV1beta1IngressRuleBuilder(this, item);
        }

        RulesNestedImpl() {
            this.index = -1;
            this.builder = new NetworkingV1beta1IngressRuleBuilder(this);
        }

        public N and() {
             return (N) NetworkingV1beta1IngressSpecFluentImpl.this.setToRules(index,builder.build());
        }

        public N endRule() {
             return and();
        }
    }


    public class TlsNestedImpl extends NetworkingV1beta1IngressTLSFluentImpl> implements NetworkingV1beta1IngressSpecFluent.TlsNested,io.kubernetes.client.fluent.Nested {
        private final NetworkingV1beta1IngressTLSBuilder builder;
        private final int index;

        TlsNestedImpl(int index,NetworkingV1beta1IngressTLS item) {
            this.index = index;
            this.builder = new NetworkingV1beta1IngressTLSBuilder(this, item);
        }

        TlsNestedImpl() {
            this.index = -1;
            this.builder = new NetworkingV1beta1IngressTLSBuilder(this);
        }

        public N and() {
             return (N) NetworkingV1beta1IngressSpecFluentImpl.this.setToTls(index,builder.build());
        }

        public N endTl() {
             return and();
        }
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy