io.fabric8.kubernetes.api.model.admissionregistration.v1.MutatingWebhookConfigurationFluent Maven / Gradle / Ivy
package io.fabric8.kubernetes.api.model.admissionregistration.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 io.fabric8.kubernetes.api.model.ObjectMetaFluent;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Iterator;
import java.util.List;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;
import java.util.Collection;
import java.lang.Object;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class MutatingWebhookConfigurationFluent> extends BaseFluent{
public MutatingWebhookConfigurationFluent() {
}
public MutatingWebhookConfigurationFluent(MutatingWebhookConfiguration instance) {
this.copyInstance(instance);
}
private String apiVersion;
private String kind;
private ObjectMetaBuilder metadata;
private ArrayList webhooks = new ArrayList();
private Map additionalProperties;
protected void copyInstance(MutatingWebhookConfiguration instance) {
instance = (instance != null ? instance : new MutatingWebhookConfiguration());
if (instance != null) {
this.withApiVersion(instance.getApiVersion());
this.withKind(instance.getKind());
this.withMetadata(instance.getMetadata());
this.withWebhooks(instance.getWebhooks());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public String getApiVersion() {
return this.apiVersion;
}
public A withApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
return (A) this;
}
public boolean hasApiVersion() {
return this.apiVersion != null;
}
public String getKind() {
return this.kind;
}
public A withKind(String kind) {
this.kind = kind;
return (A) this;
}
public boolean hasKind() {
return this.kind != null;
}
public ObjectMeta buildMetadata() {
return this.metadata != null ? this.metadata.build() : null;
}
public A withMetadata(ObjectMeta metadata) {
this._visitables.remove("metadata");
if (metadata != null) {
this.metadata = new ObjectMetaBuilder(metadata);
this._visitables.get("metadata").add(this.metadata);
} else {
this.metadata = null;
this._visitables.get("metadata").remove(this.metadata);
}
return (A) this;
}
public boolean hasMetadata() {
return this.metadata != null;
}
public MetadataNested withNewMetadata() {
return new MetadataNested(null);
}
public MetadataNested withNewMetadataLike(ObjectMeta item) {
return new MetadataNested(item);
}
public MetadataNested editMetadata() {
return withNewMetadataLike(java.util.Optional.ofNullable(buildMetadata()).orElse(null));
}
public MetadataNested editOrNewMetadata() {
return withNewMetadataLike(java.util.Optional.ofNullable(buildMetadata()).orElse(new ObjectMetaBuilder().build()));
}
public MetadataNested editOrNewMetadataLike(ObjectMeta item) {
return withNewMetadataLike(java.util.Optional.ofNullable(buildMetadata()).orElse(item));
}
public A addToWebhooks(int index,MutatingWebhook item) {
if (this.webhooks == null) {this.webhooks = new ArrayList();}
MutatingWebhookBuilder builder = new MutatingWebhookBuilder(item);
if (index < 0 || index >= webhooks.size()) { _visitables.get("webhooks").add(builder); webhooks.add(builder); } else { _visitables.get("webhooks").add(index, builder); webhooks.add(index, builder);}
return (A)this;
}
public A setToWebhooks(int index,MutatingWebhook item) {
if (this.webhooks == null) {this.webhooks = new ArrayList();}
MutatingWebhookBuilder builder = new MutatingWebhookBuilder(item);
if (index < 0 || index >= webhooks.size()) { _visitables.get("webhooks").add(builder); webhooks.add(builder); } else { _visitables.get("webhooks").set(index, builder); webhooks.set(index, builder);}
return (A)this;
}
public A addToWebhooks(io.fabric8.kubernetes.api.model.admissionregistration.v1.MutatingWebhook... items) {
if (this.webhooks == null) {this.webhooks = new ArrayList();}
for (MutatingWebhook item : items) {MutatingWebhookBuilder builder = new MutatingWebhookBuilder(item);_visitables.get("webhooks").add(builder);this.webhooks.add(builder);} return (A)this;
}
public A addAllToWebhooks(Collection items) {
if (this.webhooks == null) {this.webhooks = new ArrayList();}
for (MutatingWebhook item : items) {MutatingWebhookBuilder builder = new MutatingWebhookBuilder(item);_visitables.get("webhooks").add(builder);this.webhooks.add(builder);} return (A)this;
}
public A removeFromWebhooks(io.fabric8.kubernetes.api.model.admissionregistration.v1.MutatingWebhook... items) {
if (this.webhooks == null) return (A)this;
for (MutatingWebhook item : items) {MutatingWebhookBuilder builder = new MutatingWebhookBuilder(item);_visitables.get("webhooks").remove(builder); this.webhooks.remove(builder);} return (A)this;
}
public A removeAllFromWebhooks(Collection items) {
if (this.webhooks == null) return (A)this;
for (MutatingWebhook item : items) {MutatingWebhookBuilder builder = new MutatingWebhookBuilder(item);_visitables.get("webhooks").remove(builder); this.webhooks.remove(builder);} return (A)this;
}
public A removeMatchingFromWebhooks(Predicate predicate) {
if (webhooks == null) return (A) this;
final Iterator each = webhooks.iterator();
final List visitables = _visitables.get("webhooks");
while (each.hasNext()) {
MutatingWebhookBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
public List buildWebhooks() {
return this.webhooks != null ? build(webhooks) : null;
}
public MutatingWebhook buildWebhook(int index) {
return this.webhooks.get(index).build();
}
public MutatingWebhook buildFirstWebhook() {
return this.webhooks.get(0).build();
}
public MutatingWebhook buildLastWebhook() {
return this.webhooks.get(webhooks.size() - 1).build();
}
public MutatingWebhook buildMatchingWebhook(Predicate predicate) {
for (MutatingWebhookBuilder item : webhooks) {
if (predicate.test(item)) {
return item.build();
}
}
return null;
}
public boolean hasMatchingWebhook(Predicate predicate) {
for (MutatingWebhookBuilder item : webhooks) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withWebhooks(List webhooks) {
if (this.webhooks != null) {
this._visitables.get("webhooks").clear();
}
if (webhooks != null) {
this.webhooks = new ArrayList();
for (MutatingWebhook item : webhooks) {
this.addToWebhooks(item);
}
} else {
this.webhooks = null;
}
return (A) this;
}
public A withWebhooks(io.fabric8.kubernetes.api.model.admissionregistration.v1.MutatingWebhook... webhooks) {
if (this.webhooks != null) {
this.webhooks.clear();
_visitables.remove("webhooks");
}
if (webhooks != null) {
for (MutatingWebhook item : webhooks) {
this.addToWebhooks(item);
}
}
return (A) this;
}
public boolean hasWebhooks() {
return this.webhooks != null && !this.webhooks.isEmpty();
}
public WebhooksNested addNewWebhook() {
return new WebhooksNested(-1, null);
}
public WebhooksNested addNewWebhookLike(MutatingWebhook item) {
return new WebhooksNested(-1, item);
}
public WebhooksNested setNewWebhookLike(int index,MutatingWebhook item) {
return new WebhooksNested(index, item);
}
public WebhooksNested editWebhook(int index) {
if (webhooks.size() <= index) throw new RuntimeException("Can't edit webhooks. Index exceeds size.");
return setNewWebhookLike(index, buildWebhook(index));
}
public WebhooksNested editFirstWebhook() {
if (webhooks.size() == 0) throw new RuntimeException("Can't edit first webhooks. The list is empty.");
return setNewWebhookLike(0, buildWebhook(0));
}
public WebhooksNested editLastWebhook() {
int index = webhooks.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last webhooks. The list is empty.");
return setNewWebhookLike(index, buildWebhook(index));
}
public WebhooksNested editMatchingWebhook(Predicate predicate) {
int index = -1;
for (int i=0;i map) {
if(this.additionalProperties == null && map != null) { this.additionalProperties = new LinkedHashMap(); }
if(map != null) { this.additionalProperties.putAll(map);} return (A)this;
}
public A removeFromAdditionalProperties(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(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 Map getAdditionalProperties() {
return this.additionalProperties;
}
public A withAdditionalProperties(Map additionalProperties) {
if (additionalProperties == null) {
this.additionalProperties = null;
} else {
this.additionalProperties = new LinkedHashMap(additionalProperties);
}
return (A) this;
}
public boolean hasAdditionalProperties() {
return this.additionalProperties != 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;
MutatingWebhookConfigurationFluent that = (MutatingWebhookConfigurationFluent) o;
if (!java.util.Objects.equals(apiVersion, that.apiVersion)) return false;
if (!java.util.Objects.equals(kind, that.kind)) return false;
if (!java.util.Objects.equals(metadata, that.metadata)) return false;
if (!java.util.Objects.equals(webhooks, that.webhooks)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(apiVersion, kind, metadata, webhooks, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (apiVersion != null) { sb.append("apiVersion:"); sb.append(apiVersion + ","); }
if (kind != null) { sb.append("kind:"); sb.append(kind + ","); }
if (metadata != null) { sb.append("metadata:"); sb.append(metadata + ","); }
if (webhooks != null && !webhooks.isEmpty()) { sb.append("webhooks:"); sb.append(webhooks + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
public class MetadataNested extends ObjectMetaFluent> implements Nested{
MetadataNested(ObjectMeta item) {
this.builder = new ObjectMetaBuilder(this, item);
}
ObjectMetaBuilder builder;
public N and() {
return (N) MutatingWebhookConfigurationFluent.this.withMetadata(builder.build());
}
public N endMetadata() {
return and();
}
}
public class WebhooksNested extends MutatingWebhookFluent> implements Nested{
WebhooksNested(int index,MutatingWebhook item) {
this.index = index;
this.builder = new MutatingWebhookBuilder(this, item);
}
MutatingWebhookBuilder builder;
int index;
public N and() {
return (N) MutatingWebhookConfigurationFluent.this.setToWebhooks(index,builder.build());
}
public N endWebhook() {
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy