annotations.io.alauda.kubernetes.api.model.PipelineConfigTemplateSpecFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.alauda.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import java.lang.Deprecated;
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;
public class PipelineConfigTemplateSpecFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements PipelineConfigTemplateSpecFluent{
private JenkinsAgentBuilder agent;
private List arguments = new ArrayList();
private PipelineDependencyBuilder dependencies;
private String engine;
private List environments = new ArrayList();
private List parameters = new ArrayList();
private List stages = new ArrayList();
private Boolean withSCM;
public PipelineConfigTemplateSpecFluentImpl(){
}
public PipelineConfigTemplateSpecFluentImpl(PipelineConfigTemplateSpec instance){
this.withAgent(instance.getAgent());
this.withArguments(instance.getArguments());
this.withDependencies(instance.getDependencies());
this.withEngine(instance.getEngine());
this.withEnvironments(instance.getEnvironments());
this.withParameters(instance.getParameters());
this.withStages(instance.getStages());
this.withWithSCM(instance.getWithSCM());
}
/**
* This method has been deprecated, please use method buildAgent instead.
*/
@Deprecated public JenkinsAgent getAgent(){
return this.agent!=null?this.agent.build():null;
}
public JenkinsAgent buildAgent(){
return this.agent!=null?this.agent.build():null;
}
public A withAgent(JenkinsAgent agent){
_visitables.remove(this.agent);
if (agent!=null){ this.agent= new JenkinsAgentBuilder(agent); _visitables.add(this.agent);} return (A) this;
}
public Boolean hasAgent(){
return this.agent!=null;
}
public PipelineConfigTemplateSpecFluent.AgentNested withNewAgent(){
return new AgentNestedImpl();
}
public PipelineConfigTemplateSpecFluent.AgentNested withNewAgentLike(JenkinsAgent item){
return new AgentNestedImpl(item);
}
public PipelineConfigTemplateSpecFluent.AgentNested editAgent(){
return withNewAgentLike(getAgent());
}
public PipelineConfigTemplateSpecFluent.AgentNested editOrNewAgent(){
return withNewAgentLike(getAgent() != null ? getAgent(): new JenkinsAgentBuilder().build());
}
public PipelineConfigTemplateSpecFluent.AgentNested editOrNewAgentLike(JenkinsAgent item){
return withNewAgentLike(getAgent() != null ? getAgent(): item);
}
public A withNewAgent(String label){
return (A)withAgent(new JenkinsAgent(label));
}
public A addToArguments(int index,PipelineTemplateArgumentGroup item){
PipelineTemplateArgumentGroupBuilder builder = new PipelineTemplateArgumentGroupBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.arguments.add(index >= 0 ? index : arguments.size(), builder); return (A)this;
}
public A setToArguments(int index,PipelineTemplateArgumentGroup item){
PipelineTemplateArgumentGroupBuilder builder = new PipelineTemplateArgumentGroupBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= arguments.size()) { arguments.add(builder); } else { arguments.set(index, builder);}
return (A)this;
}
public A addToArguments(PipelineTemplateArgumentGroup... items){
for (PipelineTemplateArgumentGroup item : items) {PipelineTemplateArgumentGroupBuilder builder = new PipelineTemplateArgumentGroupBuilder(item);_visitables.add(builder);this.arguments.add(builder);} return (A)this;
}
public A addAllToArguments(Collection items){
for (PipelineTemplateArgumentGroup item : items) {PipelineTemplateArgumentGroupBuilder builder = new PipelineTemplateArgumentGroupBuilder(item);_visitables.add(builder);this.arguments.add(builder);} return (A)this;
}
public A removeFromArguments(PipelineTemplateArgumentGroup... items){
for (PipelineTemplateArgumentGroup item : items) {PipelineTemplateArgumentGroupBuilder builder = new PipelineTemplateArgumentGroupBuilder(item);_visitables.remove(builder);this.arguments.remove(builder);} return (A)this;
}
public A removeAllFromArguments(Collection items){
for (PipelineTemplateArgumentGroup item : items) {PipelineTemplateArgumentGroupBuilder builder = new PipelineTemplateArgumentGroupBuilder(item);_visitables.remove(builder);this.arguments.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildArguments instead.
*/
@Deprecated public List getArguments(){
return build(arguments);
}
public List buildArguments(){
return build(arguments);
}
public PipelineTemplateArgumentGroup buildArgument(int index){
return this.arguments.get(index).build();
}
public PipelineTemplateArgumentGroup buildFirstArgument(){
return this.arguments.get(0).build();
}
public PipelineTemplateArgumentGroup buildLastArgument(){
return this.arguments.get(arguments.size() - 1).build();
}
public PipelineTemplateArgumentGroup buildMatchingArgument(io.alauda.kubernetes.api.builder.Predicate predicate){
for (PipelineTemplateArgumentGroupBuilder item: arguments) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withArguments(List arguments){
_visitables.removeAll(this.arguments);
this.arguments.clear();
if (arguments != null) {for (PipelineTemplateArgumentGroup item : arguments){this.addToArguments(item);}} return (A) this;
}
public A withArguments(PipelineTemplateArgumentGroup... arguments){
this.arguments.clear(); if (arguments != null) {for (PipelineTemplateArgumentGroup item :arguments){ this.addToArguments(item);}} return (A) this;
}
public Boolean hasArguments(){
return arguments!= null && !arguments.isEmpty();
}
public PipelineConfigTemplateSpecFluent.ArgumentsNested addNewArgument(){
return new ArgumentsNestedImpl();
}
public PipelineConfigTemplateSpecFluent.ArgumentsNested addNewArgumentLike(PipelineTemplateArgumentGroup item){
return new ArgumentsNestedImpl(-1, item);
}
public PipelineConfigTemplateSpecFluent.ArgumentsNested setNewArgumentLike(int index,PipelineTemplateArgumentGroup item){
return new ArgumentsNestedImpl(index, item);
}
public PipelineConfigTemplateSpecFluent.ArgumentsNested editArgument(int index){
if (arguments.size() <= index) throw new RuntimeException("Can't edit arguments. Index exceeds size.");
return setNewArgumentLike(index, buildArgument(index));
}
public PipelineConfigTemplateSpecFluent.ArgumentsNested editFirstArgument(){
if (arguments.size() == 0) throw new RuntimeException("Can't edit first arguments. The list is empty.");
return setNewArgumentLike(0, buildArgument(0));
}
public PipelineConfigTemplateSpecFluent.ArgumentsNested editLastArgument(){
int index = arguments.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last arguments. The list is empty.");
return setNewArgumentLike(index, buildArgument(index));
}
public PipelineConfigTemplateSpecFluent.ArgumentsNested editMatchingArgument(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i withNewDependencies(){
return new DependenciesNestedImpl();
}
public PipelineConfigTemplateSpecFluent.DependenciesNested withNewDependenciesLike(PipelineDependency item){
return new DependenciesNestedImpl(item);
}
public PipelineConfigTemplateSpecFluent.DependenciesNested editDependencies(){
return withNewDependenciesLike(getDependencies());
}
public PipelineConfigTemplateSpecFluent.DependenciesNested editOrNewDependencies(){
return withNewDependenciesLike(getDependencies() != null ? getDependencies(): new PipelineDependencyBuilder().build());
}
public PipelineConfigTemplateSpecFluent.DependenciesNested editOrNewDependenciesLike(PipelineDependency item){
return withNewDependenciesLike(getDependencies() != null ? getDependencies(): item);
}
public String getEngine(){
return this.engine;
}
public A withEngine(String engine){
this.engine=engine; return (A) this;
}
public Boolean hasEngine(){
return this.engine!=null;
}
public A addToEnvironments(int index,PipelineEnvironment item){
PipelineEnvironmentBuilder builder = new PipelineEnvironmentBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.environments.add(index >= 0 ? index : environments.size(), builder); return (A)this;
}
public A setToEnvironments(int index,PipelineEnvironment item){
PipelineEnvironmentBuilder builder = new PipelineEnvironmentBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= environments.size()) { environments.add(builder); } else { environments.set(index, builder);}
return (A)this;
}
public A addToEnvironments(PipelineEnvironment... items){
for (PipelineEnvironment item : items) {PipelineEnvironmentBuilder builder = new PipelineEnvironmentBuilder(item);_visitables.add(builder);this.environments.add(builder);} return (A)this;
}
public A addAllToEnvironments(Collection items){
for (PipelineEnvironment item : items) {PipelineEnvironmentBuilder builder = new PipelineEnvironmentBuilder(item);_visitables.add(builder);this.environments.add(builder);} return (A)this;
}
public A removeFromEnvironments(PipelineEnvironment... items){
for (PipelineEnvironment item : items) {PipelineEnvironmentBuilder builder = new PipelineEnvironmentBuilder(item);_visitables.remove(builder);this.environments.remove(builder);} return (A)this;
}
public A removeAllFromEnvironments(Collection items){
for (PipelineEnvironment item : items) {PipelineEnvironmentBuilder builder = new PipelineEnvironmentBuilder(item);_visitables.remove(builder);this.environments.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildEnvironments instead.
*/
@Deprecated public List getEnvironments(){
return build(environments);
}
public List buildEnvironments(){
return build(environments);
}
public PipelineEnvironment buildEnvironment(int index){
return this.environments.get(index).build();
}
public PipelineEnvironment buildFirstEnvironment(){
return this.environments.get(0).build();
}
public PipelineEnvironment buildLastEnvironment(){
return this.environments.get(environments.size() - 1).build();
}
public PipelineEnvironment buildMatchingEnvironment(io.alauda.kubernetes.api.builder.Predicate predicate){
for (PipelineEnvironmentBuilder item: environments) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withEnvironments(List environments){
_visitables.removeAll(this.environments);
this.environments.clear();
if (environments != null) {for (PipelineEnvironment item : environments){this.addToEnvironments(item);}} return (A) this;
}
public A withEnvironments(PipelineEnvironment... environments){
this.environments.clear(); if (environments != null) {for (PipelineEnvironment item :environments){ this.addToEnvironments(item);}} return (A) this;
}
public Boolean hasEnvironments(){
return environments!= null && !environments.isEmpty();
}
public PipelineConfigTemplateSpecFluent.EnvironmentsNested addNewEnvironment(){
return new EnvironmentsNestedImpl();
}
public PipelineConfigTemplateSpecFluent.EnvironmentsNested addNewEnvironmentLike(PipelineEnvironment item){
return new EnvironmentsNestedImpl(-1, item);
}
public PipelineConfigTemplateSpecFluent.EnvironmentsNested setNewEnvironmentLike(int index,PipelineEnvironment item){
return new EnvironmentsNestedImpl(index, item);
}
public PipelineConfigTemplateSpecFluent.EnvironmentsNested editEnvironment(int index){
if (environments.size() <= index) throw new RuntimeException("Can't edit environments. Index exceeds size.");
return setNewEnvironmentLike(index, buildEnvironment(index));
}
public PipelineConfigTemplateSpecFluent.EnvironmentsNested editFirstEnvironment(){
if (environments.size() == 0) throw new RuntimeException("Can't edit first environments. The list is empty.");
return setNewEnvironmentLike(0, buildEnvironment(0));
}
public PipelineConfigTemplateSpecFluent.EnvironmentsNested editLastEnvironment(){
int index = environments.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last environments. The list is empty.");
return setNewEnvironmentLike(index, buildEnvironment(index));
}
public PipelineConfigTemplateSpecFluent.EnvironmentsNested editMatchingEnvironment(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i= 0 ? index : _visitables.size(), builder);this.parameters.add(index >= 0 ? index : parameters.size(), builder); return (A)this;
}
public A setToParameters(int index,PipelineParameter item){
PipelineParameterBuilder builder = new PipelineParameterBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= parameters.size()) { parameters.add(builder); } else { parameters.set(index, builder);}
return (A)this;
}
public A addToParameters(PipelineParameter... items){
for (PipelineParameter item : items) {PipelineParameterBuilder builder = new PipelineParameterBuilder(item);_visitables.add(builder);this.parameters.add(builder);} return (A)this;
}
public A addAllToParameters(Collection items){
for (PipelineParameter item : items) {PipelineParameterBuilder builder = new PipelineParameterBuilder(item);_visitables.add(builder);this.parameters.add(builder);} return (A)this;
}
public A removeFromParameters(PipelineParameter... items){
for (PipelineParameter item : items) {PipelineParameterBuilder builder = new PipelineParameterBuilder(item);_visitables.remove(builder);this.parameters.remove(builder);} return (A)this;
}
public A removeAllFromParameters(Collection items){
for (PipelineParameter item : items) {PipelineParameterBuilder builder = new PipelineParameterBuilder(item);_visitables.remove(builder);this.parameters.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildParameters instead.
*/
@Deprecated public List getParameters(){
return build(parameters);
}
public List buildParameters(){
return build(parameters);
}
public PipelineParameter buildParameter(int index){
return this.parameters.get(index).build();
}
public PipelineParameter buildFirstParameter(){
return this.parameters.get(0).build();
}
public PipelineParameter buildLastParameter(){
return this.parameters.get(parameters.size() - 1).build();
}
public PipelineParameter buildMatchingParameter(io.alauda.kubernetes.api.builder.Predicate predicate){
for (PipelineParameterBuilder item: parameters) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withParameters(List parameters){
_visitables.removeAll(this.parameters);
this.parameters.clear();
if (parameters != null) {for (PipelineParameter item : parameters){this.addToParameters(item);}} return (A) this;
}
public A withParameters(PipelineParameter... parameters){
this.parameters.clear(); if (parameters != null) {for (PipelineParameter item :parameters){ this.addToParameters(item);}} return (A) this;
}
public Boolean hasParameters(){
return parameters!= null && !parameters.isEmpty();
}
public PipelineConfigTemplateSpecFluent.ParametersNested addNewParameter(){
return new ParametersNestedImpl();
}
public PipelineConfigTemplateSpecFluent.ParametersNested addNewParameterLike(PipelineParameter item){
return new ParametersNestedImpl(-1, item);
}
public PipelineConfigTemplateSpecFluent.ParametersNested setNewParameterLike(int index,PipelineParameter item){
return new ParametersNestedImpl(index, item);
}
public PipelineConfigTemplateSpecFluent.ParametersNested editParameter(int index){
if (parameters.size() <= index) throw new RuntimeException("Can't edit parameters. Index exceeds size.");
return setNewParameterLike(index, buildParameter(index));
}
public PipelineConfigTemplateSpecFluent.ParametersNested editFirstParameter(){
if (parameters.size() == 0) throw new RuntimeException("Can't edit first parameters. The list is empty.");
return setNewParameterLike(0, buildParameter(0));
}
public PipelineConfigTemplateSpecFluent.ParametersNested editLastParameter(){
int index = parameters.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last parameters. The list is empty.");
return setNewParameterLike(index, buildParameter(index));
}
public PipelineConfigTemplateSpecFluent.ParametersNested editMatchingParameter(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i= 0 ? index : _visitables.size(), builder);this.stages.add(index >= 0 ? index : stages.size(), builder); return (A)this;
}
public A setToStages(int index,PipelineStageInstance item){
PipelineStageInstanceBuilder builder = new PipelineStageInstanceBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= stages.size()) { stages.add(builder); } else { stages.set(index, builder);}
return (A)this;
}
public A addToStages(PipelineStageInstance... items){
for (PipelineStageInstance item : items) {PipelineStageInstanceBuilder builder = new PipelineStageInstanceBuilder(item);_visitables.add(builder);this.stages.add(builder);} return (A)this;
}
public A addAllToStages(Collection items){
for (PipelineStageInstance item : items) {PipelineStageInstanceBuilder builder = new PipelineStageInstanceBuilder(item);_visitables.add(builder);this.stages.add(builder);} return (A)this;
}
public A removeFromStages(PipelineStageInstance... items){
for (PipelineStageInstance item : items) {PipelineStageInstanceBuilder builder = new PipelineStageInstanceBuilder(item);_visitables.remove(builder);this.stages.remove(builder);} return (A)this;
}
public A removeAllFromStages(Collection items){
for (PipelineStageInstance item : items) {PipelineStageInstanceBuilder builder = new PipelineStageInstanceBuilder(item);_visitables.remove(builder);this.stages.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildStages instead.
*/
@Deprecated public List getStages(){
return build(stages);
}
public List buildStages(){
return build(stages);
}
public PipelineStageInstance buildStage(int index){
return this.stages.get(index).build();
}
public PipelineStageInstance buildFirstStage(){
return this.stages.get(0).build();
}
public PipelineStageInstance buildLastStage(){
return this.stages.get(stages.size() - 1).build();
}
public PipelineStageInstance buildMatchingStage(io.alauda.kubernetes.api.builder.Predicate predicate){
for (PipelineStageInstanceBuilder item: stages) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withStages(List stages){
_visitables.removeAll(this.stages);
this.stages.clear();
if (stages != null) {for (PipelineStageInstance item : stages){this.addToStages(item);}} return (A) this;
}
public A withStages(PipelineStageInstance... stages){
this.stages.clear(); if (stages != null) {for (PipelineStageInstance item :stages){ this.addToStages(item);}} return (A) this;
}
public Boolean hasStages(){
return stages!= null && !stages.isEmpty();
}
public PipelineConfigTemplateSpecFluent.StagesNested addNewStage(){
return new StagesNestedImpl();
}
public PipelineConfigTemplateSpecFluent.StagesNested addNewStageLike(PipelineStageInstance item){
return new StagesNestedImpl(-1, item);
}
public PipelineConfigTemplateSpecFluent.StagesNested setNewStageLike(int index,PipelineStageInstance item){
return new StagesNestedImpl(index, item);
}
public PipelineConfigTemplateSpecFluent.StagesNested editStage(int index){
if (stages.size() <= index) throw new RuntimeException("Can't edit stages. Index exceeds size.");
return setNewStageLike(index, buildStage(index));
}
public PipelineConfigTemplateSpecFluent.StagesNested editFirstStage(){
if (stages.size() == 0) throw new RuntimeException("Can't edit first stages. The list is empty.");
return setNewStageLike(0, buildStage(0));
}
public PipelineConfigTemplateSpecFluent.StagesNested editLastStage(){
int index = stages.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last stages. The list is empty.");
return setNewStageLike(index, buildStage(index));
}
public PipelineConfigTemplateSpecFluent.StagesNested editMatchingStage(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends JenkinsAgentFluentImpl> implements PipelineConfigTemplateSpecFluent.AgentNested,io.alauda.kubernetes.api.builder.Nested{
private final JenkinsAgentBuilder builder;
AgentNestedImpl(JenkinsAgent item){
this.builder = new JenkinsAgentBuilder(this, item);
}
AgentNestedImpl(){
this.builder = new JenkinsAgentBuilder(this);
}
public N and(){
return (N) PipelineConfigTemplateSpecFluentImpl.this.withAgent(builder.build());
}
public N endAgent(){
return and();
}
}
public class ArgumentsNestedImpl extends PipelineTemplateArgumentGroupFluentImpl> implements PipelineConfigTemplateSpecFluent.ArgumentsNested,io.alauda.kubernetes.api.builder.Nested{
private final PipelineTemplateArgumentGroupBuilder builder;
private final int index;
ArgumentsNestedImpl(int index,PipelineTemplateArgumentGroup item){
this.index = index;
this.builder = new PipelineTemplateArgumentGroupBuilder(this, item);
}
ArgumentsNestedImpl(){
this.index = -1;
this.builder = new PipelineTemplateArgumentGroupBuilder(this);
}
public N and(){
return (N) PipelineConfigTemplateSpecFluentImpl.this.setToArguments(index, builder.build());
}
public N endArgument(){
return and();
}
}
public class DependenciesNestedImpl extends PipelineDependencyFluentImpl> implements PipelineConfigTemplateSpecFluent.DependenciesNested,io.alauda.kubernetes.api.builder.Nested{
private final PipelineDependencyBuilder builder;
DependenciesNestedImpl(PipelineDependency item){
this.builder = new PipelineDependencyBuilder(this, item);
}
DependenciesNestedImpl(){
this.builder = new PipelineDependencyBuilder(this);
}
public N and(){
return (N) PipelineConfigTemplateSpecFluentImpl.this.withDependencies(builder.build());
}
public N endDependencies(){
return and();
}
}
public class EnvironmentsNestedImpl extends PipelineEnvironmentFluentImpl> implements PipelineConfigTemplateSpecFluent.EnvironmentsNested,io.alauda.kubernetes.api.builder.Nested{
private final PipelineEnvironmentBuilder builder;
private final int index;
EnvironmentsNestedImpl(int index,PipelineEnvironment item){
this.index = index;
this.builder = new PipelineEnvironmentBuilder(this, item);
}
EnvironmentsNestedImpl(){
this.index = -1;
this.builder = new PipelineEnvironmentBuilder(this);
}
public N and(){
return (N) PipelineConfigTemplateSpecFluentImpl.this.setToEnvironments(index, builder.build());
}
public N endEnvironment(){
return and();
}
}
public class ParametersNestedImpl extends PipelineParameterFluentImpl> implements PipelineConfigTemplateSpecFluent.ParametersNested,io.alauda.kubernetes.api.builder.Nested{
private final PipelineParameterBuilder builder;
private final int index;
ParametersNestedImpl(int index,PipelineParameter item){
this.index = index;
this.builder = new PipelineParameterBuilder(this, item);
}
ParametersNestedImpl(){
this.index = -1;
this.builder = new PipelineParameterBuilder(this);
}
public N and(){
return (N) PipelineConfigTemplateSpecFluentImpl.this.setToParameters(index, builder.build());
}
public N endParameter(){
return and();
}
}
public class StagesNestedImpl extends PipelineStageInstanceFluentImpl> implements PipelineConfigTemplateSpecFluent.StagesNested,io.alauda.kubernetes.api.builder.Nested{
private final PipelineStageInstanceBuilder builder;
private final int index;
StagesNestedImpl(int index,PipelineStageInstance item){
this.index = index;
this.builder = new PipelineStageInstanceBuilder(this, item);
}
StagesNestedImpl(){
this.index = -1;
this.builder = new PipelineStageInstanceBuilder(this);
}
public N and(){
return (N) PipelineConfigTemplateSpecFluentImpl.this.setToStages(index, builder.build());
}
public N endStage(){
return and();
}
}
}