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

io.kubernetes.client.openapi.models.V1beta1CSIDriverSpecFluentImpl 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.StringBuffer;
import java.lang.Deprecated;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;

public class V1beta1CSIDriverSpecFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1beta1CSIDriverSpecFluent {

    private Boolean attachRequired;
    private String fsGroupPolicy;
    private Boolean podInfoOnMount;
    private Boolean requiresRepublish;
    private Boolean storageCapacity;
    private List tokenRequests;
    private List volumeLifecycleModes;

    public V1beta1CSIDriverSpecFluentImpl() { 
    }


    public V1beta1CSIDriverSpecFluentImpl(V1beta1CSIDriverSpec instance) { 
        this.withAttachRequired(instance.getAttachRequired());

        this.withFsGroupPolicy(instance.getFsGroupPolicy());

        this.withPodInfoOnMount(instance.getPodInfoOnMount());

        this.withRequiresRepublish(instance.getRequiresRepublish());

        this.withStorageCapacity(instance.getStorageCapacity());

        this.withTokenRequests(instance.getTokenRequests());

        this.withVolumeLifecycleModes(instance.getVolumeLifecycleModes());

    }


    public Boolean isAttachRequired() {
        return this.attachRequired;
    }

    public A withAttachRequired(Boolean attachRequired) {
        this.attachRequired=attachRequired; return (A) this;
    }

    public Boolean hasAttachRequired() {
        return this.attachRequired != null;
    }

    public A withNewAttachRequired(String arg1) {
        return (A)withAttachRequired(new Boolean(arg1));
    }

    public A withNewAttachRequired(boolean arg1) {
        return (A)withAttachRequired(new Boolean(arg1));
    }

    public String getFsGroupPolicy() {
        return this.fsGroupPolicy;
    }

    public A withFsGroupPolicy(String fsGroupPolicy) {
        this.fsGroupPolicy=fsGroupPolicy; return (A) this;
    }

    public Boolean hasFsGroupPolicy() {
        return this.fsGroupPolicy != null;
    }

    public A withNewFsGroupPolicy(String arg1) {
        return (A)withFsGroupPolicy(new String(arg1));
    }

    public A withNewFsGroupPolicy(StringBuilder arg1) {
        return (A)withFsGroupPolicy(new String(arg1));
    }

    public A withNewFsGroupPolicy(StringBuffer arg1) {
        return (A)withFsGroupPolicy(new String(arg1));
    }

    public Boolean isPodInfoOnMount() {
        return this.podInfoOnMount;
    }

    public A withPodInfoOnMount(Boolean podInfoOnMount) {
        this.podInfoOnMount=podInfoOnMount; return (A) this;
    }

    public Boolean hasPodInfoOnMount() {
        return this.podInfoOnMount != null;
    }

    public A withNewPodInfoOnMount(String arg1) {
        return (A)withPodInfoOnMount(new Boolean(arg1));
    }

    public A withNewPodInfoOnMount(boolean arg1) {
        return (A)withPodInfoOnMount(new Boolean(arg1));
    }

    public Boolean isRequiresRepublish() {
        return this.requiresRepublish;
    }

    public A withRequiresRepublish(Boolean requiresRepublish) {
        this.requiresRepublish=requiresRepublish; return (A) this;
    }

    public Boolean hasRequiresRepublish() {
        return this.requiresRepublish != null;
    }

    public A withNewRequiresRepublish(String arg1) {
        return (A)withRequiresRepublish(new Boolean(arg1));
    }

    public A withNewRequiresRepublish(boolean arg1) {
        return (A)withRequiresRepublish(new Boolean(arg1));
    }

    public Boolean isStorageCapacity() {
        return this.storageCapacity;
    }

    public A withStorageCapacity(Boolean storageCapacity) {
        this.storageCapacity=storageCapacity; return (A) this;
    }

    public Boolean hasStorageCapacity() {
        return this.storageCapacity != null;
    }

    public A withNewStorageCapacity(String arg1) {
        return (A)withStorageCapacity(new Boolean(arg1));
    }

    public A withNewStorageCapacity(boolean arg1) {
        return (A)withStorageCapacity(new Boolean(arg1));
    }

    public A addToTokenRequests(int index,V1beta1TokenRequest item) {
        if (this.tokenRequests == null) {this.tokenRequests = new ArrayList();}
        V1beta1TokenRequestBuilder builder = new V1beta1TokenRequestBuilder(item);_visitables.get("tokenRequests").add(index >= 0 ? index : _visitables.get("tokenRequests").size(), builder);this.tokenRequests.add(index >= 0 ? index : tokenRequests.size(), builder); return (A)this;
    }

    public A setToTokenRequests(int index,V1beta1TokenRequest item) {
        if (this.tokenRequests == null) {this.tokenRequests = new ArrayList();}
        V1beta1TokenRequestBuilder builder = new V1beta1TokenRequestBuilder(item);
        if (index < 0 || index >= _visitables.get("tokenRequests").size()) { _visitables.get("tokenRequests").add(builder); } else { _visitables.get("tokenRequests").set(index, builder);}
        if (index < 0 || index >= tokenRequests.size()) { tokenRequests.add(builder); } else { tokenRequests.set(index, builder);}
         return (A)this;
    }

    public A addToTokenRequests(V1beta1TokenRequest... items) {
        if (this.tokenRequests == null) {this.tokenRequests = new ArrayList();}
        for (V1beta1TokenRequest item : items) {V1beta1TokenRequestBuilder builder = new V1beta1TokenRequestBuilder(item);_visitables.get("tokenRequests").add(builder);this.tokenRequests.add(builder);} return (A)this;
    }

    public A addAllToTokenRequests(Collection items) {
        if (this.tokenRequests == null) {this.tokenRequests = new ArrayList();}
        for (V1beta1TokenRequest item : items) {V1beta1TokenRequestBuilder builder = new V1beta1TokenRequestBuilder(item);_visitables.get("tokenRequests").add(builder);this.tokenRequests.add(builder);} return (A)this;
    }

    public A removeFromTokenRequests(V1beta1TokenRequest... items) {
        for (V1beta1TokenRequest item : items) {V1beta1TokenRequestBuilder builder = new V1beta1TokenRequestBuilder(item);_visitables.get("tokenRequests").remove(builder);if (this.tokenRequests != null) {this.tokenRequests.remove(builder);}} return (A)this;
    }

    public A removeAllFromTokenRequests(Collection items) {
        for (V1beta1TokenRequest item : items) {V1beta1TokenRequestBuilder builder = new V1beta1TokenRequestBuilder(item);_visitables.get("tokenRequests").remove(builder);if (this.tokenRequests != null) {this.tokenRequests.remove(builder);}} return (A)this;
    }

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

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

    public List buildTokenRequests() {
        return build(tokenRequests);
    }

    public V1beta1TokenRequest buildTokenRequest(int index) {
        return this.tokenRequests.get(index).build();
    }

    public V1beta1TokenRequest buildFirstTokenRequest() {
        return this.tokenRequests.get(0).build();
    }

    public V1beta1TokenRequest buildLastTokenRequest() {
        return this.tokenRequests.get(tokenRequests.size() - 1).build();
    }

    public V1beta1TokenRequest buildMatchingTokenRequest(io.kubernetes.client.fluent.Predicate predicate) {
        for (V1beta1TokenRequestBuilder item: tokenRequests) { if(predicate.apply(item)){ return item.build();} } return null;
    }

    public Boolean hasMatchingTokenRequest(io.kubernetes.client.fluent.Predicate predicate) {
        for (V1beta1TokenRequestBuilder item: tokenRequests) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A withTokenRequests(List tokenRequests) {
        if (this.tokenRequests != null) { _visitables.get("tokenRequests").removeAll(this.tokenRequests);}
        if (tokenRequests != null) {this.tokenRequests = new ArrayList(); for (V1beta1TokenRequest item : tokenRequests){this.addToTokenRequests(item);}} else { this.tokenRequests = null;} return (A) this;
    }

    public A withTokenRequests(V1beta1TokenRequest... tokenRequests) {
        if (this.tokenRequests != null) {this.tokenRequests.clear();}
        if (tokenRequests != null) {for (V1beta1TokenRequest item :tokenRequests){ this.addToTokenRequests(item);}} return (A) this;
    }

    public Boolean hasTokenRequests() {
        return tokenRequests != null && !tokenRequests.isEmpty();
    }

    public V1beta1CSIDriverSpecFluent.TokenRequestsNested addNewTokenRequest() {
        return new TokenRequestsNestedImpl();
    }

    public V1beta1CSIDriverSpecFluent.TokenRequestsNested addNewTokenRequestLike(V1beta1TokenRequest item) {
        return new TokenRequestsNestedImpl(-1, item);
    }

    public V1beta1CSIDriverSpecFluent.TokenRequestsNested setNewTokenRequestLike(int index,V1beta1TokenRequest item) {
        return new TokenRequestsNestedImpl(index, item);
    }

    public V1beta1CSIDriverSpecFluent.TokenRequestsNested editTokenRequest(int index) {
        if (tokenRequests.size() <= index) throw new RuntimeException("Can't edit tokenRequests. Index exceeds size.");
        return setNewTokenRequestLike(index, buildTokenRequest(index));
    }

    public V1beta1CSIDriverSpecFluent.TokenRequestsNested editFirstTokenRequest() {
        if (tokenRequests.size() == 0) throw new RuntimeException("Can't edit first tokenRequests. The list is empty.");
        return setNewTokenRequestLike(0, buildTokenRequest(0));
    }

    public V1beta1CSIDriverSpecFluent.TokenRequestsNested editLastTokenRequest() {
        int index = tokenRequests.size() - 1;
        if (index < 0) throw new RuntimeException("Can't edit last tokenRequests. The list is empty.");
        return setNewTokenRequestLike(index, buildTokenRequest(index));
    }

    public V1beta1CSIDriverSpecFluent.TokenRequestsNested editMatchingTokenRequest(io.kubernetes.client.fluent.Predicate predicate) {
        int index = -1;
        for (int i=0;i();}
        this.volumeLifecycleModes.add(index, item);
        return (A)this;
    }

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

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

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

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

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

    public List getVolumeLifecycleModes() {
        return this.volumeLifecycleModes;
    }

    public String getVolumeLifecycleMode(int index) {
        return this.volumeLifecycleModes.get(index);
    }

    public String getFirstVolumeLifecycleMode() {
        return this.volumeLifecycleModes.get(0);
    }

    public String getLastVolumeLifecycleMode() {
        return this.volumeLifecycleModes.get(volumeLifecycleModes.size() - 1);
    }

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

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

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

    public A withVolumeLifecycleModes(String... volumeLifecycleModes) {
        if (this.volumeLifecycleModes != null) {this.volumeLifecycleModes.clear();}
        if (volumeLifecycleModes != null) {for (String item :volumeLifecycleModes){ this.addToVolumeLifecycleModes(item);}} return (A) this;
    }

    public Boolean hasVolumeLifecycleModes() {
        return volumeLifecycleModes != null && !volumeLifecycleModes.isEmpty();
    }

    public A addNewVolumeLifecycleMode(String arg1) {
        return (A)addToVolumeLifecycleModes(new String(arg1));
    }

    public A addNewVolumeLifecycleMode(StringBuilder arg1) {
        return (A)addToVolumeLifecycleModes(new String(arg1));
    }

    public A addNewVolumeLifecycleMode(StringBuffer arg1) {
        return (A)addToVolumeLifecycleModes(new String(arg1));
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        V1beta1CSIDriverSpecFluentImpl that = (V1beta1CSIDriverSpecFluentImpl) o;
        if (attachRequired != null ? !attachRequired.equals(that.attachRequired) :that.attachRequired != null) return false;
        if (fsGroupPolicy != null ? !fsGroupPolicy.equals(that.fsGroupPolicy) :that.fsGroupPolicy != null) return false;
        if (podInfoOnMount != null ? !podInfoOnMount.equals(that.podInfoOnMount) :that.podInfoOnMount != null) return false;
        if (requiresRepublish != null ? !requiresRepublish.equals(that.requiresRepublish) :that.requiresRepublish != null) return false;
        if (storageCapacity != null ? !storageCapacity.equals(that.storageCapacity) :that.storageCapacity != null) return false;
        if (tokenRequests != null ? !tokenRequests.equals(that.tokenRequests) :that.tokenRequests != null) return false;
        if (volumeLifecycleModes != null ? !volumeLifecycleModes.equals(that.volumeLifecycleModes) :that.volumeLifecycleModes != null) return false;
        return true;
    }

    public int hashCode() {
        return java.util.Objects.hash(attachRequired,  fsGroupPolicy,  podInfoOnMount,  requiresRepublish,  storageCapacity,  tokenRequests,  volumeLifecycleModes,  super.hashCode());
    }

    public class TokenRequestsNestedImpl extends V1beta1TokenRequestFluentImpl> implements V1beta1CSIDriverSpecFluent.TokenRequestsNested,io.kubernetes.client.fluent.Nested {
        private final V1beta1TokenRequestBuilder builder;
        private final int index;

        TokenRequestsNestedImpl(int index,V1beta1TokenRequest item) {
            this.index = index;
            this.builder = new V1beta1TokenRequestBuilder(this, item);
        }

        TokenRequestsNestedImpl() {
            this.index = -1;
            this.builder = new V1beta1TokenRequestBuilder(this);
        }

        public N and() {
             return (N) V1beta1CSIDriverSpecFluentImpl.this.setToTokenRequests(index,builder.build());
        }

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


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy