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

io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluentImpl Maven / Gradle / Ivy

package io.fabric8.openshift.api.model.installer.ibmcloud.v1;

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 java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import java.lang.Integer;
import java.util.Collection;
import java.lang.Object;
import java.util.Map;

 /**
  * Generated
  */
  @SuppressWarnings(value = "unchecked")
  public class MachinePoolFluentImpl> extends BaseFluent implements MachinePoolFluent{
  public MachinePoolFluentImpl() {
  }
  public MachinePoolFluentImpl(io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePool instance) {
    this.withBootVolume(instance.getBootVolume()); 
    this.withDedicatedHosts(instance.getDedicatedHosts()); 
    this.withType(instance.getType()); 
    this.withZones(instance.getZones()); 
    this.withAdditionalProperties(instance.getAdditionalProperties());

  }
  private BootVolumeBuilder bootVolume;
  private ArrayList dedicatedHosts = new java.util.ArrayList();
  private String type;
  private List zones = new java.util.ArrayList();
  private Map additionalProperties;
  
  /**
   * This method has been deprecated, please use method buildBootVolume instead.
   * @return The buildable object.
   */
  @Deprecated
  public BootVolume getBootVolume() {
    return this.bootVolume!=null ?this.bootVolume.build():null;
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.BootVolume buildBootVolume() {
    return this.bootVolume!=null ?this.bootVolume.build():null;
  }
  public A withBootVolume(io.fabric8.openshift.api.model.installer.ibmcloud.v1.BootVolume bootVolume) {
    _visitables.get("bootVolume").remove(this.bootVolume);
    if (bootVolume!=null){ this.bootVolume= new io.fabric8.openshift.api.model.installer.ibmcloud.v1.BootVolumeBuilder(bootVolume); _visitables.get("bootVolume").add(this.bootVolume);} return (A) this;
  }
  public Boolean hasBootVolume() {
    return this.bootVolume != null;
  }
  public A withNewBootVolume(java.lang.String encryptionKey) {
    return (A)withBootVolume(new BootVolume(encryptionKey));
  }
  public MachinePoolFluent.BootVolumeNested withNewBootVolume() {
    return new MachinePoolFluentImpl.BootVolumeNestedImpl();
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluent.BootVolumeNested withNewBootVolumeLike(io.fabric8.openshift.api.model.installer.ibmcloud.v1.BootVolume item) {
    return new MachinePoolFluentImpl.BootVolumeNestedImpl(item);
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluent.BootVolumeNested editBootVolume() {
    return withNewBootVolumeLike(getBootVolume());
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluent.BootVolumeNested editOrNewBootVolume() {
    return withNewBootVolumeLike(getBootVolume() != null ? getBootVolume(): new io.fabric8.openshift.api.model.installer.ibmcloud.v1.BootVolumeBuilder().build());
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluent.BootVolumeNested editOrNewBootVolumeLike(io.fabric8.openshift.api.model.installer.ibmcloud.v1.BootVolume item) {
    return withNewBootVolumeLike(getBootVolume() != null ? getBootVolume(): item);
  }
  public A addToDedicatedHosts(Integer index,io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost item) {
    if (this.dedicatedHosts == null) {this.dedicatedHosts = new java.util.ArrayList();}
    io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder builder = new io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder(item);_visitables.get("dedicatedHosts").add(index >= 0 ? index : _visitables.get("dedicatedHosts").size(), builder);this.dedicatedHosts.add(index >= 0 ? index : dedicatedHosts.size(), builder); return (A)this;
  }
  public A setToDedicatedHosts(java.lang.Integer index,io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost item) {
    if (this.dedicatedHosts == null) {this.dedicatedHosts = new java.util.ArrayList();}
    io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder builder = new io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder(item);
    if (index < 0 || index >= _visitables.get("dedicatedHosts").size()) { _visitables.get("dedicatedHosts").add(builder); } else { _visitables.get("dedicatedHosts").set(index, builder);}
    if (index < 0 || index >= dedicatedHosts.size()) { dedicatedHosts.add(builder); } else { dedicatedHosts.set(index, builder);}
     return (A)this;
  }
  public A addToDedicatedHosts(io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost... items) {
    if (this.dedicatedHosts == null) {this.dedicatedHosts = new java.util.ArrayList();}
    for (io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost item : items) {io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder builder = new io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder(item);_visitables.get("dedicatedHosts").add(builder);this.dedicatedHosts.add(builder);} return (A)this;
  }
  public A addAllToDedicatedHosts(Collection items) {
    if (this.dedicatedHosts == null) {this.dedicatedHosts = new java.util.ArrayList();}
    for (io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost item : items) {io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder builder = new io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder(item);_visitables.get("dedicatedHosts").add(builder);this.dedicatedHosts.add(builder);} return (A)this;
  }
  public A removeFromDedicatedHosts(io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost... items) {
    for (io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost item : items) {io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder builder = new io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder(item);_visitables.get("dedicatedHosts").remove(builder);if (this.dedicatedHosts != null) {this.dedicatedHosts.remove(builder);}} return (A)this;
  }
  public A removeAllFromDedicatedHosts(java.util.Collection items) {
    for (io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost item : items) {io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder builder = new io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder(item);_visitables.get("dedicatedHosts").remove(builder);if (this.dedicatedHosts != null) {this.dedicatedHosts.remove(builder);}} return (A)this;
  }
  public A removeMatchingFromDedicatedHosts(Predicate predicate) {
    if (dedicatedHosts == null) return (A) this;
    final Iterator each = dedicatedHosts.iterator();
    final List visitables = _visitables.get("dedicatedHosts");
    while (each.hasNext()) {
      io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder builder = each.next();
      if (predicate.test(builder)) {
        visitables.remove(builder);
        each.remove();
      }
    }
    return (A)this;
  }
  
  /**
   * This method has been deprecated, please use method buildDedicatedHosts instead.
   * @return The buildable object.
   */
  @java.lang.Deprecated
  public java.util.List getDedicatedHosts() {
    return dedicatedHosts != null ? build(dedicatedHosts) : null;
  }
  public java.util.List buildDedicatedHosts() {
    return dedicatedHosts != null ? build(dedicatedHosts) : null;
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost buildDedicatedHost(java.lang.Integer index) {
    return this.dedicatedHosts.get(index).build();
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost buildFirstDedicatedHost() {
    return this.dedicatedHosts.get(0).build();
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost buildLastDedicatedHost() {
    return this.dedicatedHosts.get(dedicatedHosts.size() - 1).build();
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost buildMatchingDedicatedHost(java.util.function.Predicate predicate) {
    for (io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder item: dedicatedHosts) { if(predicate.test(item)){ return item.build();} } return null;
  }
  public java.lang.Boolean hasMatchingDedicatedHost(java.util.function.Predicate predicate) {
    for (io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder item: dedicatedHosts) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withDedicatedHosts(java.util.List dedicatedHosts) {
    if (this.dedicatedHosts != null) { _visitables.get("dedicatedHosts").removeAll(this.dedicatedHosts);}
    if (dedicatedHosts != null) {this.dedicatedHosts = new java.util.ArrayList(); for (io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost item : dedicatedHosts){this.addToDedicatedHosts(item);}} else { this.dedicatedHosts = null;} return (A) this;
  }
  public A withDedicatedHosts(io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost... dedicatedHosts) {
    if (this.dedicatedHosts != null) {this.dedicatedHosts.clear();}
    if (dedicatedHosts != null) {for (io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost item :dedicatedHosts){ this.addToDedicatedHosts(item);}} return (A) this;
  }
  public java.lang.Boolean hasDedicatedHosts() {
    return dedicatedHosts != null && !dedicatedHosts.isEmpty();
  }
  public A addNewDedicatedHost(java.lang.String name,java.lang.String profile) {
    return (A)addToDedicatedHosts(new DedicatedHost(name, profile));
  }
  public MachinePoolFluent.DedicatedHostsNested addNewDedicatedHost() {
    return new MachinePoolFluentImpl.DedicatedHostsNestedImpl();
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluent.DedicatedHostsNested addNewDedicatedHostLike(io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost item) {
    return new io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluentImpl.DedicatedHostsNestedImpl(-1, item);
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluent.DedicatedHostsNested setNewDedicatedHostLike(java.lang.Integer index,io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHost item) {
    return new io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluentImpl.DedicatedHostsNestedImpl(index, item);
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluent.DedicatedHostsNested editDedicatedHost(java.lang.Integer index) {
    if (dedicatedHosts.size() <= index) throw new RuntimeException("Can't edit dedicatedHosts. Index exceeds size.");
    return setNewDedicatedHostLike(index, buildDedicatedHost(index));
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluent.DedicatedHostsNested editFirstDedicatedHost() {
    if (dedicatedHosts.size() == 0) throw new RuntimeException("Can't edit first dedicatedHosts. The list is empty.");
    return setNewDedicatedHostLike(0, buildDedicatedHost(0));
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluent.DedicatedHostsNested editLastDedicatedHost() {
    int index = dedicatedHosts.size() - 1;
    if (index < 0) throw new RuntimeException("Can't edit last dedicatedHosts. The list is empty.");
    return setNewDedicatedHostLike(index, buildDedicatedHost(index));
  }
  public io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluent.DedicatedHostsNested editMatchingDedicatedHost(java.util.function.Predicate predicate) {
    int index = -1;
    for (int i=0;i();}
    this.zones.add(index, item);
    return (A)this;
  }
  public A setToZones(java.lang.Integer index,java.lang.String item) {
    if (this.zones == null) {this.zones = new java.util.ArrayList();}
    this.zones.set(index, item); return (A)this;
  }
  public A addToZones(java.lang.String... items) {
    if (this.zones == null) {this.zones = new java.util.ArrayList();}
    for (java.lang.String item : items) {this.zones.add(item);} return (A)this;
  }
  public A addAllToZones(java.util.Collection items) {
    if (this.zones == null) {this.zones = new java.util.ArrayList();}
    for (java.lang.String item : items) {this.zones.add(item);} return (A)this;
  }
  public A removeFromZones(java.lang.String... items) {
    for (java.lang.String item : items) {if (this.zones!= null){ this.zones.remove(item);}} return (A)this;
  }
  public A removeAllFromZones(java.util.Collection items) {
    for (java.lang.String item : items) {if (this.zones!= null){ this.zones.remove(item);}} return (A)this;
  }
  public java.util.List getZones() {
    return this.zones;
  }
  public java.lang.String getZone(java.lang.Integer index) {
    return this.zones.get(index);
  }
  public java.lang.String getFirstZone() {
    return this.zones.get(0);
  }
  public java.lang.String getLastZone() {
    return this.zones.get(zones.size() - 1);
  }
  public java.lang.String getMatchingZone(java.util.function.Predicate predicate) {
    for (java.lang.String item: zones) { if(predicate.test(item)){ return item;} } return null;
  }
  public java.lang.Boolean hasMatchingZone(java.util.function.Predicate predicate) {
    for (java.lang.String item: zones) { if(predicate.test(item)){ return true;} } return false;
  }
  public A withZones(java.util.List zones) {
    if (zones != null) {this.zones = new java.util.ArrayList(); for (java.lang.String item : zones){this.addToZones(item);}} else { this.zones = null;} return (A) this;
  }
  public A withZones(java.lang.String... zones) {
    if (this.zones != null) {this.zones.clear();}
    if (zones != null) {for (java.lang.String item :zones){ this.addToZones(item);}} return (A) this;
  }
  public java.lang.Boolean hasZones() {
    return zones != null && !zones.isEmpty();
  }
  public A addToAdditionalProperties(java.lang.String key,java.lang.Object value) {
    if(this.additionalProperties == null && key != null && value != null) { this.additionalProperties = new LinkedHashMap(); }
    if(key != null && value != null) {this.additionalProperties.put(key, value);} return (A)this;
  }
  public A addToAdditionalProperties(java.util.Map map) {
    if(this.additionalProperties == null && map != null) { this.additionalProperties = new java.util.LinkedHashMap(); }
    if(map != null) { this.additionalProperties.putAll(map);} return (A)this;
  }
  public A removeFromAdditionalProperties(java.lang.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(java.util.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 java.util.Map getAdditionalProperties() {
    return this.additionalProperties;
  }
  public A withAdditionalProperties(java.util.Map additionalProperties) {
    if (additionalProperties == null) { this.additionalProperties =  null;} else {this.additionalProperties = new java.util.LinkedHashMap(additionalProperties);} return (A) this;
  }
  public java.lang.Boolean hasAdditionalProperties() {
    return this.additionalProperties != null;
  }
  public boolean equals(java.lang.Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    MachinePoolFluentImpl that = (MachinePoolFluentImpl) o;
    if (bootVolume != null ? !bootVolume.equals(that.bootVolume) :that.bootVolume != null) return false;
    if (dedicatedHosts != null ? !dedicatedHosts.equals(that.dedicatedHosts) :that.dedicatedHosts != null) return false;
    if (type != null ? !type.equals(that.type) :that.type != null) return false;
    if (zones != null ? !zones.equals(that.zones) :that.zones != null) return false;
    if (additionalProperties != null ? !additionalProperties.equals(that.additionalProperties) :that.additionalProperties != null) return false;
    return true;
  }
  public int hashCode() {
    return java.util.Objects.hash(bootVolume,  dedicatedHosts,  type,  zones,  additionalProperties,  super.hashCode());
  }
  public java.lang.String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    if (bootVolume != null) { sb.append("bootVolume:"); sb.append(bootVolume + ","); }
    if (dedicatedHosts != null && !dedicatedHosts.isEmpty()) { sb.append("dedicatedHosts:"); sb.append(dedicatedHosts + ","); }
    if (type != null) { sb.append("type:"); sb.append(type + ","); }
    if (zones != null && !zones.isEmpty()) { sb.append("zones:"); sb.append(zones + ","); }
    if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
    sb.append("}");
    return sb.toString();
  }
  class BootVolumeNestedImpl extends BootVolumeFluentImpl> implements io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluent.BootVolumeNested,Nested{
    BootVolumeNestedImpl(io.fabric8.openshift.api.model.installer.ibmcloud.v1.BootVolume item) {
      this.builder = new BootVolumeBuilder(this, item);
    }
    BootVolumeNestedImpl() {
      this.builder = new io.fabric8.openshift.api.model.installer.ibmcloud.v1.BootVolumeBuilder(this);
    }
    io.fabric8.openshift.api.model.installer.ibmcloud.v1.BootVolumeBuilder builder;
    public N and() {
      return (N) MachinePoolFluentImpl.this.withBootVolume(builder.build());
    }
    public N endBootVolume() {
      return and();
    }
    
  }
  class DedicatedHostsNestedImpl extends DedicatedHostFluentImpl> implements io.fabric8.openshift.api.model.installer.ibmcloud.v1.MachinePoolFluent.DedicatedHostsNested,io.fabric8.kubernetes.api.builder.Nested{
    DedicatedHostsNestedImpl(java.lang.Integer index,DedicatedHost item) {
      this.index = index;
      this.builder = new DedicatedHostBuilder(this, item);
    }
    DedicatedHostsNestedImpl() {
      this.index = -1;
      this.builder = new io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder(this);
    }
    io.fabric8.openshift.api.model.installer.ibmcloud.v1.DedicatedHostBuilder builder;
    java.lang.Integer index;
    public N and() {
      return (N) MachinePoolFluentImpl.this.setToDedicatedHosts(index,builder.build());
    }
    public N endDedicatedHost() {
      return and();
    }
    
  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy