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

annotations.io.alauda.kubernetes.api.model.AuthInfoFluentImpl 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 java.lang.String;
import io.alauda.kubernetes.api.builder.Predicate;
import java.util.LinkedHashMap;
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;
import java.util.Map;

public class AuthInfoFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements AuthInfoFluent{

    private String as;
    private List asGroups = new ArrayList();
    private Map> asUserExtra = new LinkedHashMap>();
    private AuthProviderConfigBuilder authProvider;
    private String clientCertificate;
    private String clientCertificateData;
    private String clientKey;
    private String clientKeyData;
    private List extensions =  new ArrayList();
    private String password;
    private String token;
    private String tokenFile;
    private String username;

    public AuthInfoFluentImpl(){
    }
    public AuthInfoFluentImpl(AuthInfo instance){
            this.withAs(instance.getAs()); 
            this.withAsGroups(instance.getAsGroups()); 
            this.withAsUserExtra(instance.getAsUserExtra()); 
            this.withAuthProvider(instance.getAuthProvider()); 
            this.withClientCertificate(instance.getClientCertificate()); 
            this.withClientCertificateData(instance.getClientCertificateData()); 
            this.withClientKey(instance.getClientKey()); 
            this.withClientKeyData(instance.getClientKeyData()); 
            this.withExtensions(instance.getExtensions()); 
            this.withPassword(instance.getPassword()); 
            this.withToken(instance.getToken()); 
            this.withTokenFile(instance.getTokenFile()); 
            this.withUsername(instance.getUsername()); 
    }

    public String getAs(){
            return this.as;
    }

    public A withAs(String as){
            this.as=as; return (A) this;
    }

    public Boolean hasAs(){
            return this.as!=null;
    }

    public A addToAsGroups(int index,String item){
            this.asGroups.add(index, item); return (A)this;
    }

    public A setToAsGroups(int index,String item){
            this.asGroups.set(index, item); return (A)this;
    }

    public A addToAsGroups(String... items){
            for (String item : items) {this.asGroups.add(item);} return (A)this;
    }

    public A addAllToAsGroups(Collection items){
            for (String item : items) {this.asGroups.add(item);} return (A)this;
    }

    public A removeFromAsGroups(String... items){
            for (String item : items) {this.asGroups.remove(item);} return (A)this;
    }

    public A removeAllFromAsGroups(Collection items){
            for (String item : items) {this.asGroups.remove(item);} return (A)this;
    }

    public List getAsGroups(){
            return this.asGroups;
    }

    public String getAsGroup(int index){
            return this.asGroups.get(index);
    }

    public String getFirstAsGroup(){
            return this.asGroups.get(0);
    }

    public String getLastAsGroup(){
            return this.asGroups.get(asGroups.size() - 1);
    }

    public String getMatchingAsGroup(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (String item: asGroups) { if(predicate.apply(item)){return item;} } return null;
    }

    public A withAsGroups(List asGroups){
            this.asGroups.clear();
            if (asGroups != null) {for (String item : asGroups){this.addToAsGroups(item);}} return (A) this;
    }

    public A withAsGroups(String... asGroups){
            this.asGroups.clear(); if (asGroups != null) {for (String item :asGroups){ this.addToAsGroups(item);}} return (A) this;
    }

    public Boolean hasAsGroups(){
            return asGroups!= null && !asGroups.isEmpty();
    }

    public A addToAsUserExtra(String key,ArrayList value){
            if(key != null && value != null) {this.asUserExtra.put(key, value);} return (A)this;
    }

    public A addToAsUserExtra(Map> map){
            if(map != null) { this.asUserExtra.putAll(map);} return (A)this;
    }

    public A removeFromAsUserExtra(String key){
            if(key != null) {this.asUserExtra.remove(key);} return (A)this;
    }

    public A removeFromAsUserExtra(Map> map){
            if(map != null) { for(Object key : map.keySet()) {this.asUserExtra.remove(key);}} return (A)this;
    }

    public Map> getAsUserExtra(){
            return this.asUserExtra;
    }

    public A withAsUserExtra(Map> asUserExtra){
            this.asUserExtra.clear();
            if (asUserExtra != null) {this.asUserExtra.putAll(asUserExtra);} return (A) this;
    }

    public Boolean hasAsUserExtra(){
            return this.asUserExtra!=null;
    }

    
/**
 * This method has been deprecated, please use method buildAuthProvider instead.
 */
@Deprecated public AuthProviderConfig getAuthProvider(){
            return this.authProvider!=null?this.authProvider.build():null;
    }

    public AuthProviderConfig buildAuthProvider(){
            return this.authProvider!=null?this.authProvider.build():null;
    }

    public A withAuthProvider(AuthProviderConfig authProvider){
            _visitables.remove(this.authProvider);
            if (authProvider!=null){ this.authProvider= new AuthProviderConfigBuilder(authProvider); _visitables.add(this.authProvider);} return (A) this;
    }

    public Boolean hasAuthProvider(){
            return this.authProvider!=null;
    }

    public AuthInfoFluent.AuthProviderNested withNewAuthProvider(){
            return new AuthProviderNestedImpl();
    }

    public AuthInfoFluent.AuthProviderNested withNewAuthProviderLike(AuthProviderConfig item){
            return new AuthProviderNestedImpl(item);
    }

    public AuthInfoFluent.AuthProviderNested editAuthProvider(){
            return withNewAuthProviderLike(getAuthProvider());
    }

    public AuthInfoFluent.AuthProviderNested editOrNewAuthProvider(){
            return withNewAuthProviderLike(getAuthProvider() != null ? getAuthProvider(): new AuthProviderConfigBuilder().build());
    }

    public AuthInfoFluent.AuthProviderNested editOrNewAuthProviderLike(AuthProviderConfig item){
            return withNewAuthProviderLike(getAuthProvider() != null ? getAuthProvider(): item);
    }

    public String getClientCertificate(){
            return this.clientCertificate;
    }

    public A withClientCertificate(String clientCertificate){
            this.clientCertificate=clientCertificate; return (A) this;
    }

    public Boolean hasClientCertificate(){
            return this.clientCertificate!=null;
    }

    public String getClientCertificateData(){
            return this.clientCertificateData;
    }

    public A withClientCertificateData(String clientCertificateData){
            this.clientCertificateData=clientCertificateData; return (A) this;
    }

    public Boolean hasClientCertificateData(){
            return this.clientCertificateData!=null;
    }

    public String getClientKey(){
            return this.clientKey;
    }

    public A withClientKey(String clientKey){
            this.clientKey=clientKey; return (A) this;
    }

    public Boolean hasClientKey(){
            return this.clientKey!=null;
    }

    public String getClientKeyData(){
            return this.clientKeyData;
    }

    public A withClientKeyData(String clientKeyData){
            this.clientKeyData=clientKeyData; return (A) this;
    }

    public Boolean hasClientKeyData(){
            return this.clientKeyData!=null;
    }

    public A addToExtensions(int index,NamedExtension item){
            NamedExtensionBuilder builder = new NamedExtensionBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.extensions.add(index >= 0 ? index : extensions.size(), builder); return (A)this;
    }

    public A setToExtensions(int index,NamedExtension item){
            NamedExtensionBuilder builder = new NamedExtensionBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= extensions.size()) { extensions.add(builder); } else { extensions.set(index, builder);}
             return (A)this;
    }

    public A addToExtensions(NamedExtension... items){
            for (NamedExtension item : items) {NamedExtensionBuilder builder = new NamedExtensionBuilder(item);_visitables.add(builder);this.extensions.add(builder);} return (A)this;
    }

    public A addAllToExtensions(Collection items){
            for (NamedExtension item : items) {NamedExtensionBuilder builder = new NamedExtensionBuilder(item);_visitables.add(builder);this.extensions.add(builder);} return (A)this;
    }

    public A removeFromExtensions(NamedExtension... items){
            for (NamedExtension item : items) {NamedExtensionBuilder builder = new NamedExtensionBuilder(item);_visitables.remove(builder);this.extensions.remove(builder);} return (A)this;
    }

    public A removeAllFromExtensions(Collection items){
            for (NamedExtension item : items) {NamedExtensionBuilder builder = new NamedExtensionBuilder(item);_visitables.remove(builder);this.extensions.remove(builder);} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildExtensions instead.
 */
@Deprecated public List getExtensions(){
            return build(extensions);
    }

    public List buildExtensions(){
            return build(extensions);
    }

    public NamedExtension buildExtension(int index){
            return this.extensions.get(index).build();
    }

    public NamedExtension buildFirstExtension(){
            return this.extensions.get(0).build();
    }

    public NamedExtension buildLastExtension(){
            return this.extensions.get(extensions.size() - 1).build();
    }

    public NamedExtension buildMatchingExtension(io.alauda.kubernetes.api.builder.Predicate predicate){
            for (NamedExtensionBuilder item: extensions) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withExtensions(List extensions){
            _visitables.removeAll(this.extensions);
            this.extensions.clear();
            if (extensions != null) {for (NamedExtension item : extensions){this.addToExtensions(item);}} return (A) this;
    }

    public A withExtensions(NamedExtension... extensions){
            this.extensions.clear(); if (extensions != null) {for (NamedExtension item :extensions){ this.addToExtensions(item);}} return (A) this;
    }

    public Boolean hasExtensions(){
            return extensions!= null && !extensions.isEmpty();
    }

    public AuthInfoFluent.ExtensionsNested addNewExtension(){
            return new ExtensionsNestedImpl();
    }

    public AuthInfoFluent.ExtensionsNested addNewExtensionLike(NamedExtension item){
            return new ExtensionsNestedImpl(-1, item);
    }

    public AuthInfoFluent.ExtensionsNested setNewExtensionLike(int index,NamedExtension item){
            return new ExtensionsNestedImpl(index, item);
    }

    public AuthInfoFluent.ExtensionsNested editExtension(int index){
            if (extensions.size() <= index) throw new RuntimeException("Can't edit extensions. Index exceeds size.");
            return setNewExtensionLike(index, buildExtension(index));
    }

    public AuthInfoFluent.ExtensionsNested editFirstExtension(){
            if (extensions.size() == 0) throw new RuntimeException("Can't edit first extensions. The list is empty.");
            return setNewExtensionLike(0, buildExtension(0));
    }

    public AuthInfoFluent.ExtensionsNested editLastExtension(){
            int index = extensions.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last extensions. The list is empty.");
            return setNewExtensionLike(index, buildExtension(index));
    }

    public AuthInfoFluent.ExtensionsNested editMatchingExtension(io.alauda.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i extends AuthProviderConfigFluentImpl> implements AuthInfoFluent.AuthProviderNested,io.alauda.kubernetes.api.builder.Nested{

            private final AuthProviderConfigBuilder builder;
    
            AuthProviderNestedImpl(AuthProviderConfig item){
                    this.builder = new AuthProviderConfigBuilder(this, item);
            }
            AuthProviderNestedImpl(){
                    this.builder = new AuthProviderConfigBuilder(this);
            }
    
    public N and(){
            return (N) AuthInfoFluentImpl.this.withAuthProvider(builder.build());
    }
    public N endAuthProvider(){
            return and();
    }

}
    public class ExtensionsNestedImpl extends NamedExtensionFluentImpl> implements AuthInfoFluent.ExtensionsNested,io.alauda.kubernetes.api.builder.Nested{

            private final NamedExtensionBuilder builder;
        private final int index;
    
            ExtensionsNestedImpl(int index,NamedExtension item){
                    this.index = index;
                    this.builder = new NamedExtensionBuilder(this, item);
            }
            ExtensionsNestedImpl(){
                    this.index = -1;
                    this.builder = new NamedExtensionBuilder(this);
            }
    
    public N and(){
            return (N) AuthInfoFluentImpl.this.setToExtensions(index, builder.build());
    }
    public N endExtension(){
            return and();
    }

}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy