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

io.kubernetes.client.openapi.models.V1NodeSpecFluentImpl 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 V1NodeSpecFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1NodeSpecFluent {

    private V1NodeConfigSourceBuilder configSource;
    private String externalID;
    private String podCIDR;
    private List podCIDRs;
    private String providerID;
    private List taints;
    private Boolean unschedulable;

    public V1NodeSpecFluentImpl() { 
    }


    public V1NodeSpecFluentImpl(V1NodeSpec instance) { 
        this.withConfigSource(instance.getConfigSource());

        this.withExternalID(instance.getExternalID());

        this.withPodCIDR(instance.getPodCIDR());

        this.withPodCIDRs(instance.getPodCIDRs());

        this.withProviderID(instance.getProviderID());

        this.withTaints(instance.getTaints());

        this.withUnschedulable(instance.getUnschedulable());

    }


    
/**
 * This method has been deprecated, please use method buildConfigSource instead.
 * @return The buildable object.
 */
@Deprecated public V1NodeConfigSource getConfigSource() {
        return this.configSource!=null?this.configSource.build():null;
    }

    public V1NodeConfigSource buildConfigSource() {
        return this.configSource!=null?this.configSource.build():null;
    }

    public A withConfigSource(V1NodeConfigSource configSource) {
        _visitables.get("configSource").remove(this.configSource);
        if (configSource!=null){ this.configSource= new V1NodeConfigSourceBuilder(configSource); _visitables.get("configSource").add(this.configSource);} return (A) this;
    }

    public Boolean hasConfigSource() {
        return this.configSource != null;
    }

    public V1NodeSpecFluent.ConfigSourceNested withNewConfigSource() {
        return new ConfigSourceNestedImpl();
    }

    public V1NodeSpecFluent.ConfigSourceNested withNewConfigSourceLike(V1NodeConfigSource item) {
        return new ConfigSourceNestedImpl(item);
    }

    public V1NodeSpecFluent.ConfigSourceNested editConfigSource() {
        return withNewConfigSourceLike(getConfigSource());
    }

    public V1NodeSpecFluent.ConfigSourceNested editOrNewConfigSource() {
        return withNewConfigSourceLike(getConfigSource() != null ? getConfigSource(): new V1NodeConfigSourceBuilder().build());
    }

    public V1NodeSpecFluent.ConfigSourceNested editOrNewConfigSourceLike(V1NodeConfigSource item) {
        return withNewConfigSourceLike(getConfigSource() != null ? getConfigSource(): item);
    }

    public String getExternalID() {
        return this.externalID;
    }

    public A withExternalID(String externalID) {
        this.externalID=externalID; return (A) this;
    }

    public Boolean hasExternalID() {
        return this.externalID != null;
    }

    public A withNewExternalID(String arg1) {
        return (A)withExternalID(new String(arg1));
    }

    public A withNewExternalID(StringBuilder arg1) {
        return (A)withExternalID(new String(arg1));
    }

    public A withNewExternalID(StringBuffer arg1) {
        return (A)withExternalID(new String(arg1));
    }

    public String getPodCIDR() {
        return this.podCIDR;
    }

    public A withPodCIDR(String podCIDR) {
        this.podCIDR=podCIDR; return (A) this;
    }

    public Boolean hasPodCIDR() {
        return this.podCIDR != null;
    }

    public A withNewPodCIDR(String arg1) {
        return (A)withPodCIDR(new String(arg1));
    }

    public A withNewPodCIDR(StringBuilder arg1) {
        return (A)withPodCIDR(new String(arg1));
    }

    public A withNewPodCIDR(StringBuffer arg1) {
        return (A)withPodCIDR(new String(arg1));
    }

    public A addToPodCIDRs(int index,String item) {
        if (this.podCIDRs == null) {this.podCIDRs = new ArrayList();}
        this.podCIDRs.add(index, item);
        return (A)this;
    }

    public A setToPodCIDRs(int index,String item) {
        if (this.podCIDRs == null) {this.podCIDRs = new ArrayList();}
        this.podCIDRs.set(index, item); return (A)this;
    }

    public A addToPodCIDRs(String... items) {
        if (this.podCIDRs == null) {this.podCIDRs = new ArrayList();}
        for (String item : items) {this.podCIDRs.add(item);} return (A)this;
    }

    public A addAllToPodCIDRs(Collection items) {
        if (this.podCIDRs == null) {this.podCIDRs = new ArrayList();}
        for (String item : items) {this.podCIDRs.add(item);} return (A)this;
    }

    public A removeFromPodCIDRs(String... items) {
        for (String item : items) {if (this.podCIDRs!= null){ this.podCIDRs.remove(item);}} return (A)this;
    }

    public A removeAllFromPodCIDRs(Collection items) {
        for (String item : items) {if (this.podCIDRs!= null){ this.podCIDRs.remove(item);}} return (A)this;
    }

    public List getPodCIDRs() {
        return this.podCIDRs;
    }

    public String getPodCIDR(int index) {
        return this.podCIDRs.get(index);
    }

    public String getFirstPodCIDR() {
        return this.podCIDRs.get(0);
    }

    public String getLastPodCIDR() {
        return this.podCIDRs.get(podCIDRs.size() - 1);
    }

    public String getMatchingPodCIDR(io.kubernetes.client.fluent.Predicate predicate) {
        for (String item: podCIDRs) { if(predicate.apply(item)){ return item;} } return null;
    }

    public Boolean hasMatchingPodCIDR(io.kubernetes.client.fluent.Predicate predicate) {
        for (String item: podCIDRs) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A withPodCIDRs(List podCIDRs) {
        if (this.podCIDRs != null) { _visitables.get("podCIDRs").removeAll(this.podCIDRs);}
        if (podCIDRs != null) {this.podCIDRs = new ArrayList(); for (String item : podCIDRs){this.addToPodCIDRs(item);}} else { this.podCIDRs = null;} return (A) this;
    }

    public A withPodCIDRs(String... podCIDRs) {
        if (this.podCIDRs != null) {this.podCIDRs.clear();}
        if (podCIDRs != null) {for (String item :podCIDRs){ this.addToPodCIDRs(item);}} return (A) this;
    }

    public Boolean hasPodCIDRs() {
        return podCIDRs != null && !podCIDRs.isEmpty();
    }

    public A addNewPodCIDR(String arg1) {
        return (A)addToPodCIDRs(new String(arg1));
    }

    public A addNewPodCIDR(StringBuilder arg1) {
        return (A)addToPodCIDRs(new String(arg1));
    }

    public A addNewPodCIDR(StringBuffer arg1) {
        return (A)addToPodCIDRs(new String(arg1));
    }

    public String getProviderID() {
        return this.providerID;
    }

    public A withProviderID(String providerID) {
        this.providerID=providerID; return (A) this;
    }

    public Boolean hasProviderID() {
        return this.providerID != null;
    }

    public A withNewProviderID(String arg1) {
        return (A)withProviderID(new String(arg1));
    }

    public A withNewProviderID(StringBuilder arg1) {
        return (A)withProviderID(new String(arg1));
    }

    public A withNewProviderID(StringBuffer arg1) {
        return (A)withProviderID(new String(arg1));
    }

    public A addToTaints(int index,V1Taint item) {
        if (this.taints == null) {this.taints = new ArrayList();}
        V1TaintBuilder builder = new V1TaintBuilder(item);_visitables.get("taints").add(index >= 0 ? index : _visitables.get("taints").size(), builder);this.taints.add(index >= 0 ? index : taints.size(), builder); return (A)this;
    }

    public A setToTaints(int index,V1Taint item) {
        if (this.taints == null) {this.taints = new ArrayList();}
        V1TaintBuilder builder = new V1TaintBuilder(item);
        if (index < 0 || index >= _visitables.get("taints").size()) { _visitables.get("taints").add(builder); } else { _visitables.get("taints").set(index, builder);}
        if (index < 0 || index >= taints.size()) { taints.add(builder); } else { taints.set(index, builder);}
         return (A)this;
    }

    public A addToTaints(V1Taint... items) {
        if (this.taints == null) {this.taints = new ArrayList();}
        for (V1Taint item : items) {V1TaintBuilder builder = new V1TaintBuilder(item);_visitables.get("taints").add(builder);this.taints.add(builder);} return (A)this;
    }

    public A addAllToTaints(Collection items) {
        if (this.taints == null) {this.taints = new ArrayList();}
        for (V1Taint item : items) {V1TaintBuilder builder = new V1TaintBuilder(item);_visitables.get("taints").add(builder);this.taints.add(builder);} return (A)this;
    }

    public A removeFromTaints(V1Taint... items) {
        for (V1Taint item : items) {V1TaintBuilder builder = new V1TaintBuilder(item);_visitables.get("taints").remove(builder);if (this.taints != null) {this.taints.remove(builder);}} return (A)this;
    }

    public A removeAllFromTaints(Collection items) {
        for (V1Taint item : items) {V1TaintBuilder builder = new V1TaintBuilder(item);_visitables.get("taints").remove(builder);if (this.taints != null) {this.taints.remove(builder);}} return (A)this;
    }

    public A removeMatchingFromTaints(io.kubernetes.client.fluent.Predicate predicate) {
        if (taints == null) return (A) this;
        final Iterator each = taints.iterator();
        final List visitables = _visitables.get("taints");
        while (each.hasNext()) {
          V1TaintBuilder builder = each.next();
          if (predicate.apply(builder)) {
            visitables.remove(builder);
            each.remove();
          }
        }
        return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildTaints instead.
 * @return The buildable object.
 */
@Deprecated public List getTaints() {
        return build(taints);
    }

    public List buildTaints() {
        return build(taints);
    }

    public V1Taint buildTaint(int index) {
        return this.taints.get(index).build();
    }

    public V1Taint buildFirstTaint() {
        return this.taints.get(0).build();
    }

    public V1Taint buildLastTaint() {
        return this.taints.get(taints.size() - 1).build();
    }

    public V1Taint buildMatchingTaint(io.kubernetes.client.fluent.Predicate predicate) {
        for (V1TaintBuilder item: taints) { if(predicate.apply(item)){ return item.build();} } return null;
    }

    public Boolean hasMatchingTaint(io.kubernetes.client.fluent.Predicate predicate) {
        for (V1TaintBuilder item: taints) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A withTaints(List taints) {
        if (this.taints != null) { _visitables.get("taints").removeAll(this.taints);}
        if (taints != null) {this.taints = new ArrayList(); for (V1Taint item : taints){this.addToTaints(item);}} else { this.taints = null;} return (A) this;
    }

    public A withTaints(V1Taint... taints) {
        if (this.taints != null) {this.taints.clear();}
        if (taints != null) {for (V1Taint item :taints){ this.addToTaints(item);}} return (A) this;
    }

    public Boolean hasTaints() {
        return taints != null && !taints.isEmpty();
    }

    public V1NodeSpecFluent.TaintsNested addNewTaint() {
        return new TaintsNestedImpl();
    }

    public V1NodeSpecFluent.TaintsNested addNewTaintLike(V1Taint item) {
        return new TaintsNestedImpl(-1, item);
    }

    public V1NodeSpecFluent.TaintsNested setNewTaintLike(int index,V1Taint item) {
        return new TaintsNestedImpl(index, item);
    }

    public V1NodeSpecFluent.TaintsNested editTaint(int index) {
        if (taints.size() <= index) throw new RuntimeException("Can't edit taints. Index exceeds size.");
        return setNewTaintLike(index, buildTaint(index));
    }

    public V1NodeSpecFluent.TaintsNested editFirstTaint() {
        if (taints.size() == 0) throw new RuntimeException("Can't edit first taints. The list is empty.");
        return setNewTaintLike(0, buildTaint(0));
    }

    public V1NodeSpecFluent.TaintsNested editLastTaint() {
        int index = taints.size() - 1;
        if (index < 0) throw new RuntimeException("Can't edit last taints. The list is empty.");
        return setNewTaintLike(index, buildTaint(index));
    }

    public V1NodeSpecFluent.TaintsNested editMatchingTaint(io.kubernetes.client.fluent.Predicate predicate) {
        int index = -1;
        for (int i=0;i extends V1NodeConfigSourceFluentImpl> implements V1NodeSpecFluent.ConfigSourceNested,io.kubernetes.client.fluent.Nested {
        private final V1NodeConfigSourceBuilder builder;

        ConfigSourceNestedImpl(V1NodeConfigSource item) {
            this.builder = new V1NodeConfigSourceBuilder(this, item);
        }

        ConfigSourceNestedImpl() {
            this.builder = new V1NodeConfigSourceBuilder(this);
        }

        public N and() {
             return (N) V1NodeSpecFluentImpl.this.withConfigSource(builder.build());
        }

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


    public class TaintsNestedImpl extends V1TaintFluentImpl> implements V1NodeSpecFluent.TaintsNested,io.kubernetes.client.fluent.Nested {
        private final V1TaintBuilder builder;
        private final int index;

        TaintsNestedImpl(int index,V1Taint item) {
            this.index = index;
            this.builder = new V1TaintBuilder(this, item);
        }

        TaintsNestedImpl() {
            this.index = -1;
            this.builder = new V1TaintBuilder(this);
        }

        public N and() {
             return (N) V1NodeSpecFluentImpl.this.setToTaints(index,builder.build());
        }

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


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy