annotations.io.alauda.kubernetes.api.model.ContainerFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.validation.constraints.Size;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.ArrayList;
import java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import javax.validation.Valid;
import java.util.Collection;
import java.lang.Object;
import io.alauda.kubernetes.api.builder.Nested;
import java.lang.Deprecated;
import javax.validation.constraints.Pattern;
import java.lang.Integer;
public class ContainerFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements ContainerFluent{
private List args = new ArrayList();
private List command = new ArrayList();
private List env = new ArrayList();
private List envFrom = new ArrayList();
private String image;
private String imagePullPolicy;
private LifecycleBuilder lifecycle;
private ProbeBuilder livenessProbe;
private String name;
private List ports = new ArrayList();
private ProbeBuilder readinessProbe;
private ResourceRequirementsBuilder resources;
private SecurityContextBuilder securityContext;
private Boolean stdin;
private Boolean stdinOnce;
private String terminationMessagePath;
private String terminationMessagePolicy;
private Boolean tty;
private List volumeMounts = new ArrayList();
private String workingDir;
public ContainerFluentImpl(){
}
public ContainerFluentImpl(Container instance){
this.withArgs(instance.getArgs());
this.withCommand(instance.getCommand());
this.withEnv(instance.getEnv());
this.withEnvFrom(instance.getEnvFrom());
this.withImage(instance.getImage());
this.withImagePullPolicy(instance.getImagePullPolicy());
this.withLifecycle(instance.getLifecycle());
this.withLivenessProbe(instance.getLivenessProbe());
this.withName(instance.getName());
this.withPorts(instance.getPorts());
this.withReadinessProbe(instance.getReadinessProbe());
this.withResources(instance.getResources());
this.withSecurityContext(instance.getSecurityContext());
this.withStdin(instance.getStdin());
this.withStdinOnce(instance.getStdinOnce());
this.withTerminationMessagePath(instance.getTerminationMessagePath());
this.withTerminationMessagePolicy(instance.getTerminationMessagePolicy());
this.withTty(instance.getTty());
this.withVolumeMounts(instance.getVolumeMounts());
this.withWorkingDir(instance.getWorkingDir());
}
public A addToArgs(int index,String item){
this.args.add(index, item); return (A)this;
}
public A setToArgs(int index,String item){
this.args.set(index, item); return (A)this;
}
public A addToArgs(String... items){
for (String item : items) {this.args.add(item);} return (A)this;
}
public A addAllToArgs(Collection items){
for (String item : items) {this.args.add(item);} return (A)this;
}
public A removeFromArgs(String... items){
for (String item : items) {this.args.remove(item);} return (A)this;
}
public A removeAllFromArgs(Collection items){
for (String item : items) {this.args.remove(item);} return (A)this;
}
public List getArgs(){
return this.args;
}
public String getArg(int index){
return this.args.get(index);
}
public String getFirstArg(){
return this.args.get(0);
}
public String getLastArg(){
return this.args.get(args.size() - 1);
}
public String getMatchingArg(io.alauda.kubernetes.api.builder.Predicate predicate){
for (String item: args) { if(predicate.apply(item)){return item;} } return null;
}
public A withArgs(List args){
this.args.clear();
if (args != null) {for (String item : args){this.addToArgs(item);}} return (A) this;
}
public A withArgs(String... args){
this.args.clear(); if (args != null) {for (String item :args){ this.addToArgs(item);}} return (A) this;
}
public Boolean hasArgs(){
return args!= null && !args.isEmpty();
}
public A addToCommand(int index,String item){
this.command.add(index, item); return (A)this;
}
public A setToCommand(int index,String item){
this.command.set(index, item); return (A)this;
}
public A addToCommand(String... items){
for (String item : items) {this.command.add(item);} return (A)this;
}
public A addAllToCommand(Collection items){
for (String item : items) {this.command.add(item);} return (A)this;
}
public A removeFromCommand(String... items){
for (String item : items) {this.command.remove(item);} return (A)this;
}
public A removeAllFromCommand(Collection items){
for (String item : items) {this.command.remove(item);} return (A)this;
}
public List getCommand(){
return this.command;
}
public String getCommand(int index){
return this.command.get(index);
}
public String getFirstCommand(){
return this.command.get(0);
}
public String getLastCommand(){
return this.command.get(command.size() - 1);
}
public String getMatchingCommand(io.alauda.kubernetes.api.builder.Predicate predicate){
for (String item: command) { if(predicate.apply(item)){return item;} } return null;
}
public A withCommand(List command){
this.command.clear();
if (command != null) {for (String item : command){this.addToCommand(item);}} return (A) this;
}
public A withCommand(String... command){
this.command.clear(); if (command != null) {for (String item :command){ this.addToCommand(item);}} return (A) this;
}
public Boolean hasCommand(){
return command!= null && !command.isEmpty();
}
public A addToEnv(int index,EnvVar item){
EnvVarBuilder builder = new EnvVarBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.env.add(index >= 0 ? index : env.size(), builder); return (A)this;
}
public A setToEnv(int index,EnvVar item){
EnvVarBuilder builder = new EnvVarBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= env.size()) { env.add(builder); } else { env.set(index, builder);}
return (A)this;
}
public A addToEnv(EnvVar... items){
for (EnvVar item : items) {EnvVarBuilder builder = new EnvVarBuilder(item);_visitables.add(builder);this.env.add(builder);} return (A)this;
}
public A addAllToEnv(Collection items){
for (EnvVar item : items) {EnvVarBuilder builder = new EnvVarBuilder(item);_visitables.add(builder);this.env.add(builder);} return (A)this;
}
public A removeFromEnv(EnvVar... items){
for (EnvVar item : items) {EnvVarBuilder builder = new EnvVarBuilder(item);_visitables.remove(builder);this.env.remove(builder);} return (A)this;
}
public A removeAllFromEnv(Collection items){
for (EnvVar item : items) {EnvVarBuilder builder = new EnvVarBuilder(item);_visitables.remove(builder);this.env.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildEnv instead.
*/
@Deprecated public List getEnv(){
return build(env);
}
public List buildEnv(){
return build(env);
}
public EnvVar buildEnv(int index){
return this.env.get(index).build();
}
public EnvVar buildFirstEnv(){
return this.env.get(0).build();
}
public EnvVar buildLastEnv(){
return this.env.get(env.size() - 1).build();
}
public EnvVar buildMatchingEnv(io.alauda.kubernetes.api.builder.Predicate predicate){
for (EnvVarBuilder item: env) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withEnv(List env){
_visitables.removeAll(this.env);
this.env.clear();
if (env != null) {for (EnvVar item : env){this.addToEnv(item);}} return (A) this;
}
public A withEnv(EnvVar... env){
this.env.clear(); if (env != null) {for (EnvVar item :env){ this.addToEnv(item);}} return (A) this;
}
public Boolean hasEnv(){
return env!= null && !env.isEmpty();
}
public ContainerFluent.EnvNested addNewEnv(){
return new EnvNestedImpl();
}
public ContainerFluent.EnvNested addNewEnvLike(EnvVar item){
return new EnvNestedImpl(-1, item);
}
public ContainerFluent.EnvNested setNewEnvLike(int index,EnvVar item){
return new EnvNestedImpl(index, item);
}
public ContainerFluent.EnvNested editEnv(int index){
if (env.size() <= index) throw new RuntimeException("Can't edit env. Index exceeds size.");
return setNewEnvLike(index, buildEnv(index));
}
public ContainerFluent.EnvNested editFirstEnv(){
if (env.size() == 0) throw new RuntimeException("Can't edit first env. The list is empty.");
return setNewEnvLike(0, buildEnv(0));
}
public ContainerFluent.EnvNested editLastEnv(){
int index = env.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last env. The list is empty.");
return setNewEnvLike(index, buildEnv(index));
}
public ContainerFluent.EnvNested editMatchingEnv(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i= 0 ? index : _visitables.size(), builder);this.envFrom.add(index >= 0 ? index : envFrom.size(), builder); return (A)this;
}
public A setToEnvFrom(int index,EnvFromSource item){
EnvFromSourceBuilder builder = new EnvFromSourceBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= envFrom.size()) { envFrom.add(builder); } else { envFrom.set(index, builder);}
return (A)this;
}
public A addToEnvFrom(EnvFromSource... items){
for (EnvFromSource item : items) {EnvFromSourceBuilder builder = new EnvFromSourceBuilder(item);_visitables.add(builder);this.envFrom.add(builder);} return (A)this;
}
public A addAllToEnvFrom(Collection items){
for (EnvFromSource item : items) {EnvFromSourceBuilder builder = new EnvFromSourceBuilder(item);_visitables.add(builder);this.envFrom.add(builder);} return (A)this;
}
public A removeFromEnvFrom(EnvFromSource... items){
for (EnvFromSource item : items) {EnvFromSourceBuilder builder = new EnvFromSourceBuilder(item);_visitables.remove(builder);this.envFrom.remove(builder);} return (A)this;
}
public A removeAllFromEnvFrom(Collection items){
for (EnvFromSource item : items) {EnvFromSourceBuilder builder = new EnvFromSourceBuilder(item);_visitables.remove(builder);this.envFrom.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildEnvFrom instead.
*/
@Deprecated public List getEnvFrom(){
return build(envFrom);
}
public List buildEnvFrom(){
return build(envFrom);
}
public EnvFromSource buildEnvFrom(int index){
return this.envFrom.get(index).build();
}
public EnvFromSource buildFirstEnvFrom(){
return this.envFrom.get(0).build();
}
public EnvFromSource buildLastEnvFrom(){
return this.envFrom.get(envFrom.size() - 1).build();
}
public EnvFromSource buildMatchingEnvFrom(io.alauda.kubernetes.api.builder.Predicate predicate){
for (EnvFromSourceBuilder item: envFrom) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withEnvFrom(List envFrom){
_visitables.removeAll(this.envFrom);
this.envFrom.clear();
if (envFrom != null) {for (EnvFromSource item : envFrom){this.addToEnvFrom(item);}} return (A) this;
}
public A withEnvFrom(EnvFromSource... envFrom){
this.envFrom.clear(); if (envFrom != null) {for (EnvFromSource item :envFrom){ this.addToEnvFrom(item);}} return (A) this;
}
public Boolean hasEnvFrom(){
return envFrom!= null && !envFrom.isEmpty();
}
public ContainerFluent.EnvFromNested addNewEnvFrom(){
return new EnvFromNestedImpl();
}
public ContainerFluent.EnvFromNested addNewEnvFromLike(EnvFromSource item){
return new EnvFromNestedImpl(-1, item);
}
public ContainerFluent.EnvFromNested setNewEnvFromLike(int index,EnvFromSource item){
return new EnvFromNestedImpl(index, item);
}
public ContainerFluent.EnvFromNested editEnvFrom(int index){
if (envFrom.size() <= index) throw new RuntimeException("Can't edit envFrom. Index exceeds size.");
return setNewEnvFromLike(index, buildEnvFrom(index));
}
public ContainerFluent.EnvFromNested editFirstEnvFrom(){
if (envFrom.size() == 0) throw new RuntimeException("Can't edit first envFrom. The list is empty.");
return setNewEnvFromLike(0, buildEnvFrom(0));
}
public ContainerFluent.EnvFromNested editLastEnvFrom(){
int index = envFrom.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last envFrom. The list is empty.");
return setNewEnvFromLike(index, buildEnvFrom(index));
}
public ContainerFluent.EnvFromNested editMatchingEnvFrom(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i withNewLifecycle(){
return new LifecycleNestedImpl();
}
public ContainerFluent.LifecycleNested withNewLifecycleLike(Lifecycle item){
return new LifecycleNestedImpl(item);
}
public ContainerFluent.LifecycleNested editLifecycle(){
return withNewLifecycleLike(getLifecycle());
}
public ContainerFluent.LifecycleNested editOrNewLifecycle(){
return withNewLifecycleLike(getLifecycle() != null ? getLifecycle(): new LifecycleBuilder().build());
}
public ContainerFluent.LifecycleNested editOrNewLifecycleLike(Lifecycle item){
return withNewLifecycleLike(getLifecycle() != null ? getLifecycle(): item);
}
/**
* This method has been deprecated, please use method buildLivenessProbe instead.
*/
@Deprecated public Probe getLivenessProbe(){
return this.livenessProbe!=null?this.livenessProbe.build():null;
}
public Probe buildLivenessProbe(){
return this.livenessProbe!=null?this.livenessProbe.build():null;
}
public A withLivenessProbe(Probe livenessProbe){
_visitables.remove(this.livenessProbe);
if (livenessProbe!=null){ this.livenessProbe= new ProbeBuilder(livenessProbe); _visitables.add(this.livenessProbe);} return (A) this;
}
public Boolean hasLivenessProbe(){
return this.livenessProbe!=null;
}
public ContainerFluent.LivenessProbeNested withNewLivenessProbe(){
return new LivenessProbeNestedImpl();
}
public ContainerFluent.LivenessProbeNested withNewLivenessProbeLike(Probe item){
return new LivenessProbeNestedImpl(item);
}
public ContainerFluent.LivenessProbeNested editLivenessProbe(){
return withNewLivenessProbeLike(getLivenessProbe());
}
public ContainerFluent.LivenessProbeNested editOrNewLivenessProbe(){
return withNewLivenessProbeLike(getLivenessProbe() != null ? getLivenessProbe(): new ProbeBuilder().build());
}
public ContainerFluent.LivenessProbeNested editOrNewLivenessProbeLike(Probe item){
return withNewLivenessProbeLike(getLivenessProbe() != null ? getLivenessProbe(): item);
}
public String getName(){
return this.name;
}
public A withName(String name){
this.name=name; return (A) this;
}
public Boolean hasName(){
return this.name!=null;
}
public A addToPorts(int index,ContainerPort item){
ContainerPortBuilder builder = new ContainerPortBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.ports.add(index >= 0 ? index : ports.size(), builder); return (A)this;
}
public A setToPorts(int index,ContainerPort item){
ContainerPortBuilder builder = new ContainerPortBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= ports.size()) { ports.add(builder); } else { ports.set(index, builder);}
return (A)this;
}
public A addToPorts(ContainerPort... items){
for (ContainerPort item : items) {ContainerPortBuilder builder = new ContainerPortBuilder(item);_visitables.add(builder);this.ports.add(builder);} return (A)this;
}
public A addAllToPorts(Collection items){
for (ContainerPort item : items) {ContainerPortBuilder builder = new ContainerPortBuilder(item);_visitables.add(builder);this.ports.add(builder);} return (A)this;
}
public A removeFromPorts(ContainerPort... items){
for (ContainerPort item : items) {ContainerPortBuilder builder = new ContainerPortBuilder(item);_visitables.remove(builder);this.ports.remove(builder);} return (A)this;
}
public A removeAllFromPorts(Collection items){
for (ContainerPort item : items) {ContainerPortBuilder builder = new ContainerPortBuilder(item);_visitables.remove(builder);this.ports.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildPorts instead.
*/
@Deprecated public List getPorts(){
return build(ports);
}
public List buildPorts(){
return build(ports);
}
public ContainerPort buildPort(int index){
return this.ports.get(index).build();
}
public ContainerPort buildFirstPort(){
return this.ports.get(0).build();
}
public ContainerPort buildLastPort(){
return this.ports.get(ports.size() - 1).build();
}
public ContainerPort buildMatchingPort(io.alauda.kubernetes.api.builder.Predicate predicate){
for (ContainerPortBuilder item: ports) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withPorts(List ports){
_visitables.removeAll(this.ports);
this.ports.clear();
if (ports != null) {for (ContainerPort item : ports){this.addToPorts(item);}} return (A) this;
}
public A withPorts(ContainerPort... ports){
this.ports.clear(); if (ports != null) {for (ContainerPort item :ports){ this.addToPorts(item);}} return (A) this;
}
public Boolean hasPorts(){
return ports!= null && !ports.isEmpty();
}
public ContainerFluent.PortsNested addNewPort(){
return new PortsNestedImpl();
}
public ContainerFluent.PortsNested addNewPortLike(ContainerPort item){
return new PortsNestedImpl(-1, item);
}
public ContainerFluent.PortsNested setNewPortLike(int index,ContainerPort item){
return new PortsNestedImpl(index, item);
}
public ContainerFluent.PortsNested editPort(int index){
if (ports.size() <= index) throw new RuntimeException("Can't edit ports. Index exceeds size.");
return setNewPortLike(index, buildPort(index));
}
public ContainerFluent.PortsNested editFirstPort(){
if (ports.size() == 0) throw new RuntimeException("Can't edit first ports. The list is empty.");
return setNewPortLike(0, buildPort(0));
}
public ContainerFluent.PortsNested editLastPort(){
int index = ports.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last ports. The list is empty.");
return setNewPortLike(index, buildPort(index));
}
public ContainerFluent.PortsNested editMatchingPort(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i withNewReadinessProbe(){
return new ReadinessProbeNestedImpl();
}
public ContainerFluent.ReadinessProbeNested withNewReadinessProbeLike(Probe item){
return new ReadinessProbeNestedImpl(item);
}
public ContainerFluent.ReadinessProbeNested editReadinessProbe(){
return withNewReadinessProbeLike(getReadinessProbe());
}
public ContainerFluent.ReadinessProbeNested editOrNewReadinessProbe(){
return withNewReadinessProbeLike(getReadinessProbe() != null ? getReadinessProbe(): new ProbeBuilder().build());
}
public ContainerFluent.ReadinessProbeNested editOrNewReadinessProbeLike(Probe item){
return withNewReadinessProbeLike(getReadinessProbe() != null ? getReadinessProbe(): item);
}
/**
* This method has been deprecated, please use method buildResources instead.
*/
@Deprecated public ResourceRequirements getResources(){
return this.resources!=null?this.resources.build():null;
}
public ResourceRequirements buildResources(){
return this.resources!=null?this.resources.build():null;
}
public A withResources(ResourceRequirements resources){
_visitables.remove(this.resources);
if (resources!=null){ this.resources= new ResourceRequirementsBuilder(resources); _visitables.add(this.resources);} return (A) this;
}
public Boolean hasResources(){
return this.resources!=null;
}
public ContainerFluent.ResourcesNested withNewResources(){
return new ResourcesNestedImpl();
}
public ContainerFluent.ResourcesNested withNewResourcesLike(ResourceRequirements item){
return new ResourcesNestedImpl(item);
}
public ContainerFluent.ResourcesNested editResources(){
return withNewResourcesLike(getResources());
}
public ContainerFluent.ResourcesNested editOrNewResources(){
return withNewResourcesLike(getResources() != null ? getResources(): new ResourceRequirementsBuilder().build());
}
public ContainerFluent.ResourcesNested editOrNewResourcesLike(ResourceRequirements item){
return withNewResourcesLike(getResources() != null ? getResources(): item);
}
/**
* This method has been deprecated, please use method buildSecurityContext instead.
*/
@Deprecated public SecurityContext getSecurityContext(){
return this.securityContext!=null?this.securityContext.build():null;
}
public SecurityContext buildSecurityContext(){
return this.securityContext!=null?this.securityContext.build():null;
}
public A withSecurityContext(SecurityContext securityContext){
_visitables.remove(this.securityContext);
if (securityContext!=null){ this.securityContext= new SecurityContextBuilder(securityContext); _visitables.add(this.securityContext);} return (A) this;
}
public Boolean hasSecurityContext(){
return this.securityContext!=null;
}
public ContainerFluent.SecurityContextNested withNewSecurityContext(){
return new SecurityContextNestedImpl();
}
public ContainerFluent.SecurityContextNested withNewSecurityContextLike(SecurityContext item){
return new SecurityContextNestedImpl(item);
}
public ContainerFluent.SecurityContextNested editSecurityContext(){
return withNewSecurityContextLike(getSecurityContext());
}
public ContainerFluent.SecurityContextNested editOrNewSecurityContext(){
return withNewSecurityContextLike(getSecurityContext() != null ? getSecurityContext(): new SecurityContextBuilder().build());
}
public ContainerFluent.SecurityContextNested editOrNewSecurityContextLike(SecurityContext item){
return withNewSecurityContextLike(getSecurityContext() != null ? getSecurityContext(): item);
}
public Boolean isStdin(){
return this.stdin;
}
public A withStdin(Boolean stdin){
this.stdin=stdin; return (A) this;
}
public Boolean hasStdin(){
return this.stdin!=null;
}
public Boolean isStdinOnce(){
return this.stdinOnce;
}
public A withStdinOnce(Boolean stdinOnce){
this.stdinOnce=stdinOnce; return (A) this;
}
public Boolean hasStdinOnce(){
return this.stdinOnce!=null;
}
public String getTerminationMessagePath(){
return this.terminationMessagePath;
}
public A withTerminationMessagePath(String terminationMessagePath){
this.terminationMessagePath=terminationMessagePath; return (A) this;
}
public Boolean hasTerminationMessagePath(){
return this.terminationMessagePath!=null;
}
public String getTerminationMessagePolicy(){
return this.terminationMessagePolicy;
}
public A withTerminationMessagePolicy(String terminationMessagePolicy){
this.terminationMessagePolicy=terminationMessagePolicy; return (A) this;
}
public Boolean hasTerminationMessagePolicy(){
return this.terminationMessagePolicy!=null;
}
public Boolean isTty(){
return this.tty;
}
public A withTty(Boolean tty){
this.tty=tty; return (A) this;
}
public Boolean hasTty(){
return this.tty!=null;
}
public A addToVolumeMounts(int index,VolumeMount item){
VolumeMountBuilder builder = new VolumeMountBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.volumeMounts.add(index >= 0 ? index : volumeMounts.size(), builder); return (A)this;
}
public A setToVolumeMounts(int index,VolumeMount item){
VolumeMountBuilder builder = new VolumeMountBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= volumeMounts.size()) { volumeMounts.add(builder); } else { volumeMounts.set(index, builder);}
return (A)this;
}
public A addToVolumeMounts(VolumeMount... items){
for (VolumeMount item : items) {VolumeMountBuilder builder = new VolumeMountBuilder(item);_visitables.add(builder);this.volumeMounts.add(builder);} return (A)this;
}
public A addAllToVolumeMounts(Collection items){
for (VolumeMount item : items) {VolumeMountBuilder builder = new VolumeMountBuilder(item);_visitables.add(builder);this.volumeMounts.add(builder);} return (A)this;
}
public A removeFromVolumeMounts(VolumeMount... items){
for (VolumeMount item : items) {VolumeMountBuilder builder = new VolumeMountBuilder(item);_visitables.remove(builder);this.volumeMounts.remove(builder);} return (A)this;
}
public A removeAllFromVolumeMounts(Collection items){
for (VolumeMount item : items) {VolumeMountBuilder builder = new VolumeMountBuilder(item);_visitables.remove(builder);this.volumeMounts.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildVolumeMounts instead.
*/
@Deprecated public List getVolumeMounts(){
return build(volumeMounts);
}
public List buildVolumeMounts(){
return build(volumeMounts);
}
public VolumeMount buildVolumeMount(int index){
return this.volumeMounts.get(index).build();
}
public VolumeMount buildFirstVolumeMount(){
return this.volumeMounts.get(0).build();
}
public VolumeMount buildLastVolumeMount(){
return this.volumeMounts.get(volumeMounts.size() - 1).build();
}
public VolumeMount buildMatchingVolumeMount(io.alauda.kubernetes.api.builder.Predicate predicate){
for (VolumeMountBuilder item: volumeMounts) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withVolumeMounts(List volumeMounts){
_visitables.removeAll(this.volumeMounts);
this.volumeMounts.clear();
if (volumeMounts != null) {for (VolumeMount item : volumeMounts){this.addToVolumeMounts(item);}} return (A) this;
}
public A withVolumeMounts(VolumeMount... volumeMounts){
this.volumeMounts.clear(); if (volumeMounts != null) {for (VolumeMount item :volumeMounts){ this.addToVolumeMounts(item);}} return (A) this;
}
public Boolean hasVolumeMounts(){
return volumeMounts!= null && !volumeMounts.isEmpty();
}
public ContainerFluent.VolumeMountsNested addNewVolumeMount(){
return new VolumeMountsNestedImpl();
}
public ContainerFluent.VolumeMountsNested addNewVolumeMountLike(VolumeMount item){
return new VolumeMountsNestedImpl(-1, item);
}
public ContainerFluent.VolumeMountsNested setNewVolumeMountLike(int index,VolumeMount item){
return new VolumeMountsNestedImpl(index, item);
}
public ContainerFluent.VolumeMountsNested editVolumeMount(int index){
if (volumeMounts.size() <= index) throw new RuntimeException("Can't edit volumeMounts. Index exceeds size.");
return setNewVolumeMountLike(index, buildVolumeMount(index));
}
public ContainerFluent.VolumeMountsNested editFirstVolumeMount(){
if (volumeMounts.size() == 0) throw new RuntimeException("Can't edit first volumeMounts. The list is empty.");
return setNewVolumeMountLike(0, buildVolumeMount(0));
}
public ContainerFluent.VolumeMountsNested editLastVolumeMount(){
int index = volumeMounts.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last volumeMounts. The list is empty.");
return setNewVolumeMountLike(index, buildVolumeMount(index));
}
public ContainerFluent.VolumeMountsNested editMatchingVolumeMount(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends EnvVarFluentImpl> implements ContainerFluent.EnvNested,io.alauda.kubernetes.api.builder.Nested{
private final EnvVarBuilder builder;
private final int index;
EnvNestedImpl(int index,EnvVar item){
this.index = index;
this.builder = new EnvVarBuilder(this, item);
}
EnvNestedImpl(){
this.index = -1;
this.builder = new EnvVarBuilder(this);
}
public N and(){
return (N) ContainerFluentImpl.this.setToEnv(index, builder.build());
}
public N endEnv(){
return and();
}
}
public class EnvFromNestedImpl extends EnvFromSourceFluentImpl> implements ContainerFluent.EnvFromNested,io.alauda.kubernetes.api.builder.Nested{
private final EnvFromSourceBuilder builder;
private final int index;
EnvFromNestedImpl(int index,EnvFromSource item){
this.index = index;
this.builder = new EnvFromSourceBuilder(this, item);
}
EnvFromNestedImpl(){
this.index = -1;
this.builder = new EnvFromSourceBuilder(this);
}
public N and(){
return (N) ContainerFluentImpl.this.setToEnvFrom(index, builder.build());
}
public N endEnvFrom(){
return and();
}
}
public class LifecycleNestedImpl extends LifecycleFluentImpl> implements ContainerFluent.LifecycleNested,io.alauda.kubernetes.api.builder.Nested{
private final LifecycleBuilder builder;
LifecycleNestedImpl(Lifecycle item){
this.builder = new LifecycleBuilder(this, item);
}
LifecycleNestedImpl(){
this.builder = new LifecycleBuilder(this);
}
public N and(){
return (N) ContainerFluentImpl.this.withLifecycle(builder.build());
}
public N endLifecycle(){
return and();
}
}
public class LivenessProbeNestedImpl extends ProbeFluentImpl> implements ContainerFluent.LivenessProbeNested,io.alauda.kubernetes.api.builder.Nested{
private final ProbeBuilder builder;
LivenessProbeNestedImpl(Probe item){
this.builder = new ProbeBuilder(this, item);
}
LivenessProbeNestedImpl(){
this.builder = new ProbeBuilder(this);
}
public N and(){
return (N) ContainerFluentImpl.this.withLivenessProbe(builder.build());
}
public N endLivenessProbe(){
return and();
}
}
public class PortsNestedImpl extends ContainerPortFluentImpl> implements ContainerFluent.PortsNested,io.alauda.kubernetes.api.builder.Nested{
private final ContainerPortBuilder builder;
private final int index;
PortsNestedImpl(int index,ContainerPort item){
this.index = index;
this.builder = new ContainerPortBuilder(this, item);
}
PortsNestedImpl(){
this.index = -1;
this.builder = new ContainerPortBuilder(this);
}
public N and(){
return (N) ContainerFluentImpl.this.setToPorts(index, builder.build());
}
public N endPort(){
return and();
}
}
public class ReadinessProbeNestedImpl extends ProbeFluentImpl> implements ContainerFluent.ReadinessProbeNested,io.alauda.kubernetes.api.builder.Nested{
private final ProbeBuilder builder;
ReadinessProbeNestedImpl(Probe item){
this.builder = new ProbeBuilder(this, item);
}
ReadinessProbeNestedImpl(){
this.builder = new ProbeBuilder(this);
}
public N and(){
return (N) ContainerFluentImpl.this.withReadinessProbe(builder.build());
}
public N endReadinessProbe(){
return and();
}
}
public class ResourcesNestedImpl extends ResourceRequirementsFluentImpl> implements ContainerFluent.ResourcesNested,io.alauda.kubernetes.api.builder.Nested{
private final ResourceRequirementsBuilder builder;
ResourcesNestedImpl(ResourceRequirements item){
this.builder = new ResourceRequirementsBuilder(this, item);
}
ResourcesNestedImpl(){
this.builder = new ResourceRequirementsBuilder(this);
}
public N and(){
return (N) ContainerFluentImpl.this.withResources(builder.build());
}
public N endResources(){
return and();
}
}
public class SecurityContextNestedImpl extends SecurityContextFluentImpl> implements ContainerFluent.SecurityContextNested,io.alauda.kubernetes.api.builder.Nested{
private final SecurityContextBuilder builder;
SecurityContextNestedImpl(SecurityContext item){
this.builder = new SecurityContextBuilder(this, item);
}
SecurityContextNestedImpl(){
this.builder = new SecurityContextBuilder(this);
}
public N and(){
return (N) ContainerFluentImpl.this.withSecurityContext(builder.build());
}
public N endSecurityContext(){
return and();
}
}
public class VolumeMountsNestedImpl extends VolumeMountFluentImpl> implements ContainerFluent.VolumeMountsNested,io.alauda.kubernetes.api.builder.Nested{
private final VolumeMountBuilder builder;
private final int index;
VolumeMountsNestedImpl(int index,VolumeMount item){
this.index = index;
this.builder = new VolumeMountBuilder(this, item);
}
VolumeMountsNestedImpl(){
this.index = -1;
this.builder = new VolumeMountBuilder(this);
}
public N and(){
return (N) ContainerFluentImpl.this.setToVolumeMounts(index, builder.build());
}
public N endVolumeMount(){
return and();
}
}
}