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

io.kubernetes.client.models.V1NodeSpecFluentImpl 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 java.lang.String;
import io.kubernetes.client.fluent.Predicate;
import java.lang.Deprecated;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;

public class V1NodeSpecFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1NodeSpecFluent{

    private V1NodeConfigSourceBuilder configSource;
    private String externalID;
    private String podCIDR;
    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.withProviderID(instance.getProviderID());

            this.withTaints(instance.getTaints());

            this.withUnschedulable(instance.isUnschedulable());

    }

    
/**
 * This method has been deprecated, please use method buildConfigSource instead.
 */
@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.remove(this.configSource);
            if (configSource!=null){ this.configSource= new V1NodeConfigSourceBuilder(configSource); _visitables.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 String getPodCIDR(){
            return this.podCIDR;
    }

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

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

    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 addToTaints(int index,V1Taint item){
            if (this.taints == null) {this.taints = new ArrayList();}
            V1TaintBuilder builder = new V1TaintBuilder(item);_visitables.add(index >= 0 ? index : _visitables.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.size()) { _visitables.add(builder); } else { _visitables.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.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.add(builder);this.taints.add(builder);} return (A)this;
    }

    public A removeFromTaints(V1Taint... items){
            for (V1Taint item : items) {V1TaintBuilder builder = new V1TaintBuilder(item);_visitables.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.remove(builder);if (this.taints != null) {this.taints.remove(builder);}} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildTaints instead.
 */
@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 A withTaints(List taints){
            if (this.taints != null) { _visitables.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){
            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