io.kubernetes.client.openapi.models.V2beta2HorizontalPodAutoscalerStatusFluentImpl Maven / Gradle / Ivy
package io.kubernetes.client.openapi.models;
import io.kubernetes.client.fluent.VisitableBuilder;
import com.google.gson.annotations.SerializedName;
import io.kubernetes.client.fluent.Nested;
import java.util.ArrayList;
import io.kubernetes.client.fluent.Predicate;
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.Integer;
import java.time.OffsetDateTime;
import java.lang.Long;
import java.util.Collection;
import java.lang.Object;
public class V2beta2HorizontalPodAutoscalerStatusFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V2beta2HorizontalPodAutoscalerStatusFluent {
private List conditions;
private List currentMetrics;
private Integer currentReplicas;
private Integer desiredReplicas;
private OffsetDateTime lastScaleTime;
private Long observedGeneration;
public V2beta2HorizontalPodAutoscalerStatusFluentImpl() {
}
public V2beta2HorizontalPodAutoscalerStatusFluentImpl(V2beta2HorizontalPodAutoscalerStatus instance) {
this.withConditions(instance.getConditions());
this.withCurrentMetrics(instance.getCurrentMetrics());
this.withCurrentReplicas(instance.getCurrentReplicas());
this.withDesiredReplicas(instance.getDesiredReplicas());
this.withLastScaleTime(instance.getLastScaleTime());
this.withObservedGeneration(instance.getObservedGeneration());
}
public A addToConditions(int index,V2beta2HorizontalPodAutoscalerCondition item) {
if (this.conditions == null) {this.conditions = new ArrayList();}
V2beta2HorizontalPodAutoscalerConditionBuilder builder = new V2beta2HorizontalPodAutoscalerConditionBuilder(item);_visitables.get("conditions").add(index >= 0 ? index : _visitables.get("conditions").size(), builder);this.conditions.add(index >= 0 ? index : conditions.size(), builder); return (A)this;
}
public A setToConditions(int index,V2beta2HorizontalPodAutoscalerCondition item) {
if (this.conditions == null) {this.conditions = new ArrayList();}
V2beta2HorizontalPodAutoscalerConditionBuilder builder = new V2beta2HorizontalPodAutoscalerConditionBuilder(item);
if (index < 0 || index >= _visitables.get("conditions").size()) { _visitables.get("conditions").add(builder); } else { _visitables.get("conditions").set(index, builder);}
if (index < 0 || index >= conditions.size()) { conditions.add(builder); } else { conditions.set(index, builder);}
return (A)this;
}
public A addToConditions(V2beta2HorizontalPodAutoscalerCondition... items) {
if (this.conditions == null) {this.conditions = new ArrayList();}
for (V2beta2HorizontalPodAutoscalerCondition item : items) {V2beta2HorizontalPodAutoscalerConditionBuilder builder = new V2beta2HorizontalPodAutoscalerConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
}
public A addAllToConditions(Collection items) {
if (this.conditions == null) {this.conditions = new ArrayList();}
for (V2beta2HorizontalPodAutoscalerCondition item : items) {V2beta2HorizontalPodAutoscalerConditionBuilder builder = new V2beta2HorizontalPodAutoscalerConditionBuilder(item);_visitables.get("conditions").add(builder);this.conditions.add(builder);} return (A)this;
}
public A removeFromConditions(V2beta2HorizontalPodAutoscalerCondition... items) {
for (V2beta2HorizontalPodAutoscalerCondition item : items) {V2beta2HorizontalPodAutoscalerConditionBuilder builder = new V2beta2HorizontalPodAutoscalerConditionBuilder(item);_visitables.get("conditions").remove(builder);if (this.conditions != null) {this.conditions.remove(builder);}} return (A)this;
}
public A removeAllFromConditions(Collection items) {
for (V2beta2HorizontalPodAutoscalerCondition item : items) {V2beta2HorizontalPodAutoscalerConditionBuilder builder = new V2beta2HorizontalPodAutoscalerConditionBuilder(item);_visitables.get("conditions").remove(builder);if (this.conditions != null) {this.conditions.remove(builder);}} return (A)this;
}
public A removeMatchingFromConditions(io.kubernetes.client.fluent.Predicate predicate) {
if (conditions == null) return (A) this;
final Iterator each = conditions.iterator();
final List visitables = _visitables.get("conditions");
while (each.hasNext()) {
V2beta2HorizontalPodAutoscalerConditionBuilder builder = each.next();
if (predicate.apply(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildConditions instead.
* @return The buildable object.
*/
@Deprecated public List getConditions() {
return build(conditions);
}
public List buildConditions() {
return build(conditions);
}
public V2beta2HorizontalPodAutoscalerCondition buildCondition(int index) {
return this.conditions.get(index).build();
}
public V2beta2HorizontalPodAutoscalerCondition buildFirstCondition() {
return this.conditions.get(0).build();
}
public V2beta2HorizontalPodAutoscalerCondition buildLastCondition() {
return this.conditions.get(conditions.size() - 1).build();
}
public V2beta2HorizontalPodAutoscalerCondition buildMatchingCondition(io.kubernetes.client.fluent.Predicate predicate) {
for (V2beta2HorizontalPodAutoscalerConditionBuilder item: conditions) { if(predicate.apply(item)){ return item.build();} } return null;
}
public Boolean hasMatchingCondition(io.kubernetes.client.fluent.Predicate predicate) {
for (V2beta2HorizontalPodAutoscalerConditionBuilder item: conditions) { if(predicate.apply(item)){ return true;} } return false;
}
public A withConditions(List conditions) {
if (this.conditions != null) { _visitables.get("conditions").removeAll(this.conditions);}
if (conditions != null) {this.conditions = new ArrayList(); for (V2beta2HorizontalPodAutoscalerCondition item : conditions){this.addToConditions(item);}} else { this.conditions = null;} return (A) this;
}
public A withConditions(V2beta2HorizontalPodAutoscalerCondition... conditions) {
if (this.conditions != null) {this.conditions.clear();}
if (conditions != null) {for (V2beta2HorizontalPodAutoscalerCondition item :conditions){ this.addToConditions(item);}} return (A) this;
}
public Boolean hasConditions() {
return conditions != null && !conditions.isEmpty();
}
public V2beta2HorizontalPodAutoscalerStatusFluent.ConditionsNested addNewCondition() {
return new ConditionsNestedImpl();
}
public V2beta2HorizontalPodAutoscalerStatusFluent.ConditionsNested addNewConditionLike(V2beta2HorizontalPodAutoscalerCondition item) {
return new ConditionsNestedImpl(-1, item);
}
public V2beta2HorizontalPodAutoscalerStatusFluent.ConditionsNested setNewConditionLike(int index,V2beta2HorizontalPodAutoscalerCondition item) {
return new ConditionsNestedImpl(index, item);
}
public V2beta2HorizontalPodAutoscalerStatusFluent.ConditionsNested editCondition(int index) {
if (conditions.size() <= index) throw new RuntimeException("Can't edit conditions. Index exceeds size.");
return setNewConditionLike(index, buildCondition(index));
}
public V2beta2HorizontalPodAutoscalerStatusFluent.ConditionsNested editFirstCondition() {
if (conditions.size() == 0) throw new RuntimeException("Can't edit first conditions. The list is empty.");
return setNewConditionLike(0, buildCondition(0));
}
public V2beta2HorizontalPodAutoscalerStatusFluent.ConditionsNested editLastCondition() {
int index = conditions.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last conditions. The list is empty.");
return setNewConditionLike(index, buildCondition(index));
}
public V2beta2HorizontalPodAutoscalerStatusFluent.ConditionsNested editMatchingCondition(io.kubernetes.client.fluent.Predicate predicate) {
int index = -1;
for (int i=0;i();}
V2beta2MetricStatusBuilder builder = new V2beta2MetricStatusBuilder(item);_visitables.get("currentMetrics").add(index >= 0 ? index : _visitables.get("currentMetrics").size(), builder);this.currentMetrics.add(index >= 0 ? index : currentMetrics.size(), builder); return (A)this;
}
public A setToCurrentMetrics(int index,V2beta2MetricStatus item) {
if (this.currentMetrics == null) {this.currentMetrics = new ArrayList();}
V2beta2MetricStatusBuilder builder = new V2beta2MetricStatusBuilder(item);
if (index < 0 || index >= _visitables.get("currentMetrics").size()) { _visitables.get("currentMetrics").add(builder); } else { _visitables.get("currentMetrics").set(index, builder);}
if (index < 0 || index >= currentMetrics.size()) { currentMetrics.add(builder); } else { currentMetrics.set(index, builder);}
return (A)this;
}
public A addToCurrentMetrics(V2beta2MetricStatus... items) {
if (this.currentMetrics == null) {this.currentMetrics = new ArrayList();}
for (V2beta2MetricStatus item : items) {V2beta2MetricStatusBuilder builder = new V2beta2MetricStatusBuilder(item);_visitables.get("currentMetrics").add(builder);this.currentMetrics.add(builder);} return (A)this;
}
public A addAllToCurrentMetrics(Collection items) {
if (this.currentMetrics == null) {this.currentMetrics = new ArrayList();}
for (V2beta2MetricStatus item : items) {V2beta2MetricStatusBuilder builder = new V2beta2MetricStatusBuilder(item);_visitables.get("currentMetrics").add(builder);this.currentMetrics.add(builder);} return (A)this;
}
public A removeFromCurrentMetrics(V2beta2MetricStatus... items) {
for (V2beta2MetricStatus item : items) {V2beta2MetricStatusBuilder builder = new V2beta2MetricStatusBuilder(item);_visitables.get("currentMetrics").remove(builder);if (this.currentMetrics != null) {this.currentMetrics.remove(builder);}} return (A)this;
}
public A removeAllFromCurrentMetrics(Collection items) {
for (V2beta2MetricStatus item : items) {V2beta2MetricStatusBuilder builder = new V2beta2MetricStatusBuilder(item);_visitables.get("currentMetrics").remove(builder);if (this.currentMetrics != null) {this.currentMetrics.remove(builder);}} return (A)this;
}
public A removeMatchingFromCurrentMetrics(io.kubernetes.client.fluent.Predicate predicate) {
if (currentMetrics == null) return (A) this;
final Iterator each = currentMetrics.iterator();
final List visitables = _visitables.get("currentMetrics");
while (each.hasNext()) {
V2beta2MetricStatusBuilder builder = each.next();
if (predicate.apply(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A)this;
}
/**
* This method has been deprecated, please use method buildCurrentMetrics instead.
* @return The buildable object.
*/
@Deprecated public List getCurrentMetrics() {
return build(currentMetrics);
}
public List buildCurrentMetrics() {
return build(currentMetrics);
}
public V2beta2MetricStatus buildCurrentMetric(int index) {
return this.currentMetrics.get(index).build();
}
public V2beta2MetricStatus buildFirstCurrentMetric() {
return this.currentMetrics.get(0).build();
}
public V2beta2MetricStatus buildLastCurrentMetric() {
return this.currentMetrics.get(currentMetrics.size() - 1).build();
}
public V2beta2MetricStatus buildMatchingCurrentMetric(io.kubernetes.client.fluent.Predicate predicate) {
for (V2beta2MetricStatusBuilder item: currentMetrics) { if(predicate.apply(item)){ return item.build();} } return null;
}
public Boolean hasMatchingCurrentMetric(io.kubernetes.client.fluent.Predicate predicate) {
for (V2beta2MetricStatusBuilder item: currentMetrics) { if(predicate.apply(item)){ return true;} } return false;
}
public A withCurrentMetrics(List currentMetrics) {
if (this.currentMetrics != null) { _visitables.get("currentMetrics").removeAll(this.currentMetrics);}
if (currentMetrics != null) {this.currentMetrics = new ArrayList(); for (V2beta2MetricStatus item : currentMetrics){this.addToCurrentMetrics(item);}} else { this.currentMetrics = null;} return (A) this;
}
public A withCurrentMetrics(V2beta2MetricStatus... currentMetrics) {
if (this.currentMetrics != null) {this.currentMetrics.clear();}
if (currentMetrics != null) {for (V2beta2MetricStatus item :currentMetrics){ this.addToCurrentMetrics(item);}} return (A) this;
}
public Boolean hasCurrentMetrics() {
return currentMetrics != null && !currentMetrics.isEmpty();
}
public V2beta2HorizontalPodAutoscalerStatusFluent.CurrentMetricsNested addNewCurrentMetric() {
return new CurrentMetricsNestedImpl();
}
public V2beta2HorizontalPodAutoscalerStatusFluent.CurrentMetricsNested addNewCurrentMetricLike(V2beta2MetricStatus item) {
return new CurrentMetricsNestedImpl(-1, item);
}
public V2beta2HorizontalPodAutoscalerStatusFluent.CurrentMetricsNested setNewCurrentMetricLike(int index,V2beta2MetricStatus item) {
return new CurrentMetricsNestedImpl(index, item);
}
public V2beta2HorizontalPodAutoscalerStatusFluent.CurrentMetricsNested editCurrentMetric(int index) {
if (currentMetrics.size() <= index) throw new RuntimeException("Can't edit currentMetrics. Index exceeds size.");
return setNewCurrentMetricLike(index, buildCurrentMetric(index));
}
public V2beta2HorizontalPodAutoscalerStatusFluent.CurrentMetricsNested editFirstCurrentMetric() {
if (currentMetrics.size() == 0) throw new RuntimeException("Can't edit first currentMetrics. The list is empty.");
return setNewCurrentMetricLike(0, buildCurrentMetric(0));
}
public V2beta2HorizontalPodAutoscalerStatusFluent.CurrentMetricsNested editLastCurrentMetric() {
int index = currentMetrics.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last currentMetrics. The list is empty.");
return setNewCurrentMetricLike(index, buildCurrentMetric(index));
}
public V2beta2HorizontalPodAutoscalerStatusFluent.CurrentMetricsNested editMatchingCurrentMetric(io.kubernetes.client.fluent.Predicate predicate) {
int index = -1;
for (int i=0;i extends V2beta2HorizontalPodAutoscalerConditionFluentImpl> implements V2beta2HorizontalPodAutoscalerStatusFluent.ConditionsNested,io.kubernetes.client.fluent.Nested {
private final V2beta2HorizontalPodAutoscalerConditionBuilder builder;
private final int index;
ConditionsNestedImpl(int index,V2beta2HorizontalPodAutoscalerCondition item) {
this.index = index;
this.builder = new V2beta2HorizontalPodAutoscalerConditionBuilder(this, item);
}
ConditionsNestedImpl() {
this.index = -1;
this.builder = new V2beta2HorizontalPodAutoscalerConditionBuilder(this);
}
public N and() {
return (N) V2beta2HorizontalPodAutoscalerStatusFluentImpl.this.setToConditions(index,builder.build());
}
public N endCondition() {
return and();
}
}
public class CurrentMetricsNestedImpl extends V2beta2MetricStatusFluentImpl> implements V2beta2HorizontalPodAutoscalerStatusFluent.CurrentMetricsNested,io.kubernetes.client.fluent.Nested {
private final V2beta2MetricStatusBuilder builder;
private final int index;
CurrentMetricsNestedImpl(int index,V2beta2MetricStatus item) {
this.index = index;
this.builder = new V2beta2MetricStatusBuilder(this, item);
}
CurrentMetricsNestedImpl() {
this.index = -1;
this.builder = new V2beta2MetricStatusBuilder(this);
}
public N and() {
return (N) V2beta2HorizontalPodAutoscalerStatusFluentImpl.this.setToCurrentMetrics(index,builder.build());
}
public N endCurrentMetric() {
return and();
}
}
}