
io.fabric8.kubernetes.api.model.autoscaling.v1.HorizontalPodAutoscalerSpecFluentImpl Maven / Gradle / Ivy
package io.fabric8.kubernetes.api.model.autoscaling.v1;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.lang.String;
import java.util.LinkedHashMap;
import java.lang.Integer;
import java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.lang.Object;
import java.lang.Boolean;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings(value = "unchecked")
public class HorizontalPodAutoscalerSpecFluentImpl> extends BaseFluent implements HorizontalPodAutoscalerSpecFluent{
public HorizontalPodAutoscalerSpecFluentImpl() {
}
public HorizontalPodAutoscalerSpecFluentImpl(HorizontalPodAutoscalerSpec instance) {
this.withMaxReplicas(instance.getMaxReplicas());
this.withMinReplicas(instance.getMinReplicas());
this.withScaleTargetRef(instance.getScaleTargetRef());
this.withTargetCPUUtilizationPercentage(instance.getTargetCPUUtilizationPercentage());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
private Integer maxReplicas;
private Integer minReplicas;
private CrossVersionObjectReferenceBuilder scaleTargetRef;
private Integer targetCPUUtilizationPercentage;
private Map additionalProperties;
public Integer getMaxReplicas() {
return this.maxReplicas;
}
public A withMaxReplicas(Integer maxReplicas) {
this.maxReplicas=maxReplicas; return (A) this;
}
public Boolean hasMaxReplicas() {
return this.maxReplicas != null;
}
public Integer getMinReplicas() {
return this.minReplicas;
}
public A withMinReplicas(Integer minReplicas) {
this.minReplicas=minReplicas; return (A) this;
}
public Boolean hasMinReplicas() {
return this.minReplicas != null;
}
/**
* This method has been deprecated, please use method buildScaleTargetRef instead.
* @return The buildable object.
*/
@Deprecated
public CrossVersionObjectReference getScaleTargetRef() {
return this.scaleTargetRef!=null ?this.scaleTargetRef.build():null;
}
public CrossVersionObjectReference buildScaleTargetRef() {
return this.scaleTargetRef!=null ?this.scaleTargetRef.build():null;
}
public A withScaleTargetRef(CrossVersionObjectReference scaleTargetRef) {
_visitables.get("scaleTargetRef").remove(this.scaleTargetRef);
if (scaleTargetRef!=null){ this.scaleTargetRef= new CrossVersionObjectReferenceBuilder(scaleTargetRef); _visitables.get("scaleTargetRef").add(this.scaleTargetRef);} else { this.scaleTargetRef = null; _visitables.get("scaleTargetRef").remove(this.scaleTargetRef); } return (A) this;
}
public Boolean hasScaleTargetRef() {
return this.scaleTargetRef != null;
}
public A withNewScaleTargetRef(String apiVersion,String kind,String name) {
return (A)withScaleTargetRef(new CrossVersionObjectReference(apiVersion, kind, name));
}
public HorizontalPodAutoscalerSpecFluent.ScaleTargetRefNested withNewScaleTargetRef() {
return new HorizontalPodAutoscalerSpecFluentImpl.ScaleTargetRefNestedImpl();
}
public HorizontalPodAutoscalerSpecFluent.ScaleTargetRefNested withNewScaleTargetRefLike(CrossVersionObjectReference item) {
return new HorizontalPodAutoscalerSpecFluentImpl.ScaleTargetRefNestedImpl(item);
}
public HorizontalPodAutoscalerSpecFluent.ScaleTargetRefNested editScaleTargetRef() {
return withNewScaleTargetRefLike(getScaleTargetRef());
}
public HorizontalPodAutoscalerSpecFluent.ScaleTargetRefNested editOrNewScaleTargetRef() {
return withNewScaleTargetRefLike(getScaleTargetRef() != null ? getScaleTargetRef(): new CrossVersionObjectReferenceBuilder().build());
}
public HorizontalPodAutoscalerSpecFluent.ScaleTargetRefNested editOrNewScaleTargetRefLike(CrossVersionObjectReference item) {
return withNewScaleTargetRefLike(getScaleTargetRef() != null ? getScaleTargetRef(): item);
}
public Integer getTargetCPUUtilizationPercentage() {
return this.targetCPUUtilizationPercentage;
}
public A withTargetCPUUtilizationPercentage(Integer targetCPUUtilizationPercentage) {
this.targetCPUUtilizationPercentage=targetCPUUtilizationPercentage; return (A) this;
}
public Boolean hasTargetCPUUtilizationPercentage() {
return this.targetCPUUtilizationPercentage != null;
}
public A addToAdditionalProperties(String key,Object value) {
if(this.additionalProperties == null && key != null && value != null) { this.additionalProperties = new LinkedHashMap(); }
if(key != null && value != null) {this.additionalProperties.put(key, value);} return (A)this;
}
public A addToAdditionalProperties(Map 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;
HorizontalPodAutoscalerSpecFluentImpl that = (HorizontalPodAutoscalerSpecFluentImpl) o;
if (maxReplicas != null ? !maxReplicas.equals(that.maxReplicas) :that.maxReplicas != null) return false;
if (minReplicas != null ? !minReplicas.equals(that.minReplicas) :that.minReplicas != null) return false;
if (scaleTargetRef != null ? !scaleTargetRef.equals(that.scaleTargetRef) :that.scaleTargetRef != null) return false;
if (targetCPUUtilizationPercentage != null ? !targetCPUUtilizationPercentage.equals(that.targetCPUUtilizationPercentage) :that.targetCPUUtilizationPercentage != null) return false;
if (additionalProperties != null ? !additionalProperties.equals(that.additionalProperties) :that.additionalProperties != null) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(maxReplicas, minReplicas, scaleTargetRef, targetCPUUtilizationPercentage, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (maxReplicas != null) { sb.append("maxReplicas:"); sb.append(maxReplicas + ","); }
if (minReplicas != null) { sb.append("minReplicas:"); sb.append(minReplicas + ","); }
if (scaleTargetRef != null) { sb.append("scaleTargetRef:"); sb.append(scaleTargetRef + ","); }
if (targetCPUUtilizationPercentage != null) { sb.append("targetCPUUtilizationPercentage:"); sb.append(targetCPUUtilizationPercentage + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
class ScaleTargetRefNestedImpl extends CrossVersionObjectReferenceFluentImpl> implements HorizontalPodAutoscalerSpecFluent.ScaleTargetRefNested,Nested{
ScaleTargetRefNestedImpl(CrossVersionObjectReference item) {
this.builder = new CrossVersionObjectReferenceBuilder(this, item);
}
ScaleTargetRefNestedImpl() {
this.builder = new CrossVersionObjectReferenceBuilder(this);
}
CrossVersionObjectReferenceBuilder builder;
public N and() {
return (N) HorizontalPodAutoscalerSpecFluentImpl.this.withScaleTargetRef(builder.build());
}
public N endScaleTargetRef() {
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy