io.strimzi.api.kafka.model.KafkaBridgeTlsFluentImpl Maven / Gradle / Ivy
package io.strimzi.api.kafka.model;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import io.fabric8.kubernetes.api.builder.Predicate;
import java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;
public class KafkaBridgeTlsFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements KafkaBridgeTlsFluent{
private List trustedCertificates;
public KafkaBridgeTlsFluentImpl(){
}
public KafkaBridgeTlsFluentImpl(KafkaBridgeTls instance){
this.withTrustedCertificates(instance.getTrustedCertificates());
}
public A addToTrustedCertificates(int index,CertSecretSource item){
if (this.trustedCertificates == null) {this.trustedCertificates = new ArrayList();}
CertSecretSourceBuilder builder = new CertSecretSourceBuilder(item);_visitables.get("trustedCertificates").add(index >= 0 ? index : _visitables.get("trustedCertificates").size(), builder);this.trustedCertificates.add(index >= 0 ? index : trustedCertificates.size(), builder); return (A)this;
}
public A setToTrustedCertificates(int index,CertSecretSource item){
if (this.trustedCertificates == null) {this.trustedCertificates = new ArrayList();}
CertSecretSourceBuilder builder = new CertSecretSourceBuilder(item);
if (index < 0 || index >= _visitables.get("trustedCertificates").size()) { _visitables.get("trustedCertificates").add(builder); } else { _visitables.get("trustedCertificates").set(index, builder);}
if (index < 0 || index >= trustedCertificates.size()) { trustedCertificates.add(builder); } else { trustedCertificates.set(index, builder);}
return (A)this;
}
public A addToTrustedCertificates(CertSecretSource... items){
if (this.trustedCertificates == null) {this.trustedCertificates = new ArrayList();}
for (CertSecretSource item : items) {CertSecretSourceBuilder builder = new CertSecretSourceBuilder(item);_visitables.get("trustedCertificates").add(builder);this.trustedCertificates.add(builder);} return (A)this;
}
public A addAllToTrustedCertificates(Collection items){
if (this.trustedCertificates == null) {this.trustedCertificates = new ArrayList();}
for (CertSecretSource item : items) {CertSecretSourceBuilder builder = new CertSecretSourceBuilder(item);_visitables.get("trustedCertificates").add(builder);this.trustedCertificates.add(builder);} return (A)this;
}
public A removeFromTrustedCertificates(CertSecretSource... items){
for (CertSecretSource item : items) {CertSecretSourceBuilder builder = new CertSecretSourceBuilder(item);_visitables.get("trustedCertificates").remove(builder);if (this.trustedCertificates != null) {this.trustedCertificates.remove(builder);}} return (A)this;
}
public A removeAllFromTrustedCertificates(Collection items){
for (CertSecretSource item : items) {CertSecretSourceBuilder builder = new CertSecretSourceBuilder(item);_visitables.get("trustedCertificates").remove(builder);if (this.trustedCertificates != null) {this.trustedCertificates.remove(builder);}} return (A)this;
}
public A removeMatchingFromTrustedCertificates(io.fabric8.kubernetes.api.builder.Predicate predicate){
if (trustedCertificates == null) return (A) this;
final Iterator each = trustedCertificates.iterator();
final List visitables = _visitables.get("trustedCertificates");
while (each.hasNext()) {
CertSecretSourceBuilder builder = each.next();
if (predicate.apply(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildTrustedCertificates instead.
* @return The buildable object.
*/
@Deprecated public List getTrustedCertificates(){
return build(trustedCertificates);
}
public List buildTrustedCertificates(){
return build(trustedCertificates);
}
public CertSecretSource buildTrustedCertificate(int index){
return this.trustedCertificates.get(index).build();
}
public CertSecretSource buildFirstTrustedCertificate(){
return this.trustedCertificates.get(0).build();
}
public CertSecretSource buildLastTrustedCertificate(){
return this.trustedCertificates.get(trustedCertificates.size() - 1).build();
}
public CertSecretSource buildMatchingTrustedCertificate(io.fabric8.kubernetes.api.builder.Predicate predicate){
for (CertSecretSourceBuilder item: trustedCertificates) { if(predicate.apply(item)){ return item.build();} } return null;
}
public Boolean hasMatchingTrustedCertificate(io.fabric8.kubernetes.api.builder.Predicate predicate){
for (CertSecretSourceBuilder item: trustedCertificates) { if(predicate.apply(item)){ return true;} } return false;
}
public A withTrustedCertificates(List trustedCertificates){
if (this.trustedCertificates != null) { _visitables.get("trustedCertificates").removeAll(this.trustedCertificates);}
if (trustedCertificates != null) {this.trustedCertificates = new ArrayList(); for (CertSecretSource item : trustedCertificates){this.addToTrustedCertificates(item);}} else { this.trustedCertificates = null;} return (A) this;
}
public A withTrustedCertificates(CertSecretSource... trustedCertificates){
if (this.trustedCertificates != null) {this.trustedCertificates.clear();}
if (trustedCertificates != null) {for (CertSecretSource item :trustedCertificates){ this.addToTrustedCertificates(item);}} return (A) this;
}
public Boolean hasTrustedCertificates(){
return trustedCertificates != null && !trustedCertificates.isEmpty();
}
public KafkaBridgeTlsFluent.TrustedCertificatesNested addNewTrustedCertificate(){
return new TrustedCertificatesNestedImpl();
}
public KafkaBridgeTlsFluent.TrustedCertificatesNested addNewTrustedCertificateLike(CertSecretSource item){
return new TrustedCertificatesNestedImpl(-1, item);
}
public KafkaBridgeTlsFluent.TrustedCertificatesNested setNewTrustedCertificateLike(int index,CertSecretSource item){
return new TrustedCertificatesNestedImpl(index, item);
}
public KafkaBridgeTlsFluent.TrustedCertificatesNested editTrustedCertificate(int index){
if (trustedCertificates.size() <= index) throw new RuntimeException("Can't edit trustedCertificates. Index exceeds size.");
return setNewTrustedCertificateLike(index, buildTrustedCertificate(index));
}
public KafkaBridgeTlsFluent.TrustedCertificatesNested editFirstTrustedCertificate(){
if (trustedCertificates.size() == 0) throw new RuntimeException("Can't edit first trustedCertificates. The list is empty.");
return setNewTrustedCertificateLike(0, buildTrustedCertificate(0));
}
public KafkaBridgeTlsFluent.TrustedCertificatesNested editLastTrustedCertificate(){
int index = trustedCertificates.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last trustedCertificates. The list is empty.");
return setNewTrustedCertificateLike(index, buildTrustedCertificate(index));
}
public KafkaBridgeTlsFluent.TrustedCertificatesNested editMatchingTrustedCertificate(io.fabric8.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends CertSecretSourceFluentImpl> implements KafkaBridgeTlsFluent.TrustedCertificatesNested,io.fabric8.kubernetes.api.builder.Nested{
private final CertSecretSourceBuilder builder;
private final int index;
TrustedCertificatesNestedImpl(int index,CertSecretSource item){
this.index = index;
this.builder = new CertSecretSourceBuilder(this, item);
}
TrustedCertificatesNestedImpl(){
this.index = -1;
this.builder = new CertSecretSourceBuilder(this);
}
public N and(){
return (N) KafkaBridgeTlsFluentImpl.this.setToTrustedCertificates(index, builder.build());
}
public N endTrustedCertificate(){
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy