annotations.io.alauda.kubernetes.api.model.extensions.StatefulSetSpecFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model.extensions;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.alauda.kubernetes.api.model.PodTemplateSpecFluentImpl;
import io.alauda.kubernetes.api.model.LabelSelectorFluentImpl;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.alauda.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import io.alauda.kubernetes.api.model.PodTemplateSpec;
import java.lang.Deprecated;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import io.alauda.kubernetes.api.model.LabelSelectorBuilder;
import io.alauda.kubernetes.api.model.LabelSelector;
import io.alauda.kubernetes.api.model.PersistentVolumeClaimBuilder;
import io.alauda.kubernetes.api.model.PersistentVolumeClaimFluentImpl;
import java.lang.Integer;
import javax.validation.Valid;
import io.alauda.kubernetes.api.model.PodTemplateSpecBuilder;
import java.util.Collection;
import io.alauda.kubernetes.api.model.PersistentVolumeClaim;
import java.lang.Object;
public class StatefulSetSpecFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements StatefulSetSpecFluent{
private String podManagementPolicy;
private Integer replicas;
private Integer revisionHistoryLimit;
private LabelSelectorBuilder selector;
private String serviceName;
private PodTemplateSpecBuilder template;
private StatefulSetUpdateStrategyBuilder updateStrategy;
private List volumeClaimTemplates = new ArrayList();
public StatefulSetSpecFluentImpl(){
}
public StatefulSetSpecFluentImpl(StatefulSetSpec instance){
this.withPodManagementPolicy(instance.getPodManagementPolicy());
this.withReplicas(instance.getReplicas());
this.withRevisionHistoryLimit(instance.getRevisionHistoryLimit());
this.withSelector(instance.getSelector());
this.withServiceName(instance.getServiceName());
this.withTemplate(instance.getTemplate());
this.withUpdateStrategy(instance.getUpdateStrategy());
this.withVolumeClaimTemplates(instance.getVolumeClaimTemplates());
}
public String getPodManagementPolicy(){
return this.podManagementPolicy;
}
public A withPodManagementPolicy(String podManagementPolicy){
this.podManagementPolicy=podManagementPolicy; return (A) this;
}
public Boolean hasPodManagementPolicy(){
return this.podManagementPolicy!=null;
}
public Integer getReplicas(){
return this.replicas;
}
public A withReplicas(Integer replicas){
this.replicas=replicas; return (A) this;
}
public Boolean hasReplicas(){
return this.replicas!=null;
}
public Integer getRevisionHistoryLimit(){
return this.revisionHistoryLimit;
}
public A withRevisionHistoryLimit(Integer revisionHistoryLimit){
this.revisionHistoryLimit=revisionHistoryLimit; return (A) this;
}
public Boolean hasRevisionHistoryLimit(){
return this.revisionHistoryLimit!=null;
}
/**
* This method has been deprecated, please use method buildSelector instead.
*/
@Deprecated public LabelSelector getSelector(){
return this.selector!=null?this.selector.build():null;
}
public LabelSelector buildSelector(){
return this.selector!=null?this.selector.build():null;
}
public A withSelector(LabelSelector selector){
_visitables.remove(this.selector);
if (selector!=null){ this.selector= new LabelSelectorBuilder(selector); _visitables.add(this.selector);} return (A) this;
}
public Boolean hasSelector(){
return this.selector!=null;
}
public StatefulSetSpecFluent.SelectorNested withNewSelector(){
return new SelectorNestedImpl();
}
public StatefulSetSpecFluent.SelectorNested withNewSelectorLike(LabelSelector item){
return new SelectorNestedImpl(item);
}
public StatefulSetSpecFluent.SelectorNested editSelector(){
return withNewSelectorLike(getSelector());
}
public StatefulSetSpecFluent.SelectorNested editOrNewSelector(){
return withNewSelectorLike(getSelector() != null ? getSelector(): new LabelSelectorBuilder().build());
}
public StatefulSetSpecFluent.SelectorNested editOrNewSelectorLike(LabelSelector item){
return withNewSelectorLike(getSelector() != null ? getSelector(): item);
}
public String getServiceName(){
return this.serviceName;
}
public A withServiceName(String serviceName){
this.serviceName=serviceName; return (A) this;
}
public Boolean hasServiceName(){
return this.serviceName!=null;
}
/**
* This method has been deprecated, please use method buildTemplate instead.
*/
@Deprecated public PodTemplateSpec getTemplate(){
return this.template!=null?this.template.build():null;
}
public PodTemplateSpec buildTemplate(){
return this.template!=null?this.template.build():null;
}
public A withTemplate(PodTemplateSpec template){
_visitables.remove(this.template);
if (template!=null){ this.template= new PodTemplateSpecBuilder(template); _visitables.add(this.template);} return (A) this;
}
public Boolean hasTemplate(){
return this.template!=null;
}
public StatefulSetSpecFluent.TemplateNested withNewTemplate(){
return new TemplateNestedImpl();
}
public StatefulSetSpecFluent.TemplateNested withNewTemplateLike(PodTemplateSpec item){
return new TemplateNestedImpl(item);
}
public StatefulSetSpecFluent.TemplateNested editTemplate(){
return withNewTemplateLike(getTemplate());
}
public StatefulSetSpecFluent.TemplateNested editOrNewTemplate(){
return withNewTemplateLike(getTemplate() != null ? getTemplate(): new PodTemplateSpecBuilder().build());
}
public StatefulSetSpecFluent.TemplateNested editOrNewTemplateLike(PodTemplateSpec item){
return withNewTemplateLike(getTemplate() != null ? getTemplate(): item);
}
/**
* This method has been deprecated, please use method buildUpdateStrategy instead.
*/
@Deprecated public StatefulSetUpdateStrategy getUpdateStrategy(){
return this.updateStrategy!=null?this.updateStrategy.build():null;
}
public StatefulSetUpdateStrategy buildUpdateStrategy(){
return this.updateStrategy!=null?this.updateStrategy.build():null;
}
public A withUpdateStrategy(StatefulSetUpdateStrategy updateStrategy){
_visitables.remove(this.updateStrategy);
if (updateStrategy!=null){ this.updateStrategy= new StatefulSetUpdateStrategyBuilder(updateStrategy); _visitables.add(this.updateStrategy);} return (A) this;
}
public Boolean hasUpdateStrategy(){
return this.updateStrategy!=null;
}
public StatefulSetSpecFluent.UpdateStrategyNested withNewUpdateStrategy(){
return new UpdateStrategyNestedImpl();
}
public StatefulSetSpecFluent.UpdateStrategyNested withNewUpdateStrategyLike(StatefulSetUpdateStrategy item){
return new UpdateStrategyNestedImpl(item);
}
public StatefulSetSpecFluent.UpdateStrategyNested editUpdateStrategy(){
return withNewUpdateStrategyLike(getUpdateStrategy());
}
public StatefulSetSpecFluent.UpdateStrategyNested editOrNewUpdateStrategy(){
return withNewUpdateStrategyLike(getUpdateStrategy() != null ? getUpdateStrategy(): new StatefulSetUpdateStrategyBuilder().build());
}
public StatefulSetSpecFluent.UpdateStrategyNested editOrNewUpdateStrategyLike(StatefulSetUpdateStrategy item){
return withNewUpdateStrategyLike(getUpdateStrategy() != null ? getUpdateStrategy(): item);
}
public A addToVolumeClaimTemplates(int index,PersistentVolumeClaim item){
PersistentVolumeClaimBuilder builder = new PersistentVolumeClaimBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.volumeClaimTemplates.add(index >= 0 ? index : volumeClaimTemplates.size(), builder); return (A)this;
}
public A setToVolumeClaimTemplates(int index,PersistentVolumeClaim item){
PersistentVolumeClaimBuilder builder = new PersistentVolumeClaimBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= volumeClaimTemplates.size()) { volumeClaimTemplates.add(builder); } else { volumeClaimTemplates.set(index, builder);}
return (A)this;
}
public A addToVolumeClaimTemplates(PersistentVolumeClaim... items){
for (PersistentVolumeClaim item : items) {PersistentVolumeClaimBuilder builder = new PersistentVolumeClaimBuilder(item);_visitables.add(builder);this.volumeClaimTemplates.add(builder);} return (A)this;
}
public A addAllToVolumeClaimTemplates(Collection items){
for (PersistentVolumeClaim item : items) {PersistentVolumeClaimBuilder builder = new PersistentVolumeClaimBuilder(item);_visitables.add(builder);this.volumeClaimTemplates.add(builder);} return (A)this;
}
public A removeFromVolumeClaimTemplates(PersistentVolumeClaim... items){
for (PersistentVolumeClaim item : items) {PersistentVolumeClaimBuilder builder = new PersistentVolumeClaimBuilder(item);_visitables.remove(builder);this.volumeClaimTemplates.remove(builder);} return (A)this;
}
public A removeAllFromVolumeClaimTemplates(Collection items){
for (PersistentVolumeClaim item : items) {PersistentVolumeClaimBuilder builder = new PersistentVolumeClaimBuilder(item);_visitables.remove(builder);this.volumeClaimTemplates.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildVolumeClaimTemplates instead.
*/
@Deprecated public List getVolumeClaimTemplates(){
return build(volumeClaimTemplates);
}
public List buildVolumeClaimTemplates(){
return build(volumeClaimTemplates);
}
public PersistentVolumeClaim buildVolumeClaimTemplate(int index){
return this.volumeClaimTemplates.get(index).build();
}
public PersistentVolumeClaim buildFirstVolumeClaimTemplate(){
return this.volumeClaimTemplates.get(0).build();
}
public PersistentVolumeClaim buildLastVolumeClaimTemplate(){
return this.volumeClaimTemplates.get(volumeClaimTemplates.size() - 1).build();
}
public PersistentVolumeClaim buildMatchingVolumeClaimTemplate(io.alauda.kubernetes.api.builder.Predicate predicate){
for (PersistentVolumeClaimBuilder item: volumeClaimTemplates) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withVolumeClaimTemplates(List volumeClaimTemplates){
_visitables.removeAll(this.volumeClaimTemplates);
this.volumeClaimTemplates.clear();
if (volumeClaimTemplates != null) {for (PersistentVolumeClaim item : volumeClaimTemplates){this.addToVolumeClaimTemplates(item);}} return (A) this;
}
public A withVolumeClaimTemplates(PersistentVolumeClaim... volumeClaimTemplates){
this.volumeClaimTemplates.clear(); if (volumeClaimTemplates != null) {for (PersistentVolumeClaim item :volumeClaimTemplates){ this.addToVolumeClaimTemplates(item);}} return (A) this;
}
public Boolean hasVolumeClaimTemplates(){
return volumeClaimTemplates!= null && !volumeClaimTemplates.isEmpty();
}
public StatefulSetSpecFluent.VolumeClaimTemplatesNested addNewVolumeClaimTemplate(){
return new VolumeClaimTemplatesNestedImpl();
}
public StatefulSetSpecFluent.VolumeClaimTemplatesNested addNewVolumeClaimTemplateLike(PersistentVolumeClaim item){
return new VolumeClaimTemplatesNestedImpl(-1, item);
}
public StatefulSetSpecFluent.VolumeClaimTemplatesNested setNewVolumeClaimTemplateLike(int index,PersistentVolumeClaim item){
return new VolumeClaimTemplatesNestedImpl(index, item);
}
public StatefulSetSpecFluent.VolumeClaimTemplatesNested editVolumeClaimTemplate(int index){
if (volumeClaimTemplates.size() <= index) throw new RuntimeException("Can't edit volumeClaimTemplates. Index exceeds size.");
return setNewVolumeClaimTemplateLike(index, buildVolumeClaimTemplate(index));
}
public StatefulSetSpecFluent.VolumeClaimTemplatesNested editFirstVolumeClaimTemplate(){
if (volumeClaimTemplates.size() == 0) throw new RuntimeException("Can't edit first volumeClaimTemplates. The list is empty.");
return setNewVolumeClaimTemplateLike(0, buildVolumeClaimTemplate(0));
}
public StatefulSetSpecFluent.VolumeClaimTemplatesNested editLastVolumeClaimTemplate(){
int index = volumeClaimTemplates.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last volumeClaimTemplates. The list is empty.");
return setNewVolumeClaimTemplateLike(index, buildVolumeClaimTemplate(index));
}
public StatefulSetSpecFluent.VolumeClaimTemplatesNested editMatchingVolumeClaimTemplate(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends LabelSelectorFluentImpl> implements StatefulSetSpecFluent.SelectorNested,io.alauda.kubernetes.api.builder.Nested{
private final LabelSelectorBuilder builder;
SelectorNestedImpl(LabelSelector item){
this.builder = new LabelSelectorBuilder(this, item);
}
SelectorNestedImpl(){
this.builder = new LabelSelectorBuilder(this);
}
public N and(){
return (N) StatefulSetSpecFluentImpl.this.withSelector(builder.build());
}
public N endSelector(){
return and();
}
}
public class TemplateNestedImpl extends PodTemplateSpecFluentImpl> implements StatefulSetSpecFluent.TemplateNested,io.alauda.kubernetes.api.builder.Nested{
private final PodTemplateSpecBuilder builder;
TemplateNestedImpl(PodTemplateSpec item){
this.builder = new PodTemplateSpecBuilder(this, item);
}
TemplateNestedImpl(){
this.builder = new PodTemplateSpecBuilder(this);
}
public N and(){
return (N) StatefulSetSpecFluentImpl.this.withTemplate(builder.build());
}
public N endTemplate(){
return and();
}
}
public class UpdateStrategyNestedImpl extends StatefulSetUpdateStrategyFluentImpl> implements StatefulSetSpecFluent.UpdateStrategyNested,io.alauda.kubernetes.api.builder.Nested{
private final StatefulSetUpdateStrategyBuilder builder;
UpdateStrategyNestedImpl(StatefulSetUpdateStrategy item){
this.builder = new StatefulSetUpdateStrategyBuilder(this, item);
}
UpdateStrategyNestedImpl(){
this.builder = new StatefulSetUpdateStrategyBuilder(this);
}
public N and(){
return (N) StatefulSetSpecFluentImpl.this.withUpdateStrategy(builder.build());
}
public N endUpdateStrategy(){
return and();
}
}
public class VolumeClaimTemplatesNestedImpl extends PersistentVolumeClaimFluentImpl> implements StatefulSetSpecFluent.VolumeClaimTemplatesNested,io.alauda.kubernetes.api.builder.Nested{
private final PersistentVolumeClaimBuilder builder;
private final int index;
VolumeClaimTemplatesNestedImpl(int index,PersistentVolumeClaim item){
this.index = index;
this.builder = new PersistentVolumeClaimBuilder(this, item);
}
VolumeClaimTemplatesNestedImpl(){
this.index = -1;
this.builder = new PersistentVolumeClaimBuilder(this);
}
public N and(){
return (N) StatefulSetSpecFluentImpl.this.setToVolumeClaimTemplates(index, builder.build());
}
public N endVolumeClaimTemplate(){
return and();
}
}
}