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

me.snowdrop.istio.api.model.v1.networking.ServerFluentImpl Maven / Gradle / Ivy

package me.snowdrop.istio.api.model.v1.networking;

import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import io.fabric8.kubernetes.api.builder.Predicate;
import java.lang.Deprecated;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.List;
import java.lang.Boolean;
import java.lang.Integer;
import javax.validation.Valid;
import java.util.Collection;
import java.lang.Object;

public class ServerFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements ServerFluent{

    private List hosts;
    private PortBuilder port;
    private TLSOptionsBuilder tls;

    public ServerFluentImpl(){
    }
    public ServerFluentImpl(Server instance){
            this.withHosts(instance.getHosts()); 
            this.withPort(instance.getPort()); 
            this.withTls(instance.getTls()); 
    }

    public A addToHosts(int index,String item){
            if (this.hosts == null) {this.hosts = new ArrayList();}
            this.hosts.add(index, item);
            return (A)this;
    }

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

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

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

    public A removeFromHosts(String... items){
            for (String item : items) {if (this.hosts!= null){ this.hosts.remove(item);}} return (A)this;
    }

    public A removeAllFromHosts(Collection items){
            for (String item : items) {if (this.hosts!= null){ this.hosts.remove(item);}} return (A)this;
    }

    public List getHosts(){
            return this.hosts;
    }

    public String getHost(int index){
            return this.hosts.get(index);
    }

    public String getFirstHost(){
            return this.hosts.get(0);
    }

    public String getLastHost(){
            return this.hosts.get(hosts.size() - 1);
    }

    public String getMatchingHost(io.fabric8.kubernetes.api.builder.Predicate predicate){
            for (String item: hosts) { if(predicate.apply(item)){return item;} } return null;
    }

    public A withHosts(List hosts){
            if (this.hosts != null) { _visitables.removeAll(this.hosts);}
            if (hosts != null) {this.hosts = new ArrayList(); for (String item : hosts){this.addToHosts(item);}} else { this.hosts = null;} return (A) this;
    }

    public A withHosts(String... hosts){
            this.hosts.clear(); if (hosts != null) {for (String item :hosts){ this.addToHosts(item);}} return (A) this;
    }

    public Boolean hasHosts(){
            return hosts != null && !hosts.isEmpty();
    }

    
/**
 * This method has been deprecated, please use method buildPort instead.
 */
@Deprecated public Port getPort(){
            return this.port!=null?this.port.build():null;
    }

    public Port buildPort(){
            return this.port!=null?this.port.build():null;
    }

    public A withPort(Port port){
            _visitables.remove(this.port);
            if (port!=null){ this.port= new PortBuilder(port); _visitables.add(this.port);} return (A) this;
    }

    public Boolean hasPort(){
            return this.port != null;
    }

    public A withNewPort(String name,Integer number,String protocol){
            return (A)withPort(new Port(name, number, protocol));
    }

    public ServerFluent.PortNested withNewPort(){
            return new PortNestedImpl();
    }

    public ServerFluent.PortNested withNewPortLike(Port item){
            return new PortNestedImpl(item);
    }

    public ServerFluent.PortNested editPort(){
            return withNewPortLike(getPort());
    }

    public ServerFluent.PortNested editOrNewPort(){
            return withNewPortLike(getPort() != null ? getPort(): new PortBuilder().build());
    }

    public ServerFluent.PortNested editOrNewPortLike(Port item){
            return withNewPortLike(getPort() != null ? getPort(): item);
    }

    
/**
 * This method has been deprecated, please use method buildTls instead.
 */
@Deprecated public TLSOptions getTls(){
            return this.tls!=null?this.tls.build():null;
    }

    public TLSOptions buildTls(){
            return this.tls!=null?this.tls.build():null;
    }

    public A withTls(TLSOptions tls){
            _visitables.remove(this.tls);
            if (tls!=null){ this.tls= new TLSOptionsBuilder(tls); _visitables.add(this.tls);} return (A) this;
    }

    public Boolean hasTls(){
            return this.tls != null;
    }

    public ServerFluent.TlsNested withNewTls(){
            return new TlsNestedImpl();
    }

    public ServerFluent.TlsNested withNewTlsLike(TLSOptions item){
            return new TlsNestedImpl(item);
    }

    public ServerFluent.TlsNested editTls(){
            return withNewTlsLike(getTls());
    }

    public ServerFluent.TlsNested editOrNewTls(){
            return withNewTlsLike(getTls() != null ? getTls(): new TLSOptionsBuilder().build());
    }

    public ServerFluent.TlsNested editOrNewTlsLike(TLSOptions item){
            return withNewTlsLike(getTls() != null ? getTls(): 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;
            ServerFluentImpl that = (ServerFluentImpl) o;
            if (hosts != null ? !hosts.equals(that.hosts) :that.hosts != null) return false;
            if (port != null ? !port.equals(that.port) :that.port != null) return false;
            if (tls != null ? !tls.equals(that.tls) :that.tls != null) return false;
            return true;
    }


    public class PortNestedImpl extends PortFluentImpl> implements ServerFluent.PortNested,io.fabric8.kubernetes.api.builder.Nested{

            private final PortBuilder builder;
    
            PortNestedImpl(Port item){
                    this.builder = new PortBuilder(this, item);
            }
            PortNestedImpl(){
                    this.builder = new PortBuilder(this);
            }
    
    public N and(){
            return (N) ServerFluentImpl.this.withPort(builder.build());
    }
    public N endPort(){
            return and();
    }

}
    public class TlsNestedImpl extends TLSOptionsFluentImpl> implements ServerFluent.TlsNested,io.fabric8.kubernetes.api.builder.Nested{

            private final TLSOptionsBuilder builder;
    
            TlsNestedImpl(TLSOptions item){
                    this.builder = new TLSOptionsBuilder(this, item);
            }
            TlsNestedImpl(){
                    this.builder = new TLSOptionsBuilder(this);
            }
    
    public N and(){
            return (N) ServerFluentImpl.this.withTls(builder.build());
    }
    public N endTls(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy