io.kubernetes.client.openapi.models.V1ObjectMetaFluentImpl Maven / Gradle / Ivy
package io.kubernetes.client.openapi.models;
import io.kubernetes.client.fluent.VisitableBuilder;
import java.lang.StringBuilder;
import com.google.gson.annotations.SerializedName;
import io.kubernetes.client.fluent.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.kubernetes.client.fluent.Predicate;
import java.util.LinkedHashMap;
import java.lang.Deprecated;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import java.lang.StringBuffer;
import java.time.OffsetDateTime;
import java.lang.Long;
import java.util.Collection;
import java.lang.Object;
import java.util.Map;
public class V1ObjectMetaFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1ObjectMetaFluent {
private Map annotations;
private String clusterName;
private OffsetDateTime creationTimestamp;
private Long deletionGracePeriodSeconds;
private OffsetDateTime deletionTimestamp;
private List finalizers;
private String generateName;
private Long generation;
private Map labels;
private List managedFields;
private String name;
private String namespace;
private List ownerReferences;
private String resourceVersion;
private String selfLink;
private String uid;
public V1ObjectMetaFluentImpl() {
}
public V1ObjectMetaFluentImpl(V1ObjectMeta instance) {
this.withAnnotations(instance.getAnnotations());
this.withClusterName(instance.getClusterName());
this.withCreationTimestamp(instance.getCreationTimestamp());
this.withDeletionGracePeriodSeconds(instance.getDeletionGracePeriodSeconds());
this.withDeletionTimestamp(instance.getDeletionTimestamp());
this.withFinalizers(instance.getFinalizers());
this.withGenerateName(instance.getGenerateName());
this.withGeneration(instance.getGeneration());
this.withLabels(instance.getLabels());
this.withManagedFields(instance.getManagedFields());
this.withName(instance.getName());
this.withNamespace(instance.getNamespace());
this.withOwnerReferences(instance.getOwnerReferences());
this.withResourceVersion(instance.getResourceVersion());
this.withSelfLink(instance.getSelfLink());
this.withUid(instance.getUid());
}
public A addToAnnotations(String key,String value) {
if(this.annotations == null && key != null && value != null) { this.annotations = new LinkedHashMap(); }
if(key != null && value != null) {this.annotations.put(key, value);} return (A)this;
}
public A addToAnnotations(Map map) {
if(this.annotations == null && map != null) { this.annotations = new LinkedHashMap(); }
if(map != null) { this.annotations.putAll(map);} return (A)this;
}
public A removeFromAnnotations(String key) {
if(this.annotations == null) { return (A) this; }
if(key != null && this.annotations != null) {this.annotations.remove(key);} return (A)this;
}
public A removeFromAnnotations(Map map) {
if(this.annotations == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.annotations != null){this.annotations.remove(key);}}} return (A)this;
}
public Map getAnnotations() {
return this.annotations;
}
public A withAnnotations(Map annotations) {
if (annotations == null) { this.annotations = null;} else {this.annotations = new LinkedHashMap(annotations);} return (A) this;
}
public Boolean hasAnnotations() {
return this.annotations != null;
}
public String getClusterName() {
return this.clusterName;
}
public A withClusterName(String clusterName) {
this.clusterName=clusterName; return (A) this;
}
public Boolean hasClusterName() {
return this.clusterName != null;
}
public A withNewClusterName(String arg1) {
return (A)withClusterName(new String(arg1));
}
public A withNewClusterName(StringBuilder arg1) {
return (A)withClusterName(new String(arg1));
}
public A withNewClusterName(StringBuffer arg1) {
return (A)withClusterName(new String(arg1));
}
public OffsetDateTime getCreationTimestamp() {
return this.creationTimestamp;
}
public A withCreationTimestamp(OffsetDateTime creationTimestamp) {
this.creationTimestamp=creationTimestamp; return (A) this;
}
public Boolean hasCreationTimestamp() {
return this.creationTimestamp != null;
}
public Long getDeletionGracePeriodSeconds() {
return this.deletionGracePeriodSeconds;
}
public A withDeletionGracePeriodSeconds(Long deletionGracePeriodSeconds) {
this.deletionGracePeriodSeconds=deletionGracePeriodSeconds; return (A) this;
}
public Boolean hasDeletionGracePeriodSeconds() {
return this.deletionGracePeriodSeconds != null;
}
public OffsetDateTime getDeletionTimestamp() {
return this.deletionTimestamp;
}
public A withDeletionTimestamp(OffsetDateTime deletionTimestamp) {
this.deletionTimestamp=deletionTimestamp; return (A) this;
}
public Boolean hasDeletionTimestamp() {
return this.deletionTimestamp != null;
}
public A addToFinalizers(int index,String item) {
if (this.finalizers == null) {this.finalizers = new ArrayList();}
this.finalizers.add(index, item);
return (A)this;
}
public A setToFinalizers(int index,String item) {
if (this.finalizers == null) {this.finalizers = new ArrayList();}
this.finalizers.set(index, item); return (A)this;
}
public A addToFinalizers(String... items) {
if (this.finalizers == null) {this.finalizers = new ArrayList();}
for (String item : items) {this.finalizers.add(item);} return (A)this;
}
public A addAllToFinalizers(Collection items) {
if (this.finalizers == null) {this.finalizers = new ArrayList();}
for (String item : items) {this.finalizers.add(item);} return (A)this;
}
public A removeFromFinalizers(String... items) {
for (String item : items) {if (this.finalizers!= null){ this.finalizers.remove(item);}} return (A)this;
}
public A removeAllFromFinalizers(Collection items) {
for (String item : items) {if (this.finalizers!= null){ this.finalizers.remove(item);}} return (A)this;
}
public List getFinalizers() {
return this.finalizers;
}
public String getFinalizer(int index) {
return this.finalizers.get(index);
}
public String getFirstFinalizer() {
return this.finalizers.get(0);
}
public String getLastFinalizer() {
return this.finalizers.get(finalizers.size() - 1);
}
public String getMatchingFinalizer(io.kubernetes.client.fluent.Predicate predicate) {
for (String item: finalizers) { if(predicate.apply(item)){ return item;} } return null;
}
public Boolean hasMatchingFinalizer(io.kubernetes.client.fluent.Predicate predicate) {
for (String item: finalizers) { if(predicate.apply(item)){ return true;} } return false;
}
public A withFinalizers(List finalizers) {
if (this.finalizers != null) { _visitables.get("finalizers").removeAll(this.finalizers);}
if (finalizers != null) {this.finalizers = new ArrayList(); for (String item : finalizers){this.addToFinalizers(item);}} else { this.finalizers = null;} return (A) this;
}
public A withFinalizers(String... finalizers) {
if (this.finalizers != null) {this.finalizers.clear();}
if (finalizers != null) {for (String item :finalizers){ this.addToFinalizers(item);}} return (A) this;
}
public Boolean hasFinalizers() {
return finalizers != null && !finalizers.isEmpty();
}
public A addNewFinalizer(String arg1) {
return (A)addToFinalizers(new String(arg1));
}
public A addNewFinalizer(StringBuilder arg1) {
return (A)addToFinalizers(new String(arg1));
}
public A addNewFinalizer(StringBuffer arg1) {
return (A)addToFinalizers(new String(arg1));
}
public String getGenerateName() {
return this.generateName;
}
public A withGenerateName(String generateName) {
this.generateName=generateName; return (A) this;
}
public Boolean hasGenerateName() {
return this.generateName != null;
}
public A withNewGenerateName(String arg1) {
return (A)withGenerateName(new String(arg1));
}
public A withNewGenerateName(StringBuilder arg1) {
return (A)withGenerateName(new String(arg1));
}
public A withNewGenerateName(StringBuffer arg1) {
return (A)withGenerateName(new String(arg1));
}
public Long getGeneration() {
return this.generation;
}
public A withGeneration(Long generation) {
this.generation=generation; return (A) this;
}
public Boolean hasGeneration() {
return this.generation != null;
}
public A addToLabels(String key,String value) {
if(this.labels == null && key != null && value != null) { this.labels = new LinkedHashMap(); }
if(key != null && value != null) {this.labels.put(key, value);} return (A)this;
}
public A addToLabels(Map map) {
if(this.labels == null && map != null) { this.labels = new LinkedHashMap(); }
if(map != null) { this.labels.putAll(map);} return (A)this;
}
public A removeFromLabels(String key) {
if(this.labels == null) { return (A) this; }
if(key != null && this.labels != null) {this.labels.remove(key);} return (A)this;
}
public A removeFromLabels(Map map) {
if(this.labels == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.labels != null){this.labels.remove(key);}}} return (A)this;
}
public Map getLabels() {
return this.labels;
}
public A withLabels(Map labels) {
if (labels == null) { this.labels = null;} else {this.labels = new LinkedHashMap(labels);} return (A) this;
}
public Boolean hasLabels() {
return this.labels != null;
}
public A addToManagedFields(int index,V1ManagedFieldsEntry item) {
if (this.managedFields == null) {this.managedFields = new ArrayList();}
V1ManagedFieldsEntryBuilder builder = new V1ManagedFieldsEntryBuilder(item);_visitables.get("managedFields").add(index >= 0 ? index : _visitables.get("managedFields").size(), builder);this.managedFields.add(index >= 0 ? index : managedFields.size(), builder); return (A)this;
}
public A setToManagedFields(int index,V1ManagedFieldsEntry item) {
if (this.managedFields == null) {this.managedFields = new ArrayList();}
V1ManagedFieldsEntryBuilder builder = new V1ManagedFieldsEntryBuilder(item);
if (index < 0 || index >= _visitables.get("managedFields").size()) { _visitables.get("managedFields").add(builder); } else { _visitables.get("managedFields").set(index, builder);}
if (index < 0 || index >= managedFields.size()) { managedFields.add(builder); } else { managedFields.set(index, builder);}
return (A)this;
}
public A addToManagedFields(V1ManagedFieldsEntry... items) {
if (this.managedFields == null) {this.managedFields = new ArrayList();}
for (V1ManagedFieldsEntry item : items) {V1ManagedFieldsEntryBuilder builder = new V1ManagedFieldsEntryBuilder(item);_visitables.get("managedFields").add(builder);this.managedFields.add(builder);} return (A)this;
}
public A addAllToManagedFields(Collection items) {
if (this.managedFields == null) {this.managedFields = new ArrayList();}
for (V1ManagedFieldsEntry item : items) {V1ManagedFieldsEntryBuilder builder = new V1ManagedFieldsEntryBuilder(item);_visitables.get("managedFields").add(builder);this.managedFields.add(builder);} return (A)this;
}
public A removeFromManagedFields(V1ManagedFieldsEntry... items) {
for (V1ManagedFieldsEntry item : items) {V1ManagedFieldsEntryBuilder builder = new V1ManagedFieldsEntryBuilder(item);_visitables.get("managedFields").remove(builder);if (this.managedFields != null) {this.managedFields.remove(builder);}} return (A)this;
}
public A removeAllFromManagedFields(Collection items) {
for (V1ManagedFieldsEntry item : items) {V1ManagedFieldsEntryBuilder builder = new V1ManagedFieldsEntryBuilder(item);_visitables.get("managedFields").remove(builder);if (this.managedFields != null) {this.managedFields.remove(builder);}} return (A)this;
}
public A removeMatchingFromManagedFields(io.kubernetes.client.fluent.Predicate predicate) {
if (managedFields == null) return (A) this;
final Iterator each = managedFields.iterator();
final List visitables = _visitables.get("managedFields");
while (each.hasNext()) {
V1ManagedFieldsEntryBuilder builder = each.next();
if (predicate.apply(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildManagedFields instead.
* @return The buildable object.
*/
@Deprecated public List getManagedFields() {
return build(managedFields);
}
public List buildManagedFields() {
return build(managedFields);
}
public V1ManagedFieldsEntry buildManagedField(int index) {
return this.managedFields.get(index).build();
}
public V1ManagedFieldsEntry buildFirstManagedField() {
return this.managedFields.get(0).build();
}
public V1ManagedFieldsEntry buildLastManagedField() {
return this.managedFields.get(managedFields.size() - 1).build();
}
public V1ManagedFieldsEntry buildMatchingManagedField(io.kubernetes.client.fluent.Predicate predicate) {
for (V1ManagedFieldsEntryBuilder item: managedFields) { if(predicate.apply(item)){ return item.build();} } return null;
}
public Boolean hasMatchingManagedField(io.kubernetes.client.fluent.Predicate predicate) {
for (V1ManagedFieldsEntryBuilder item: managedFields) { if(predicate.apply(item)){ return true;} } return false;
}
public A withManagedFields(List managedFields) {
if (this.managedFields != null) { _visitables.get("managedFields").removeAll(this.managedFields);}
if (managedFields != null) {this.managedFields = new ArrayList(); for (V1ManagedFieldsEntry item : managedFields){this.addToManagedFields(item);}} else { this.managedFields = null;} return (A) this;
}
public A withManagedFields(V1ManagedFieldsEntry... managedFields) {
if (this.managedFields != null) {this.managedFields.clear();}
if (managedFields != null) {for (V1ManagedFieldsEntry item :managedFields){ this.addToManagedFields(item);}} return (A) this;
}
public Boolean hasManagedFields() {
return managedFields != null && !managedFields.isEmpty();
}
public V1ObjectMetaFluent.ManagedFieldsNested addNewManagedField() {
return new ManagedFieldsNestedImpl();
}
public V1ObjectMetaFluent.ManagedFieldsNested addNewManagedFieldLike(V1ManagedFieldsEntry item) {
return new ManagedFieldsNestedImpl(-1, item);
}
public V1ObjectMetaFluent.ManagedFieldsNested setNewManagedFieldLike(int index,V1ManagedFieldsEntry item) {
return new ManagedFieldsNestedImpl(index, item);
}
public V1ObjectMetaFluent.ManagedFieldsNested editManagedField(int index) {
if (managedFields.size() <= index) throw new RuntimeException("Can't edit managedFields. Index exceeds size.");
return setNewManagedFieldLike(index, buildManagedField(index));
}
public V1ObjectMetaFluent.ManagedFieldsNested editFirstManagedField() {
if (managedFields.size() == 0) throw new RuntimeException("Can't edit first managedFields. The list is empty.");
return setNewManagedFieldLike(0, buildManagedField(0));
}
public V1ObjectMetaFluent.ManagedFieldsNested editLastManagedField() {
int index = managedFields.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last managedFields. The list is empty.");
return setNewManagedFieldLike(index, buildManagedField(index));
}
public V1ObjectMetaFluent.ManagedFieldsNested editMatchingManagedField(io.kubernetes.client.fluent.Predicate predicate) {
int index = -1;
for (int i=0;i();}
V1OwnerReferenceBuilder builder = new V1OwnerReferenceBuilder(item);_visitables.get("ownerReferences").add(index >= 0 ? index : _visitables.get("ownerReferences").size(), builder);this.ownerReferences.add(index >= 0 ? index : ownerReferences.size(), builder); return (A)this;
}
public A setToOwnerReferences(int index,V1OwnerReference item) {
if (this.ownerReferences == null) {this.ownerReferences = new ArrayList();}
V1OwnerReferenceBuilder builder = new V1OwnerReferenceBuilder(item);
if (index < 0 || index >= _visitables.get("ownerReferences").size()) { _visitables.get("ownerReferences").add(builder); } else { _visitables.get("ownerReferences").set(index, builder);}
if (index < 0 || index >= ownerReferences.size()) { ownerReferences.add(builder); } else { ownerReferences.set(index, builder);}
return (A)this;
}
public A addToOwnerReferences(V1OwnerReference... items) {
if (this.ownerReferences == null) {this.ownerReferences = new ArrayList();}
for (V1OwnerReference item : items) {V1OwnerReferenceBuilder builder = new V1OwnerReferenceBuilder(item);_visitables.get("ownerReferences").add(builder);this.ownerReferences.add(builder);} return (A)this;
}
public A addAllToOwnerReferences(Collection items) {
if (this.ownerReferences == null) {this.ownerReferences = new ArrayList();}
for (V1OwnerReference item : items) {V1OwnerReferenceBuilder builder = new V1OwnerReferenceBuilder(item);_visitables.get("ownerReferences").add(builder);this.ownerReferences.add(builder);} return (A)this;
}
public A removeFromOwnerReferences(V1OwnerReference... items) {
for (V1OwnerReference item : items) {V1OwnerReferenceBuilder builder = new V1OwnerReferenceBuilder(item);_visitables.get("ownerReferences").remove(builder);if (this.ownerReferences != null) {this.ownerReferences.remove(builder);}} return (A)this;
}
public A removeAllFromOwnerReferences(Collection items) {
for (V1OwnerReference item : items) {V1OwnerReferenceBuilder builder = new V1OwnerReferenceBuilder(item);_visitables.get("ownerReferences").remove(builder);if (this.ownerReferences != null) {this.ownerReferences.remove(builder);}} return (A)this;
}
public A removeMatchingFromOwnerReferences(io.kubernetes.client.fluent.Predicate predicate) {
if (ownerReferences == null) return (A) this;
final Iterator each = ownerReferences.iterator();
final List visitables = _visitables.get("ownerReferences");
while (each.hasNext()) {
V1OwnerReferenceBuilder builder = each.next();
if (predicate.apply(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildOwnerReferences instead.
* @return The buildable object.
*/
@Deprecated public List getOwnerReferences() {
return build(ownerReferences);
}
public List buildOwnerReferences() {
return build(ownerReferences);
}
public V1OwnerReference buildOwnerReference(int index) {
return this.ownerReferences.get(index).build();
}
public V1OwnerReference buildFirstOwnerReference() {
return this.ownerReferences.get(0).build();
}
public V1OwnerReference buildLastOwnerReference() {
return this.ownerReferences.get(ownerReferences.size() - 1).build();
}
public V1OwnerReference buildMatchingOwnerReference(io.kubernetes.client.fluent.Predicate predicate) {
for (V1OwnerReferenceBuilder item: ownerReferences) { if(predicate.apply(item)){ return item.build();} } return null;
}
public Boolean hasMatchingOwnerReference(io.kubernetes.client.fluent.Predicate predicate) {
for (V1OwnerReferenceBuilder item: ownerReferences) { if(predicate.apply(item)){ return true;} } return false;
}
public A withOwnerReferences(List ownerReferences) {
if (this.ownerReferences != null) { _visitables.get("ownerReferences").removeAll(this.ownerReferences);}
if (ownerReferences != null) {this.ownerReferences = new ArrayList(); for (V1OwnerReference item : ownerReferences){this.addToOwnerReferences(item);}} else { this.ownerReferences = null;} return (A) this;
}
public A withOwnerReferences(V1OwnerReference... ownerReferences) {
if (this.ownerReferences != null) {this.ownerReferences.clear();}
if (ownerReferences != null) {for (V1OwnerReference item :ownerReferences){ this.addToOwnerReferences(item);}} return (A) this;
}
public Boolean hasOwnerReferences() {
return ownerReferences != null && !ownerReferences.isEmpty();
}
public V1ObjectMetaFluent.OwnerReferencesNested addNewOwnerReference() {
return new OwnerReferencesNestedImpl();
}
public V1ObjectMetaFluent.OwnerReferencesNested addNewOwnerReferenceLike(V1OwnerReference item) {
return new OwnerReferencesNestedImpl(-1, item);
}
public V1ObjectMetaFluent.OwnerReferencesNested setNewOwnerReferenceLike(int index,V1OwnerReference item) {
return new OwnerReferencesNestedImpl(index, item);
}
public V1ObjectMetaFluent.OwnerReferencesNested editOwnerReference(int index) {
if (ownerReferences.size() <= index) throw new RuntimeException("Can't edit ownerReferences. Index exceeds size.");
return setNewOwnerReferenceLike(index, buildOwnerReference(index));
}
public V1ObjectMetaFluent.OwnerReferencesNested editFirstOwnerReference() {
if (ownerReferences.size() == 0) throw new RuntimeException("Can't edit first ownerReferences. The list is empty.");
return setNewOwnerReferenceLike(0, buildOwnerReference(0));
}
public V1ObjectMetaFluent.OwnerReferencesNested editLastOwnerReference() {
int index = ownerReferences.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last ownerReferences. The list is empty.");
return setNewOwnerReferenceLike(index, buildOwnerReference(index));
}
public V1ObjectMetaFluent.OwnerReferencesNested editMatchingOwnerReference(io.kubernetes.client.fluent.Predicate predicate) {
int index = -1;
for (int i=0;i extends V1ManagedFieldsEntryFluentImpl> implements V1ObjectMetaFluent.ManagedFieldsNested,io.kubernetes.client.fluent.Nested {
private final V1ManagedFieldsEntryBuilder builder;
private final int index;
ManagedFieldsNestedImpl(int index,V1ManagedFieldsEntry item) {
this.index = index;
this.builder = new V1ManagedFieldsEntryBuilder(this, item);
}
ManagedFieldsNestedImpl() {
this.index = -1;
this.builder = new V1ManagedFieldsEntryBuilder(this);
}
public N and() {
return (N) V1ObjectMetaFluentImpl.this.setToManagedFields(index,builder.build());
}
public N endManagedField() {
return and();
}
}
public class OwnerReferencesNestedImpl extends V1OwnerReferenceFluentImpl> implements V1ObjectMetaFluent.OwnerReferencesNested,io.kubernetes.client.fluent.Nested {
private final V1OwnerReferenceBuilder builder;
private final int index;
OwnerReferencesNestedImpl(int index,V1OwnerReference item) {
this.index = index;
this.builder = new V1OwnerReferenceBuilder(this, item);
}
OwnerReferencesNestedImpl() {
this.index = -1;
this.builder = new V1OwnerReferenceBuilder(this);
}
public N and() {
return (N) V1ObjectMetaFluentImpl.this.setToOwnerReferences(index,builder.build());
}
public N endOwnerReference() {
return and();
}
}
}