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

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

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

import java.lang.SuppressWarnings;
import io.github.microcks.operator.api.model.ImageSpecFluent;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.github.microcks.operator.api.model.ImageSpec;
import java.util.function.Predicate;
import io.github.microcks.operator.api.model.ImageSpecBuilder;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import io.fabric8.kubernetes.api.model.EnvVar;
import java.util.List;
import java.util.Collection;
import java.lang.Object;

/**
 * Generated
 */
@SuppressWarnings("unchecked")
public class AsyncFeatureSpecFluent> extends BaseFluent{
  public AsyncFeatureSpecFluent() {
  }
  
  public AsyncFeatureSpecFluent(AsyncFeatureSpec instance) {
    this.copyInstance(instance);
  }
  private boolean enabled;
  private ImageSpecBuilder image;
  private List env;
  private String defaultBinding;
  private int defaultFrequency;
  private AvroEncoding defaultAvroEncoding;
  private KafkaSpecBuilder kafka;
  private GenericBrokerConnectionSpecBuilder amqp;
  private GenericBrokerConnectionSpecBuilder mqtt;
  private GenericBrokerConnectionSpecBuilder nats;
  private GooglePubSubConnectionSpecBuilder googlepubsub;
  private AmazonServiceConnectionSpecBuilder sqs;
  private AmazonServiceConnectionSpecBuilder sns;
  
  protected void copyInstance(AsyncFeatureSpec instance) {
    instance = (instance != null ? instance : new AsyncFeatureSpec());
    if (instance != null) {
          this.withEnabled(instance.isEnabled());
          this.withImage(instance.getImage());
          this.withEnv(instance.getEnv());
          this.withDefaultBinding(instance.getDefaultBinding());
          this.withDefaultFrequency(instance.getDefaultFrequency());
          this.withDefaultAvroEncoding(instance.getDefaultAvroEncoding());
          this.withKafka(instance.getKafka());
          this.withAmqp(instance.getAmqp());
          this.withMqtt(instance.getMqtt());
          this.withNats(instance.getNats());
          this.withGooglepubsub(instance.getGooglepubsub());
          this.withSqs(instance.getSqs());
          this.withSns(instance.getSns());
        }
  }
  
  public boolean isEnabled() {
    return this.enabled;
  }
  
  public A withEnabled(boolean enabled) {
    this.enabled = enabled;
    return (A) this;
  }
  
  public boolean hasEnabled() {
    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 A addToEnv(int index,EnvVar item) {
    if (this.env == null) {this.env = new ArrayList();}
    this.env.add(index, item);
    return (A)this;
  }
  
  public A setToEnv(int index,EnvVar item) {
    if (this.env == null) {this.env = new ArrayList();}
    this.env.set(index, item); return (A)this;
  }
  
  public A addToEnv(io.fabric8.kubernetes.api.model.EnvVar... items) {
    if (this.env == null) {this.env = new ArrayList();}
    for (EnvVar item : items) {this.env.add(item);} return (A)this;
  }
  
  public A addAllToEnv(Collection items) {
    if (this.env == null) {this.env = new ArrayList();}
    for (EnvVar item : items) {this.env.add(item);} return (A)this;
  }
  
  public A removeFromEnv(io.fabric8.kubernetes.api.model.EnvVar... items) {
    if (this.env == null) return (A)this;
    for (EnvVar item : items) { this.env.remove(item);} return (A)this;
  }
  
  public A removeAllFromEnv(Collection items) {
    if (this.env == null) return (A)this;
    for (EnvVar item : items) { this.env.remove(item);} return (A)this;
  }
  
  public List getEnv() {
    return this.env;
  }
  
  public EnvVar getEnv(int index) {
    return this.env.get(index);
  }
  
  public EnvVar getFirstEnv() {
    return this.env.get(0);
  }
  
  public EnvVar getLastEnv() {
    return this.env.get(env.size() - 1);
  }
  
  public EnvVar getMatchingEnv(Predicate predicate) {
      for (EnvVar item : env) {
        if (predicate.test(item)) {
          return item;
        }
      }
      return null;
  }
  
  public boolean hasMatchingEnv(Predicate predicate) {
      for (EnvVar item : env) {
        if (predicate.test(item)) {
          return true;
        }
      }
      return false;
  }
  
  public A withEnv(List env) {
    if (env != null) {
        this.env = new ArrayList();
        for (EnvVar item : env) {
          this.addToEnv(item);
        }
    } else {
      this.env = null;
    }
    return (A) this;
  }
  
  public A withEnv(io.fabric8.kubernetes.api.model.EnvVar... env) {
    if (this.env != null) {
        this.env.clear();
        _visitables.remove("env");
    }
    if (env != null) {
      for (EnvVar item : env) {
        this.addToEnv(item);
      }
    }
    return (A) this;
  }
  
  public boolean hasEnv() {
    return this.env != null && !this.env.isEmpty();
  }
  
  public String getDefaultBinding() {
    return this.defaultBinding;
  }
  
  public A withDefaultBinding(String defaultBinding) {
    this.defaultBinding = defaultBinding;
    return (A) this;
  }
  
  public boolean hasDefaultBinding() {
    return this.defaultBinding != null;
  }
  
  public int getDefaultFrequency() {
    return this.defaultFrequency;
  }
  
  public A withDefaultFrequency(int defaultFrequency) {
    this.defaultFrequency = defaultFrequency;
    return (A) this;
  }
  
  public boolean hasDefaultFrequency() {
    return true;
  }
  
  public AvroEncoding getDefaultAvroEncoding() {
    return this.defaultAvroEncoding;
  }
  
  public A withDefaultAvroEncoding(AvroEncoding defaultAvroEncoding) {
    this.defaultAvroEncoding = defaultAvroEncoding;
    return (A) this;
  }
  
  public boolean hasDefaultAvroEncoding() {
    return this.defaultAvroEncoding != null;
  }
  
  public KafkaSpec buildKafka() {
    return this.kafka != null ? this.kafka.build() : null;
  }
  
  public A withKafka(KafkaSpec kafka) {
    this._visitables.remove("kafka");
    if (kafka != null) {
        this.kafka = new KafkaSpecBuilder(kafka);
        this._visitables.get("kafka").add(this.kafka);
    } else {
        this.kafka = null;
        this._visitables.get("kafka").remove(this.kafka);
    }
    return (A) this;
  }
  
  public boolean hasKafka() {
    return this.kafka != null;
  }
  
  public KafkaNested withNewKafka() {
    return new KafkaNested(null);
  }
  
  public KafkaNested withNewKafkaLike(KafkaSpec item) {
    return new KafkaNested(item);
  }
  
  public KafkaNested editKafka() {
    return withNewKafkaLike(java.util.Optional.ofNullable(buildKafka()).orElse(null));
  }
  
  public KafkaNested editOrNewKafka() {
    return withNewKafkaLike(java.util.Optional.ofNullable(buildKafka()).orElse(new KafkaSpecBuilder().build()));
  }
  
  public KafkaNested editOrNewKafkaLike(KafkaSpec item) {
    return withNewKafkaLike(java.util.Optional.ofNullable(buildKafka()).orElse(item));
  }
  
  public GenericBrokerConnectionSpec buildAmqp() {
    return this.amqp != null ? this.amqp.build() : null;
  }
  
  public A withAmqp(GenericBrokerConnectionSpec amqp) {
    this._visitables.remove("amqp");
    if (amqp != null) {
        this.amqp = new GenericBrokerConnectionSpecBuilder(amqp);
        this._visitables.get("amqp").add(this.amqp);
    } else {
        this.amqp = null;
        this._visitables.get("amqp").remove(this.amqp);
    }
    return (A) this;
  }
  
  public boolean hasAmqp() {
    return this.amqp != null;
  }
  
  public AmqpNested withNewAmqp() {
    return new AmqpNested(null);
  }
  
  public AmqpNested withNewAmqpLike(GenericBrokerConnectionSpec item) {
    return new AmqpNested(item);
  }
  
  public AmqpNested editAmqp() {
    return withNewAmqpLike(java.util.Optional.ofNullable(buildAmqp()).orElse(null));
  }
  
  public AmqpNested editOrNewAmqp() {
    return withNewAmqpLike(java.util.Optional.ofNullable(buildAmqp()).orElse(new GenericBrokerConnectionSpecBuilder().build()));
  }
  
  public AmqpNested editOrNewAmqpLike(GenericBrokerConnectionSpec item) {
    return withNewAmqpLike(java.util.Optional.ofNullable(buildAmqp()).orElse(item));
  }
  
  public GenericBrokerConnectionSpec buildMqtt() {
    return this.mqtt != null ? this.mqtt.build() : null;
  }
  
  public A withMqtt(GenericBrokerConnectionSpec mqtt) {
    this._visitables.remove("mqtt");
    if (mqtt != null) {
        this.mqtt = new GenericBrokerConnectionSpecBuilder(mqtt);
        this._visitables.get("mqtt").add(this.mqtt);
    } else {
        this.mqtt = null;
        this._visitables.get("mqtt").remove(this.mqtt);
    }
    return (A) this;
  }
  
  public boolean hasMqtt() {
    return this.mqtt != null;
  }
  
  public MqttNested withNewMqtt() {
    return new MqttNested(null);
  }
  
  public MqttNested withNewMqttLike(GenericBrokerConnectionSpec item) {
    return new MqttNested(item);
  }
  
  public MqttNested editMqtt() {
    return withNewMqttLike(java.util.Optional.ofNullable(buildMqtt()).orElse(null));
  }
  
  public MqttNested editOrNewMqtt() {
    return withNewMqttLike(java.util.Optional.ofNullable(buildMqtt()).orElse(new GenericBrokerConnectionSpecBuilder().build()));
  }
  
  public MqttNested editOrNewMqttLike(GenericBrokerConnectionSpec item) {
    return withNewMqttLike(java.util.Optional.ofNullable(buildMqtt()).orElse(item));
  }
  
  public GenericBrokerConnectionSpec buildNats() {
    return this.nats != null ? this.nats.build() : null;
  }
  
  public A withNats(GenericBrokerConnectionSpec nats) {
    this._visitables.remove("nats");
    if (nats != null) {
        this.nats = new GenericBrokerConnectionSpecBuilder(nats);
        this._visitables.get("nats").add(this.nats);
    } else {
        this.nats = null;
        this._visitables.get("nats").remove(this.nats);
    }
    return (A) this;
  }
  
  public boolean hasNats() {
    return this.nats != null;
  }
  
  public NatsNested withNewNats() {
    return new NatsNested(null);
  }
  
  public NatsNested withNewNatsLike(GenericBrokerConnectionSpec item) {
    return new NatsNested(item);
  }
  
  public NatsNested editNats() {
    return withNewNatsLike(java.util.Optional.ofNullable(buildNats()).orElse(null));
  }
  
  public NatsNested editOrNewNats() {
    return withNewNatsLike(java.util.Optional.ofNullable(buildNats()).orElse(new GenericBrokerConnectionSpecBuilder().build()));
  }
  
  public NatsNested editOrNewNatsLike(GenericBrokerConnectionSpec item) {
    return withNewNatsLike(java.util.Optional.ofNullable(buildNats()).orElse(item));
  }
  
  public GooglePubSubConnectionSpec buildGooglepubsub() {
    return this.googlepubsub != null ? this.googlepubsub.build() : null;
  }
  
  public A withGooglepubsub(GooglePubSubConnectionSpec googlepubsub) {
    this._visitables.remove("googlepubsub");
    if (googlepubsub != null) {
        this.googlepubsub = new GooglePubSubConnectionSpecBuilder(googlepubsub);
        this._visitables.get("googlepubsub").add(this.googlepubsub);
    } else {
        this.googlepubsub = null;
        this._visitables.get("googlepubsub").remove(this.googlepubsub);
    }
    return (A) this;
  }
  
  public boolean hasGooglepubsub() {
    return this.googlepubsub != null;
  }
  
  public GooglepubsubNested withNewGooglepubsub() {
    return new GooglepubsubNested(null);
  }
  
  public GooglepubsubNested withNewGooglepubsubLike(GooglePubSubConnectionSpec item) {
    return new GooglepubsubNested(item);
  }
  
  public GooglepubsubNested editGooglepubsub() {
    return withNewGooglepubsubLike(java.util.Optional.ofNullable(buildGooglepubsub()).orElse(null));
  }
  
  public GooglepubsubNested editOrNewGooglepubsub() {
    return withNewGooglepubsubLike(java.util.Optional.ofNullable(buildGooglepubsub()).orElse(new GooglePubSubConnectionSpecBuilder().build()));
  }
  
  public GooglepubsubNested editOrNewGooglepubsubLike(GooglePubSubConnectionSpec item) {
    return withNewGooglepubsubLike(java.util.Optional.ofNullable(buildGooglepubsub()).orElse(item));
  }
  
  public AmazonServiceConnectionSpec buildSqs() {
    return this.sqs != null ? this.sqs.build() : null;
  }
  
  public A withSqs(AmazonServiceConnectionSpec sqs) {
    this._visitables.remove("sqs");
    if (sqs != null) {
        this.sqs = new AmazonServiceConnectionSpecBuilder(sqs);
        this._visitables.get("sqs").add(this.sqs);
    } else {
        this.sqs = null;
        this._visitables.get("sqs").remove(this.sqs);
    }
    return (A) this;
  }
  
  public boolean hasSqs() {
    return this.sqs != null;
  }
  
  public SqsNested withNewSqs() {
    return new SqsNested(null);
  }
  
  public SqsNested withNewSqsLike(AmazonServiceConnectionSpec item) {
    return new SqsNested(item);
  }
  
  public SqsNested editSqs() {
    return withNewSqsLike(java.util.Optional.ofNullable(buildSqs()).orElse(null));
  }
  
  public SqsNested editOrNewSqs() {
    return withNewSqsLike(java.util.Optional.ofNullable(buildSqs()).orElse(new AmazonServiceConnectionSpecBuilder().build()));
  }
  
  public SqsNested editOrNewSqsLike(AmazonServiceConnectionSpec item) {
    return withNewSqsLike(java.util.Optional.ofNullable(buildSqs()).orElse(item));
  }
  
  public AmazonServiceConnectionSpec buildSns() {
    return this.sns != null ? this.sns.build() : null;
  }
  
  public A withSns(AmazonServiceConnectionSpec sns) {
    this._visitables.remove("sns");
    if (sns != null) {
        this.sns = new AmazonServiceConnectionSpecBuilder(sns);
        this._visitables.get("sns").add(this.sns);
    } else {
        this.sns = null;
        this._visitables.get("sns").remove(this.sns);
    }
    return (A) this;
  }
  
  public boolean hasSns() {
    return this.sns != null;
  }
  
  public SnsNested withNewSns() {
    return new SnsNested(null);
  }
  
  public SnsNested withNewSnsLike(AmazonServiceConnectionSpec item) {
    return new SnsNested(item);
  }
  
  public SnsNested editSns() {
    return withNewSnsLike(java.util.Optional.ofNullable(buildSns()).orElse(null));
  }
  
  public SnsNested editOrNewSns() {
    return withNewSnsLike(java.util.Optional.ofNullable(buildSns()).orElse(new AmazonServiceConnectionSpecBuilder().build()));
  }
  
  public SnsNested editOrNewSnsLike(AmazonServiceConnectionSpec item) {
    return withNewSnsLike(java.util.Optional.ofNullable(buildSns()).orElse(item));
  }
  
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    if (!super.equals(o)) return false;
    AsyncFeatureSpecFluent that = (AsyncFeatureSpecFluent) o;
    if (enabled != that.enabled) return false;
    if (!java.util.Objects.equals(image, that.image)) return false;
    if (!java.util.Objects.equals(env, that.env)) return false;
    if (!java.util.Objects.equals(defaultBinding, that.defaultBinding)) return false;
    if (defaultFrequency != that.defaultFrequency) return false;
    if (!java.util.Objects.equals(defaultAvroEncoding, that.defaultAvroEncoding)) return false;
    if (!java.util.Objects.equals(kafka, that.kafka)) return false;
    if (!java.util.Objects.equals(amqp, that.amqp)) return false;
    if (!java.util.Objects.equals(mqtt, that.mqtt)) return false;
    if (!java.util.Objects.equals(nats, that.nats)) return false;
    if (!java.util.Objects.equals(googlepubsub, that.googlepubsub)) return false;
    if (!java.util.Objects.equals(sqs, that.sqs)) return false;
    if (!java.util.Objects.equals(sns, that.sns)) return false;
    return true;
  }
  
  public int hashCode() {
    return java.util.Objects.hash(enabled,  image,  env,  defaultBinding,  defaultFrequency,  defaultAvroEncoding,  kafka,  amqp,  mqtt,  nats,  googlepubsub,  sqs,  sns,  super.hashCode());
  }
  
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("{");
    sb.append("enabled:"); sb.append(enabled + ",");
    if (image != null) { sb.append("image:"); sb.append(image + ","); }
    if (env != null && !env.isEmpty()) { sb.append("env:"); sb.append(env + ","); }
    if (defaultBinding != null) { sb.append("defaultBinding:"); sb.append(defaultBinding + ","); }
    sb.append("defaultFrequency:"); sb.append(defaultFrequency + ",");
    if (defaultAvroEncoding != null) { sb.append("defaultAvroEncoding:"); sb.append(defaultAvroEncoding + ","); }
    if (kafka != null) { sb.append("kafka:"); sb.append(kafka + ","); }
    if (amqp != null) { sb.append("amqp:"); sb.append(amqp + ","); }
    if (mqtt != null) { sb.append("mqtt:"); sb.append(mqtt + ","); }
    if (nats != null) { sb.append("nats:"); sb.append(nats + ","); }
    if (googlepubsub != null) { sb.append("googlepubsub:"); sb.append(googlepubsub + ","); }
    if (sqs != null) { sb.append("sqs:"); sb.append(sqs + ","); }
    if (sns != null) { sb.append("sns:"); sb.append(sns); }
    sb.append("}");
    return sb.toString();
  }
  
  public A withEnabled() {
    return withEnabled(true);
  }
  public class ImageNested extends ImageSpecFluent> implements Nested{
    ImageNested(ImageSpec item) {
      this.builder = new ImageSpecBuilder(this, item);
    }
    ImageSpecBuilder builder;
    
    public N and() {
      return (N) AsyncFeatureSpecFluent.this.withImage(builder.build());
    }
    
    public N endImage() {
      return and();
    }
    
  
  }
  public class KafkaNested extends KafkaSpecFluent> implements Nested{
    KafkaNested(KafkaSpec item) {
      this.builder = new KafkaSpecBuilder(this, item);
    }
    KafkaSpecBuilder builder;
    
    public N and() {
      return (N) AsyncFeatureSpecFluent.this.withKafka(builder.build());
    }
    
    public N endKafka() {
      return and();
    }
    
  
  }
  public class AmqpNested extends GenericBrokerConnectionSpecFluent> implements Nested{
    AmqpNested(GenericBrokerConnectionSpec item) {
      this.builder = new GenericBrokerConnectionSpecBuilder(this, item);
    }
    GenericBrokerConnectionSpecBuilder builder;
    
    public N and() {
      return (N) AsyncFeatureSpecFluent.this.withAmqp(builder.build());
    }
    
    public N endAmqp() {
      return and();
    }
    
  
  }
  public class MqttNested extends GenericBrokerConnectionSpecFluent> implements Nested{
    MqttNested(GenericBrokerConnectionSpec item) {
      this.builder = new GenericBrokerConnectionSpecBuilder(this, item);
    }
    GenericBrokerConnectionSpecBuilder builder;
    
    public N and() {
      return (N) AsyncFeatureSpecFluent.this.withMqtt(builder.build());
    }
    
    public N endMqtt() {
      return and();
    }
    
  
  }
  public class NatsNested extends GenericBrokerConnectionSpecFluent> implements Nested{
    NatsNested(GenericBrokerConnectionSpec item) {
      this.builder = new GenericBrokerConnectionSpecBuilder(this, item);
    }
    GenericBrokerConnectionSpecBuilder builder;
    
    public N and() {
      return (N) AsyncFeatureSpecFluent.this.withNats(builder.build());
    }
    
    public N endNats() {
      return and();
    }
    
  
  }
  public class GooglepubsubNested extends GooglePubSubConnectionSpecFluent> implements Nested{
    GooglepubsubNested(GooglePubSubConnectionSpec item) {
      this.builder = new GooglePubSubConnectionSpecBuilder(this, item);
    }
    GooglePubSubConnectionSpecBuilder builder;
    
    public N and() {
      return (N) AsyncFeatureSpecFluent.this.withGooglepubsub(builder.build());
    }
    
    public N endGooglepubsub() {
      return and();
    }
    
  
  }
  public class SqsNested extends AmazonServiceConnectionSpecFluent> implements Nested{
    SqsNested(AmazonServiceConnectionSpec item) {
      this.builder = new AmazonServiceConnectionSpecBuilder(this, item);
    }
    AmazonServiceConnectionSpecBuilder builder;
    
    public N and() {
      return (N) AsyncFeatureSpecFluent.this.withSqs(builder.build());
    }
    
    public N endSqs() {
      return and();
    }
    
  
  }
  public class SnsNested extends AmazonServiceConnectionSpecFluent> implements Nested{
    SnsNested(AmazonServiceConnectionSpec item) {
      this.builder = new AmazonServiceConnectionSpecBuilder(this, item);
    }
    AmazonServiceConnectionSpecBuilder builder;
    
    public N and() {
      return (N) AsyncFeatureSpecFluent.this.withSns(builder.build());
    }
    
    public N endSns() {
      return and();
    }
    
  
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy