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

io.kubernetes.client.models.V1beta1IngressSpecFluentImpl Maven / Gradle / Ivy

package io.kubernetes.client.models;

import com.google.gson.annotations.SerializedName;
import io.kubernetes.client.fluent.Nested;
import java.util.ArrayList;
import io.kubernetes.client.fluent.Predicate;
import java.lang.Deprecated;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import java.util.Collection;
import java.lang.Object;

public class V1beta1IngressSpecFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1beta1IngressSpecFluent{

    private V1beta1IngressBackendBuilder backend;
    private List rules;
    private List tls;

    public V1beta1IngressSpecFluentImpl(){
    }
    public V1beta1IngressSpecFluentImpl(V1beta1IngressSpec instance){
            this.withBackend(instance.getBackend());

            this.withRules(instance.getRules());

            this.withTls(instance.getTls());

    }

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

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

    public A withBackend(V1beta1IngressBackend backend){
            _visitables.remove(this.backend);
            if (backend!=null){ this.backend= new V1beta1IngressBackendBuilder(backend); _visitables.add(this.backend);} return (A) this;
    }

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

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

    public V1beta1IngressSpecFluent.BackendNested withNewBackendLike(V1beta1IngressBackend item){
            return new BackendNestedImpl(item);
    }

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

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

    public V1beta1IngressSpecFluent.BackendNested editOrNewBackendLike(V1beta1IngressBackend item){
            return withNewBackendLike(getBackend() != null ? getBackend(): item);
    }

    public A addToRules(int index,V1beta1IngressRule item){
            if (this.rules == null) {this.rules = new ArrayList();}
            V1beta1IngressRuleBuilder builder = new V1beta1IngressRuleBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.rules.add(index >= 0 ? index : rules.size(), builder); return (A)this;
    }

    public A setToRules(int index,V1beta1IngressRule item){
            if (this.rules == null) {this.rules = new ArrayList();}
            V1beta1IngressRuleBuilder builder = new V1beta1IngressRuleBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= rules.size()) { rules.add(builder); } else { rules.set(index, builder);}
             return (A)this;
    }

    public A addToRules(V1beta1IngressRule... items){
            if (this.rules == null) {this.rules = new ArrayList();}
            for (V1beta1IngressRule item : items) {V1beta1IngressRuleBuilder builder = new V1beta1IngressRuleBuilder(item);_visitables.add(builder);this.rules.add(builder);} return (A)this;
    }

    public A addAllToRules(Collection items){
            if (this.rules == null) {this.rules = new ArrayList();}
            for (V1beta1IngressRule item : items) {V1beta1IngressRuleBuilder builder = new V1beta1IngressRuleBuilder(item);_visitables.add(builder);this.rules.add(builder);} return (A)this;
    }

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

    public A removeAllFromRules(Collection items){
            for (V1beta1IngressRule item : items) {V1beta1IngressRuleBuilder builder = new V1beta1IngressRuleBuilder(item);_visitables.remove(builder);if (this.rules != null) {this.rules.remove(builder);}} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildRules instead.
 */
@Deprecated public List getRules(){
            return build(rules);
    }

    public List buildRules(){
            return build(rules);
    }

    public V1beta1IngressRule buildRule(int index){
            return this.rules.get(index).build();
    }

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

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

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

    public A withRules(List rules){
            if (this.rules != null) { _visitables.removeAll(this.rules);}
            if (rules != null) {this.rules = new ArrayList(); for (V1beta1IngressRule item : rules){this.addToRules(item);}} else { this.rules = null;} return (A) this;
    }

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

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

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

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

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

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

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

    public V1beta1IngressSpecFluent.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 V1beta1IngressSpecFluent.RulesNested editMatchingRule(io.kubernetes.client.fluent.Predicate predicate){
            int index = -1;
            for (int i=0;i();}
            V1beta1IngressTLSBuilder builder = new V1beta1IngressTLSBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.tls.add(index >= 0 ? index : tls.size(), builder); return (A)this;
    }

    public A setToTls(int index,V1beta1IngressTLS item){
            if (this.tls == null) {this.tls = new ArrayList();}
            V1beta1IngressTLSBuilder builder = new V1beta1IngressTLSBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= tls.size()) { tls.add(builder); } else { tls.set(index, builder);}
             return (A)this;
    }

    public A addToTls(V1beta1IngressTLS... items){
            if (this.tls == null) {this.tls = new ArrayList();}
            for (V1beta1IngressTLS item : items) {V1beta1IngressTLSBuilder builder = new V1beta1IngressTLSBuilder(item);_visitables.add(builder);this.tls.add(builder);} return (A)this;
    }

    public A addAllToTls(Collection items){
            if (this.tls == null) {this.tls = new ArrayList();}
            for (V1beta1IngressTLS item : items) {V1beta1IngressTLSBuilder builder = new V1beta1IngressTLSBuilder(item);_visitables.add(builder);this.tls.add(builder);} return (A)this;
    }

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

    public A removeAllFromTls(Collection items){
            for (V1beta1IngressTLS item : items) {V1beta1IngressTLSBuilder builder = new V1beta1IngressTLSBuilder(item);_visitables.remove(builder);if (this.tls != null) {this.tls.remove(builder);}} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildTls instead.
 */
@Deprecated public List getTls(){
            return build(tls);
    }

    public List buildTls(){
            return build(tls);
    }

    public V1beta1IngressTLS buildTl(int index){
            return this.tls.get(index).build();
    }

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

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

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

    public A withTls(List tls){
            if (this.tls != null) { _visitables.removeAll(this.tls);}
            if (tls != null) {this.tls = new ArrayList(); for (V1beta1IngressTLS item : tls){this.addToTls(item);}} else { this.tls = null;} return (A) this;
    }

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

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

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

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

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

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

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

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

            private final V1beta1IngressBackendBuilder builder;
    
            BackendNestedImpl(V1beta1IngressBackend item){
                    this.builder = new V1beta1IngressBackendBuilder(this, item);
            }
            BackendNestedImpl(){
                    this.builder = new V1beta1IngressBackendBuilder(this);
            }
    
    public N and(){
            return (N) V1beta1IngressSpecFluentImpl.this.withBackend(builder.build());
    }
    public N endBackend(){
            return and();
    }

}
    public class RulesNestedImpl extends V1beta1IngressRuleFluentImpl> implements V1beta1IngressSpecFluent.RulesNested,io.kubernetes.client.fluent.Nested{

            private final V1beta1IngressRuleBuilder builder;
        private final int index;
    
            RulesNestedImpl(int index,V1beta1IngressRule item){
                    this.index = index;
                    this.builder = new V1beta1IngressRuleBuilder(this, item);
            }
            RulesNestedImpl(){
                    this.index = -1;
                    this.builder = new V1beta1IngressRuleBuilder(this);
            }
    
    public N and(){
            return (N) V1beta1IngressSpecFluentImpl.this.setToRules(index, builder.build());
    }
    public N endRule(){
            return and();
    }

}
    public class TlsNestedImpl extends V1beta1IngressTLSFluentImpl> implements V1beta1IngressSpecFluent.TlsNested,io.kubernetes.client.fluent.Nested{

            private final V1beta1IngressTLSBuilder builder;
        private final int index;
    
            TlsNestedImpl(int index,V1beta1IngressTLS item){
                    this.index = index;
                    this.builder = new V1beta1IngressTLSBuilder(this, item);
            }
            TlsNestedImpl(){
                    this.index = -1;
                    this.builder = new V1beta1IngressTLSBuilder(this);
            }
    
    public N and(){
            return (N) V1beta1IngressSpecFluentImpl.this.setToTls(index, builder.build());
    }
    public N endTl(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy