All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.alauda.kubernetes.api.model.PipelineTemplateSpecFluentImpl Maven / Gradle / Ivy

There is a newer version: 0.2.12
Show newest version
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 PipelineTemplateSpecFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements PipelineTemplateSpecFluent{

    private JenkinsAgentBuilder agent;
    private List arguments =  new ArrayList();
    private String engine;
    private List environments =  new ArrayList();
    private List parameters =  new ArrayList();
    private List stages =  new ArrayList();
    private Boolean withSCM;

    public PipelineTemplateSpecFluentImpl(){
    }
    public PipelineTemplateSpecFluentImpl(PipelineTemplateSpec instance){
            this.withAgent(instance.getAgent()); 
            this.withArguments(instance.getArguments()); 
            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 PipelineTemplateSpecFluent.AgentNested withNewAgent(){
            return new AgentNestedImpl();
    }

    public PipelineTemplateSpecFluent.AgentNested withNewAgentLike(JenkinsAgent item){
            return new AgentNestedImpl(item);
    }

    public PipelineTemplateSpecFluent.AgentNested editAgent(){
            return withNewAgentLike(getAgent());
    }

    public PipelineTemplateSpecFluent.AgentNested editOrNewAgent(){
            return withNewAgentLike(getAgent() != null ? getAgent(): new JenkinsAgentBuilder().build());
    }

    public PipelineTemplateSpecFluent.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 PipelineTemplateSpecFluent.ArgumentsNested addNewArgument(){
            return new ArgumentsNestedImpl();
    }

    public PipelineTemplateSpecFluent.ArgumentsNested addNewArgumentLike(PipelineTemplateArgumentGroup item){
            return new ArgumentsNestedImpl(-1, item);
    }

    public PipelineTemplateSpecFluent.ArgumentsNested setNewArgumentLike(int index,PipelineTemplateArgumentGroup item){
            return new ArgumentsNestedImpl(index, item);
    }

    public PipelineTemplateSpecFluent.ArgumentsNested editArgument(int index){
            if (arguments.size() <= index) throw new RuntimeException("Can't edit arguments. Index exceeds size.");
            return setNewArgumentLike(index, buildArgument(index));
    }

    public PipelineTemplateSpecFluent.ArgumentsNested editFirstArgument(){
            if (arguments.size() == 0) throw new RuntimeException("Can't edit first arguments. The list is empty.");
            return setNewArgumentLike(0, buildArgument(0));
    }

    public PipelineTemplateSpecFluent.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 PipelineTemplateSpecFluent.ArgumentsNested editMatchingArgument(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i= 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 PipelineTemplateSpecFluent.EnvironmentsNested addNewEnvironment(){
            return new EnvironmentsNestedImpl();
    }

    public PipelineTemplateSpecFluent.EnvironmentsNested addNewEnvironmentLike(PipelineEnvironment item){
            return new EnvironmentsNestedImpl(-1, item);
    }

    public PipelineTemplateSpecFluent.EnvironmentsNested setNewEnvironmentLike(int index,PipelineEnvironment item){
            return new EnvironmentsNestedImpl(index, item);
    }

    public PipelineTemplateSpecFluent.EnvironmentsNested editEnvironment(int index){
            if (environments.size() <= index) throw new RuntimeException("Can't edit environments. Index exceeds size.");
            return setNewEnvironmentLike(index, buildEnvironment(index));
    }

    public PipelineTemplateSpecFluent.EnvironmentsNested editFirstEnvironment(){
            if (environments.size() == 0) throw new RuntimeException("Can't edit first environments. The list is empty.");
            return setNewEnvironmentLike(0, buildEnvironment(0));
    }

    public PipelineTemplateSpecFluent.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 PipelineTemplateSpecFluent.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 PipelineTemplateSpecFluent.ParametersNested addNewParameter(){
            return new ParametersNestedImpl();
    }

    public PipelineTemplateSpecFluent.ParametersNested addNewParameterLike(PipelineParameter item){
            return new ParametersNestedImpl(-1, item);
    }

    public PipelineTemplateSpecFluent.ParametersNested setNewParameterLike(int index,PipelineParameter item){
            return new ParametersNestedImpl(index, item);
    }

    public PipelineTemplateSpecFluent.ParametersNested editParameter(int index){
            if (parameters.size() <= index) throw new RuntimeException("Can't edit parameters. Index exceeds size.");
            return setNewParameterLike(index, buildParameter(index));
    }

    public PipelineTemplateSpecFluent.ParametersNested editFirstParameter(){
            if (parameters.size() == 0) throw new RuntimeException("Can't edit first parameters. The list is empty.");
            return setNewParameterLike(0, buildParameter(0));
    }

    public PipelineTemplateSpecFluent.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 PipelineTemplateSpecFluent.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,PipelineStage item){
            PipelineStageBuilder builder = new PipelineStageBuilder(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(PipelineStage... items){
            for (PipelineStage item : items) {PipelineStageBuilder builder = new PipelineStageBuilder(item);_visitables.add(builder);this.stages.add(builder);} return (A)this;
    }

    public A addAllToStages(Collection items){
            for (PipelineStage item : items) {PipelineStageBuilder builder = new PipelineStageBuilder(item);_visitables.add(builder);this.stages.add(builder);} return (A)this;
    }

    public A removeFromStages(PipelineStage... items){
            for (PipelineStage item : items) {PipelineStageBuilder builder = new PipelineStageBuilder(item);_visitables.remove(builder);this.stages.remove(builder);} return (A)this;
    }

    public A removeAllFromStages(Collection items){
            for (PipelineStage item : items) {PipelineStageBuilder builder = new PipelineStageBuilder(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 PipelineStage buildStage(int index){
            return this.stages.get(index).build();
    }

    public PipelineStage buildFirstStage(){
            return this.stages.get(0).build();
    }

    public PipelineStage buildLastStage(){
            return this.stages.get(stages.size() - 1).build();
    }

    public PipelineStage buildMatchingStage(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (PipelineStageBuilder 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 (PipelineStage item : stages){this.addToStages(item);}} return (A) this;
    }

    public A withStages(PipelineStage... stages){
            this.stages.clear(); if (stages != null) {for (PipelineStage item :stages){ this.addToStages(item);}} return (A) this;
    }

    public Boolean hasStages(){
            return stages!= null && !stages.isEmpty();
    }

    public PipelineTemplateSpecFluent.StagesNested addNewStage(){
            return new StagesNestedImpl();
    }

    public PipelineTemplateSpecFluent.StagesNested addNewStageLike(PipelineStage item){
            return new StagesNestedImpl(-1, item);
    }

    public PipelineTemplateSpecFluent.StagesNested setNewStageLike(int index,PipelineStage item){
            return new StagesNestedImpl(index, item);
    }

    public PipelineTemplateSpecFluent.StagesNested editStage(int index){
            if (stages.size() <= index) throw new RuntimeException("Can't edit stages. Index exceeds size.");
            return setNewStageLike(index, buildStage(index));
    }

    public PipelineTemplateSpecFluent.StagesNested editFirstStage(){
            if (stages.size() == 0) throw new RuntimeException("Can't edit first stages. The list is empty.");
            return setNewStageLike(0, buildStage(0));
    }

    public PipelineTemplateSpecFluent.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 PipelineTemplateSpecFluent.StagesNested editMatchingStage(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i extends JenkinsAgentFluentImpl> implements PipelineTemplateSpecFluent.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) PipelineTemplateSpecFluentImpl.this.withAgent(builder.build());
    }
    public N endAgent(){
            return and();
    }

}
    public class ArgumentsNestedImpl extends PipelineTemplateArgumentGroupFluentImpl> implements PipelineTemplateSpecFluent.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) PipelineTemplateSpecFluentImpl.this.setToArguments(index, builder.build());
    }
    public N endArgument(){
            return and();
    }

}
    public class EnvironmentsNestedImpl extends PipelineEnvironmentFluentImpl> implements PipelineTemplateSpecFluent.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) PipelineTemplateSpecFluentImpl.this.setToEnvironments(index, builder.build());
    }
    public N endEnvironment(){
            return and();
    }

}
    public class ParametersNestedImpl extends PipelineParameterFluentImpl> implements PipelineTemplateSpecFluent.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) PipelineTemplateSpecFluentImpl.this.setToParameters(index, builder.build());
    }
    public N endParameter(){
            return and();
    }

}
    public class StagesNestedImpl extends PipelineStageFluentImpl> implements PipelineTemplateSpecFluent.StagesNested,io.alauda.kubernetes.api.builder.Nested{

            private final PipelineStageBuilder builder;
        private final int index;
    
            StagesNestedImpl(int index,PipelineStage item){
                    this.index = index;
                    this.builder = new PipelineStageBuilder(this, item);
            }
            StagesNestedImpl(){
                    this.index = -1;
                    this.builder = new PipelineStageBuilder(this);
            }
    
    public N and(){
            return (N) PipelineTemplateSpecFluentImpl.this.setToStages(index, builder.build());
    }
    public N endStage(){
            return and();
    }

}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy