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

io.kubernetes.client.openapi.models.V1beta1StorageClassFluentImpl 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.util.LinkedHashMap;
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;
import java.util.Map;

public class V1beta1StorageClassFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1beta1StorageClassFluent {

    private Boolean allowVolumeExpansion;
    private List allowedTopologies;
    private String apiVersion;
    private String kind;
    private V1ObjectMetaBuilder metadata;
    private List mountOptions;
    private Map parameters;
    private String provisioner;
    private String reclaimPolicy;
    private String volumeBindingMode;

    public V1beta1StorageClassFluentImpl() { 
    }


    public V1beta1StorageClassFluentImpl(V1beta1StorageClass instance) { 
        this.withAllowVolumeExpansion(instance.getAllowVolumeExpansion());

        this.withAllowedTopologies(instance.getAllowedTopologies());

        this.withApiVersion(instance.getApiVersion());

        this.withKind(instance.getKind());

        this.withMetadata(instance.getMetadata());

        this.withMountOptions(instance.getMountOptions());

        this.withParameters(instance.getParameters());

        this.withProvisioner(instance.getProvisioner());

        this.withReclaimPolicy(instance.getReclaimPolicy());

        this.withVolumeBindingMode(instance.getVolumeBindingMode());

    }


    public Boolean isAllowVolumeExpansion() {
        return this.allowVolumeExpansion;
    }

    public A withAllowVolumeExpansion(Boolean allowVolumeExpansion) {
        this.allowVolumeExpansion=allowVolumeExpansion; return (A) this;
    }

    public Boolean hasAllowVolumeExpansion() {
        return this.allowVolumeExpansion != null;
    }

    public A withNewAllowVolumeExpansion(String arg1) {
        return (A)withAllowVolumeExpansion(new Boolean(arg1));
    }

    public A withNewAllowVolumeExpansion(boolean arg1) {
        return (A)withAllowVolumeExpansion(new Boolean(arg1));
    }

    public A addToAllowedTopologies(int index,V1TopologySelectorTerm item) {
        if (this.allowedTopologies == null) {this.allowedTopologies = new ArrayList();}
        V1TopologySelectorTermBuilder builder = new V1TopologySelectorTermBuilder(item);_visitables.get("allowedTopologies").add(index >= 0 ? index : _visitables.get("allowedTopologies").size(), builder);this.allowedTopologies.add(index >= 0 ? index : allowedTopologies.size(), builder); return (A)this;
    }

    public A setToAllowedTopologies(int index,V1TopologySelectorTerm item) {
        if (this.allowedTopologies == null) {this.allowedTopologies = new ArrayList();}
        V1TopologySelectorTermBuilder builder = new V1TopologySelectorTermBuilder(item);
        if (index < 0 || index >= _visitables.get("allowedTopologies").size()) { _visitables.get("allowedTopologies").add(builder); } else { _visitables.get("allowedTopologies").set(index, builder);}
        if (index < 0 || index >= allowedTopologies.size()) { allowedTopologies.add(builder); } else { allowedTopologies.set(index, builder);}
         return (A)this;
    }

    public A addToAllowedTopologies(V1TopologySelectorTerm... items) {
        if (this.allowedTopologies == null) {this.allowedTopologies = new ArrayList();}
        for (V1TopologySelectorTerm item : items) {V1TopologySelectorTermBuilder builder = new V1TopologySelectorTermBuilder(item);_visitables.get("allowedTopologies").add(builder);this.allowedTopologies.add(builder);} return (A)this;
    }

    public A addAllToAllowedTopologies(Collection items) {
        if (this.allowedTopologies == null) {this.allowedTopologies = new ArrayList();}
        for (V1TopologySelectorTerm item : items) {V1TopologySelectorTermBuilder builder = new V1TopologySelectorTermBuilder(item);_visitables.get("allowedTopologies").add(builder);this.allowedTopologies.add(builder);} return (A)this;
    }

    public A removeFromAllowedTopologies(V1TopologySelectorTerm... items) {
        for (V1TopologySelectorTerm item : items) {V1TopologySelectorTermBuilder builder = new V1TopologySelectorTermBuilder(item);_visitables.get("allowedTopologies").remove(builder);if (this.allowedTopologies != null) {this.allowedTopologies.remove(builder);}} return (A)this;
    }

    public A removeAllFromAllowedTopologies(Collection items) {
        for (V1TopologySelectorTerm item : items) {V1TopologySelectorTermBuilder builder = new V1TopologySelectorTermBuilder(item);_visitables.get("allowedTopologies").remove(builder);if (this.allowedTopologies != null) {this.allowedTopologies.remove(builder);}} return (A)this;
    }

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

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

    public List buildAllowedTopologies() {
        return build(allowedTopologies);
    }

    public V1TopologySelectorTerm buildAllowedTopology(int index) {
        return this.allowedTopologies.get(index).build();
    }

    public V1TopologySelectorTerm buildFirstAllowedTopology() {
        return this.allowedTopologies.get(0).build();
    }

    public V1TopologySelectorTerm buildLastAllowedTopology() {
        return this.allowedTopologies.get(allowedTopologies.size() - 1).build();
    }

    public V1TopologySelectorTerm buildMatchingAllowedTopology(io.kubernetes.client.fluent.Predicate predicate) {
        for (V1TopologySelectorTermBuilder item: allowedTopologies) { if(predicate.apply(item)){ return item.build();} } return null;
    }

    public Boolean hasMatchingAllowedTopology(io.kubernetes.client.fluent.Predicate predicate) {
        for (V1TopologySelectorTermBuilder item: allowedTopologies) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A withAllowedTopologies(List allowedTopologies) {
        if (this.allowedTopologies != null) { _visitables.get("allowedTopologies").removeAll(this.allowedTopologies);}
        if (allowedTopologies != null) {this.allowedTopologies = new ArrayList(); for (V1TopologySelectorTerm item : allowedTopologies){this.addToAllowedTopologies(item);}} else { this.allowedTopologies = null;} return (A) this;
    }

    public A withAllowedTopologies(V1TopologySelectorTerm... allowedTopologies) {
        if (this.allowedTopologies != null) {this.allowedTopologies.clear();}
        if (allowedTopologies != null) {for (V1TopologySelectorTerm item :allowedTopologies){ this.addToAllowedTopologies(item);}} return (A) this;
    }

    public Boolean hasAllowedTopologies() {
        return allowedTopologies != null && !allowedTopologies.isEmpty();
    }

    public V1beta1StorageClassFluent.AllowedTopologiesNested addNewAllowedTopology() {
        return new AllowedTopologiesNestedImpl();
    }

    public V1beta1StorageClassFluent.AllowedTopologiesNested addNewAllowedTopologyLike(V1TopologySelectorTerm item) {
        return new AllowedTopologiesNestedImpl(-1, item);
    }

    public V1beta1StorageClassFluent.AllowedTopologiesNested setNewAllowedTopologyLike(int index,V1TopologySelectorTerm item) {
        return new AllowedTopologiesNestedImpl(index, item);
    }

    public V1beta1StorageClassFluent.AllowedTopologiesNested editAllowedTopology(int index) {
        if (allowedTopologies.size() <= index) throw new RuntimeException("Can't edit allowedTopologies. Index exceeds size.");
        return setNewAllowedTopologyLike(index, buildAllowedTopology(index));
    }

    public V1beta1StorageClassFluent.AllowedTopologiesNested editFirstAllowedTopology() {
        if (allowedTopologies.size() == 0) throw new RuntimeException("Can't edit first allowedTopologies. The list is empty.");
        return setNewAllowedTopologyLike(0, buildAllowedTopology(0));
    }

    public V1beta1StorageClassFluent.AllowedTopologiesNested editLastAllowedTopology() {
        int index = allowedTopologies.size() - 1;
        if (index < 0) throw new RuntimeException("Can't edit last allowedTopologies. The list is empty.");
        return setNewAllowedTopologyLike(index, buildAllowedTopology(index));
    }

    public V1beta1StorageClassFluent.AllowedTopologiesNested editMatchingAllowedTopology(io.kubernetes.client.fluent.Predicate predicate) {
        int index = -1;
        for (int i=0;i withNewMetadata() {
        return new MetadataNestedImpl();
    }

    public V1beta1StorageClassFluent.MetadataNested withNewMetadataLike(V1ObjectMeta item) {
        return new MetadataNestedImpl(item);
    }

    public V1beta1StorageClassFluent.MetadataNested editMetadata() {
        return withNewMetadataLike(getMetadata());
    }

    public V1beta1StorageClassFluent.MetadataNested editOrNewMetadata() {
        return withNewMetadataLike(getMetadata() != null ? getMetadata(): new V1ObjectMetaBuilder().build());
    }

    public V1beta1StorageClassFluent.MetadataNested editOrNewMetadataLike(V1ObjectMeta item) {
        return withNewMetadataLike(getMetadata() != null ? getMetadata(): item);
    }

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

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

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

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

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

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

    public List getMountOptions() {
        return this.mountOptions;
    }

    public String getMountOption(int index) {
        return this.mountOptions.get(index);
    }

    public String getFirstMountOption() {
        return this.mountOptions.get(0);
    }

    public String getLastMountOption() {
        return this.mountOptions.get(mountOptions.size() - 1);
    }

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

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

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

    public A withMountOptions(String... mountOptions) {
        if (this.mountOptions != null) {this.mountOptions.clear();}
        if (mountOptions != null) {for (String item :mountOptions){ this.addToMountOptions(item);}} return (A) this;
    }

    public Boolean hasMountOptions() {
        return mountOptions != null && !mountOptions.isEmpty();
    }

    public A addNewMountOption(String arg1) {
        return (A)addToMountOptions(new String(arg1));
    }

    public A addNewMountOption(StringBuilder arg1) {
        return (A)addToMountOptions(new String(arg1));
    }

    public A addNewMountOption(StringBuffer arg1) {
        return (A)addToMountOptions(new String(arg1));
    }

    public A addToParameters(String key,String value) {
        if(this.parameters == null && key != null && value != null) { this.parameters = new LinkedHashMap(); }
        if(key != null && value != null) {this.parameters.put(key, value);} return (A)this;
    }

    public A addToParameters(Map map) {
        if(this.parameters == null && map != null) { this.parameters = new LinkedHashMap(); }
        if(map != null) { this.parameters.putAll(map);} return (A)this;
    }

    public A removeFromParameters(String key) {
        if(this.parameters == null) { return (A) this; }
        if(key != null && this.parameters != null) {this.parameters.remove(key);} return (A)this;
    }

    public A removeFromParameters(Map map) {
        if(this.parameters == null) { return (A) this; }
        if(map != null) { for(Object key : map.keySet()) {if (this.parameters != null){this.parameters.remove(key);}}} return (A)this;
    }

    public Map getParameters() {
        return this.parameters;
    }

    public A withParameters(Map parameters) {
        if (parameters == null) { this.parameters =  null;} else {this.parameters = new LinkedHashMap(parameters);} return (A) this;
    }

    public Boolean hasParameters() {
        return this.parameters != null;
    }

    public String getProvisioner() {
        return this.provisioner;
    }

    public A withProvisioner(String provisioner) {
        this.provisioner=provisioner; return (A) this;
    }

    public Boolean hasProvisioner() {
        return this.provisioner != null;
    }

    public A withNewProvisioner(String arg1) {
        return (A)withProvisioner(new String(arg1));
    }

    public A withNewProvisioner(StringBuilder arg1) {
        return (A)withProvisioner(new String(arg1));
    }

    public A withNewProvisioner(StringBuffer arg1) {
        return (A)withProvisioner(new String(arg1));
    }

    public String getReclaimPolicy() {
        return this.reclaimPolicy;
    }

    public A withReclaimPolicy(String reclaimPolicy) {
        this.reclaimPolicy=reclaimPolicy; return (A) this;
    }

    public Boolean hasReclaimPolicy() {
        return this.reclaimPolicy != null;
    }

    public A withNewReclaimPolicy(String arg1) {
        return (A)withReclaimPolicy(new String(arg1));
    }

    public A withNewReclaimPolicy(StringBuilder arg1) {
        return (A)withReclaimPolicy(new String(arg1));
    }

    public A withNewReclaimPolicy(StringBuffer arg1) {
        return (A)withReclaimPolicy(new String(arg1));
    }

    public String getVolumeBindingMode() {
        return this.volumeBindingMode;
    }

    public A withVolumeBindingMode(String volumeBindingMode) {
        this.volumeBindingMode=volumeBindingMode; return (A) this;
    }

    public Boolean hasVolumeBindingMode() {
        return this.volumeBindingMode != null;
    }

    public A withNewVolumeBindingMode(String arg1) {
        return (A)withVolumeBindingMode(new String(arg1));
    }

    public A withNewVolumeBindingMode(StringBuilder arg1) {
        return (A)withVolumeBindingMode(new String(arg1));
    }

    public A withNewVolumeBindingMode(StringBuffer arg1) {
        return (A)withVolumeBindingMode(new String(arg1));
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        V1beta1StorageClassFluentImpl that = (V1beta1StorageClassFluentImpl) o;
        if (allowVolumeExpansion != null ? !allowVolumeExpansion.equals(that.allowVolumeExpansion) :that.allowVolumeExpansion != null) return false;
        if (allowedTopologies != null ? !allowedTopologies.equals(that.allowedTopologies) :that.allowedTopologies != null) return false;
        if (apiVersion != null ? !apiVersion.equals(that.apiVersion) :that.apiVersion != null) return false;
        if (kind != null ? !kind.equals(that.kind) :that.kind != null) return false;
        if (metadata != null ? !metadata.equals(that.metadata) :that.metadata != null) return false;
        if (mountOptions != null ? !mountOptions.equals(that.mountOptions) :that.mountOptions != null) return false;
        if (parameters != null ? !parameters.equals(that.parameters) :that.parameters != null) return false;
        if (provisioner != null ? !provisioner.equals(that.provisioner) :that.provisioner != null) return false;
        if (reclaimPolicy != null ? !reclaimPolicy.equals(that.reclaimPolicy) :that.reclaimPolicy != null) return false;
        if (volumeBindingMode != null ? !volumeBindingMode.equals(that.volumeBindingMode) :that.volumeBindingMode != null) return false;
        return true;
    }

    public int hashCode() {
        return java.util.Objects.hash(allowVolumeExpansion,  allowedTopologies,  apiVersion,  kind,  metadata,  mountOptions,  parameters,  provisioner,  reclaimPolicy,  volumeBindingMode,  super.hashCode());
    }

    public class AllowedTopologiesNestedImpl extends V1TopologySelectorTermFluentImpl> implements V1beta1StorageClassFluent.AllowedTopologiesNested,io.kubernetes.client.fluent.Nested {
        private final V1TopologySelectorTermBuilder builder;
        private final int index;

        AllowedTopologiesNestedImpl(int index,V1TopologySelectorTerm item) {
            this.index = index;
            this.builder = new V1TopologySelectorTermBuilder(this, item);
        }

        AllowedTopologiesNestedImpl() {
            this.index = -1;
            this.builder = new V1TopologySelectorTermBuilder(this);
        }

        public N and() {
             return (N) V1beta1StorageClassFluentImpl.this.setToAllowedTopologies(index,builder.build());
        }

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


    public class MetadataNestedImpl extends V1ObjectMetaFluentImpl> implements V1beta1StorageClassFluent.MetadataNested,io.kubernetes.client.fluent.Nested {
        private final V1ObjectMetaBuilder builder;

        MetadataNestedImpl(V1ObjectMeta item) {
            this.builder = new V1ObjectMetaBuilder(this, item);
        }

        MetadataNestedImpl() {
            this.builder = new V1ObjectMetaBuilder(this);
        }

        public N and() {
             return (N) V1beta1StorageClassFluentImpl.this.withMetadata(builder.build());
        }

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


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy