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

io.kubernetes.client.openapi.models.V1ServiceAccountFluentImpl Maven / Gradle / Ivy

There is a newer version: 22.0.0
Show newest version
package io.kubernetes.client.openapi.models;

import io.kubernetes.client.fluent.VisitableBuilder;
import java.lang.StringBuilder;
import com.google.gson.annotations.SerializedName;
import io.kubernetes.client.fluent.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.kubernetes.client.fluent.Predicate;
import java.lang.Deprecated;
import io.kubernetes.client.fluent.BaseFluent;
import java.util.Iterator;
import java.util.List;
import java.lang.Boolean;
import java.lang.StringBuffer;
import java.util.Collection;
import java.lang.Object;

public class V1ServiceAccountFluentImpl> extends io.kubernetes.client.fluent.BaseFluent implements V1ServiceAccountFluent {

    private String apiVersion;
    private Boolean automountServiceAccountToken;
    private List imagePullSecrets;
    private String kind;
    private V1ObjectMetaBuilder metadata;
    private List secrets;

    public V1ServiceAccountFluentImpl() { 
    }


    public V1ServiceAccountFluentImpl(V1ServiceAccount 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 A withNewApiVersion(String arg1) {
        return (A)withApiVersion(new String(arg1));
    }

    public A withNewApiVersion(StringBuilder arg1) {
        return (A)withApiVersion(new String(arg1));
    }

    public A withNewApiVersion(StringBuffer arg1) {
        return (A)withApiVersion(new String(arg1));
    }

    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 withNewAutomountServiceAccountToken(String arg1) {
        return (A)withAutomountServiceAccountToken(new Boolean(arg1));
    }

    public A withNewAutomountServiceAccountToken(boolean arg1) {
        return (A)withAutomountServiceAccountToken(new Boolean(arg1));
    }

    public A addToImagePullSecrets(int index,V1LocalObjectReference item) {
        if (this.imagePullSecrets == null) {this.imagePullSecrets = new ArrayList();}
        V1LocalObjectReferenceBuilder builder = new V1LocalObjectReferenceBuilder(item);_visitables.get("imagePullSecrets").add(index >= 0 ? index : _visitables.get("imagePullSecrets").size(), builder);this.imagePullSecrets.add(index >= 0 ? index : imagePullSecrets.size(), builder); return (A)this;
    }

    public A setToImagePullSecrets(int index,V1LocalObjectReference item) {
        if (this.imagePullSecrets == null) {this.imagePullSecrets = new ArrayList();}
        V1LocalObjectReferenceBuilder builder = new V1LocalObjectReferenceBuilder(item);
        if (index < 0 || index >= _visitables.get("imagePullSecrets").size()) { _visitables.get("imagePullSecrets").add(builder); } else { _visitables.get("imagePullSecrets").set(index, builder);}
        if (index < 0 || index >= imagePullSecrets.size()) { imagePullSecrets.add(builder); } else { imagePullSecrets.set(index, builder);}
         return (A)this;
    }

    public A addToImagePullSecrets(V1LocalObjectReference... items) {
        if (this.imagePullSecrets == null) {this.imagePullSecrets = new ArrayList();}
        for (V1LocalObjectReference item : items) {V1LocalObjectReferenceBuilder builder = new V1LocalObjectReferenceBuilder(item);_visitables.get("imagePullSecrets").add(builder);this.imagePullSecrets.add(builder);} return (A)this;
    }

    public A addAllToImagePullSecrets(Collection items) {
        if (this.imagePullSecrets == null) {this.imagePullSecrets = new ArrayList();}
        for (V1LocalObjectReference item : items) {V1LocalObjectReferenceBuilder builder = new V1LocalObjectReferenceBuilder(item);_visitables.get("imagePullSecrets").add(builder);this.imagePullSecrets.add(builder);} return (A)this;
    }

    public A removeFromImagePullSecrets(V1LocalObjectReference... items) {
        for (V1LocalObjectReference item : items) {V1LocalObjectReferenceBuilder builder = new V1LocalObjectReferenceBuilder(item);_visitables.get("imagePullSecrets").remove(builder);if (this.imagePullSecrets != null) {this.imagePullSecrets.remove(builder);}} return (A)this;
    }

    public A removeAllFromImagePullSecrets(Collection items) {
        for (V1LocalObjectReference item : items) {V1LocalObjectReferenceBuilder builder = new V1LocalObjectReferenceBuilder(item);_visitables.get("imagePullSecrets").remove(builder);if (this.imagePullSecrets != null) {this.imagePullSecrets.remove(builder);}} return (A)this;
    }

    public A removeMatchingFromImagePullSecrets(io.kubernetes.client.fluent.Predicate predicate) {
        if (imagePullSecrets == null) return (A) this;
        final Iterator each = imagePullSecrets.iterator();
        final List visitables = _visitables.get("imagePullSecrets");
        while (each.hasNext()) {
          V1LocalObjectReferenceBuilder builder = each.next();
          if (predicate.apply(builder)) {
            visitables.remove(builder);
            each.remove();
          }
        }
        return (A)this;
    }

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

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

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

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

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

    public V1LocalObjectReference buildMatchingImagePullSecret(io.kubernetes.client.fluent.Predicate predicate) {
        for (V1LocalObjectReferenceBuilder item: imagePullSecrets) { if(predicate.apply(item)){ return item.build();} } return null;
    }

    public Boolean hasMatchingImagePullSecret(io.kubernetes.client.fluent.Predicate predicate) {
        for (V1LocalObjectReferenceBuilder item: imagePullSecrets) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A withImagePullSecrets(List imagePullSecrets) {
        if (this.imagePullSecrets != null) { _visitables.get("imagePullSecrets").removeAll(this.imagePullSecrets);}
        if (imagePullSecrets != null) {this.imagePullSecrets = new ArrayList(); for (V1LocalObjectReference item : imagePullSecrets){this.addToImagePullSecrets(item);}} else { this.imagePullSecrets = null;} return (A) this;
    }

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

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

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

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

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

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

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

    public V1ServiceAccountFluent.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 V1ServiceAccountFluent.ImagePullSecretsNested editMatchingImagePullSecret(io.kubernetes.client.fluent.Predicate predicate) {
        int index = -1;
        for (int i=0;i withNewMetadata() {
        return new MetadataNestedImpl();
    }

    public V1ServiceAccountFluent.MetadataNested withNewMetadataLike(V1ObjectMeta item) {
        return new MetadataNestedImpl(item);
    }

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

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

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

    public A addToSecrets(int index,V1ObjectReference item) {
        if (this.secrets == null) {this.secrets = new ArrayList();}
        V1ObjectReferenceBuilder builder = new V1ObjectReferenceBuilder(item);_visitables.get("secrets").add(index >= 0 ? index : _visitables.get("secrets").size(), builder);this.secrets.add(index >= 0 ? index : secrets.size(), builder); return (A)this;
    }

    public A setToSecrets(int index,V1ObjectReference item) {
        if (this.secrets == null) {this.secrets = new ArrayList();}
        V1ObjectReferenceBuilder builder = new V1ObjectReferenceBuilder(item);
        if (index < 0 || index >= _visitables.get("secrets").size()) { _visitables.get("secrets").add(builder); } else { _visitables.get("secrets").set(index, builder);}
        if (index < 0 || index >= secrets.size()) { secrets.add(builder); } else { secrets.set(index, builder);}
         return (A)this;
    }

    public A addToSecrets(V1ObjectReference... items) {
        if (this.secrets == null) {this.secrets = new ArrayList();}
        for (V1ObjectReference item : items) {V1ObjectReferenceBuilder builder = new V1ObjectReferenceBuilder(item);_visitables.get("secrets").add(builder);this.secrets.add(builder);} return (A)this;
    }

    public A addAllToSecrets(Collection items) {
        if (this.secrets == null) {this.secrets = new ArrayList();}
        for (V1ObjectReference item : items) {V1ObjectReferenceBuilder builder = new V1ObjectReferenceBuilder(item);_visitables.get("secrets").add(builder);this.secrets.add(builder);} return (A)this;
    }

    public A removeFromSecrets(V1ObjectReference... items) {
        for (V1ObjectReference item : items) {V1ObjectReferenceBuilder builder = new V1ObjectReferenceBuilder(item);_visitables.get("secrets").remove(builder);if (this.secrets != null) {this.secrets.remove(builder);}} return (A)this;
    }

    public A removeAllFromSecrets(Collection items) {
        for (V1ObjectReference item : items) {V1ObjectReferenceBuilder builder = new V1ObjectReferenceBuilder(item);_visitables.get("secrets").remove(builder);if (this.secrets != null) {this.secrets.remove(builder);}} return (A)this;
    }

    public A removeMatchingFromSecrets(io.kubernetes.client.fluent.Predicate predicate) {
        if (secrets == null) return (A) this;
        final Iterator each = secrets.iterator();
        final List visitables = _visitables.get("secrets");
        while (each.hasNext()) {
          V1ObjectReferenceBuilder builder = each.next();
          if (predicate.apply(builder)) {
            visitables.remove(builder);
            each.remove();
          }
        }
        return (A)this;
    }

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

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

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

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

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

    public V1ObjectReference buildMatchingSecret(io.kubernetes.client.fluent.Predicate predicate) {
        for (V1ObjectReferenceBuilder item: secrets) { if(predicate.apply(item)){ return item.build();} } return null;
    }

    public Boolean hasMatchingSecret(io.kubernetes.client.fluent.Predicate predicate) {
        for (V1ObjectReferenceBuilder item: secrets) { if(predicate.apply(item)){ return true;} } return false;
    }

    public A withSecrets(List secrets) {
        if (this.secrets != null) { _visitables.get("secrets").removeAll(this.secrets);}
        if (secrets != null) {this.secrets = new ArrayList(); for (V1ObjectReference item : secrets){this.addToSecrets(item);}} else { this.secrets = null;} return (A) this;
    }

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

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

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

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

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

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

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

    public V1ServiceAccountFluent.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 V1ServiceAccountFluent.SecretsNested editMatchingSecret(io.kubernetes.client.fluent.Predicate predicate) {
        int index = -1;
        for (int i=0;i extends V1LocalObjectReferenceFluentImpl> implements V1ServiceAccountFluent.ImagePullSecretsNested,io.kubernetes.client.fluent.Nested {
        private final V1LocalObjectReferenceBuilder builder;
        private final int index;

        ImagePullSecretsNestedImpl(int index,V1LocalObjectReference item) {
            this.index = index;
            this.builder = new V1LocalObjectReferenceBuilder(this, item);
        }

        ImagePullSecretsNestedImpl() {
            this.index = -1;
            this.builder = new V1LocalObjectReferenceBuilder(this);
        }

        public N and() {
             return (N) V1ServiceAccountFluentImpl.this.setToImagePullSecrets(index,builder.build());
        }

        public N endImagePullSecret() {
             return and();
        }
    }


    public class MetadataNestedImpl extends V1ObjectMetaFluentImpl> implements V1ServiceAccountFluent.MetadataNested,io.kubernetes.client.fluent.Nested {
        private final V1ObjectMetaBuilder builder;

        MetadataNestedImpl(V1ObjectMeta item) {
            this.builder = new V1ObjectMetaBuilder(this, item);
        }

        MetadataNestedImpl() {
            this.builder = new V1ObjectMetaBuilder(this);
        }

        public N and() {
             return (N) V1ServiceAccountFluentImpl.this.withMetadata(builder.build());
        }

        public N endMetadata() {
             return and();
        }
    }


    public class SecretsNestedImpl extends V1ObjectReferenceFluentImpl> implements V1ServiceAccountFluent.SecretsNested,io.kubernetes.client.fluent.Nested {
        private final V1ObjectReferenceBuilder builder;
        private final int index;

        SecretsNestedImpl(int index,V1ObjectReference item) {
            this.index = index;
            this.builder = new V1ObjectReferenceBuilder(this, item);
        }

        SecretsNestedImpl() {
            this.index = -1;
            this.builder = new V1ObjectReferenceBuilder(this);
        }

        public N and() {
             return (N) V1ServiceAccountFluentImpl.this.setToSecrets(index,builder.build());
        }

        public N endSecret() {
             return and();
        }
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy