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

io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluentImpl 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.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.util.Collection;
import java.lang.Object;

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

    private java.util.List nonResourceRules =  new java.util.ArrayList();
    private java.util.List resourceRules =  new java.util.ArrayList();
    private java.util.List subjects =  new java.util.ArrayList();

    public PolicyRulesWithSubjectsFluentImpl() {
    }

    public PolicyRulesWithSubjectsFluentImpl(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjects instance) {
        this.withNonResourceRules(instance.getNonResourceRules()); 
        this.withResourceRules(instance.getResourceRules()); 
        this.withSubjects(instance.getSubjects()); 
    }

    public A addToNonResourceRules(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule item) {
        if (this.nonResourceRules == null) {this.nonResourceRules = new java.util.ArrayList();}
        io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRuleBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRuleBuilder(item);_visitables.get("nonResourceRules").add(index >= 0 ? index : _visitables.get("nonResourceRules").size(), builder);this.nonResourceRules.add(index >= 0 ? index : nonResourceRules.size(), builder); return (A)this;
    }

    public A setToNonResourceRules(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule item) {
        if (this.nonResourceRules == null) {this.nonResourceRules = new java.util.ArrayList();}
        io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRuleBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRuleBuilder(item);
        if (index < 0 || index >= _visitables.get("nonResourceRules").size()) { _visitables.get("nonResourceRules").add(builder); } else { _visitables.get("nonResourceRules").set(index, builder);}
        if (index < 0 || index >= nonResourceRules.size()) { nonResourceRules.add(builder); } else { nonResourceRules.set(index, builder);}
         return (A)this;
    }

    public A addToNonResourceRules(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule... items) {
        if (this.nonResourceRules == null) {this.nonResourceRules = new java.util.ArrayList();}
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRuleBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRuleBuilder(item);_visitables.get("nonResourceRules").add(builder);this.nonResourceRules.add(builder);} return (A)this;
    }

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

    public A removeFromNonResourceRules(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule... items) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRuleBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRuleBuilder(item);_visitables.get("nonResourceRules").remove(builder);if (this.nonResourceRules != null) {this.nonResourceRules.remove(builder);}} return (A)this;
    }

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

    public A removeMatchingFromNonResourceRules(java.util.function.Predicate predicate) {
        if (nonResourceRules == null) return (A) this;
        final Iterator each = nonResourceRules.iterator();
        final List visitables = _visitables.get("nonResourceRules");
        while (each.hasNext()) {
          io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRuleBuilder 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 buildNonResourceRules instead.
     * @return The buildable object.
     */
        public java.util.List getNonResourceRules() {
        return build(nonResourceRules);
    }

    public java.util.List buildNonResourceRules() {
        return build(nonResourceRules);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule buildNonResourceRule(int index) {
        return this.nonResourceRules.get(index).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule buildFirstNonResourceRule() {
        return this.nonResourceRules.get(0).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule buildLastNonResourceRule() {
        return this.nonResourceRules.get(nonResourceRules.size() - 1).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule buildMatchingNonResourceRule(java.util.function.Predicate predicate) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRuleBuilder item: nonResourceRules) { if(predicate.test(item)){ return item.build();} } return null;
    }

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

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

    public A withNonResourceRules(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule... nonResourceRules) {
        if (this.nonResourceRules != null) {this.nonResourceRules.clear();}
        if (nonResourceRules != null) {for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule item :nonResourceRules){ this.addToNonResourceRules(item);}} return (A) this;
    }

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

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.NonResourceRulesNested addNewNonResourceRule() {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluentImpl.NonResourceRulesNestedImpl();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.NonResourceRulesNested addNewNonResourceRuleLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluentImpl.NonResourceRulesNestedImpl(-1, item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.NonResourceRulesNested setNewNonResourceRuleLike(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluentImpl.NonResourceRulesNestedImpl(index, item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.NonResourceRulesNested editNonResourceRule(int index) {
        if (nonResourceRules.size() <= index) throw new RuntimeException("Can't edit nonResourceRules. Index exceeds size.");
        return setNewNonResourceRuleLike(index, buildNonResourceRule(index));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.NonResourceRulesNested editFirstNonResourceRule() {
        if (nonResourceRules.size() == 0) throw new RuntimeException("Can't edit first nonResourceRules. The list is empty.");
        return setNewNonResourceRuleLike(0, buildNonResourceRule(0));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.NonResourceRulesNested editLastNonResourceRule() {
        int index = nonResourceRules.size() - 1;
        if (index < 0) throw new RuntimeException("Can't edit last nonResourceRules. The list is empty.");
        return setNewNonResourceRuleLike(index, buildNonResourceRule(index));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.NonResourceRulesNested editMatchingNonResourceRule(java.util.function.Predicate predicate) {
        int index = -1;
        for (int i=0;i();}
        io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRuleBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRuleBuilder(item);_visitables.get("resourceRules").add(index >= 0 ? index : _visitables.get("resourceRules").size(), builder);this.resourceRules.add(index >= 0 ? index : resourceRules.size(), builder); return (A)this;
    }

    public A setToResourceRules(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule item) {
        if (this.resourceRules == null) {this.resourceRules = new java.util.ArrayList();}
        io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRuleBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRuleBuilder(item);
        if (index < 0 || index >= _visitables.get("resourceRules").size()) { _visitables.get("resourceRules").add(builder); } else { _visitables.get("resourceRules").set(index, builder);}
        if (index < 0 || index >= resourceRules.size()) { resourceRules.add(builder); } else { resourceRules.set(index, builder);}
         return (A)this;
    }

    public A addToResourceRules(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule... items) {
        if (this.resourceRules == null) {this.resourceRules = new java.util.ArrayList();}
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRuleBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRuleBuilder(item);_visitables.get("resourceRules").add(builder);this.resourceRules.add(builder);} return (A)this;
    }

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

    public A removeFromResourceRules(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule... items) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRuleBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRuleBuilder(item);_visitables.get("resourceRules").remove(builder);if (this.resourceRules != null) {this.resourceRules.remove(builder);}} return (A)this;
    }

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

    public A removeMatchingFromResourceRules(java.util.function.Predicate predicate) {
        if (resourceRules == null) return (A) this;
        final Iterator each = resourceRules.iterator();
        final List visitables = _visitables.get("resourceRules");
        while (each.hasNext()) {
          io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRuleBuilder 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 buildResourceRules instead.
     * @return The buildable object.
     */
        public java.util.List getResourceRules() {
        return build(resourceRules);
    }

    public java.util.List buildResourceRules() {
        return build(resourceRules);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule buildResourceRule(int index) {
        return this.resourceRules.get(index).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule buildFirstResourceRule() {
        return this.resourceRules.get(0).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule buildLastResourceRule() {
        return this.resourceRules.get(resourceRules.size() - 1).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule buildMatchingResourceRule(java.util.function.Predicate predicate) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRuleBuilder item: resourceRules) { if(predicate.test(item)){ return item.build();} } return null;
    }

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

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

    public A withResourceRules(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule... resourceRules) {
        if (this.resourceRules != null) {this.resourceRules.clear();}
        if (resourceRules != null) {for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule item :resourceRules){ this.addToResourceRules(item);}} return (A) this;
    }

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

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.ResourceRulesNested addNewResourceRule() {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluentImpl.ResourceRulesNestedImpl();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.ResourceRulesNested addNewResourceRuleLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluentImpl.ResourceRulesNestedImpl(-1, item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.ResourceRulesNested setNewResourceRuleLike(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluentImpl.ResourceRulesNestedImpl(index, item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.ResourceRulesNested editResourceRule(int index) {
        if (resourceRules.size() <= index) throw new RuntimeException("Can't edit resourceRules. Index exceeds size.");
        return setNewResourceRuleLike(index, buildResourceRule(index));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.ResourceRulesNested editFirstResourceRule() {
        if (resourceRules.size() == 0) throw new RuntimeException("Can't edit first resourceRules. The list is empty.");
        return setNewResourceRuleLike(0, buildResourceRule(0));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.ResourceRulesNested editLastResourceRule() {
        int index = resourceRules.size() - 1;
        if (index < 0) throw new RuntimeException("Can't edit last resourceRules. The list is empty.");
        return setNewResourceRuleLike(index, buildResourceRule(index));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.ResourceRulesNested editMatchingResourceRule(java.util.function.Predicate predicate) {
        int index = -1;
        for (int i=0;i();}
        io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.SubjectBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.SubjectBuilder(item);_visitables.get("subjects").add(index >= 0 ? index : _visitables.get("subjects").size(), builder);this.subjects.add(index >= 0 ? index : subjects.size(), builder); return (A)this;
    }

    public A setToSubjects(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject item) {
        if (this.subjects == null) {this.subjects = new java.util.ArrayList();}
        io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.SubjectBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.SubjectBuilder(item);
        if (index < 0 || index >= _visitables.get("subjects").size()) { _visitables.get("subjects").add(builder); } else { _visitables.get("subjects").set(index, builder);}
        if (index < 0 || index >= subjects.size()) { subjects.add(builder); } else { subjects.set(index, builder);}
         return (A)this;
    }

    public A addToSubjects(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject... items) {
        if (this.subjects == null) {this.subjects = new java.util.ArrayList();}
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.SubjectBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.SubjectBuilder(item);_visitables.get("subjects").add(builder);this.subjects.add(builder);} return (A)this;
    }

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

    public A removeFromSubjects(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject... items) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject item : items) {io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.SubjectBuilder builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.SubjectBuilder(item);_visitables.get("subjects").remove(builder);if (this.subjects != null) {this.subjects.remove(builder);}} return (A)this;
    }

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

    public A removeMatchingFromSubjects(java.util.function.Predicate predicate) {
        if (subjects == null) return (A) this;
        final Iterator each = subjects.iterator();
        final List visitables = _visitables.get("subjects");
        while (each.hasNext()) {
          io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.SubjectBuilder 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 buildSubjects instead.
     * @return The buildable object.
     */
        public java.util.List getSubjects() {
        return build(subjects);
    }

    public java.util.List buildSubjects() {
        return build(subjects);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject buildSubject(int index) {
        return this.subjects.get(index).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject buildFirstSubject() {
        return this.subjects.get(0).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject buildLastSubject() {
        return this.subjects.get(subjects.size() - 1).build();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject buildMatchingSubject(java.util.function.Predicate predicate) {
        for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.SubjectBuilder item: subjects) { if(predicate.test(item)){ return item.build();} } return null;
    }

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

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

    public A withSubjects(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject... subjects) {
        if (this.subjects != null) {this.subjects.clear();}
        if (subjects != null) {for (io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject item :subjects){ this.addToSubjects(item);}} return (A) this;
    }

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

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.SubjectsNested addNewSubject() {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluentImpl.SubjectsNestedImpl();
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.SubjectsNested addNewSubjectLike(io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluentImpl.SubjectsNestedImpl(-1, item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.SubjectsNested setNewSubjectLike(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject item) {
        return new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluentImpl.SubjectsNestedImpl(index, item);
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.SubjectsNested editSubject(int index) {
        if (subjects.size() <= index) throw new RuntimeException("Can't edit subjects. Index exceeds size.");
        return setNewSubjectLike(index, buildSubject(index));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.SubjectsNested editFirstSubject() {
        if (subjects.size() == 0) throw new RuntimeException("Can't edit first subjects. The list is empty.");
        return setNewSubjectLike(0, buildSubject(0));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.SubjectsNested editLastSubject() {
        int index = subjects.size() - 1;
        if (index < 0) throw new RuntimeException("Can't edit last subjects. The list is empty.");
        return setNewSubjectLike(index, buildSubject(index));
    }

    public io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.SubjectsNested editMatchingSubject(java.util.function.Predicate predicate) {
        int index = -1;
        for (int i=0;i extends io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRuleFluentImpl> implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.NonResourceRulesNested,io.fabric8.kubernetes.api.builder.Nested {
        private final io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRuleBuilder builder;
        private final int index;

            NonResourceRulesNestedImpl(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRule item) {
                this.index = index;
                this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.NonResourcePolicyRuleBuilder(this, item);
                        
            }

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

            public N and() {
                return (N) PolicyRulesWithSubjectsFluentImpl.this.setToNonResourceRules(index,builder.build());
            }

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


    public class ResourceRulesNestedImpl extends io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRuleFluentImpl> implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.ResourceRulesNested,io.fabric8.kubernetes.api.builder.Nested {
        private final io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRuleBuilder builder;
        private final int index;

            ResourceRulesNestedImpl(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRule item) {
                this.index = index;
                this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.ResourcePolicyRuleBuilder(this, item);
                        
            }

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

            public N and() {
                return (N) PolicyRulesWithSubjectsFluentImpl.this.setToResourceRules(index,builder.build());
            }

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


    public class SubjectsNestedImpl extends io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.SubjectFluentImpl> implements io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent.SubjectsNested,io.fabric8.kubernetes.api.builder.Nested {
        private final io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.SubjectBuilder builder;
        private final int index;

            SubjectsNestedImpl(int index,io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.Subject item) {
                this.index = index;
                this.builder = new io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.SubjectBuilder(this, item);
                        
            }

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

            public N and() {
                return (N) PolicyRulesWithSubjectsFluentImpl.this.setToSubjects(index,builder.build());
            }

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


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy