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

io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl Maven / Gradle / Ivy

There is a newer version: 7.0.1
Show newest version
package io.fabric8.kubernetes.api.model.flowcontrol.v1beta1;

import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.util.function.Predicate;
import java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import java.lang.Integer;
import java.util.Collection;
import java.lang.Object;

public class FlowSchemaSpecFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent {

    private io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodBuilder distinguisherMethod;
    private java.lang.Integer matchingPrecedence;
    private io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceBuilder priorityLevelConfiguration;
    private java.util.List rules =  new java.util.ArrayList();

    public FlowSchemaSpecFluentImpl() {
    }

    public FlowSchemaSpecFluentImpl(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpec instance) {
        this.withDistinguisherMethod(instance.getDistinguisherMethod()); 
        this.withMatchingPrecedence(instance.getMatchingPrecedence()); 
        this.withPriorityLevelConfiguration(instance.getPriorityLevelConfiguration()); 
        this.withRules(instance.getRules()); 
    }

    
    @java.lang.Deprecated
        
    /**
     * This method has been deprecated, please use method buildDistinguisherMethod instead.
     * @return The buildable object.
     */
        public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethod getDistinguisherMethod() {
        return this.distinguisherMethod!=null?this.distinguisherMethod.build():null;
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethod buildDistinguisherMethod() {
        return this.distinguisherMethod!=null?this.distinguisherMethod.build():null;
    }

    public A withDistinguisherMethod(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethod distinguisherMethod) {
        _visitables.get("distinguisherMethod").remove(this.distinguisherMethod);
        if (distinguisherMethod!=null){ this.distinguisherMethod= new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodBuilder(distinguisherMethod); _visitables.get("distinguisherMethod").add(this.distinguisherMethod);} return (A) this;
    }

    public java.lang.Boolean hasDistinguisherMethod() {
        return this.distinguisherMethod != null;
    }

    public A withNewDistinguisherMethod(java.lang.String type) {
        return (A)withDistinguisherMethod(new FlowDistinguisherMethod(type));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.DistinguisherMethodNested withNewDistinguisherMethod() {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.DistinguisherMethodNestedImpl();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.DistinguisherMethodNested withNewDistinguisherMethodLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethod item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.DistinguisherMethodNestedImpl(item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.DistinguisherMethodNested editDistinguisherMethod() {
        return withNewDistinguisherMethodLike(getDistinguisherMethod());
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.DistinguisherMethodNested editOrNewDistinguisherMethod() {
        return withNewDistinguisherMethodLike(getDistinguisherMethod() != null ? getDistinguisherMethod(): new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodBuilder().build());
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.DistinguisherMethodNested editOrNewDistinguisherMethodLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethod item) {
        return withNewDistinguisherMethodLike(getDistinguisherMethod() != null ? getDistinguisherMethod(): item);
    }

    public java.lang.Integer getMatchingPrecedence() {
        return this.matchingPrecedence;
    }

    public A withMatchingPrecedence(java.lang.Integer matchingPrecedence) {
        this.matchingPrecedence=matchingPrecedence; return (A) this;
    }

    public java.lang.Boolean hasMatchingPrecedence() {
        return this.matchingPrecedence != null;
    }

    
    @java.lang.Deprecated
        
    /**
     * This method has been deprecated, please use method buildPriorityLevelConfiguration instead.
     * @return The buildable object.
     */
        public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReference getPriorityLevelConfiguration() {
        return this.priorityLevelConfiguration!=null?this.priorityLevelConfiguration.build():null;
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReference buildPriorityLevelConfiguration() {
        return this.priorityLevelConfiguration!=null?this.priorityLevelConfiguration.build():null;
    }

    public A withPriorityLevelConfiguration(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReference priorityLevelConfiguration) {
        _visitables.get("priorityLevelConfiguration").remove(this.priorityLevelConfiguration);
        if (priorityLevelConfiguration!=null){ this.priorityLevelConfiguration= new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceBuilder(priorityLevelConfiguration); _visitables.get("priorityLevelConfiguration").add(this.priorityLevelConfiguration);} return (A) this;
    }

    public java.lang.Boolean hasPriorityLevelConfiguration() {
        return this.priorityLevelConfiguration != null;
    }

    public A withNewPriorityLevelConfiguration(java.lang.String name) {
        return (A)withPriorityLevelConfiguration(new PriorityLevelConfigurationReference(name));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.PriorityLevelConfigurationNested withNewPriorityLevelConfiguration() {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.PriorityLevelConfigurationNestedImpl();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.PriorityLevelConfigurationNested withNewPriorityLevelConfigurationLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReference item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.PriorityLevelConfigurationNestedImpl(item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.PriorityLevelConfigurationNested editPriorityLevelConfiguration() {
        return withNewPriorityLevelConfigurationLike(getPriorityLevelConfiguration());
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.PriorityLevelConfigurationNested editOrNewPriorityLevelConfiguration() {
        return withNewPriorityLevelConfigurationLike(getPriorityLevelConfiguration() != null ? getPriorityLevelConfiguration(): new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceBuilder().build());
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.PriorityLevelConfigurationNested editOrNewPriorityLevelConfigurationLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReference item) {
        return withNewPriorityLevelConfigurationLike(getPriorityLevelConfiguration() != null ? getPriorityLevelConfiguration(): item);
    }

    public A addToRules(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item) {
        if (this.rules == null) {this.rules = new java.util.ArrayList();}
        io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(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,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item) {
        if (this.rules == null) {this.rules = new java.util.ArrayList();}
        io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(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(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects... items) {
        if (this.rules == null) {this.rules = new java.util.ArrayList();}
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(item);_visitables.get("rules").add(builder);this.rules.add(builder);} return (A)this;
    }

    public A addAllToRules(java.util.Collection items) {
        if (this.rules == null) {this.rules = new java.util.ArrayList();}
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(item);_visitables.get("rules").add(builder);this.rules.add(builder);} return (A)this;
    }

    public A removeFromRules(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects... items) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(item);_visitables.get("rules").remove(builder);if (this.rules != null) {this.rules.remove(builder);}} return (A)this;
    }

    public A removeAllFromRules(java.util.Collection items) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(item);_visitables.get("rules").remove(builder);if (this.rules != null) {this.rules.remove(builder);}} return (A)this;
    }

    public A removeMatchingFromRules(java.util.function.Predicate predicate) {
        if (rules == null) return (A) this;
        final Iterator each = rules.iterator();
        final List visitables = _visitables.get("rules");
        while (each.hasNext()) {
          io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder = each.next();
          if (predicate.test(builder)) {
            visitables.remove(builder);
            each.remove();
          }
        }
        return (A)this;
    }

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

    public java.util.List buildRules() {
        return build(rules);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects buildRule(int index) {
        return this.rules.get(index).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects buildFirstRule() {
        return this.rules.get(0).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects buildLastRule() {
        return this.rules.get(rules.size() - 1).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects buildMatchingRule(java.util.function.Predicate predicate) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder item: rules) { if(predicate.test(item)){ return item.build();} } return null;
    }

    public java.lang.Boolean hasMatchingRule(java.util.function.Predicate predicate) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder item: rules) { if(predicate.test(item)){ return true;} } return false;
    }

    public A withRules(java.util.List rules) {
        if (this.rules != null) { _visitables.get("rules").removeAll(this.rules);}
        if (rules != null) {this.rules = new java.util.ArrayList(); for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item : rules){this.addToRules(item);}} else { this.rules = null;} return (A) this;
    }

    public A withRules(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects... rules) {
        if (this.rules != null) {this.rules.clear();}
        if (rules != null) {for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item :rules){ this.addToRules(item);}} return (A) this;
    }

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

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested addNewRule() {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.RulesNestedImpl();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested addNewRuleLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.RulesNestedImpl(-1, item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested setNewRuleLike(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluentImpl.RulesNestedImpl(index, item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested editRule(int index) {
        if (rules.size() <= index) throw new RuntimeException("Can't edit rules. Index exceeds size.");
        return setNewRuleLike(index, buildRule(index));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested editFirstRule() {
        if (rules.size() == 0) throw new RuntimeException("Can't edit first rules. The list is empty.");
        return setNewRuleLike(0, buildRule(0));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.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 io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested editMatchingRule(java.util.function.Predicate predicate) {
        int index = -1;
        for (int i=0;i extends io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodFluentImpl> implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.DistinguisherMethodNested,io.fabric8.kubernetes.api.builder.Nested {
        private final io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodBuilder builder;

            DistinguisherMethodNestedImpl(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethod item) {
                this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodBuilder(this, item);
                        
            }

            DistinguisherMethodNestedImpl() {
                this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowDistinguisherMethodBuilder(this);
                        
            }

            public N and() {
                return (N) FlowSchemaSpecFluentImpl.this.withDistinguisherMethod(builder.build());
            }

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


    public class PriorityLevelConfigurationNestedImpl extends io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceFluentImpl> implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.PriorityLevelConfigurationNested,io.fabric8.kubernetes.api.builder.Nested {
        private final io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceBuilder builder;

            PriorityLevelConfigurationNestedImpl(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReference item) {
                this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceBuilder(this, item);
                        
            }

            PriorityLevelConfigurationNestedImpl() {
                this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationReferenceBuilder(this);
                        
            }

            public N and() {
                return (N) FlowSchemaSpecFluentImpl.this.withPriorityLevelConfiguration(builder.build());
            }

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


    public class RulesNestedImpl extends io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluentImpl> implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaSpecFluent.RulesNested,io.fabric8.kubernetes.api.builder.Nested {
        private final io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder builder;
        private final int index;

            RulesNestedImpl(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects item) {
                this.index = index;
                this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(this, item);
                        
            }

            RulesNestedImpl() {
                this.index = -1;
                this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsBuilder(this);
                        
            }

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

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


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy