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

io.alauda.kubernetes.api.model.ServiceAccountFluentImpl 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 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 javax.validation.Valid;
import java.util.Collection;
import java.lang.Object;

public class ServiceAccountFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements ServiceAccountFluent{

    private String apiVersion;
    private Boolean automountServiceAccountToken;
    private List imagePullSecrets =  new ArrayList();
    private String kind;
    private ObjectMetaBuilder metadata;
    private List secrets =  new ArrayList();

    public ServiceAccountFluentImpl(){
    }
    public ServiceAccountFluentImpl(ServiceAccount instance){
            this.withApiVersion(instance.getApiVersion()); 
            this.withAutomountServiceAccountToken(instance.getAutomountServiceAccountToken()); 
            this.withImagePullSecrets(instance.getImagePullSecrets()); 
            this.withKind(instance.getKind()); 
            this.withMetadata(instance.getMetadata()); 
            this.withSecrets(instance.getSecrets()); 
    }

    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 Boolean isAutomountServiceAccountToken(){
            return this.automountServiceAccountToken;
    }

    public A withAutomountServiceAccountToken(Boolean automountServiceAccountToken){
            this.automountServiceAccountToken=automountServiceAccountToken; return (A) this;
    }

    public Boolean hasAutomountServiceAccountToken(){
            return this.automountServiceAccountToken!=null;
    }

    public A addToImagePullSecrets(int index,LocalObjectReference item){
            LocalObjectReferenceBuilder builder = new LocalObjectReferenceBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.imagePullSecrets.add(index >= 0 ? index : imagePullSecrets.size(), builder); return (A)this;
    }

    public A setToImagePullSecrets(int index,LocalObjectReference item){
            LocalObjectReferenceBuilder builder = new LocalObjectReferenceBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= imagePullSecrets.size()) { imagePullSecrets.add(builder); } else { imagePullSecrets.set(index, builder);}
             return (A)this;
    }

    public A addToImagePullSecrets(LocalObjectReference... items){
            for (LocalObjectReference item : items) {LocalObjectReferenceBuilder builder = new LocalObjectReferenceBuilder(item);_visitables.add(builder);this.imagePullSecrets.add(builder);} return (A)this;
    }

    public A addAllToImagePullSecrets(Collection items){
            for (LocalObjectReference item : items) {LocalObjectReferenceBuilder builder = new LocalObjectReferenceBuilder(item);_visitables.add(builder);this.imagePullSecrets.add(builder);} return (A)this;
    }

    public A removeFromImagePullSecrets(LocalObjectReference... items){
            for (LocalObjectReference item : items) {LocalObjectReferenceBuilder builder = new LocalObjectReferenceBuilder(item);_visitables.remove(builder);this.imagePullSecrets.remove(builder);} return (A)this;
    }

    public A removeAllFromImagePullSecrets(Collection items){
            for (LocalObjectReference item : items) {LocalObjectReferenceBuilder builder = new LocalObjectReferenceBuilder(item);_visitables.remove(builder);this.imagePullSecrets.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildImagePullSecrets instead.
 */
@Deprecated public List getImagePullSecrets(){
            return build(imagePullSecrets);
    }

    public List buildImagePullSecrets(){
            return build(imagePullSecrets);
    }

    public LocalObjectReference buildImagePullSecret(int index){
            return this.imagePullSecrets.get(index).build();
    }

    public LocalObjectReference buildFirstImagePullSecret(){
            return this.imagePullSecrets.get(0).build();
    }

    public LocalObjectReference buildLastImagePullSecret(){
            return this.imagePullSecrets.get(imagePullSecrets.size() - 1).build();
    }

    public LocalObjectReference buildMatchingImagePullSecret(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (LocalObjectReferenceBuilder item: imagePullSecrets) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withImagePullSecrets(List imagePullSecrets){
            _visitables.removeAll(this.imagePullSecrets);
            this.imagePullSecrets.clear();
            if (imagePullSecrets != null) {for (LocalObjectReference item : imagePullSecrets){this.addToImagePullSecrets(item);}} return (A) this;
    }

    public A withImagePullSecrets(LocalObjectReference... imagePullSecrets){
            this.imagePullSecrets.clear(); if (imagePullSecrets != null) {for (LocalObjectReference item :imagePullSecrets){ this.addToImagePullSecrets(item);}} return (A) this;
    }

    public Boolean hasImagePullSecrets(){
            return imagePullSecrets!= null && !imagePullSecrets.isEmpty();
    }

    public ServiceAccountFluent.ImagePullSecretsNested addNewImagePullSecret(){
            return new ImagePullSecretsNestedImpl();
    }

    public ServiceAccountFluent.ImagePullSecretsNested addNewImagePullSecretLike(LocalObjectReference item){
            return new ImagePullSecretsNestedImpl(-1, item);
    }

    public ServiceAccountFluent.ImagePullSecretsNested setNewImagePullSecretLike(int index,LocalObjectReference item){
            return new ImagePullSecretsNestedImpl(index, item);
    }

    public ServiceAccountFluent.ImagePullSecretsNested editImagePullSecret(int index){
            if (imagePullSecrets.size() <= index) throw new RuntimeException("Can't edit imagePullSecrets. Index exceeds size.");
            return setNewImagePullSecretLike(index, buildImagePullSecret(index));
    }

    public ServiceAccountFluent.ImagePullSecretsNested editFirstImagePullSecret(){
            if (imagePullSecrets.size() == 0) throw new RuntimeException("Can't edit first imagePullSecrets. The list is empty.");
            return setNewImagePullSecretLike(0, buildImagePullSecret(0));
    }

    public ServiceAccountFluent.ImagePullSecretsNested editLastImagePullSecret(){
            int index = imagePullSecrets.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last imagePullSecrets. The list is empty.");
            return setNewImagePullSecretLike(index, buildImagePullSecret(index));
    }

    public ServiceAccountFluent.ImagePullSecretsNested editMatchingImagePullSecret(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i withNewMetadata(){
            return new MetadataNestedImpl();
    }

    public ServiceAccountFluent.MetadataNested withNewMetadataLike(ObjectMeta item){
            return new MetadataNestedImpl(item);
    }

    public ServiceAccountFluent.MetadataNested editMetadata(){
            return withNewMetadataLike(getMetadata());
    }

    public ServiceAccountFluent.MetadataNested editOrNewMetadata(){
            return withNewMetadataLike(getMetadata() != null ? getMetadata(): new ObjectMetaBuilder().build());
    }

    public ServiceAccountFluent.MetadataNested editOrNewMetadataLike(ObjectMeta item){
            return withNewMetadataLike(getMetadata() != null ? getMetadata(): item);
    }

    public A addToSecrets(int index,ObjectReference item){
            ObjectReferenceBuilder builder = new ObjectReferenceBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.secrets.add(index >= 0 ? index : secrets.size(), builder); return (A)this;
    }

    public A setToSecrets(int index,ObjectReference item){
            ObjectReferenceBuilder builder = new ObjectReferenceBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= secrets.size()) { secrets.add(builder); } else { secrets.set(index, builder);}
             return (A)this;
    }

    public A addToSecrets(ObjectReference... items){
            for (ObjectReference item : items) {ObjectReferenceBuilder builder = new ObjectReferenceBuilder(item);_visitables.add(builder);this.secrets.add(builder);} return (A)this;
    }

    public A addAllToSecrets(Collection items){
            for (ObjectReference item : items) {ObjectReferenceBuilder builder = new ObjectReferenceBuilder(item);_visitables.add(builder);this.secrets.add(builder);} return (A)this;
    }

    public A removeFromSecrets(ObjectReference... items){
            for (ObjectReference item : items) {ObjectReferenceBuilder builder = new ObjectReferenceBuilder(item);_visitables.remove(builder);this.secrets.remove(builder);} return (A)this;
    }

    public A removeAllFromSecrets(Collection items){
            for (ObjectReference item : items) {ObjectReferenceBuilder builder = new ObjectReferenceBuilder(item);_visitables.remove(builder);this.secrets.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildSecrets instead.
 */
@Deprecated public List getSecrets(){
            return build(secrets);
    }

    public List buildSecrets(){
            return build(secrets);
    }

    public ObjectReference buildSecret(int index){
            return this.secrets.get(index).build();
    }

    public ObjectReference buildFirstSecret(){
            return this.secrets.get(0).build();
    }

    public ObjectReference buildLastSecret(){
            return this.secrets.get(secrets.size() - 1).build();
    }

    public ObjectReference buildMatchingSecret(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (ObjectReferenceBuilder item: secrets) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withSecrets(List secrets){
            _visitables.removeAll(this.secrets);
            this.secrets.clear();
            if (secrets != null) {for (ObjectReference item : secrets){this.addToSecrets(item);}} return (A) this;
    }

    public A withSecrets(ObjectReference... secrets){
            this.secrets.clear(); if (secrets != null) {for (ObjectReference item :secrets){ this.addToSecrets(item);}} return (A) this;
    }

    public Boolean hasSecrets(){
            return secrets!= null && !secrets.isEmpty();
    }

    public ServiceAccountFluent.SecretsNested addNewSecret(){
            return new SecretsNestedImpl();
    }

    public ServiceAccountFluent.SecretsNested addNewSecretLike(ObjectReference item){
            return new SecretsNestedImpl(-1, item);
    }

    public ServiceAccountFluent.SecretsNested setNewSecretLike(int index,ObjectReference item){
            return new SecretsNestedImpl(index, item);
    }

    public ServiceAccountFluent.SecretsNested editSecret(int index){
            if (secrets.size() <= index) throw new RuntimeException("Can't edit secrets. Index exceeds size.");
            return setNewSecretLike(index, buildSecret(index));
    }

    public ServiceAccountFluent.SecretsNested editFirstSecret(){
            if (secrets.size() == 0) throw new RuntimeException("Can't edit first secrets. The list is empty.");
            return setNewSecretLike(0, buildSecret(0));
    }

    public ServiceAccountFluent.SecretsNested editLastSecret(){
            int index = secrets.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last secrets. The list is empty.");
            return setNewSecretLike(index, buildSecret(index));
    }

    public ServiceAccountFluent.SecretsNested editMatchingSecret(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i extends LocalObjectReferenceFluentImpl> implements ServiceAccountFluent.ImagePullSecretsNested,io.alauda.kubernetes.api.builder.Nested{

            private final LocalObjectReferenceBuilder builder;
        private final int index;
    
            ImagePullSecretsNestedImpl(int index,LocalObjectReference item){
                    this.index = index;
                    this.builder = new LocalObjectReferenceBuilder(this, item);
            }
            ImagePullSecretsNestedImpl(){
                    this.index = -1;
                    this.builder = new LocalObjectReferenceBuilder(this);
            }
    
    public N and(){
            return (N) ServiceAccountFluentImpl.this.setToImagePullSecrets(index, builder.build());
    }
    public N endImagePullSecret(){
            return and();
    }

}
    public class MetadataNestedImpl extends ObjectMetaFluentImpl> implements ServiceAccountFluent.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) ServiceAccountFluentImpl.this.withMetadata(builder.build());
    }
    public N endMetadata(){
            return and();
    }

}
    public class SecretsNestedImpl extends ObjectReferenceFluentImpl> implements ServiceAccountFluent.SecretsNested,io.alauda.kubernetes.api.builder.Nested{

            private final ObjectReferenceBuilder builder;
        private final int index;
    
            SecretsNestedImpl(int index,ObjectReference item){
                    this.index = index;
                    this.builder = new ObjectReferenceBuilder(this, item);
            }
            SecretsNestedImpl(){
                    this.index = -1;
                    this.builder = new ObjectReferenceBuilder(this);
            }
    
    public N and(){
            return (N) ServiceAccountFluentImpl.this.setToSecrets(index, builder.build());
    }
    public N endSecret(){
            return and();
    }

}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy