io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PolicyRulesWithSubjectsFluent Maven / Gradle / Ivy
package io.fabric8.kubernetes.api.model.flowcontrol.v1beta1;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.util.LinkedHashMap;
import java.util.function.Predicate;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.util.Collection;
import java.lang.Object;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class PolicyRulesWithSubjectsFluent> extends BaseFluent{
public PolicyRulesWithSubjectsFluent() {
}
public PolicyRulesWithSubjectsFluent(PolicyRulesWithSubjects instance) {
this.copyInstance(instance);
}
private ArrayList nonResourceRules = new ArrayList();
private ArrayList resourceRules = new ArrayList();
private ArrayList subjects = new ArrayList();
private Map additionalProperties;
protected void copyInstance(PolicyRulesWithSubjects instance) {
instance = (instance != null ? instance : new PolicyRulesWithSubjects());
if (instance != null) {
this.withNonResourceRules(instance.getNonResourceRules());
this.withResourceRules(instance.getResourceRules());
this.withSubjects(instance.getSubjects());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public A addToNonResourceRules(int index,NonResourcePolicyRule item) {
if (this.nonResourceRules == null) {this.nonResourceRules = new ArrayList();}
NonResourcePolicyRuleBuilder builder = new NonResourcePolicyRuleBuilder(item);
if (index < 0 || index >= nonResourceRules.size()) { _visitables.get("nonResourceRules").add(builder); nonResourceRules.add(builder); } else { _visitables.get("nonResourceRules").add(index, builder); nonResourceRules.add(index, builder);}
return (A)this;
}
public A setToNonResourceRules(int index,NonResourcePolicyRule item) {
if (this.nonResourceRules == null) {this.nonResourceRules = new ArrayList();}
NonResourcePolicyRuleBuilder builder = new NonResourcePolicyRuleBuilder(item);
if (index < 0 || index >= nonResourceRules.size()) { _visitables.get("nonResourceRules").add(builder); nonResourceRules.add(builder); } else { _visitables.get("nonResourceRules").set(index, builder); 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 ArrayList();}
for (NonResourcePolicyRule item : items) {NonResourcePolicyRuleBuilder builder = new NonResourcePolicyRuleBuilder(item);_visitables.get("nonResourceRules").add(builder);this.nonResourceRules.add(builder);} return (A)this;
}
public A addAllToNonResourceRules(Collection items) {
if (this.nonResourceRules == null) {this.nonResourceRules = new ArrayList();}
for (NonResourcePolicyRule item : items) {NonResourcePolicyRuleBuilder builder = new 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) {
if (this.nonResourceRules == null) return (A)this;
for (NonResourcePolicyRule item : items) {NonResourcePolicyRuleBuilder builder = new NonResourcePolicyRuleBuilder(item);_visitables.get("nonResourceRules").remove(builder); this.nonResourceRules.remove(builder);} return (A)this;
}
public A removeAllFromNonResourceRules(Collection items) {
if (this.nonResourceRules == null) return (A)this;
for (NonResourcePolicyRule item : items) {NonResourcePolicyRuleBuilder builder = new NonResourcePolicyRuleBuilder(item);_visitables.get("nonResourceRules").remove(builder); this.nonResourceRules.remove(builder);} return (A)this;
}
public A removeMatchingFromNonResourceRules(Predicate predicate) {
if (nonResourceRules == null) return (A) this;
final Iterator each = nonResourceRules.iterator();
final List visitables = _visitables.get("nonResourceRules");
while (each.hasNext()) {
NonResourcePolicyRuleBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
public List buildNonResourceRules() {
return this.nonResourceRules != null ? build(nonResourceRules) : null;
}
public NonResourcePolicyRule buildNonResourceRule(int index) {
return this.nonResourceRules.get(index).build();
}
public NonResourcePolicyRule buildFirstNonResourceRule() {
return this.nonResourceRules.get(0).build();
}
public NonResourcePolicyRule buildLastNonResourceRule() {
return this.nonResourceRules.get(nonResourceRules.size() - 1).build();
}
public NonResourcePolicyRule buildMatchingNonResourceRule(Predicate predicate) {
for (NonResourcePolicyRuleBuilder item : nonResourceRules) {
if (predicate.test(item)) {
return item.build();
}
}
return null;
}
public boolean hasMatchingNonResourceRule(Predicate predicate) {
for (NonResourcePolicyRuleBuilder item : nonResourceRules) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withNonResourceRules(List nonResourceRules) {
if (this.nonResourceRules != null) {
this._visitables.get("nonResourceRules").clear();
}
if (nonResourceRules != null) {
this.nonResourceRules = new ArrayList();
for (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();
_visitables.remove("nonResourceRules");
}
if (nonResourceRules != null) {
for (NonResourcePolicyRule item : nonResourceRules) {
this.addToNonResourceRules(item);
}
}
return (A) this;
}
public boolean hasNonResourceRules() {
return this.nonResourceRules != null && !this.nonResourceRules.isEmpty();
}
public NonResourceRulesNested addNewNonResourceRule() {
return new NonResourceRulesNested(-1, null);
}
public NonResourceRulesNested addNewNonResourceRuleLike(NonResourcePolicyRule item) {
return new NonResourceRulesNested(-1, item);
}
public NonResourceRulesNested setNewNonResourceRuleLike(int index,NonResourcePolicyRule item) {
return new NonResourceRulesNested(index, item);
}
public NonResourceRulesNested editNonResourceRule(int index) {
if (nonResourceRules.size() <= index) throw new RuntimeException("Can't edit nonResourceRules. Index exceeds size.");
return setNewNonResourceRuleLike(index, buildNonResourceRule(index));
}
public NonResourceRulesNested editFirstNonResourceRule() {
if (nonResourceRules.size() == 0) throw new RuntimeException("Can't edit first nonResourceRules. The list is empty.");
return setNewNonResourceRuleLike(0, buildNonResourceRule(0));
}
public 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 NonResourceRulesNested editMatchingNonResourceRule(Predicate predicate) {
int index = -1;
for (int i=0;i();}
ResourcePolicyRuleBuilder builder = new ResourcePolicyRuleBuilder(item);
if (index < 0 || index >= resourceRules.size()) { _visitables.get("resourceRules").add(builder); resourceRules.add(builder); } else { _visitables.get("resourceRules").add(index, builder); resourceRules.add(index, builder);}
return (A)this;
}
public A setToResourceRules(int index,ResourcePolicyRule item) {
if (this.resourceRules == null) {this.resourceRules = new ArrayList();}
ResourcePolicyRuleBuilder builder = new ResourcePolicyRuleBuilder(item);
if (index < 0 || index >= resourceRules.size()) { _visitables.get("resourceRules").add(builder); resourceRules.add(builder); } else { _visitables.get("resourceRules").set(index, builder); 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 ArrayList();}
for (ResourcePolicyRule item : items) {ResourcePolicyRuleBuilder builder = new ResourcePolicyRuleBuilder(item);_visitables.get("resourceRules").add(builder);this.resourceRules.add(builder);} return (A)this;
}
public A addAllToResourceRules(Collection items) {
if (this.resourceRules == null) {this.resourceRules = new ArrayList();}
for (ResourcePolicyRule item : items) {ResourcePolicyRuleBuilder builder = new 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) {
if (this.resourceRules == null) return (A)this;
for (ResourcePolicyRule item : items) {ResourcePolicyRuleBuilder builder = new ResourcePolicyRuleBuilder(item);_visitables.get("resourceRules").remove(builder); this.resourceRules.remove(builder);} return (A)this;
}
public A removeAllFromResourceRules(Collection items) {
if (this.resourceRules == null) return (A)this;
for (ResourcePolicyRule item : items) {ResourcePolicyRuleBuilder builder = new ResourcePolicyRuleBuilder(item);_visitables.get("resourceRules").remove(builder); this.resourceRules.remove(builder);} return (A)this;
}
public A removeMatchingFromResourceRules(Predicate predicate) {
if (resourceRules == null) return (A) this;
final Iterator each = resourceRules.iterator();
final List visitables = _visitables.get("resourceRules");
while (each.hasNext()) {
ResourcePolicyRuleBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
public List buildResourceRules() {
return this.resourceRules != null ? build(resourceRules) : null;
}
public ResourcePolicyRule buildResourceRule(int index) {
return this.resourceRules.get(index).build();
}
public ResourcePolicyRule buildFirstResourceRule() {
return this.resourceRules.get(0).build();
}
public ResourcePolicyRule buildLastResourceRule() {
return this.resourceRules.get(resourceRules.size() - 1).build();
}
public ResourcePolicyRule buildMatchingResourceRule(Predicate predicate) {
for (ResourcePolicyRuleBuilder item : resourceRules) {
if (predicate.test(item)) {
return item.build();
}
}
return null;
}
public boolean hasMatchingResourceRule(Predicate predicate) {
for (ResourcePolicyRuleBuilder item : resourceRules) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withResourceRules(List resourceRules) {
if (this.resourceRules != null) {
this._visitables.get("resourceRules").clear();
}
if (resourceRules != null) {
this.resourceRules = new ArrayList();
for (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();
_visitables.remove("resourceRules");
}
if (resourceRules != null) {
for (ResourcePolicyRule item : resourceRules) {
this.addToResourceRules(item);
}
}
return (A) this;
}
public boolean hasResourceRules() {
return this.resourceRules != null && !this.resourceRules.isEmpty();
}
public ResourceRulesNested addNewResourceRule() {
return new ResourceRulesNested(-1, null);
}
public ResourceRulesNested addNewResourceRuleLike(ResourcePolicyRule item) {
return new ResourceRulesNested(-1, item);
}
public ResourceRulesNested setNewResourceRuleLike(int index,ResourcePolicyRule item) {
return new ResourceRulesNested(index, item);
}
public ResourceRulesNested editResourceRule(int index) {
if (resourceRules.size() <= index) throw new RuntimeException("Can't edit resourceRules. Index exceeds size.");
return setNewResourceRuleLike(index, buildResourceRule(index));
}
public ResourceRulesNested editFirstResourceRule() {
if (resourceRules.size() == 0) throw new RuntimeException("Can't edit first resourceRules. The list is empty.");
return setNewResourceRuleLike(0, buildResourceRule(0));
}
public 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 ResourceRulesNested editMatchingResourceRule(Predicate predicate) {
int index = -1;
for (int i=0;i();}
SubjectBuilder builder = new SubjectBuilder(item);
if (index < 0 || index >= subjects.size()) { _visitables.get("subjects").add(builder); subjects.add(builder); } else { _visitables.get("subjects").add(index, builder); subjects.add(index, builder);}
return (A)this;
}
public A setToSubjects(int index,Subject item) {
if (this.subjects == null) {this.subjects = new ArrayList();}
SubjectBuilder builder = new SubjectBuilder(item);
if (index < 0 || index >= subjects.size()) { _visitables.get("subjects").add(builder); subjects.add(builder); } else { _visitables.get("subjects").set(index, builder); 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 ArrayList();}
for (Subject item : items) {SubjectBuilder builder = new SubjectBuilder(item);_visitables.get("subjects").add(builder);this.subjects.add(builder);} return (A)this;
}
public A addAllToSubjects(Collection items) {
if (this.subjects == null) {this.subjects = new ArrayList();}
for (Subject item : items) {SubjectBuilder builder = new 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) {
if (this.subjects == null) return (A)this;
for (Subject item : items) {SubjectBuilder builder = new SubjectBuilder(item);_visitables.get("subjects").remove(builder); this.subjects.remove(builder);} return (A)this;
}
public A removeAllFromSubjects(Collection items) {
if (this.subjects == null) return (A)this;
for (Subject item : items) {SubjectBuilder builder = new SubjectBuilder(item);_visitables.get("subjects").remove(builder); this.subjects.remove(builder);} return (A)this;
}
public A removeMatchingFromSubjects(Predicate predicate) {
if (subjects == null) return (A) this;
final Iterator each = subjects.iterator();
final List visitables = _visitables.get("subjects");
while (each.hasNext()) {
SubjectBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
public List buildSubjects() {
return this.subjects != null ? build(subjects) : null;
}
public Subject buildSubject(int index) {
return this.subjects.get(index).build();
}
public Subject buildFirstSubject() {
return this.subjects.get(0).build();
}
public Subject buildLastSubject() {
return this.subjects.get(subjects.size() - 1).build();
}
public Subject buildMatchingSubject(Predicate predicate) {
for (SubjectBuilder item : subjects) {
if (predicate.test(item)) {
return item.build();
}
}
return null;
}
public boolean hasMatchingSubject(Predicate predicate) {
for (SubjectBuilder item : subjects) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withSubjects(List subjects) {
if (this.subjects != null) {
this._visitables.get("subjects").clear();
}
if (subjects != null) {
this.subjects = new ArrayList();
for (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();
_visitables.remove("subjects");
}
if (subjects != null) {
for (Subject item : subjects) {
this.addToSubjects(item);
}
}
return (A) this;
}
public boolean hasSubjects() {
return this.subjects != null && !this.subjects.isEmpty();
}
public SubjectsNested addNewSubject() {
return new SubjectsNested(-1, null);
}
public SubjectsNested addNewSubjectLike(Subject item) {
return new SubjectsNested(-1, item);
}
public SubjectsNested setNewSubjectLike(int index,Subject item) {
return new SubjectsNested(index, item);
}
public SubjectsNested editSubject(int index) {
if (subjects.size() <= index) throw new RuntimeException("Can't edit subjects. Index exceeds size.");
return setNewSubjectLike(index, buildSubject(index));
}
public SubjectsNested editFirstSubject() {
if (subjects.size() == 0) throw new RuntimeException("Can't edit first subjects. The list is empty.");
return setNewSubjectLike(0, buildSubject(0));
}
public 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 SubjectsNested editMatchingSubject(Predicate predicate) {
int index = -1;
for (int i=0;i map) {
if(this.additionalProperties == null && map != null) { this.additionalProperties = new LinkedHashMap(); }
if(map != null) { this.additionalProperties.putAll(map);} return (A)this;
}
public A removeFromAdditionalProperties(String key) {
if(this.additionalProperties == null) { return (A) this; }
if(key != null && this.additionalProperties != null) {this.additionalProperties.remove(key);} return (A)this;
}
public A removeFromAdditionalProperties(Map map) {
if(this.additionalProperties == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.additionalProperties != null){this.additionalProperties.remove(key);}}} return (A)this;
}
public Map getAdditionalProperties() {
return this.additionalProperties;
}
public A withAdditionalProperties(Map additionalProperties) {
if (additionalProperties == null) {
this.additionalProperties = null;
} else {
this.additionalProperties = new LinkedHashMap(additionalProperties);
}
return (A) this;
}
public boolean hasAdditionalProperties() {
return this.additionalProperties != null;
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
PolicyRulesWithSubjectsFluent that = (PolicyRulesWithSubjectsFluent) o;
if (!java.util.Objects.equals(nonResourceRules, that.nonResourceRules)) return false;
if (!java.util.Objects.equals(resourceRules, that.resourceRules)) return false;
if (!java.util.Objects.equals(subjects, that.subjects)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(nonResourceRules, resourceRules, subjects, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (nonResourceRules != null && !nonResourceRules.isEmpty()) { sb.append("nonResourceRules:"); sb.append(nonResourceRules + ","); }
if (resourceRules != null && !resourceRules.isEmpty()) { sb.append("resourceRules:"); sb.append(resourceRules + ","); }
if (subjects != null && !subjects.isEmpty()) { sb.append("subjects:"); sb.append(subjects + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
public class NonResourceRulesNested extends NonResourcePolicyRuleFluent> implements Nested{
NonResourceRulesNested(int index,NonResourcePolicyRule item) {
this.index = index;
this.builder = new NonResourcePolicyRuleBuilder(this, item);
}
NonResourcePolicyRuleBuilder builder;
int index;
public N and() {
return (N) PolicyRulesWithSubjectsFluent.this.setToNonResourceRules(index,builder.build());
}
public N endNonResourceRule() {
return and();
}
}
public class ResourceRulesNested extends ResourcePolicyRuleFluent> implements Nested{
ResourceRulesNested(int index,ResourcePolicyRule item) {
this.index = index;
this.builder = new ResourcePolicyRuleBuilder(this, item);
}
ResourcePolicyRuleBuilder builder;
int index;
public N and() {
return (N) PolicyRulesWithSubjectsFluent.this.setToResourceRules(index,builder.build());
}
public N endResourceRule() {
return and();
}
}
public class SubjectsNested extends SubjectFluent> implements Nested{
SubjectsNested(int index,Subject item) {
this.index = index;
this.builder = new SubjectBuilder(this, item);
}
SubjectBuilder builder;
int index;
public N and() {
return (N) PolicyRulesWithSubjectsFluent.this.setToSubjects(index,builder.build());
}
public N endSubject() {
return and();
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy