io.alauda.devops.api.model.BuildConfigSpecFluentImpl Maven / Gradle / Ivy
package io.alauda.devops.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.lang.String;
import io.alauda.kubernetes.api.model.ResourceRequirements;
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 io.alauda.kubernetes.api.model.ResourceRequirementsFluentImpl;
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.model.ResourceRequirementsBuilder;
import io.alauda.kubernetes.api.builder.Nested;
import java.lang.Deprecated;
import java.lang.Integer;
public class BuildConfigSpecFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements BuildConfigSpecFluent{
private Long completionDeadlineSeconds;
private Integer failedBuildsHistoryLimit;
private Map nodeSelector = new LinkedHashMap();
private BuildOutputBuilder output;
private BuildPostCommitSpecBuilder postCommit;
private ResourceRequirementsBuilder resources;
private SourceRevisionBuilder revision;
private String runPolicy;
private String serviceAccount;
private BuildSourceBuilder source;
private BuildStrategyBuilder strategy;
private Integer successfulBuildsHistoryLimit;
private List triggers = new ArrayList();
public BuildConfigSpecFluentImpl(){
}
public BuildConfigSpecFluentImpl(BuildConfigSpec instance){
this.withCompletionDeadlineSeconds(instance.getCompletionDeadlineSeconds());
this.withFailedBuildsHistoryLimit(instance.getFailedBuildsHistoryLimit());
this.withNodeSelector(instance.getNodeSelector());
this.withOutput(instance.getOutput());
this.withPostCommit(instance.getPostCommit());
this.withResources(instance.getResources());
this.withRevision(instance.getRevision());
this.withRunPolicy(instance.getRunPolicy());
this.withServiceAccount(instance.getServiceAccount());
this.withSource(instance.getSource());
this.withStrategy(instance.getStrategy());
this.withSuccessfulBuildsHistoryLimit(instance.getSuccessfulBuildsHistoryLimit());
this.withTriggers(instance.getTriggers());
}
public Long getCompletionDeadlineSeconds(){
return this.completionDeadlineSeconds;
}
public A withCompletionDeadlineSeconds(Long completionDeadlineSeconds){
this.completionDeadlineSeconds=completionDeadlineSeconds; return (A) this;
}
public Boolean hasCompletionDeadlineSeconds(){
return this.completionDeadlineSeconds!=null;
}
public Integer getFailedBuildsHistoryLimit(){
return this.failedBuildsHistoryLimit;
}
public A withFailedBuildsHistoryLimit(Integer failedBuildsHistoryLimit){
this.failedBuildsHistoryLimit=failedBuildsHistoryLimit; return (A) this;
}
public Boolean hasFailedBuildsHistoryLimit(){
return this.failedBuildsHistoryLimit!=null;
}
public A addToNodeSelector(String key,String value){
if(key != null && value != null) {this.nodeSelector.put(key, value);} return (A)this;
}
public A addToNodeSelector(Map 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;
}
/**
* This method has been deprecated, please use method buildOutput instead.
*/
@Deprecated public BuildOutput getOutput(){
return this.output!=null?this.output.build():null;
}
public BuildOutput buildOutput(){
return this.output!=null?this.output.build():null;
}
public A withOutput(BuildOutput output){
_visitables.remove(this.output);
if (output!=null){ this.output= new BuildOutputBuilder(output); _visitables.add(this.output);} return (A) this;
}
public Boolean hasOutput(){
return this.output!=null;
}
public BuildConfigSpecFluent.OutputNested withNewOutput(){
return new OutputNestedImpl();
}
public BuildConfigSpecFluent.OutputNested withNewOutputLike(BuildOutput item){
return new OutputNestedImpl(item);
}
public BuildConfigSpecFluent.OutputNested editOutput(){
return withNewOutputLike(getOutput());
}
public BuildConfigSpecFluent.OutputNested editOrNewOutput(){
return withNewOutputLike(getOutput() != null ? getOutput(): new BuildOutputBuilder().build());
}
public BuildConfigSpecFluent.OutputNested editOrNewOutputLike(BuildOutput item){
return withNewOutputLike(getOutput() != null ? getOutput(): item);
}
/**
* This method has been deprecated, please use method buildPostCommit instead.
*/
@Deprecated public BuildPostCommitSpec getPostCommit(){
return this.postCommit!=null?this.postCommit.build():null;
}
public BuildPostCommitSpec buildPostCommit(){
return this.postCommit!=null?this.postCommit.build():null;
}
public A withPostCommit(BuildPostCommitSpec postCommit){
_visitables.remove(this.postCommit);
if (postCommit!=null){ this.postCommit= new BuildPostCommitSpecBuilder(postCommit); _visitables.add(this.postCommit);} return (A) this;
}
public Boolean hasPostCommit(){
return this.postCommit!=null;
}
public BuildConfigSpecFluent.PostCommitNested withNewPostCommit(){
return new PostCommitNestedImpl();
}
public BuildConfigSpecFluent.PostCommitNested withNewPostCommitLike(BuildPostCommitSpec item){
return new PostCommitNestedImpl(item);
}
public BuildConfigSpecFluent.PostCommitNested editPostCommit(){
return withNewPostCommitLike(getPostCommit());
}
public BuildConfigSpecFluent.PostCommitNested editOrNewPostCommit(){
return withNewPostCommitLike(getPostCommit() != null ? getPostCommit(): new BuildPostCommitSpecBuilder().build());
}
public BuildConfigSpecFluent.PostCommitNested editOrNewPostCommitLike(BuildPostCommitSpec item){
return withNewPostCommitLike(getPostCommit() != null ? getPostCommit(): 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 BuildConfigSpecFluent.ResourcesNested withNewResources(){
return new ResourcesNestedImpl();
}
public BuildConfigSpecFluent.ResourcesNested withNewResourcesLike(ResourceRequirements item){
return new ResourcesNestedImpl(item);
}
public BuildConfigSpecFluent.ResourcesNested editResources(){
return withNewResourcesLike(getResources());
}
public BuildConfigSpecFluent.ResourcesNested editOrNewResources(){
return withNewResourcesLike(getResources() != null ? getResources(): new ResourceRequirementsBuilder().build());
}
public BuildConfigSpecFluent.ResourcesNested editOrNewResourcesLike(ResourceRequirements item){
return withNewResourcesLike(getResources() != null ? getResources(): item);
}
/**
* This method has been deprecated, please use method buildRevision instead.
*/
@Deprecated public SourceRevision getRevision(){
return this.revision!=null?this.revision.build():null;
}
public SourceRevision buildRevision(){
return this.revision!=null?this.revision.build():null;
}
public A withRevision(SourceRevision revision){
_visitables.remove(this.revision);
if (revision!=null){ this.revision= new SourceRevisionBuilder(revision); _visitables.add(this.revision);} return (A) this;
}
public Boolean hasRevision(){
return this.revision!=null;
}
public BuildConfigSpecFluent.RevisionNested withNewRevision(){
return new RevisionNestedImpl();
}
public BuildConfigSpecFluent.RevisionNested withNewRevisionLike(SourceRevision item){
return new RevisionNestedImpl(item);
}
public BuildConfigSpecFluent.RevisionNested editRevision(){
return withNewRevisionLike(getRevision());
}
public BuildConfigSpecFluent.RevisionNested editOrNewRevision(){
return withNewRevisionLike(getRevision() != null ? getRevision(): new SourceRevisionBuilder().build());
}
public BuildConfigSpecFluent.RevisionNested editOrNewRevisionLike(SourceRevision item){
return withNewRevisionLike(getRevision() != null ? getRevision(): item);
}
public String getRunPolicy(){
return this.runPolicy;
}
public A withRunPolicy(String runPolicy){
this.runPolicy=runPolicy; return (A) this;
}
public Boolean hasRunPolicy(){
return this.runPolicy!=null;
}
public String getServiceAccount(){
return this.serviceAccount;
}
public A withServiceAccount(String serviceAccount){
this.serviceAccount=serviceAccount; return (A) this;
}
public Boolean hasServiceAccount(){
return this.serviceAccount!=null;
}
/**
* This method has been deprecated, please use method buildSource instead.
*/
@Deprecated public BuildSource getSource(){
return this.source!=null?this.source.build():null;
}
public BuildSource buildSource(){
return this.source!=null?this.source.build():null;
}
public A withSource(BuildSource source){
_visitables.remove(this.source);
if (source!=null){ this.source= new BuildSourceBuilder(source); _visitables.add(this.source);} return (A) this;
}
public Boolean hasSource(){
return this.source!=null;
}
public BuildConfigSpecFluent.SourceNested withNewSource(){
return new SourceNestedImpl();
}
public BuildConfigSpecFluent.SourceNested withNewSourceLike(BuildSource item){
return new SourceNestedImpl(item);
}
public BuildConfigSpecFluent.SourceNested editSource(){
return withNewSourceLike(getSource());
}
public BuildConfigSpecFluent.SourceNested editOrNewSource(){
return withNewSourceLike(getSource() != null ? getSource(): new BuildSourceBuilder().build());
}
public BuildConfigSpecFluent.SourceNested editOrNewSourceLike(BuildSource item){
return withNewSourceLike(getSource() != null ? getSource(): item);
}
/**
* This method has been deprecated, please use method buildStrategy instead.
*/
@Deprecated public BuildStrategy getStrategy(){
return this.strategy!=null?this.strategy.build():null;
}
public BuildStrategy buildStrategy(){
return this.strategy!=null?this.strategy.build():null;
}
public A withStrategy(BuildStrategy strategy){
_visitables.remove(this.strategy);
if (strategy!=null){ this.strategy= new BuildStrategyBuilder(strategy); _visitables.add(this.strategy);} return (A) this;
}
public Boolean hasStrategy(){
return this.strategy!=null;
}
public BuildConfigSpecFluent.StrategyNested withNewStrategy(){
return new StrategyNestedImpl();
}
public BuildConfigSpecFluent.StrategyNested withNewStrategyLike(BuildStrategy item){
return new StrategyNestedImpl(item);
}
public BuildConfigSpecFluent.StrategyNested editStrategy(){
return withNewStrategyLike(getStrategy());
}
public BuildConfigSpecFluent.StrategyNested editOrNewStrategy(){
return withNewStrategyLike(getStrategy() != null ? getStrategy(): new BuildStrategyBuilder().build());
}
public BuildConfigSpecFluent.StrategyNested editOrNewStrategyLike(BuildStrategy item){
return withNewStrategyLike(getStrategy() != null ? getStrategy(): item);
}
public Integer getSuccessfulBuildsHistoryLimit(){
return this.successfulBuildsHistoryLimit;
}
public A withSuccessfulBuildsHistoryLimit(Integer successfulBuildsHistoryLimit){
this.successfulBuildsHistoryLimit=successfulBuildsHistoryLimit; return (A) this;
}
public Boolean hasSuccessfulBuildsHistoryLimit(){
return this.successfulBuildsHistoryLimit!=null;
}
public A addToTriggers(int index,BuildTriggerPolicy item){
BuildTriggerPolicyBuilder builder = new BuildTriggerPolicyBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.triggers.add(index >= 0 ? index : triggers.size(), builder); return (A)this;
}
public A setToTriggers(int index,BuildTriggerPolicy item){
BuildTriggerPolicyBuilder builder = new BuildTriggerPolicyBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= triggers.size()) { triggers.add(builder); } else { triggers.set(index, builder);}
return (A)this;
}
public A addToTriggers(BuildTriggerPolicy... items){
for (BuildTriggerPolicy item : items) {BuildTriggerPolicyBuilder builder = new BuildTriggerPolicyBuilder(item);_visitables.add(builder);this.triggers.add(builder);} return (A)this;
}
public A addAllToTriggers(Collection items){
for (BuildTriggerPolicy item : items) {BuildTriggerPolicyBuilder builder = new BuildTriggerPolicyBuilder(item);_visitables.add(builder);this.triggers.add(builder);} return (A)this;
}
public A removeFromTriggers(BuildTriggerPolicy... items){
for (BuildTriggerPolicy item : items) {BuildTriggerPolicyBuilder builder = new BuildTriggerPolicyBuilder(item);_visitables.remove(builder);this.triggers.remove(builder);} return (A)this;
}
public A removeAllFromTriggers(Collection items){
for (BuildTriggerPolicy item : items) {BuildTriggerPolicyBuilder builder = new BuildTriggerPolicyBuilder(item);_visitables.remove(builder);this.triggers.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildTriggers instead.
*/
@Deprecated public List getTriggers(){
return build(triggers);
}
public List buildTriggers(){
return build(triggers);
}
public BuildTriggerPolicy buildTrigger(int index){
return this.triggers.get(index).build();
}
public BuildTriggerPolicy buildFirstTrigger(){
return this.triggers.get(0).build();
}
public BuildTriggerPolicy buildLastTrigger(){
return this.triggers.get(triggers.size() - 1).build();
}
public BuildTriggerPolicy buildMatchingTrigger(io.alauda.kubernetes.api.builder.Predicate predicate){
for (BuildTriggerPolicyBuilder item: triggers) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withTriggers(List triggers){
_visitables.removeAll(this.triggers);
this.triggers.clear();
if (triggers != null) {for (BuildTriggerPolicy item : triggers){this.addToTriggers(item);}} return (A) this;
}
public A withTriggers(BuildTriggerPolicy... triggers){
this.triggers.clear(); if (triggers != null) {for (BuildTriggerPolicy item :triggers){ this.addToTriggers(item);}} return (A) this;
}
public Boolean hasTriggers(){
return triggers!= null && !triggers.isEmpty();
}
public BuildConfigSpecFluent.TriggersNested addNewTrigger(){
return new TriggersNestedImpl();
}
public BuildConfigSpecFluent.TriggersNested addNewTriggerLike(BuildTriggerPolicy item){
return new TriggersNestedImpl(-1, item);
}
public BuildConfigSpecFluent.TriggersNested setNewTriggerLike(int index,BuildTriggerPolicy item){
return new TriggersNestedImpl(index, item);
}
public BuildConfigSpecFluent.TriggersNested editTrigger(int index){
if (triggers.size() <= index) throw new RuntimeException("Can't edit triggers. Index exceeds size.");
return setNewTriggerLike(index, buildTrigger(index));
}
public BuildConfigSpecFluent.TriggersNested editFirstTrigger(){
if (triggers.size() == 0) throw new RuntimeException("Can't edit first triggers. The list is empty.");
return setNewTriggerLike(0, buildTrigger(0));
}
public BuildConfigSpecFluent.TriggersNested editLastTrigger(){
int index = triggers.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last triggers. The list is empty.");
return setNewTriggerLike(index, buildTrigger(index));
}
public BuildConfigSpecFluent.TriggersNested editMatchingTrigger(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends BuildOutputFluentImpl> implements BuildConfigSpecFluent.OutputNested,io.alauda.kubernetes.api.builder.Nested{
private final BuildOutputBuilder builder;
OutputNestedImpl(BuildOutput item){
this.builder = new BuildOutputBuilder(this, item);
}
OutputNestedImpl(){
this.builder = new BuildOutputBuilder(this);
}
public N and(){
return (N) BuildConfigSpecFluentImpl.this.withOutput(builder.build());
}
public N endOutput(){
return and();
}
}
public class PostCommitNestedImpl extends BuildPostCommitSpecFluentImpl> implements BuildConfigSpecFluent.PostCommitNested,io.alauda.kubernetes.api.builder.Nested{
private final BuildPostCommitSpecBuilder builder;
PostCommitNestedImpl(BuildPostCommitSpec item){
this.builder = new BuildPostCommitSpecBuilder(this, item);
}
PostCommitNestedImpl(){
this.builder = new BuildPostCommitSpecBuilder(this);
}
public N and(){
return (N) BuildConfigSpecFluentImpl.this.withPostCommit(builder.build());
}
public N endPostCommit(){
return and();
}
}
public class ResourcesNestedImpl extends ResourceRequirementsFluentImpl> implements BuildConfigSpecFluent.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) BuildConfigSpecFluentImpl.this.withResources(builder.build());
}
public N endResources(){
return and();
}
}
public class RevisionNestedImpl extends SourceRevisionFluentImpl> implements BuildConfigSpecFluent.RevisionNested,io.alauda.kubernetes.api.builder.Nested{
private final SourceRevisionBuilder builder;
RevisionNestedImpl(SourceRevision item){
this.builder = new SourceRevisionBuilder(this, item);
}
RevisionNestedImpl(){
this.builder = new SourceRevisionBuilder(this);
}
public N and(){
return (N) BuildConfigSpecFluentImpl.this.withRevision(builder.build());
}
public N endRevision(){
return and();
}
}
public class SourceNestedImpl extends BuildSourceFluentImpl> implements BuildConfigSpecFluent.SourceNested,io.alauda.kubernetes.api.builder.Nested{
private final BuildSourceBuilder builder;
SourceNestedImpl(BuildSource item){
this.builder = new BuildSourceBuilder(this, item);
}
SourceNestedImpl(){
this.builder = new BuildSourceBuilder(this);
}
public N and(){
return (N) BuildConfigSpecFluentImpl.this.withSource(builder.build());
}
public N endSource(){
return and();
}
}
public class StrategyNestedImpl extends BuildStrategyFluentImpl> implements BuildConfigSpecFluent.StrategyNested,io.alauda.kubernetes.api.builder.Nested{
private final BuildStrategyBuilder builder;
StrategyNestedImpl(BuildStrategy item){
this.builder = new BuildStrategyBuilder(this, item);
}
StrategyNestedImpl(){
this.builder = new BuildStrategyBuilder(this);
}
public N and(){
return (N) BuildConfigSpecFluentImpl.this.withStrategy(builder.build());
}
public N endStrategy(){
return and();
}
}
public class TriggersNestedImpl extends BuildTriggerPolicyFluentImpl> implements BuildConfigSpecFluent.TriggersNested,io.alauda.kubernetes.api.builder.Nested{
private final BuildTriggerPolicyBuilder builder;
private final int index;
TriggersNestedImpl(int index,BuildTriggerPolicy item){
this.index = index;
this.builder = new BuildTriggerPolicyBuilder(this, item);
}
TriggersNestedImpl(){
this.index = -1;
this.builder = new BuildTriggerPolicyBuilder(this);
}
public N and(){
return (N) BuildConfigSpecFluentImpl.this.setToTriggers(index, builder.build());
}
public N endTrigger(){
return and();
}
}
}