io.alauda.kubernetes.api.model.HorizontalPodAutoscalerSpecFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.alauda.kubernetes.api.builder.Nested;
import java.lang.String;
import java.lang.Integer;
import java.lang.Deprecated;
import javax.validation.Valid;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.lang.Object;
import java.lang.Boolean;
public class HorizontalPodAutoscalerSpecFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements HorizontalPodAutoscalerSpecFluent{
private Integer maxReplicas;
private Integer minReplicas;
private CrossVersionObjectReferenceBuilder scaleTargetRef;
private Integer targetCPUUtilizationPercentage;
public HorizontalPodAutoscalerSpecFluentImpl(){
}
public HorizontalPodAutoscalerSpecFluentImpl(HorizontalPodAutoscalerSpec instance){
this.withMaxReplicas(instance.getMaxReplicas());
this.withMinReplicas(instance.getMinReplicas());
this.withScaleTargetRef(instance.getScaleTargetRef());
this.withTargetCPUUtilizationPercentage(instance.getTargetCPUUtilizationPercentage());
}
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.
*/
@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.remove(this.scaleTargetRef);
if (scaleTargetRef!=null){ this.scaleTargetRef= new CrossVersionObjectReferenceBuilder(scaleTargetRef); _visitables.add(this.scaleTargetRef);} return (A) this;
}
public Boolean hasScaleTargetRef(){
return this.scaleTargetRef!=null;
}
public HorizontalPodAutoscalerSpecFluent.ScaleTargetRefNested withNewScaleTargetRef(){
return new ScaleTargetRefNestedImpl();
}
public HorizontalPodAutoscalerSpecFluent.ScaleTargetRefNested withNewScaleTargetRefLike(CrossVersionObjectReference item){
return new 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 A withNewScaleTargetRef(String apiVersion,String kind,String name){
return (A)withScaleTargetRef(new CrossVersionObjectReference(apiVersion, kind, name));
}
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 boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) 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;
return true;
}
public class ScaleTargetRefNestedImpl extends CrossVersionObjectReferenceFluentImpl> implements HorizontalPodAutoscalerSpecFluent.ScaleTargetRefNested,io.alauda.kubernetes.api.builder.Nested{
private final CrossVersionObjectReferenceBuilder builder;
ScaleTargetRefNestedImpl(CrossVersionObjectReference item){
this.builder = new CrossVersionObjectReferenceBuilder(this, item);
}
ScaleTargetRefNestedImpl(){
this.builder = new CrossVersionObjectReferenceBuilder(this);
}
public N and(){
return (N) HorizontalPodAutoscalerSpecFluentImpl.this.withScaleTargetRef(builder.build());
}
public N endScaleTargetRef(){
return and();
}
}
}