
annotations.io.alauda.devops.api.model.OAuthClientFluentImpl Maven / Gradle / Ivy
package io.alauda.devops.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.alauda.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import io.alauda.kubernetes.api.model.validators.CheckObjectMeta;
import java.lang.String;
import javax.validation.constraints.NotNull;
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 io.alauda.kubernetes.api.model.ObjectMeta;
import io.alauda.kubernetes.api.model.ObjectMetaFluentImpl;
import io.alauda.kubernetes.api.model.ObjectMetaBuilder;
import javax.validation.Valid;
import java.util.Collection;
import java.lang.Object;
public class OAuthClientFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements OAuthClientFluent{
private List additionalSecrets = new ArrayList();
private String apiVersion;
private String grantMethod;
private String kind;
private ObjectMetaBuilder metadata;
private List redirectURIs = new ArrayList();
private Boolean respondWithChallenges;
private List scopeRestrictions = new ArrayList();
private String secret;
public OAuthClientFluentImpl(){
}
public OAuthClientFluentImpl(OAuthClient instance){
this.withAdditionalSecrets(instance.getAdditionalSecrets());
this.withApiVersion(instance.getApiVersion());
this.withGrantMethod(instance.getGrantMethod());
this.withKind(instance.getKind());
this.withMetadata(instance.getMetadata());
this.withRedirectURIs(instance.getRedirectURIs());
this.withRespondWithChallenges(instance.getRespondWithChallenges());
this.withScopeRestrictions(instance.getScopeRestrictions());
this.withSecret(instance.getSecret());
}
public A addToAdditionalSecrets(int index,String item){
this.additionalSecrets.add(index, item); return (A)this;
}
public A setToAdditionalSecrets(int index,String item){
this.additionalSecrets.set(index, item); return (A)this;
}
public A addToAdditionalSecrets(String... items){
for (String item : items) {this.additionalSecrets.add(item);} return (A)this;
}
public A addAllToAdditionalSecrets(Collection items){
for (String item : items) {this.additionalSecrets.add(item);} return (A)this;
}
public A removeFromAdditionalSecrets(String... items){
for (String item : items) {this.additionalSecrets.remove(item);} return (A)this;
}
public A removeAllFromAdditionalSecrets(Collection items){
for (String item : items) {this.additionalSecrets.remove(item);} return (A)this;
}
public List getAdditionalSecrets(){
return this.additionalSecrets;
}
public String getAdditionalSecret(int index){
return this.additionalSecrets.get(index);
}
public String getFirstAdditionalSecret(){
return this.additionalSecrets.get(0);
}
public String getLastAdditionalSecret(){
return this.additionalSecrets.get(additionalSecrets.size() - 1);
}
public String getMatchingAdditionalSecret(io.alauda.kubernetes.api.builder.Predicate predicate){
for (String item: additionalSecrets) { if(predicate.apply(item)){return item;} } return null;
}
public A withAdditionalSecrets(List additionalSecrets){
this.additionalSecrets.clear();
if (additionalSecrets != null) {for (String item : additionalSecrets){this.addToAdditionalSecrets(item);}} return (A) this;
}
public A withAdditionalSecrets(String... additionalSecrets){
this.additionalSecrets.clear(); if (additionalSecrets != null) {for (String item :additionalSecrets){ this.addToAdditionalSecrets(item);}} return (A) this;
}
public Boolean hasAdditionalSecrets(){
return additionalSecrets!= null && !additionalSecrets.isEmpty();
}
public String getApiVersion(){
return this.apiVersion;
}
public A withApiVersion(String apiVersion){
this.apiVersion=apiVersion; return (A) this;
}
public Boolean hasApiVersion(){
return this.apiVersion!=null;
}
public String getGrantMethod(){
return this.grantMethod;
}
public A withGrantMethod(String grantMethod){
this.grantMethod=grantMethod; return (A) this;
}
public Boolean hasGrantMethod(){
return this.grantMethod!=null;
}
public String getKind(){
return this.kind;
}
public A withKind(String kind){
this.kind=kind; return (A) this;
}
public Boolean hasKind(){
return this.kind!=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 OAuthClientFluent.MetadataNested withNewMetadata(){
return new MetadataNestedImpl();
}
public OAuthClientFluent.MetadataNested withNewMetadataLike(ObjectMeta item){
return new MetadataNestedImpl(item);
}
public OAuthClientFluent.MetadataNested editMetadata(){
return withNewMetadataLike(getMetadata());
}
public OAuthClientFluent.MetadataNested editOrNewMetadata(){
return withNewMetadataLike(getMetadata() != null ? getMetadata(): new ObjectMetaBuilder().build());
}
public OAuthClientFluent.MetadataNested editOrNewMetadataLike(ObjectMeta item){
return withNewMetadataLike(getMetadata() != null ? getMetadata(): item);
}
public A addToRedirectURIs(int index,String item){
this.redirectURIs.add(index, item); return (A)this;
}
public A setToRedirectURIs(int index,String item){
this.redirectURIs.set(index, item); return (A)this;
}
public A addToRedirectURIs(String... items){
for (String item : items) {this.redirectURIs.add(item);} return (A)this;
}
public A addAllToRedirectURIs(Collection items){
for (String item : items) {this.redirectURIs.add(item);} return (A)this;
}
public A removeFromRedirectURIs(String... items){
for (String item : items) {this.redirectURIs.remove(item);} return (A)this;
}
public A removeAllFromRedirectURIs(Collection items){
for (String item : items) {this.redirectURIs.remove(item);} return (A)this;
}
public List getRedirectURIs(){
return this.redirectURIs;
}
public String getRedirectURI(int index){
return this.redirectURIs.get(index);
}
public String getFirstRedirectURI(){
return this.redirectURIs.get(0);
}
public String getLastRedirectURI(){
return this.redirectURIs.get(redirectURIs.size() - 1);
}
public String getMatchingRedirectURI(io.alauda.kubernetes.api.builder.Predicate predicate){
for (String item: redirectURIs) { if(predicate.apply(item)){return item;} } return null;
}
public A withRedirectURIs(List redirectURIs){
this.redirectURIs.clear();
if (redirectURIs != null) {for (String item : redirectURIs){this.addToRedirectURIs(item);}} return (A) this;
}
public A withRedirectURIs(String... redirectURIs){
this.redirectURIs.clear(); if (redirectURIs != null) {for (String item :redirectURIs){ this.addToRedirectURIs(item);}} return (A) this;
}
public Boolean hasRedirectURIs(){
return redirectURIs!= null && !redirectURIs.isEmpty();
}
public Boolean isRespondWithChallenges(){
return this.respondWithChallenges;
}
public A withRespondWithChallenges(Boolean respondWithChallenges){
this.respondWithChallenges=respondWithChallenges; return (A) this;
}
public Boolean hasRespondWithChallenges(){
return this.respondWithChallenges!=null;
}
public A addToScopeRestrictions(int index,ScopeRestriction item){
ScopeRestrictionBuilder builder = new ScopeRestrictionBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.scopeRestrictions.add(index >= 0 ? index : scopeRestrictions.size(), builder); return (A)this;
}
public A setToScopeRestrictions(int index,ScopeRestriction item){
ScopeRestrictionBuilder builder = new ScopeRestrictionBuilder(item);
if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
if (index < 0 || index >= scopeRestrictions.size()) { scopeRestrictions.add(builder); } else { scopeRestrictions.set(index, builder);}
return (A)this;
}
public A addToScopeRestrictions(ScopeRestriction... items){
for (ScopeRestriction item : items) {ScopeRestrictionBuilder builder = new ScopeRestrictionBuilder(item);_visitables.add(builder);this.scopeRestrictions.add(builder);} return (A)this;
}
public A addAllToScopeRestrictions(Collection items){
for (ScopeRestriction item : items) {ScopeRestrictionBuilder builder = new ScopeRestrictionBuilder(item);_visitables.add(builder);this.scopeRestrictions.add(builder);} return (A)this;
}
public A removeFromScopeRestrictions(ScopeRestriction... items){
for (ScopeRestriction item : items) {ScopeRestrictionBuilder builder = new ScopeRestrictionBuilder(item);_visitables.remove(builder);this.scopeRestrictions.remove(builder);} return (A)this;
}
public A removeAllFromScopeRestrictions(Collection items){
for (ScopeRestriction item : items) {ScopeRestrictionBuilder builder = new ScopeRestrictionBuilder(item);_visitables.remove(builder);this.scopeRestrictions.remove(builder);} return (A)this;
}
/**
* This method has been deprecated, please use method buildScopeRestrictions instead.
*/
@Deprecated public List getScopeRestrictions(){
return build(scopeRestrictions);
}
public List buildScopeRestrictions(){
return build(scopeRestrictions);
}
public ScopeRestriction buildScopeRestriction(int index){
return this.scopeRestrictions.get(index).build();
}
public ScopeRestriction buildFirstScopeRestriction(){
return this.scopeRestrictions.get(0).build();
}
public ScopeRestriction buildLastScopeRestriction(){
return this.scopeRestrictions.get(scopeRestrictions.size() - 1).build();
}
public ScopeRestriction buildMatchingScopeRestriction(io.alauda.kubernetes.api.builder.Predicate predicate){
for (ScopeRestrictionBuilder item: scopeRestrictions) { if(predicate.apply(item)){return item.build();} } return null;
}
public A withScopeRestrictions(List scopeRestrictions){
_visitables.removeAll(this.scopeRestrictions);
this.scopeRestrictions.clear();
if (scopeRestrictions != null) {for (ScopeRestriction item : scopeRestrictions){this.addToScopeRestrictions(item);}} return (A) this;
}
public A withScopeRestrictions(ScopeRestriction... scopeRestrictions){
this.scopeRestrictions.clear(); if (scopeRestrictions != null) {for (ScopeRestriction item :scopeRestrictions){ this.addToScopeRestrictions(item);}} return (A) this;
}
public Boolean hasScopeRestrictions(){
return scopeRestrictions!= null && !scopeRestrictions.isEmpty();
}
public OAuthClientFluent.ScopeRestrictionsNested addNewScopeRestriction(){
return new ScopeRestrictionsNestedImpl();
}
public OAuthClientFluent.ScopeRestrictionsNested addNewScopeRestrictionLike(ScopeRestriction item){
return new ScopeRestrictionsNestedImpl(-1, item);
}
public OAuthClientFluent.ScopeRestrictionsNested setNewScopeRestrictionLike(int index,ScopeRestriction item){
return new ScopeRestrictionsNestedImpl(index, item);
}
public OAuthClientFluent.ScopeRestrictionsNested editScopeRestriction(int index){
if (scopeRestrictions.size() <= index) throw new RuntimeException("Can't edit scopeRestrictions. Index exceeds size.");
return setNewScopeRestrictionLike(index, buildScopeRestriction(index));
}
public OAuthClientFluent.ScopeRestrictionsNested editFirstScopeRestriction(){
if (scopeRestrictions.size() == 0) throw new RuntimeException("Can't edit first scopeRestrictions. The list is empty.");
return setNewScopeRestrictionLike(0, buildScopeRestriction(0));
}
public OAuthClientFluent.ScopeRestrictionsNested editLastScopeRestriction(){
int index = scopeRestrictions.size() - 1;
if (index < 0) throw new RuntimeException("Can't edit last scopeRestrictions. The list is empty.");
return setNewScopeRestrictionLike(index, buildScopeRestriction(index));
}
public OAuthClientFluent.ScopeRestrictionsNested editMatchingScopeRestriction(io.alauda.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends ObjectMetaFluentImpl> implements OAuthClientFluent.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) OAuthClientFluentImpl.this.withMetadata(builder.build());
}
public N endMetadata(){
return and();
}
}
public class ScopeRestrictionsNestedImpl extends ScopeRestrictionFluentImpl> implements OAuthClientFluent.ScopeRestrictionsNested,io.alauda.kubernetes.api.builder.Nested{
private final ScopeRestrictionBuilder builder;
private final int index;
ScopeRestrictionsNestedImpl(int index,ScopeRestriction item){
this.index = index;
this.builder = new ScopeRestrictionBuilder(this, item);
}
ScopeRestrictionsNestedImpl(){
this.index = -1;
this.builder = new ScopeRestrictionBuilder(this);
}
public N and(){
return (N) OAuthClientFluentImpl.this.setToScopeRestrictions(index, builder.build());
}
public N endScopeRestriction(){
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy