io.alauda.kubernetes.api.model.PodSpecFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.ArrayList;
import java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import java.util.LinkedHashMap;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import javax.validation.Valid;
import java.lang.Long;
import java.util.Collection;
import java.lang.Object;
import java.util.Map;
import io.alauda.kubernetes.api.builder.Nested;
import java.lang.Deprecated;
public class PodSpecFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements PodSpecFluent{
private Long activeDeadlineSeconds;
private AffinityBuilder affinity;
private Boolean automountServiceAccountToken;
private List containers = new ArrayList();
private String dnsPolicy;
private List hostAliases = new ArrayList();
private Boolean hostIPC;
private Boolean hostNetwork;
private Boolean hostPID;
private String hostname;
private List imagePullSecrets = new ArrayList();
private List initContainers = new ArrayList();
private String nodeName;
private Map nodeSelector = new LinkedHashMap();
private String restartPolicy;
private String schedulerName;
private PodSecurityContextBuilder securityContext;
private String serviceAccount;
private String serviceAccountName;
private String subdomain;
private Long terminationGracePeriodSeconds;
private List tolerations = new ArrayList();
private List volumes = new ArrayList();
public PodSpecFluentImpl(){
}
public PodSpecFluentImpl(PodSpec instance){
this.withActiveDeadlineSeconds(instance.getActiveDeadlineSeconds());
this.withAffinity(instance.getAffinity());
this.withAutomountServiceAccountToken(instance.getAutomountServiceAccountToken());
this.withContainers(instance.getContainers());
this.withDnsPolicy(instance.getDnsPolicy());
this.withHostAliases(instance.getHostAliases());
this.withHostIPC(instance.getHostIPC());
this.withHostNetwork(instance.getHostNetwork());
this.withHostPID(instance.getHostPID());
this.withHostname(instance.getHostname());
this.withImagePullSecrets(instance.getImagePullSecrets());
this.withInitContainers(instance.getInitContainers());
this.withNodeName(instance.getNodeName());
this.withNodeSelector(instance.getNodeSelector());
this.withRestartPolicy(instance.getRestartPolicy());
this.withSchedulerName(instance.getSchedulerName());
this.withSecurityContext(instance.getSecurityContext());
this.withServiceAccount(instance.getServiceAccount());
this.withServiceAccountName(instance.getServiceAccountName());
this.withSubdomain(instance.getSubdomain());
this.withTerminationGracePeriodSeconds(instance.getTerminationGracePeriodSeconds());
this.withTolerations(instance.getTolerations());
this.withVolumes(instance.getVolumes());
}
public Long getActiveDeadlineSeconds(){
return this.activeDeadlineSeconds;
}
public A withActiveDeadlineSeconds(Long activeDeadlineSeconds){
this.activeDeadlineSeconds=activeDeadlineSeconds; return (A) this;
}
public Boolean hasActiveDeadlineSeconds(){
return this.activeDeadlineSeconds!=null;
}
/**
* This method has been deprecated, please use method buildAffinity instead.
*/
@Deprecated public Affinity getAffinity(){
return this.affinity!=null?this.affinity.build():null;
}
public Affinity buildAffinity(){
return this.affinity!=null?this.affinity.build():null;
}
public A withAffinity(Affinity affinity){
_visitables.remove(this.affinity);
if (affinity!=null){ this.affinity= new AffinityBuilder(affinity); _visitables.add(this.affinity);} return (A) this;
}
public Boolean hasAffinity(){
return this.affinity!=null;
}
public PodSpecFluent.AffinityNested withNewAffinity(){
return new AffinityNestedImpl();
}
public PodSpecFluent.AffinityNested withNewAffinityLike(Affinity item){
return new AffinityNestedImpl(item);
}
public PodSpecFluent.AffinityNested editAffinity(){
return withNewAffinityLike(getAffinity());
}
public PodSpecFluent.AffinityNested editOrNewAffinity(){
return withNewAffinityLike(getAffinity() != null ? getAffinity(): new AffinityBuilder().build());
}
public PodSpecFluent.AffinityNested editOrNewAffinityLike(Affinity item){
return withNewAffinityLike(getAffinity() != null ? getAffinity(): item);
}
public Boolean isAutomountServiceAccountToken(){
return this.automountServiceAccountToken;
}
public A withAutomountServiceAccountToken(Boolean automountServiceAccountToken){
this.automountServiceAccountToken=automountServiceAccountToken; return (A) this;
}
public Boolean hasAutomountServiceAccountToken(){
return this.automountServiceAccountToken!=null;
}
public A addToContainers(int index,Container item){
ContainerBuilder builder = new ContainerBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.containers.add(index >= 0 ? index : containers.size(), builder); return (A)this;
}
public A setToContainers(int index,Container item){
ContainerBuilder builder = new ContainerBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= containers.size()) { containers.add(builder); } else { containers.set(index, builder);}
return (A)this;
}
public A addToContainers(Container... items){
for (Container item : items) {ContainerBuilder builder = new ContainerBuilder(item);_visitables.add(builder);this.containers.add(builder);} return (A)this;
}
public A addAllToContainers(Collection items){
for (Container item : items) {ContainerBuilder builder = new ContainerBuilder(item);_visitables.add(builder);this.containers.add(builder);} return (A)this;
}
public A removeFromContainers(Container... items){
for (Container item : items) {ContainerBuilder builder = new ContainerBuilder(item);_visitables.remove(builder);this.containers.remove(builder);} return (A)this;
}
public A removeAllFromContainers(Collection items){
for (Container item : items) {ContainerBuilder builder = new ContainerBuilder(item);_visitables.remove(builder);this.containers.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildContainers instead.
*/
@Deprecated public List getContainers(){
return build(containers);
}
public List buildContainers(){
return build(containers);
}
public Container buildContainer(int index){
return this.containers.get(index).build();
}
public Container buildFirstContainer(){
return this.containers.get(0).build();
}
public Container buildLastContainer(){
return this.containers.get(containers.size() - 1).build();
}
public Container buildMatchingContainer(io.alauda.kubernetes.api.builder.Predicate predicate){
for (ContainerBuilder item: containers) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withContainers(List containers){
_visitables.removeAll(this.containers);
this.containers.clear();
if (containers != null) {for (Container item : containers){this.addToContainers(item);}} return (A) this;
}
public A withContainers(Container... containers){
this.containers.clear(); if (containers != null) {for (Container item :containers){ this.addToContainers(item);}} return (A) this;
}
public Boolean hasContainers(){
return containers!= null && !containers.isEmpty();
}
public PodSpecFluent.ContainersNested addNewContainer(){
return new ContainersNestedImpl();
}
public PodSpecFluent.ContainersNested addNewContainerLike(Container item){
return new ContainersNestedImpl(-1, item);
}
public PodSpecFluent.ContainersNested setNewContainerLike(int index,Container item){
return new ContainersNestedImpl(index, item);
}
public PodSpecFluent.ContainersNested editContainer(int index){
if (containers.size() <= index) throw new RuntimeException("Can't edit containers. Index exceeds size.");
return setNewContainerLike(index, buildContainer(index));
}
public PodSpecFluent.ContainersNested editFirstContainer(){
if (containers.size() == 0) throw new RuntimeException("Can't edit first containers. The list is empty.");
return setNewContainerLike(0, buildContainer(0));
}
public PodSpecFluent.ContainersNested editLastContainer(){
int index = containers.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last containers. The list is empty.");
return setNewContainerLike(index, buildContainer(index));
}
public PodSpecFluent.ContainersNested editMatchingContainer(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i= 0 ? index : _visitables.size(), builder);this.hostAliases.add(index >= 0 ? index : hostAliases.size(), builder); return (A)this;
}
public A setToHostAliases(int index,HostAlias item){
HostAliasBuilder builder = new HostAliasBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= hostAliases.size()) { hostAliases.add(builder); } else { hostAliases.set(index, builder);}
return (A)this;
}
public A addToHostAliases(HostAlias... items){
for (HostAlias item : items) {HostAliasBuilder builder = new HostAliasBuilder(item);_visitables.add(builder);this.hostAliases.add(builder);} return (A)this;
}
public A addAllToHostAliases(Collection items){
for (HostAlias item : items) {HostAliasBuilder builder = new HostAliasBuilder(item);_visitables.add(builder);this.hostAliases.add(builder);} return (A)this;
}
public A removeFromHostAliases(HostAlias... items){
for (HostAlias item : items) {HostAliasBuilder builder = new HostAliasBuilder(item);_visitables.remove(builder);this.hostAliases.remove(builder);} return (A)this;
}
public A removeAllFromHostAliases(Collection items){
for (HostAlias item : items) {HostAliasBuilder builder = new HostAliasBuilder(item);_visitables.remove(builder);this.hostAliases.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildHostAliases instead.
*/
@Deprecated public List getHostAliases(){
return build(hostAliases);
}
public List buildHostAliases(){
return build(hostAliases);
}
public HostAlias buildHostAlias(int index){
return this.hostAliases.get(index).build();
}
public HostAlias buildFirstHostAlias(){
return this.hostAliases.get(0).build();
}
public HostAlias buildLastHostAlias(){
return this.hostAliases.get(hostAliases.size() - 1).build();
}
public HostAlias buildMatchingHostAlias(io.alauda.kubernetes.api.builder.Predicate predicate){
for (HostAliasBuilder item: hostAliases) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withHostAliases(List hostAliases){
_visitables.removeAll(this.hostAliases);
this.hostAliases.clear();
if (hostAliases != null) {for (HostAlias item : hostAliases){this.addToHostAliases(item);}} return (A) this;
}
public A withHostAliases(HostAlias... hostAliases){
this.hostAliases.clear(); if (hostAliases != null) {for (HostAlias item :hostAliases){ this.addToHostAliases(item);}} return (A) this;
}
public Boolean hasHostAliases(){
return hostAliases!= null && !hostAliases.isEmpty();
}
public PodSpecFluent.HostAliasesNested addNewHostAlias(){
return new HostAliasesNestedImpl();
}
public PodSpecFluent.HostAliasesNested addNewHostAliasLike(HostAlias item){
return new HostAliasesNestedImpl(-1, item);
}
public PodSpecFluent.HostAliasesNested setNewHostAliasLike(int index,HostAlias item){
return new HostAliasesNestedImpl(index, item);
}
public PodSpecFluent.HostAliasesNested editHostAlias(int index){
if (hostAliases.size() <= index) throw new RuntimeException("Can't edit hostAliases. Index exceeds size.");
return setNewHostAliasLike(index, buildHostAlias(index));
}
public PodSpecFluent.HostAliasesNested editFirstHostAlias(){
if (hostAliases.size() == 0) throw new RuntimeException("Can't edit first hostAliases. The list is empty.");
return setNewHostAliasLike(0, buildHostAlias(0));
}
public PodSpecFluent.HostAliasesNested editLastHostAlias(){
int index = hostAliases.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last hostAliases. The list is empty.");
return setNewHostAliasLike(index, buildHostAlias(index));
}
public PodSpecFluent.HostAliasesNested editMatchingHostAlias(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i= 0 ? index : _visitables.size(), builder);this.imagePullSecrets.add(index >= 0 ? index : imagePullSecrets.size(), builder); return (A)this;
}
public A setToImagePullSecrets(int index,LocalObjectReference item){
LocalObjectReferenceBuilder builder = new LocalObjectReferenceBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= imagePullSecrets.size()) { imagePullSecrets.add(builder); } else { imagePullSecrets.set(index, builder);}
return (A)this;
}
public A addToImagePullSecrets(LocalObjectReference... items){
for (LocalObjectReference item : items) {LocalObjectReferenceBuilder builder = new LocalObjectReferenceBuilder(item);_visitables.add(builder);this.imagePullSecrets.add(builder);} return (A)this;
}
public A addAllToImagePullSecrets(Collection items){
for (LocalObjectReference item : items) {LocalObjectReferenceBuilder builder = new LocalObjectReferenceBuilder(item);_visitables.add(builder);this.imagePullSecrets.add(builder);} return (A)this;
}
public A removeFromImagePullSecrets(LocalObjectReference... items){
for (LocalObjectReference item : items) {LocalObjectReferenceBuilder builder = new LocalObjectReferenceBuilder(item);_visitables.remove(builder);this.imagePullSecrets.remove(builder);} return (A)this;
}
public A removeAllFromImagePullSecrets(Collection items){
for (LocalObjectReference item : items) {LocalObjectReferenceBuilder builder = new LocalObjectReferenceBuilder(item);_visitables.remove(builder);this.imagePullSecrets.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildImagePullSecrets instead.
*/
@Deprecated public List getImagePullSecrets(){
return build(imagePullSecrets);
}
public List buildImagePullSecrets(){
return build(imagePullSecrets);
}
public LocalObjectReference buildImagePullSecret(int index){
return this.imagePullSecrets.get(index).build();
}
public LocalObjectReference buildFirstImagePullSecret(){
return this.imagePullSecrets.get(0).build();
}
public LocalObjectReference buildLastImagePullSecret(){
return this.imagePullSecrets.get(imagePullSecrets.size() - 1).build();
}
public LocalObjectReference buildMatchingImagePullSecret(io.alauda.kubernetes.api.builder.Predicate predicate){
for (LocalObjectReferenceBuilder item: imagePullSecrets) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withImagePullSecrets(List imagePullSecrets){
_visitables.removeAll(this.imagePullSecrets);
this.imagePullSecrets.clear();
if (imagePullSecrets != null) {for (LocalObjectReference item : imagePullSecrets){this.addToImagePullSecrets(item);}} return (A) this;
}
public A withImagePullSecrets(LocalObjectReference... imagePullSecrets){
this.imagePullSecrets.clear(); if (imagePullSecrets != null) {for (LocalObjectReference item :imagePullSecrets){ this.addToImagePullSecrets(item);}} return (A) this;
}
public Boolean hasImagePullSecrets(){
return imagePullSecrets!= null && !imagePullSecrets.isEmpty();
}
public PodSpecFluent.ImagePullSecretsNested addNewImagePullSecret(){
return new ImagePullSecretsNestedImpl();
}
public PodSpecFluent.ImagePullSecretsNested addNewImagePullSecretLike(LocalObjectReference item){
return new ImagePullSecretsNestedImpl(-1, item);
}
public PodSpecFluent.ImagePullSecretsNested setNewImagePullSecretLike(int index,LocalObjectReference item){
return new ImagePullSecretsNestedImpl(index, item);
}
public PodSpecFluent.ImagePullSecretsNested editImagePullSecret(int index){
if (imagePullSecrets.size() <= index) throw new RuntimeException("Can't edit imagePullSecrets. Index exceeds size.");
return setNewImagePullSecretLike(index, buildImagePullSecret(index));
}
public PodSpecFluent.ImagePullSecretsNested editFirstImagePullSecret(){
if (imagePullSecrets.size() == 0) throw new RuntimeException("Can't edit first imagePullSecrets. The list is empty.");
return setNewImagePullSecretLike(0, buildImagePullSecret(0));
}
public PodSpecFluent.ImagePullSecretsNested editLastImagePullSecret(){
int index = imagePullSecrets.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last imagePullSecrets. The list is empty.");
return setNewImagePullSecretLike(index, buildImagePullSecret(index));
}
public PodSpecFluent.ImagePullSecretsNested editMatchingImagePullSecret(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i= 0 ? index : _visitables.size(), builder);this.initContainers.add(index >= 0 ? index : initContainers.size(), builder); return (A)this;
}
public A setToInitContainers(int index,Container item){
ContainerBuilder builder = new ContainerBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= initContainers.size()) { initContainers.add(builder); } else { initContainers.set(index, builder);}
return (A)this;
}
public A addToInitContainers(Container... items){
for (Container item : items) {ContainerBuilder builder = new ContainerBuilder(item);_visitables.add(builder);this.initContainers.add(builder);} return (A)this;
}
public A addAllToInitContainers(Collection items){
for (Container item : items) {ContainerBuilder builder = new ContainerBuilder(item);_visitables.add(builder);this.initContainers.add(builder);} return (A)this;
}
public A removeFromInitContainers(Container... items){
for (Container item : items) {ContainerBuilder builder = new ContainerBuilder(item);_visitables.remove(builder);this.initContainers.remove(builder);} return (A)this;
}
public A removeAllFromInitContainers(Collection items){
for (Container item : items) {ContainerBuilder builder = new ContainerBuilder(item);_visitables.remove(builder);this.initContainers.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildInitContainers instead.
*/
@Deprecated public List getInitContainers(){
return build(initContainers);
}
public List buildInitContainers(){
return build(initContainers);
}
public Container buildInitContainer(int index){
return this.initContainers.get(index).build();
}
public Container buildFirstInitContainer(){
return this.initContainers.get(0).build();
}
public Container buildLastInitContainer(){
return this.initContainers.get(initContainers.size() - 1).build();
}
public Container buildMatchingInitContainer(io.alauda.kubernetes.api.builder.Predicate predicate){
for (ContainerBuilder item: initContainers) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withInitContainers(List initContainers){
_visitables.removeAll(this.initContainers);
this.initContainers.clear();
if (initContainers != null) {for (Container item : initContainers){this.addToInitContainers(item);}} return (A) this;
}
public A withInitContainers(Container... initContainers){
this.initContainers.clear(); if (initContainers != null) {for (Container item :initContainers){ this.addToInitContainers(item);}} return (A) this;
}
public Boolean hasInitContainers(){
return initContainers!= null && !initContainers.isEmpty();
}
public PodSpecFluent.InitContainersNested addNewInitContainer(){
return new InitContainersNestedImpl();
}
public PodSpecFluent.InitContainersNested addNewInitContainerLike(Container item){
return new InitContainersNestedImpl(-1, item);
}
public PodSpecFluent.InitContainersNested setNewInitContainerLike(int index,Container item){
return new InitContainersNestedImpl(index, item);
}
public PodSpecFluent.InitContainersNested editInitContainer(int index){
if (initContainers.size() <= index) throw new RuntimeException("Can't edit initContainers. Index exceeds size.");
return setNewInitContainerLike(index, buildInitContainer(index));
}
public PodSpecFluent.InitContainersNested editFirstInitContainer(){
if (initContainers.size() == 0) throw new RuntimeException("Can't edit first initContainers. The list is empty.");
return setNewInitContainerLike(0, buildInitContainer(0));
}
public PodSpecFluent.InitContainersNested editLastInitContainer(){
int index = initContainers.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last initContainers. The list is empty.");
return setNewInitContainerLike(index, buildInitContainer(index));
}
public PodSpecFluent.InitContainersNested editMatchingInitContainer(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i map){
if(map != null) { this.nodeSelector.putAll(map);} return (A)this;
}
public A removeFromNodeSelector(String key){
if(key != null) {this.nodeSelector.remove(key);} return (A)this;
}
public A removeFromNodeSelector(Map map){
if(map != null) { for(Object key : map.keySet()) {this.nodeSelector.remove(key);}} return (A)this;
}
public Map getNodeSelector(){
return this.nodeSelector;
}
public A withNodeSelector(Map nodeSelector){
this.nodeSelector.clear();
if (nodeSelector != null) {this.nodeSelector.putAll(nodeSelector);} return (A) this;
}
public Boolean hasNodeSelector(){
return this.nodeSelector!=null;
}
public String getRestartPolicy(){
return this.restartPolicy;
}
public A withRestartPolicy(String restartPolicy){
this.restartPolicy=restartPolicy; return (A) this;
}
public Boolean hasRestartPolicy(){
return this.restartPolicy!=null;
}
public String getSchedulerName(){
return this.schedulerName;
}
public A withSchedulerName(String schedulerName){
this.schedulerName=schedulerName; return (A) this;
}
public Boolean hasSchedulerName(){
return this.schedulerName!=null;
}
/**
* This method has been deprecated, please use method buildSecurityContext instead.
*/
@Deprecated public PodSecurityContext getSecurityContext(){
return this.securityContext!=null?this.securityContext.build():null;
}
public PodSecurityContext buildSecurityContext(){
return this.securityContext!=null?this.securityContext.build():null;
}
public A withSecurityContext(PodSecurityContext securityContext){
_visitables.remove(this.securityContext);
if (securityContext!=null){ this.securityContext= new PodSecurityContextBuilder(securityContext); _visitables.add(this.securityContext);} return (A) this;
}
public Boolean hasSecurityContext(){
return this.securityContext!=null;
}
public PodSpecFluent.SecurityContextNested withNewSecurityContext(){
return new SecurityContextNestedImpl();
}
public PodSpecFluent.SecurityContextNested withNewSecurityContextLike(PodSecurityContext item){
return new SecurityContextNestedImpl(item);
}
public PodSpecFluent.SecurityContextNested editSecurityContext(){
return withNewSecurityContextLike(getSecurityContext());
}
public PodSpecFluent.SecurityContextNested editOrNewSecurityContext(){
return withNewSecurityContextLike(getSecurityContext() != null ? getSecurityContext(): new PodSecurityContextBuilder().build());
}
public PodSpecFluent.SecurityContextNested editOrNewSecurityContextLike(PodSecurityContext item){
return withNewSecurityContextLike(getSecurityContext() != null ? getSecurityContext(): item);
}
public String getServiceAccount(){
return this.serviceAccount;
}
public A withServiceAccount(String serviceAccount){
this.serviceAccount=serviceAccount; return (A) this;
}
public Boolean hasServiceAccount(){
return this.serviceAccount!=null;
}
public String getServiceAccountName(){
return this.serviceAccountName;
}
public A withServiceAccountName(String serviceAccountName){
this.serviceAccountName=serviceAccountName; return (A) this;
}
public Boolean hasServiceAccountName(){
return this.serviceAccountName!=null;
}
public String getSubdomain(){
return this.subdomain;
}
public A withSubdomain(String subdomain){
this.subdomain=subdomain; return (A) this;
}
public Boolean hasSubdomain(){
return this.subdomain!=null;
}
public Long getTerminationGracePeriodSeconds(){
return this.terminationGracePeriodSeconds;
}
public A withTerminationGracePeriodSeconds(Long terminationGracePeriodSeconds){
this.terminationGracePeriodSeconds=terminationGracePeriodSeconds; return (A) this;
}
public Boolean hasTerminationGracePeriodSeconds(){
return this.terminationGracePeriodSeconds!=null;
}
public A addToTolerations(int index,Toleration item){
TolerationBuilder builder = new TolerationBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.tolerations.add(index >= 0 ? index : tolerations.size(), builder); return (A)this;
}
public A setToTolerations(int index,Toleration item){
TolerationBuilder builder = new TolerationBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= tolerations.size()) { tolerations.add(builder); } else { tolerations.set(index, builder);}
return (A)this;
}
public A addToTolerations(Toleration... items){
for (Toleration item : items) {TolerationBuilder builder = new TolerationBuilder(item);_visitables.add(builder);this.tolerations.add(builder);} return (A)this;
}
public A addAllToTolerations(Collection items){
for (Toleration item : items) {TolerationBuilder builder = new TolerationBuilder(item);_visitables.add(builder);this.tolerations.add(builder);} return (A)this;
}
public A removeFromTolerations(Toleration... items){
for (Toleration item : items) {TolerationBuilder builder = new TolerationBuilder(item);_visitables.remove(builder);this.tolerations.remove(builder);} return (A)this;
}
public A removeAllFromTolerations(Collection items){
for (Toleration item : items) {TolerationBuilder builder = new TolerationBuilder(item);_visitables.remove(builder);this.tolerations.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildTolerations instead.
*/
@Deprecated public List getTolerations(){
return build(tolerations);
}
public List buildTolerations(){
return build(tolerations);
}
public Toleration buildToleration(int index){
return this.tolerations.get(index).build();
}
public Toleration buildFirstToleration(){
return this.tolerations.get(0).build();
}
public Toleration buildLastToleration(){
return this.tolerations.get(tolerations.size() - 1).build();
}
public Toleration buildMatchingToleration(io.alauda.kubernetes.api.builder.Predicate predicate){
for (TolerationBuilder item: tolerations) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withTolerations(List tolerations){
_visitables.removeAll(this.tolerations);
this.tolerations.clear();
if (tolerations != null) {for (Toleration item : tolerations){this.addToTolerations(item);}} return (A) this;
}
public A withTolerations(Toleration... tolerations){
this.tolerations.clear(); if (tolerations != null) {for (Toleration item :tolerations){ this.addToTolerations(item);}} return (A) this;
}
public Boolean hasTolerations(){
return tolerations!= null && !tolerations.isEmpty();
}
public PodSpecFluent.TolerationsNested addNewToleration(){
return new TolerationsNestedImpl();
}
public PodSpecFluent.TolerationsNested addNewTolerationLike(Toleration item){
return new TolerationsNestedImpl(-1, item);
}
public PodSpecFluent.TolerationsNested setNewTolerationLike(int index,Toleration item){
return new TolerationsNestedImpl(index, item);
}
public PodSpecFluent.TolerationsNested editToleration(int index){
if (tolerations.size() <= index) throw new RuntimeException("Can't edit tolerations. Index exceeds size.");
return setNewTolerationLike(index, buildToleration(index));
}
public PodSpecFluent.TolerationsNested editFirstToleration(){
if (tolerations.size() == 0) throw new RuntimeException("Can't edit first tolerations. The list is empty.");
return setNewTolerationLike(0, buildToleration(0));
}
public PodSpecFluent.TolerationsNested editLastToleration(){
int index = tolerations.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last tolerations. The list is empty.");
return setNewTolerationLike(index, buildToleration(index));
}
public PodSpecFluent.TolerationsNested editMatchingToleration(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i= 0 ? index : _visitables.size(), builder);this.volumes.add(index >= 0 ? index : volumes.size(), builder); return (A)this;
}
public A setToVolumes(int index,Volume item){
VolumeBuilder builder = new VolumeBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= volumes.size()) { volumes.add(builder); } else { volumes.set(index, builder);}
return (A)this;
}
public A addToVolumes(Volume... items){
for (Volume item : items) {VolumeBuilder builder = new VolumeBuilder(item);_visitables.add(builder);this.volumes.add(builder);} return (A)this;
}
public A addAllToVolumes(Collection items){
for (Volume item : items) {VolumeBuilder builder = new VolumeBuilder(item);_visitables.add(builder);this.volumes.add(builder);} return (A)this;
}
public A removeFromVolumes(Volume... items){
for (Volume item : items) {VolumeBuilder builder = new VolumeBuilder(item);_visitables.remove(builder);this.volumes.remove(builder);} return (A)this;
}
public A removeAllFromVolumes(Collection items){
for (Volume item : items) {VolumeBuilder builder = new VolumeBuilder(item);_visitables.remove(builder);this.volumes.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildVolumes instead.
*/
@Deprecated public List getVolumes(){
return build(volumes);
}
public List buildVolumes(){
return build(volumes);
}
public Volume buildVolume(int index){
return this.volumes.get(index).build();
}
public Volume buildFirstVolume(){
return this.volumes.get(0).build();
}
public Volume buildLastVolume(){
return this.volumes.get(volumes.size() - 1).build();
}
public Volume buildMatchingVolume(io.alauda.kubernetes.api.builder.Predicate predicate){
for (VolumeBuilder item: volumes) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withVolumes(List volumes){
_visitables.removeAll(this.volumes);
this.volumes.clear();
if (volumes != null) {for (Volume item : volumes){this.addToVolumes(item);}} return (A) this;
}
public A withVolumes(Volume... volumes){
this.volumes.clear(); if (volumes != null) {for (Volume item :volumes){ this.addToVolumes(item);}} return (A) this;
}
public Boolean hasVolumes(){
return volumes!= null && !volumes.isEmpty();
}
public PodSpecFluent.VolumesNested addNewVolume(){
return new VolumesNestedImpl();
}
public PodSpecFluent.VolumesNested addNewVolumeLike(Volume item){
return new VolumesNestedImpl(-1, item);
}
public PodSpecFluent.VolumesNested setNewVolumeLike(int index,Volume item){
return new VolumesNestedImpl(index, item);
}
public PodSpecFluent.VolumesNested editVolume(int index){
if (volumes.size() <= index) throw new RuntimeException("Can't edit volumes. Index exceeds size.");
return setNewVolumeLike(index, buildVolume(index));
}
public PodSpecFluent.VolumesNested editFirstVolume(){
if (volumes.size() == 0) throw new RuntimeException("Can't edit first volumes. The list is empty.");
return setNewVolumeLike(0, buildVolume(0));
}
public PodSpecFluent.VolumesNested editLastVolume(){
int index = volumes.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last volumes. The list is empty.");
return setNewVolumeLike(index, buildVolume(index));
}
public PodSpecFluent.VolumesNested editMatchingVolume(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends AffinityFluentImpl> implements PodSpecFluent.AffinityNested,io.alauda.kubernetes.api.builder.Nested{
private final AffinityBuilder builder;
AffinityNestedImpl(Affinity item){
this.builder = new AffinityBuilder(this, item);
}
AffinityNestedImpl(){
this.builder = new AffinityBuilder(this);
}
public N and(){
return (N) PodSpecFluentImpl.this.withAffinity(builder.build());
}
public N endAffinity(){
return and();
}
}
public class ContainersNestedImpl extends ContainerFluentImpl> implements PodSpecFluent.ContainersNested,io.alauda.kubernetes.api.builder.Nested{
private final ContainerBuilder builder;
private final int index;
ContainersNestedImpl(int index,Container item){
this.index = index;
this.builder = new ContainerBuilder(this, item);
}
ContainersNestedImpl(){
this.index = -1;
this.builder = new ContainerBuilder(this);
}
public N and(){
return (N) PodSpecFluentImpl.this.setToContainers(index, builder.build());
}
public N endContainer(){
return and();
}
}
public class HostAliasesNestedImpl extends HostAliasFluentImpl> implements PodSpecFluent.HostAliasesNested,io.alauda.kubernetes.api.builder.Nested{
private final HostAliasBuilder builder;
private final int index;
HostAliasesNestedImpl(int index,HostAlias item){
this.index = index;
this.builder = new HostAliasBuilder(this, item);
}
HostAliasesNestedImpl(){
this.index = -1;
this.builder = new HostAliasBuilder(this);
}
public N and(){
return (N) PodSpecFluentImpl.this.setToHostAliases(index, builder.build());
}
public N endHostAlias(){
return and();
}
}
public class ImagePullSecretsNestedImpl extends LocalObjectReferenceFluentImpl> implements PodSpecFluent.ImagePullSecretsNested,io.alauda.kubernetes.api.builder.Nested{
private final LocalObjectReferenceBuilder builder;
private final int index;
ImagePullSecretsNestedImpl(int index,LocalObjectReference item){
this.index = index;
this.builder = new LocalObjectReferenceBuilder(this, item);
}
ImagePullSecretsNestedImpl(){
this.index = -1;
this.builder = new LocalObjectReferenceBuilder(this);
}
public N and(){
return (N) PodSpecFluentImpl.this.setToImagePullSecrets(index, builder.build());
}
public N endImagePullSecret(){
return and();
}
}
public class InitContainersNestedImpl extends ContainerFluentImpl> implements PodSpecFluent.InitContainersNested,io.alauda.kubernetes.api.builder.Nested{
private final ContainerBuilder builder;
private final int index;
InitContainersNestedImpl(int index,Container item){
this.index = index;
this.builder = new ContainerBuilder(this, item);
}
InitContainersNestedImpl(){
this.index = -1;
this.builder = new ContainerBuilder(this);
}
public N and(){
return (N) PodSpecFluentImpl.this.setToInitContainers(index, builder.build());
}
public N endInitContainer(){
return and();
}
}
public class SecurityContextNestedImpl extends PodSecurityContextFluentImpl> implements PodSpecFluent.SecurityContextNested,io.alauda.kubernetes.api.builder.Nested{
private final PodSecurityContextBuilder builder;
SecurityContextNestedImpl(PodSecurityContext item){
this.builder = new PodSecurityContextBuilder(this, item);
}
SecurityContextNestedImpl(){
this.builder = new PodSecurityContextBuilder(this);
}
public N and(){
return (N) PodSpecFluentImpl.this.withSecurityContext(builder.build());
}
public N endSecurityContext(){
return and();
}
}
public class TolerationsNestedImpl extends TolerationFluentImpl> implements PodSpecFluent.TolerationsNested,io.alauda.kubernetes.api.builder.Nested{
private final TolerationBuilder builder;
private final int index;
TolerationsNestedImpl(int index,Toleration item){
this.index = index;
this.builder = new TolerationBuilder(this, item);
}
TolerationsNestedImpl(){
this.index = -1;
this.builder = new TolerationBuilder(this);
}
public N and(){
return (N) PodSpecFluentImpl.this.setToTolerations(index, builder.build());
}
public N endToleration(){
return and();
}
}
public class VolumesNestedImpl extends VolumeFluentImpl> implements PodSpecFluent.VolumesNested,io.alauda.kubernetes.api.builder.Nested{
private final VolumeBuilder builder;
private final int index;
VolumesNestedImpl(int index,Volume item){
this.index = index;
this.builder = new VolumeBuilder(this, item);
}
VolumesNestedImpl(){
this.index = -1;
this.builder = new VolumeBuilder(this);
}
public N and(){
return (N) PodSpecFluentImpl.this.setToVolumes(index, builder.build());
}
public N endVolume(){
return and();
}
}
}