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

io.github.microcks.operator.api.base.v1alpha1.MongoDBSpecFluent Maven / Gradle / Ivy

There is a newer version: 0.0.2
Show newest version
package io.github.microcks.operator.api.base.v1alpha1;

import io.github.microcks.operator.api.model.SecretReferenceSpecBuilder;
import io.fabric8.kubernetes.api.model.PodSecurityContext;
import java.lang.SuppressWarnings;
import io.github.microcks.operator.api.model.ImageSpecFluent;
import io.fabric8.kubernetes.api.builder.Nested;
import io.github.microcks.operator.api.model.SecretReferenceSpecFluent;
import java.lang.String;
import io.github.microcks.operator.api.model.ImageSpec;
import io.fabric8.kubernetes.api.model.ResourceRequirements;
import java.util.LinkedHashMap;
import io.github.microcks.operator.api.model.ImageSpecBuilder;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.lang.Object;
import io.github.microcks.operator.api.model.SecretReferenceSpec;
import java.util.Map;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class MongoDBSpecFluent> extends BaseFluent{
  public MongoDBSpecFluent() {
  }
  
  public MongoDBSpecFluent(MongoDBSpec instance) {
    this.copyInstance(instance);
  }
  private boolean install;
  private ImageSpecBuilder image;
  private String uri;
  private String uriParameters;
  private String database;
  private SecretReferenceSpecBuilder secretRef;
  private ResourceRequirements resources;
  private PodSecurityContext securityContext;
  private boolean persistent;
  private String volumeSize;
  private String storageClassName;
  private Map pvcAnnotations;
  
  protected void copyInstance(MongoDBSpec instance) {
    instance = (instance != null ? instance : new MongoDBSpec());
    if (instance != null) {
          this.withInstall(instance.isInstall());
          this.withImage(instance.getImage());
          this.withUri(instance.getUri());
          this.withUriParameters(instance.getUriParameters());
          this.withDatabase(instance.getDatabase());
          this.withSecretRef(instance.getSecretRef());
          this.withResources(instance.getResources());
          this.withSecurityContext(instance.getSecurityContext());
          this.withPersistent(instance.isPersistent());
          this.withVolumeSize(instance.getVolumeSize());
          this.withStorageClassName(instance.getStorageClassName());
          this.withPvcAnnotations(instance.getPvcAnnotations());
        }
  }
  
  public boolean isInstall() {
    return this.install;
  }
  
  public A withInstall(boolean install) {
    this.install = install;
    return (A) this;
  }
  
  public boolean hasInstall() {
    return true;
  }
  
  public ImageSpec buildImage() {
    return this.image != null ? this.image.build() : null;
  }
  
  public A withImage(ImageSpec image) {
    this._visitables.remove("image");
    if (image != null) {
        this.image = new ImageSpecBuilder(image);
        this._visitables.get("image").add(this.image);
    } else {
        this.image = null;
        this._visitables.get("image").remove(this.image);
    }
    return (A) this;
  }
  
  public boolean hasImage() {
    return this.image != null;
  }
  
  public ImageNested withNewImage() {
    return new ImageNested(null);
  }
  
  public ImageNested withNewImageLike(ImageSpec item) {
    return new ImageNested(item);
  }
  
  public ImageNested editImage() {
    return withNewImageLike(java.util.Optional.ofNullable(buildImage()).orElse(null));
  }
  
  public ImageNested editOrNewImage() {
    return withNewImageLike(java.util.Optional.ofNullable(buildImage()).orElse(new ImageSpecBuilder().build()));
  }
  
  public ImageNested editOrNewImageLike(ImageSpec item) {
    return withNewImageLike(java.util.Optional.ofNullable(buildImage()).orElse(item));
  }
  
  public String getUri() {
    return this.uri;
  }
  
  public A withUri(String uri) {
    this.uri = uri;
    return (A) this;
  }
  
  public boolean hasUri() {
    return this.uri != null;
  }
  
  public String getUriParameters() {
    return this.uriParameters;
  }
  
  public A withUriParameters(String uriParameters) {
    this.uriParameters = uriParameters;
    return (A) this;
  }
  
  public boolean hasUriParameters() {
    return this.uriParameters != null;
  }
  
  public String getDatabase() {
    return this.database;
  }
  
  public A withDatabase(String database) {
    this.database = database;
    return (A) this;
  }
  
  public boolean hasDatabase() {
    return this.database != null;
  }
  
  public SecretReferenceSpec buildSecretRef() {
    return this.secretRef != null ? this.secretRef.build() : null;
  }
  
  public A withSecretRef(SecretReferenceSpec secretRef) {
    this._visitables.remove("secretRef");
    if (secretRef != null) {
        this.secretRef = new SecretReferenceSpecBuilder(secretRef);
        this._visitables.get("secretRef").add(this.secretRef);
    } else {
        this.secretRef = null;
        this._visitables.get("secretRef").remove(this.secretRef);
    }
    return (A) this;
  }
  
  public boolean hasSecretRef() {
    return this.secretRef != null;
  }
  
  public SecretRefNested withNewSecretRef() {
    return new SecretRefNested(null);
  }
  
  public SecretRefNested withNewSecretRefLike(SecretReferenceSpec item) {
    return new SecretRefNested(item);
  }
  
  public SecretRefNested editSecretRef() {
    return withNewSecretRefLike(java.util.Optional.ofNullable(buildSecretRef()).orElse(null));
  }
  
  public SecretRefNested editOrNewSecretRef() {
    return withNewSecretRefLike(java.util.Optional.ofNullable(buildSecretRef()).orElse(new SecretReferenceSpecBuilder().build()));
  }
  
  public SecretRefNested editOrNewSecretRefLike(SecretReferenceSpec item) {
    return withNewSecretRefLike(java.util.Optional.ofNullable(buildSecretRef()).orElse(item));
  }
  
  public ResourceRequirements getResources() {
    return this.resources;
  }
  
  public A withResources(ResourceRequirements resources) {
    this.resources = resources;
    return (A) this;
  }
  
  public boolean hasResources() {
    return this.resources != null;
  }
  
  public PodSecurityContext getSecurityContext() {
    return this.securityContext;
  }
  
  public A withSecurityContext(PodSecurityContext securityContext) {
    this.securityContext = securityContext;
    return (A) this;
  }
  
  public boolean hasSecurityContext() {
    return this.securityContext != null;
  }
  
  public boolean isPersistent() {
    return this.persistent;
  }
  
  public A withPersistent(boolean persistent) {
    this.persistent = persistent;
    return (A) this;
  }
  
  public boolean hasPersistent() {
    return true;
  }
  
  public String getVolumeSize() {
    return this.volumeSize;
  }
  
  public A withVolumeSize(String volumeSize) {
    this.volumeSize = volumeSize;
    return (A) this;
  }
  
  public boolean hasVolumeSize() {
    return this.volumeSize != null;
  }
  
  public String getStorageClassName() {
    return this.storageClassName;
  }
  
  public A withStorageClassName(String storageClassName) {
    this.storageClassName = storageClassName;
    return (A) this;
  }
  
  public boolean hasStorageClassName() {
    return this.storageClassName != null;
  }
  
  public A addToPvcAnnotations(String key,String value) {
    if(this.pvcAnnotations == null && key != null && value != null) { this.pvcAnnotations = new LinkedHashMap(); }
    if(key != null && value != null) {this.pvcAnnotations.put(key, value);} return (A)this;
  }
  
  public A addToPvcAnnotations(Map map) {
    if(this.pvcAnnotations == null && map != null) { this.pvcAnnotations = new LinkedHashMap(); }
    if(map != null) { this.pvcAnnotations.putAll(map);} return (A)this;
  }
  
  public A removeFromPvcAnnotations(String key) {
    if(this.pvcAnnotations == null) { return (A) this; }
    if(key != null && this.pvcAnnotations != null) {this.pvcAnnotations.remove(key);} return (A)this;
  }
  
  public A removeFromPvcAnnotations(Map map) {
    if(this.pvcAnnotations == null) { return (A) this; }
    if(map != null) { for(Object key : map.keySet()) {if (this.pvcAnnotations != null){this.pvcAnnotations.remove(key);}}} return (A)this;
  }
  
  public Map getPvcAnnotations() {
    return this.pvcAnnotations;
  }
  
  public A withPvcAnnotations(Map pvcAnnotations) {
    if (pvcAnnotations == null) {
      this.pvcAnnotations = null;
    } else {
      this.pvcAnnotations = new LinkedHashMap(pvcAnnotations);
    }
    return (A) this;
  }
  
  public boolean hasPvcAnnotations() {
    return this.pvcAnnotations != null;
  }
  
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;
    MongoDBSpecFluent that = (MongoDBSpecFluent) o;
    if (install != that.install) return false;
    if (!java.util.Objects.equals(image, that.image)) return false;
    if (!java.util.Objects.equals(uri, that.uri)) return false;
    if (!java.util.Objects.equals(uriParameters, that.uriParameters)) return false;
    if (!java.util.Objects.equals(database, that.database)) return false;
    if (!java.util.Objects.equals(secretRef, that.secretRef)) return false;
    if (!java.util.Objects.equals(resources, that.resources)) return false;
    if (!java.util.Objects.equals(securityContext, that.securityContext)) return false;
    if (persistent != that.persistent) return false;
    if (!java.util.Objects.equals(volumeSize, that.volumeSize)) return false;
    if (!java.util.Objects.equals(storageClassName, that.storageClassName)) return false;
    if (!java.util.Objects.equals(pvcAnnotations, that.pvcAnnotations)) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(install,  image,  uri,  uriParameters,  database,  secretRef,  resources,  securityContext,  persistent,  volumeSize,  storageClassName,  pvcAnnotations,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    sb.append("install:"); sb.append(install + ",");
    if (image != null) { sb.append("image:"); sb.append(image + ","); }
    if (uri != null) { sb.append("uri:"); sb.append(uri + ","); }
    if (uriParameters != null) { sb.append("uriParameters:"); sb.append(uriParameters + ","); }
    if (database != null) { sb.append("database:"); sb.append(database + ","); }
    if (secretRef != null) { sb.append("secretRef:"); sb.append(secretRef + ","); }
    if (resources != null) { sb.append("resources:"); sb.append(resources + ","); }
    if (securityContext != null) { sb.append("securityContext:"); sb.append(securityContext + ","); }
    sb.append("persistent:"); sb.append(persistent + ",");
    if (volumeSize != null) { sb.append("volumeSize:"); sb.append(volumeSize + ","); }
    if (storageClassName != null) { sb.append("storageClassName:"); sb.append(storageClassName + ","); }
    if (pvcAnnotations != null && !pvcAnnotations.isEmpty()) { sb.append("pvcAnnotations:"); sb.append(pvcAnnotations); }
    sb.append("}");
    return sb.toString();
  }
  
  public A withInstall() {
    return withInstall(true);
  }
  
  public A withPersistent() {
    return withPersistent(true);
  }
  public class ImageNested extends ImageSpecFluent> implements Nested{
    ImageNested(ImageSpec item) {
      this.builder = new ImageSpecBuilder(this, item);
    }
    ImageSpecBuilder builder;
    
    public N and() {
      return (N) MongoDBSpecFluent.this.withImage(builder.build());
    }
    
    public N endImage() {
      return and();
    }
    
  
  }
  public class SecretRefNested extends SecretReferenceSpecFluent> implements Nested{
    SecretRefNested(SecretReferenceSpec item) {
      this.builder = new SecretReferenceSpecBuilder(this, item);
    }
    SecretReferenceSpecBuilder builder;
    
    public N and() {
      return (N) MongoDBSpecFluent.this.withSecretRef(builder.build());
    }
    
    public N endSecretRef() {
      return and();
    }
    
  
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy