annotations.io.alauda.devops.api.model.BuildRequestFluentImpl Maven / Gradle / Ivy
package io.alauda.devops.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.ArrayList;
import io.alauda.kubernetes.api.model.validators.CheckObjectMeta;
import java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import io.alauda.kubernetes.api.builder.BaseFluent;
import io.alauda.kubernetes.api.model.EnvVar;
import java.util.List;
import java.lang.Boolean;
import io.alauda.kubernetes.api.model.ObjectReferenceFluentImpl;
import io.alauda.kubernetes.api.model.ObjectMetaBuilder;
import javax.validation.Valid;
import io.alauda.kubernetes.api.model.ObjectReferenceBuilder;
import java.lang.Long;
import java.util.Collection;
import java.lang.Object;
import io.alauda.kubernetes.api.builder.Nested;
import io.alauda.kubernetes.api.model.EnvVarBuilder;
import javax.validation.constraints.NotNull;
import io.alauda.kubernetes.api.model.ObjectReference;
import java.lang.Deprecated;
import io.alauda.kubernetes.api.model.ObjectMeta;
import io.alauda.kubernetes.api.model.ObjectMetaFluentImpl;
import io.alauda.kubernetes.api.model.EnvVarFluentImpl;
public class BuildRequestFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements BuildRequestFluent{
private String apiVersion;
private BinaryBuildSourceBuilder binary;
private DockerStrategyOptionsBuilder dockerStrategyOptions;
private List env = new ArrayList();
private ObjectReferenceBuilder from;
private String kind;
private Long lastVersion;
private ObjectMetaBuilder metadata;
private SourceRevisionBuilder revision;
private List triggeredBy = new ArrayList();
private ObjectReferenceBuilder triggeredByImage;
public BuildRequestFluentImpl(){
}
public BuildRequestFluentImpl(BuildRequest instance){
this.withApiVersion(instance.getApiVersion());
this.withBinary(instance.getBinary());
this.withDockerStrategyOptions(instance.getDockerStrategyOptions());
this.withEnv(instance.getEnv());
this.withFrom(instance.getFrom());
this.withKind(instance.getKind());
this.withLastVersion(instance.getLastVersion());
this.withMetadata(instance.getMetadata());
this.withRevision(instance.getRevision());
this.withTriggeredBy(instance.getTriggeredBy());
this.withTriggeredByImage(instance.getTriggeredByImage());
}
public String getApiVersion(){
return this.apiVersion;
}
public A withApiVersion(String apiVersion){
this.apiVersion=apiVersion; return (A) this;
}
public Boolean hasApiVersion(){
return this.apiVersion!=null;
}
/**
* This method has been deprecated, please use method buildBinary instead.
*/
@Deprecated public BinaryBuildSource getBinary(){
return this.binary!=null?this.binary.build():null;
}
public BinaryBuildSource buildBinary(){
return this.binary!=null?this.binary.build():null;
}
public A withBinary(BinaryBuildSource binary){
_visitables.remove(this.binary);
if (binary!=null){ this.binary= new BinaryBuildSourceBuilder(binary); _visitables.add(this.binary);} return (A) this;
}
public Boolean hasBinary(){
return this.binary!=null;
}
public BuildRequestFluent.BinaryNested withNewBinary(){
return new BinaryNestedImpl();
}
public BuildRequestFluent.BinaryNested withNewBinaryLike(BinaryBuildSource item){
return new BinaryNestedImpl(item);
}
public BuildRequestFluent.BinaryNested editBinary(){
return withNewBinaryLike(getBinary());
}
public BuildRequestFluent.BinaryNested editOrNewBinary(){
return withNewBinaryLike(getBinary() != null ? getBinary(): new BinaryBuildSourceBuilder().build());
}
public BuildRequestFluent.BinaryNested editOrNewBinaryLike(BinaryBuildSource item){
return withNewBinaryLike(getBinary() != null ? getBinary(): item);
}
public A withNewBinary(String asFile){
return (A)withBinary(new BinaryBuildSource(asFile));
}
/**
* This method has been deprecated, please use method buildDockerStrategyOptions instead.
*/
@Deprecated public DockerStrategyOptions getDockerStrategyOptions(){
return this.dockerStrategyOptions!=null?this.dockerStrategyOptions.build():null;
}
public DockerStrategyOptions buildDockerStrategyOptions(){
return this.dockerStrategyOptions!=null?this.dockerStrategyOptions.build():null;
}
public A withDockerStrategyOptions(DockerStrategyOptions dockerStrategyOptions){
_visitables.remove(this.dockerStrategyOptions);
if (dockerStrategyOptions!=null){ this.dockerStrategyOptions= new DockerStrategyOptionsBuilder(dockerStrategyOptions); _visitables.add(this.dockerStrategyOptions);} return (A) this;
}
public Boolean hasDockerStrategyOptions(){
return this.dockerStrategyOptions!=null;
}
public BuildRequestFluent.DockerStrategyOptionsNested withNewDockerStrategyOptions(){
return new DockerStrategyOptionsNestedImpl();
}
public BuildRequestFluent.DockerStrategyOptionsNested withNewDockerStrategyOptionsLike(DockerStrategyOptions item){
return new DockerStrategyOptionsNestedImpl(item);
}
public BuildRequestFluent.DockerStrategyOptionsNested editDockerStrategyOptions(){
return withNewDockerStrategyOptionsLike(getDockerStrategyOptions());
}
public BuildRequestFluent.DockerStrategyOptionsNested editOrNewDockerStrategyOptions(){
return withNewDockerStrategyOptionsLike(getDockerStrategyOptions() != null ? getDockerStrategyOptions(): new DockerStrategyOptionsBuilder().build());
}
public BuildRequestFluent.DockerStrategyOptionsNested editOrNewDockerStrategyOptionsLike(DockerStrategyOptions item){
return withNewDockerStrategyOptionsLike(getDockerStrategyOptions() != null ? getDockerStrategyOptions(): item);
}
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 BuildRequestFluent.EnvNested addNewEnv(){
return new EnvNestedImpl();
}
public BuildRequestFluent.EnvNested addNewEnvLike(EnvVar item){
return new EnvNestedImpl(-1, item);
}
public BuildRequestFluent.EnvNested setNewEnvLike(int index,EnvVar item){
return new EnvNestedImpl(index, item);
}
public BuildRequestFluent.EnvNested editEnv(int index){
if (env.size() <= index) throw new RuntimeException("Can't edit env. Index exceeds size.");
return setNewEnvLike(index, buildEnv(index));
}
public BuildRequestFluent.EnvNested editFirstEnv(){
if (env.size() == 0) throw new RuntimeException("Can't edit first env. The list is empty.");
return setNewEnvLike(0, buildEnv(0));
}
public BuildRequestFluent.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 BuildRequestFluent.EnvNested editMatchingEnv(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i withNewFrom(){
return new FromNestedImpl();
}
public BuildRequestFluent.FromNested withNewFromLike(ObjectReference item){
return new FromNestedImpl(item);
}
public BuildRequestFluent.FromNested editFrom(){
return withNewFromLike(getFrom());
}
public BuildRequestFluent.FromNested editOrNewFrom(){
return withNewFromLike(getFrom() != null ? getFrom(): new ObjectReferenceBuilder().build());
}
public BuildRequestFluent.FromNested editOrNewFromLike(ObjectReference item){
return withNewFromLike(getFrom() != null ? getFrom(): item);
}
public String getKind(){
return this.kind;
}
public A withKind(String kind){
this.kind=kind; return (A) this;
}
public Boolean hasKind(){
return this.kind!=null;
}
public Long getLastVersion(){
return this.lastVersion;
}
public A withLastVersion(Long lastVersion){
this.lastVersion=lastVersion; return (A) this;
}
public Boolean hasLastVersion(){
return this.lastVersion!=null;
}
/**
* This method has been deprecated, please use method buildMetadata instead.
*/
@Deprecated public ObjectMeta getMetadata(){
return this.metadata!=null?this.metadata.build():null;
}
public ObjectMeta buildMetadata(){
return this.metadata!=null?this.metadata.build():null;
}
public A withMetadata(ObjectMeta metadata){
_visitables.remove(this.metadata);
if (metadata!=null){ this.metadata= new ObjectMetaBuilder(metadata); _visitables.add(this.metadata);} return (A) this;
}
public Boolean hasMetadata(){
return this.metadata!=null;
}
public BuildRequestFluent.MetadataNested withNewMetadata(){
return new MetadataNestedImpl();
}
public BuildRequestFluent.MetadataNested withNewMetadataLike(ObjectMeta item){
return new MetadataNestedImpl(item);
}
public BuildRequestFluent.MetadataNested editMetadata(){
return withNewMetadataLike(getMetadata());
}
public BuildRequestFluent.MetadataNested editOrNewMetadata(){
return withNewMetadataLike(getMetadata() != null ? getMetadata(): new ObjectMetaBuilder().build());
}
public BuildRequestFluent.MetadataNested editOrNewMetadataLike(ObjectMeta item){
return withNewMetadataLike(getMetadata() != null ? getMetadata(): 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 BuildRequestFluent.RevisionNested withNewRevision(){
return new RevisionNestedImpl();
}
public BuildRequestFluent.RevisionNested withNewRevisionLike(SourceRevision item){
return new RevisionNestedImpl(item);
}
public BuildRequestFluent.RevisionNested editRevision(){
return withNewRevisionLike(getRevision());
}
public BuildRequestFluent.RevisionNested editOrNewRevision(){
return withNewRevisionLike(getRevision() != null ? getRevision(): new SourceRevisionBuilder().build());
}
public BuildRequestFluent.RevisionNested editOrNewRevisionLike(SourceRevision item){
return withNewRevisionLike(getRevision() != null ? getRevision(): item);
}
public A addToTriggeredBy(int index,BuildTriggerCause item){
BuildTriggerCauseBuilder builder = new BuildTriggerCauseBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.triggeredBy.add(index >= 0 ? index : triggeredBy.size(), builder); return (A)this;
}
public A setToTriggeredBy(int index,BuildTriggerCause item){
BuildTriggerCauseBuilder builder = new BuildTriggerCauseBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= triggeredBy.size()) { triggeredBy.add(builder); } else { triggeredBy.set(index, builder);}
return (A)this;
}
public A addToTriggeredBy(BuildTriggerCause... items){
for (BuildTriggerCause item : items) {BuildTriggerCauseBuilder builder = new BuildTriggerCauseBuilder(item);_visitables.add(builder);this.triggeredBy.add(builder);} return (A)this;
}
public A addAllToTriggeredBy(Collection items){
for (BuildTriggerCause item : items) {BuildTriggerCauseBuilder builder = new BuildTriggerCauseBuilder(item);_visitables.add(builder);this.triggeredBy.add(builder);} return (A)this;
}
public A removeFromTriggeredBy(BuildTriggerCause... items){
for (BuildTriggerCause item : items) {BuildTriggerCauseBuilder builder = new BuildTriggerCauseBuilder(item);_visitables.remove(builder);this.triggeredBy.remove(builder);} return (A)this;
}
public A removeAllFromTriggeredBy(Collection items){
for (BuildTriggerCause item : items) {BuildTriggerCauseBuilder builder = new BuildTriggerCauseBuilder(item);_visitables.remove(builder);this.triggeredBy.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildTriggeredBy instead.
*/
@Deprecated public List getTriggeredBy(){
return build(triggeredBy);
}
public List buildTriggeredBy(){
return build(triggeredBy);
}
public BuildTriggerCause buildTriggeredBy(int index){
return this.triggeredBy.get(index).build();
}
public BuildTriggerCause buildFirstTriggeredBy(){
return this.triggeredBy.get(0).build();
}
public BuildTriggerCause buildLastTriggeredBy(){
return this.triggeredBy.get(triggeredBy.size() - 1).build();
}
public BuildTriggerCause buildMatchingTriggeredBy(io.alauda.kubernetes.api.builder.Predicate predicate){
for (BuildTriggerCauseBuilder item: triggeredBy) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withTriggeredBy(List triggeredBy){
_visitables.removeAll(this.triggeredBy);
this.triggeredBy.clear();
if (triggeredBy != null) {for (BuildTriggerCause item : triggeredBy){this.addToTriggeredBy(item);}} return (A) this;
}
public A withTriggeredBy(BuildTriggerCause... triggeredBy){
this.triggeredBy.clear(); if (triggeredBy != null) {for (BuildTriggerCause item :triggeredBy){ this.addToTriggeredBy(item);}} return (A) this;
}
public Boolean hasTriggeredBy(){
return triggeredBy!= null && !triggeredBy.isEmpty();
}
public BuildRequestFluent.TriggeredByNested addNewTriggeredBy(){
return new TriggeredByNestedImpl();
}
public BuildRequestFluent.TriggeredByNested addNewTriggeredByLike(BuildTriggerCause item){
return new TriggeredByNestedImpl(-1, item);
}
public BuildRequestFluent.TriggeredByNested setNewTriggeredByLike(int index,BuildTriggerCause item){
return new TriggeredByNestedImpl(index, item);
}
public BuildRequestFluent.TriggeredByNested editTriggeredBy(int index){
if (triggeredBy.size() <= index) throw new RuntimeException("Can't edit triggeredBy. Index exceeds size.");
return setNewTriggeredByLike(index, buildTriggeredBy(index));
}
public BuildRequestFluent.TriggeredByNested editFirstTriggeredBy(){
if (triggeredBy.size() == 0) throw new RuntimeException("Can't edit first triggeredBy. The list is empty.");
return setNewTriggeredByLike(0, buildTriggeredBy(0));
}
public BuildRequestFluent.TriggeredByNested editLastTriggeredBy(){
int index = triggeredBy.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last triggeredBy. The list is empty.");
return setNewTriggeredByLike(index, buildTriggeredBy(index));
}
public BuildRequestFluent.TriggeredByNested editMatchingTriggeredBy(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i withNewTriggeredByImage(){
return new TriggeredByImageNestedImpl();
}
public BuildRequestFluent.TriggeredByImageNested withNewTriggeredByImageLike(ObjectReference item){
return new TriggeredByImageNestedImpl(item);
}
public BuildRequestFluent.TriggeredByImageNested editTriggeredByImage(){
return withNewTriggeredByImageLike(getTriggeredByImage());
}
public BuildRequestFluent.TriggeredByImageNested editOrNewTriggeredByImage(){
return withNewTriggeredByImageLike(getTriggeredByImage() != null ? getTriggeredByImage(): new ObjectReferenceBuilder().build());
}
public BuildRequestFluent.TriggeredByImageNested editOrNewTriggeredByImageLike(ObjectReference item){
return withNewTriggeredByImageLike(getTriggeredByImage() != null ? getTriggeredByImage(): item);
}
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
BuildRequestFluentImpl that = (BuildRequestFluentImpl) o;
if (apiVersion != null ? !apiVersion.equals(that.apiVersion) :that.apiVersion != null) return false;
if (binary != null ? !binary.equals(that.binary) :that.binary != null) return false;
if (dockerStrategyOptions != null ? !dockerStrategyOptions.equals(that.dockerStrategyOptions) :that.dockerStrategyOptions != null) return false;
if (env != null ? !env.equals(that.env) :that.env != null) return false;
if (from != null ? !from.equals(that.from) :that.from != null) return false;
if (kind != null ? !kind.equals(that.kind) :that.kind != null) return false;
if (lastVersion != null ? !lastVersion.equals(that.lastVersion) :that.lastVersion != null) return false;
if (metadata != null ? !metadata.equals(that.metadata) :that.metadata != null) return false;
if (revision != null ? !revision.equals(that.revision) :that.revision != null) return false;
if (triggeredBy != null ? !triggeredBy.equals(that.triggeredBy) :that.triggeredBy != null) return false;
if (triggeredByImage != null ? !triggeredByImage.equals(that.triggeredByImage) :that.triggeredByImage != null) return false;
return true;
}
public class BinaryNestedImpl extends BinaryBuildSourceFluentImpl> implements BuildRequestFluent.BinaryNested,io.alauda.kubernetes.api.builder.Nested{
private final BinaryBuildSourceBuilder builder;
BinaryNestedImpl(BinaryBuildSource item){
this.builder = new BinaryBuildSourceBuilder(this, item);
}
BinaryNestedImpl(){
this.builder = new BinaryBuildSourceBuilder(this);
}
public N and(){
return (N) BuildRequestFluentImpl.this.withBinary(builder.build());
}
public N endBinary(){
return and();
}
}
public class DockerStrategyOptionsNestedImpl extends DockerStrategyOptionsFluentImpl> implements BuildRequestFluent.DockerStrategyOptionsNested,io.alauda.kubernetes.api.builder.Nested{
private final DockerStrategyOptionsBuilder builder;
DockerStrategyOptionsNestedImpl(DockerStrategyOptions item){
this.builder = new DockerStrategyOptionsBuilder(this, item);
}
DockerStrategyOptionsNestedImpl(){
this.builder = new DockerStrategyOptionsBuilder(this);
}
public N and(){
return (N) BuildRequestFluentImpl.this.withDockerStrategyOptions(builder.build());
}
public N endDockerStrategyOptions(){
return and();
}
}
public class EnvNestedImpl extends EnvVarFluentImpl> implements BuildRequestFluent.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) BuildRequestFluentImpl.this.setToEnv(index, builder.build());
}
public N endEnv(){
return and();
}
}
public class FromNestedImpl extends ObjectReferenceFluentImpl> implements BuildRequestFluent.FromNested,io.alauda.kubernetes.api.builder.Nested{
private final ObjectReferenceBuilder builder;
FromNestedImpl(ObjectReference item){
this.builder = new ObjectReferenceBuilder(this, item);
}
FromNestedImpl(){
this.builder = new ObjectReferenceBuilder(this);
}
public N and(){
return (N) BuildRequestFluentImpl.this.withFrom(builder.build());
}
public N endFrom(){
return and();
}
}
public class MetadataNestedImpl extends ObjectMetaFluentImpl> implements BuildRequestFluent.MetadataNested,io.alauda.kubernetes.api.builder.Nested{
private final ObjectMetaBuilder builder;
MetadataNestedImpl(ObjectMeta item){
this.builder = new ObjectMetaBuilder(this, item);
}
MetadataNestedImpl(){
this.builder = new ObjectMetaBuilder(this);
}
public N and(){
return (N) BuildRequestFluentImpl.this.withMetadata(builder.build());
}
public N endMetadata(){
return and();
}
}
public class RevisionNestedImpl extends SourceRevisionFluentImpl> implements BuildRequestFluent.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) BuildRequestFluentImpl.this.withRevision(builder.build());
}
public N endRevision(){
return and();
}
}
public class TriggeredByNestedImpl extends BuildTriggerCauseFluentImpl> implements BuildRequestFluent.TriggeredByNested,io.alauda.kubernetes.api.builder.Nested{
private final BuildTriggerCauseBuilder builder;
private final int index;
TriggeredByNestedImpl(int index,BuildTriggerCause item){
this.index = index;
this.builder = new BuildTriggerCauseBuilder(this, item);
}
TriggeredByNestedImpl(){
this.index = -1;
this.builder = new BuildTriggerCauseBuilder(this);
}
public N and(){
return (N) BuildRequestFluentImpl.this.setToTriggeredBy(index, builder.build());
}
public N endTriggeredBy(){
return and();
}
}
public class TriggeredByImageNestedImpl extends ObjectReferenceFluentImpl> implements BuildRequestFluent.TriggeredByImageNested,io.alauda.kubernetes.api.builder.Nested{
private final ObjectReferenceBuilder builder;
TriggeredByImageNestedImpl(ObjectReference item){
this.builder = new ObjectReferenceBuilder(this, item);
}
TriggeredByImageNestedImpl(){
this.builder = new ObjectReferenceBuilder(this);
}
public N and(){
return (N) BuildRequestFluentImpl.this.withTriggeredByImage(builder.build());
}
public N endTriggeredByImage(){
return and();
}
}
}