io.strimzi.api.kafka.model.mirrormaker.KafkaMirrorMakerClientSpecFluent Maven / Gradle / Ivy
package io.strimzi.api.kafka.model.mirrormaker;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationOAuthBuilder;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.lang.String;
import java.util.LinkedHashMap;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationScramSha512Builder;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationOAuth;
import io.strimzi.api.kafka.model.common.ClientTlsBuilder;
import io.strimzi.api.kafka.model.common.ClientTlsFluent;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationPlainBuilder;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationTlsBuilder;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationOAuthFluent;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationPlain;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationScramSha256;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationScramSha512;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationTls;
import io.strimzi.api.kafka.model.common.ClientTls;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationScramSha512Fluent;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthentication;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationPlainFluent;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationTlsFluent;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationScramSha256Builder;
import java.lang.Object;
import io.strimzi.api.kafka.model.common.authentication.KafkaClientAuthenticationScramSha256Fluent;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class KafkaMirrorMakerClientSpecFluent> extends BaseFluent{
public KafkaMirrorMakerClientSpecFluent() {
}
public KafkaMirrorMakerClientSpecFluent(KafkaMirrorMakerClientSpec instance) {
this.copyInstance(instance);
}
private String bootstrapServers;
private Map config;
private ClientTlsBuilder tls;
private VisitableBuilder extends KafkaClientAuthentication,?> authentication;
protected void copyInstance(KafkaMirrorMakerClientSpec instance) {
instance = (instance != null ? instance : new KafkaMirrorMakerClientSpec());
if (instance != null) {
this.withBootstrapServers(instance.getBootstrapServers());
this.withConfig(instance.getConfig());
this.withTls(instance.getTls());
this.withAuthentication(instance.getAuthentication());
}
}
public String getBootstrapServers() {
return this.bootstrapServers;
}
public A withBootstrapServers(String bootstrapServers) {
this.bootstrapServers = bootstrapServers;
return (A) this;
}
public boolean hasBootstrapServers() {
return this.bootstrapServers != null;
}
public A addToConfig(String key,Object value) {
if(this.config == null && key != null && value != null) { this.config = new LinkedHashMap(); }
if(key != null && value != null) {this.config.put(key, value);} return (A)this;
}
public A addToConfig(Map map) {
if(this.config == null && map != null) { this.config = new LinkedHashMap(); }
if(map != null) { this.config.putAll(map);} return (A)this;
}
public A removeFromConfig(String key) {
if(this.config == null) { return (A) this; }
if(key != null && this.config != null) {this.config.remove(key);} return (A)this;
}
public A removeFromConfig(Map map) {
if(this.config == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.config != null){this.config.remove(key);}}} return (A)this;
}
public Map getConfig() {
return this.config;
}
public A withConfig(Map config) {
if (config == null) {
this.config = null;
} else {
this.config = new LinkedHashMap(config);
}
return (A) this;
}
public boolean hasConfig() {
return this.config != null;
}
public ClientTls buildTls() {
return this.tls != null ? this.tls.build() : null;
}
public A withTls(ClientTls tls) {
this._visitables.remove("tls");
if (tls != null) {
this.tls = new ClientTlsBuilder(tls);
this._visitables.get("tls").add(this.tls);
} else {
this.tls = null;
this._visitables.get("tls").remove(this.tls);
}
return (A) this;
}
public boolean hasTls() {
return this.tls != null;
}
public TlsNested withNewTls() {
return new TlsNested(null);
}
public TlsNested withNewTlsLike(ClientTls item) {
return new TlsNested(item);
}
public TlsNested editTls() {
return withNewTlsLike(java.util.Optional.ofNullable(buildTls()).orElse(null));
}
public TlsNested editOrNewTls() {
return withNewTlsLike(java.util.Optional.ofNullable(buildTls()).orElse(new ClientTlsBuilder().build()));
}
public TlsNested editOrNewTlsLike(ClientTls item) {
return withNewTlsLike(java.util.Optional.ofNullable(buildTls()).orElse(item));
}
public KafkaClientAuthentication buildAuthentication() {
return this.authentication != null ? this.authentication.build() : null;
}
public A withAuthentication(KafkaClientAuthentication authentication) {
if (authentication == null) {
this.authentication = null;
this._visitables.remove("authentication");
return (A) this;
} else {
VisitableBuilder extends KafkaClientAuthentication,?> builder = builder(authentication);;
this._visitables.get("authentication").clear();
this._visitables.get("authentication").add(builder);
this.authentication = builder;
return (A) this;
}
}
public boolean hasAuthentication() {
return this.authentication != null;
}
public KafkaClientAuthenticationScramSha512Nested withNewKafkaClientAuthenticationScramSha512() {
return new KafkaClientAuthenticationScramSha512Nested(null);
}
public KafkaClientAuthenticationScramSha512Nested withNewKafkaClientAuthenticationScramSha512Like(KafkaClientAuthenticationScramSha512 item) {
return new KafkaClientAuthenticationScramSha512Nested(item);
}
public KafkaClientAuthenticationTlsNested withNewKafkaClientAuthenticationTls() {
return new KafkaClientAuthenticationTlsNested(null);
}
public KafkaClientAuthenticationTlsNested withNewKafkaClientAuthenticationTlsLike(KafkaClientAuthenticationTls item) {
return new KafkaClientAuthenticationTlsNested(item);
}
public KafkaClientAuthenticationOAuthNested withNewKafkaClientAuthenticationOAuth() {
return new KafkaClientAuthenticationOAuthNested(null);
}
public KafkaClientAuthenticationOAuthNested withNewKafkaClientAuthenticationOAuthLike(KafkaClientAuthenticationOAuth item) {
return new KafkaClientAuthenticationOAuthNested(item);
}
public KafkaClientAuthenticationScramSha256Nested withNewKafkaClientAuthenticationScramSha256() {
return new KafkaClientAuthenticationScramSha256Nested(null);
}
public KafkaClientAuthenticationScramSha256Nested withNewKafkaClientAuthenticationScramSha256Like(KafkaClientAuthenticationScramSha256 item) {
return new KafkaClientAuthenticationScramSha256Nested(item);
}
public KafkaClientAuthenticationPlainNested withNewKafkaClientAuthenticationPlain() {
return new KafkaClientAuthenticationPlainNested(null);
}
public KafkaClientAuthenticationPlainNested withNewKafkaClientAuthenticationPlainLike(KafkaClientAuthenticationPlain item) {
return new KafkaClientAuthenticationPlainNested(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;
KafkaMirrorMakerClientSpecFluent that = (KafkaMirrorMakerClientSpecFluent) o;
if (!java.util.Objects.equals(bootstrapServers, that.bootstrapServers)) return false;
if (!java.util.Objects.equals(config, that.config)) return false;
if (!java.util.Objects.equals(tls, that.tls)) return false;
if (!java.util.Objects.equals(authentication, that.authentication)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(bootstrapServers, config, tls, authentication, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (bootstrapServers != null) { sb.append("bootstrapServers:"); sb.append(bootstrapServers + ","); }
if (config != null && !config.isEmpty()) { sb.append("config:"); sb.append(config + ","); }
if (tls != null) { sb.append("tls:"); sb.append(tls + ","); }
if (authentication != null) { sb.append("authentication:"); sb.append(authentication); }
sb.append("}");
return sb.toString();
}
protected static VisitableBuilder builder(Object item) {
switch (item.getClass().getName()) {
case "io.strimzi.api.kafka.model.common.authentication."+"KafkaClientAuthenticationScramSha512": return (VisitableBuilder)new KafkaClientAuthenticationScramSha512Builder((KafkaClientAuthenticationScramSha512) item);
case "io.strimzi.api.kafka.model.common.authentication."+"KafkaClientAuthenticationTls": return (VisitableBuilder)new KafkaClientAuthenticationTlsBuilder((KafkaClientAuthenticationTls) item);
case "io.strimzi.api.kafka.model.common.authentication."+"KafkaClientAuthenticationOAuth": return (VisitableBuilder)new KafkaClientAuthenticationOAuthBuilder((KafkaClientAuthenticationOAuth) item);
case "io.strimzi.api.kafka.model.common.authentication."+"KafkaClientAuthenticationScramSha256": return (VisitableBuilder)new KafkaClientAuthenticationScramSha256Builder((KafkaClientAuthenticationScramSha256) item);
case "io.strimzi.api.kafka.model.common.authentication."+"KafkaClientAuthenticationPlain": return (VisitableBuilder)new KafkaClientAuthenticationPlainBuilder((KafkaClientAuthenticationPlain) item);
}
return (VisitableBuilder)builderOf(item);
}
public class TlsNested extends ClientTlsFluent> implements Nested{
TlsNested(ClientTls item) {
this.builder = new ClientTlsBuilder(this, item);
}
ClientTlsBuilder builder;
public N and() {
return (N) KafkaMirrorMakerClientSpecFluent.this.withTls(builder.build());
}
public N endTls() {
return and();
}
}
public class KafkaClientAuthenticationScramSha512Nested extends KafkaClientAuthenticationScramSha512Fluent> implements Nested{
KafkaClientAuthenticationScramSha512Nested(KafkaClientAuthenticationScramSha512 item) {
this.builder = new KafkaClientAuthenticationScramSha512Builder(this, item);
}
KafkaClientAuthenticationScramSha512Builder builder;
public N and() {
return (N) KafkaMirrorMakerClientSpecFluent.this.withAuthentication(builder.build());
}
public N endKafkaClientAuthenticationScramSha512() {
return and();
}
}
public class KafkaClientAuthenticationTlsNested extends KafkaClientAuthenticationTlsFluent> implements Nested{
KafkaClientAuthenticationTlsNested(KafkaClientAuthenticationTls item) {
this.builder = new KafkaClientAuthenticationTlsBuilder(this, item);
}
KafkaClientAuthenticationTlsBuilder builder;
public N and() {
return (N) KafkaMirrorMakerClientSpecFluent.this.withAuthentication(builder.build());
}
public N endKafkaClientAuthenticationTls() {
return and();
}
}
public class KafkaClientAuthenticationOAuthNested extends KafkaClientAuthenticationOAuthFluent> implements Nested{
KafkaClientAuthenticationOAuthNested(KafkaClientAuthenticationOAuth item) {
this.builder = new KafkaClientAuthenticationOAuthBuilder(this, item);
}
KafkaClientAuthenticationOAuthBuilder builder;
public N and() {
return (N) KafkaMirrorMakerClientSpecFluent.this.withAuthentication(builder.build());
}
public N endKafkaClientAuthenticationOAuth() {
return and();
}
}
public class KafkaClientAuthenticationScramSha256Nested extends KafkaClientAuthenticationScramSha256Fluent> implements Nested{
KafkaClientAuthenticationScramSha256Nested(KafkaClientAuthenticationScramSha256 item) {
this.builder = new KafkaClientAuthenticationScramSha256Builder(this, item);
}
KafkaClientAuthenticationScramSha256Builder builder;
public N and() {
return (N) KafkaMirrorMakerClientSpecFluent.this.withAuthentication(builder.build());
}
public N endKafkaClientAuthenticationScramSha256() {
return and();
}
}
public class KafkaClientAuthenticationPlainNested extends KafkaClientAuthenticationPlainFluent> implements Nested{
KafkaClientAuthenticationPlainNested(KafkaClientAuthenticationPlain item) {
this.builder = new KafkaClientAuthenticationPlainBuilder(this, item);
}
KafkaClientAuthenticationPlainBuilder builder;
public N and() {
return (N) KafkaMirrorMakerClientSpecFluent.this.withAuthentication(builder.build());
}
public N endKafkaClientAuthenticationPlain() {
return and();
}
}
}