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

me.snowdrop.istio.api.model.v1.networking.VirtualServiceFluentImpl 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 javax.validation.Valid;
import java.util.Collection;
import java.lang.Object;

public class VirtualServiceFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements VirtualServiceFluent{

    private List gateways;
    private List hosts;
    private List http;
    private List tcp;

    public VirtualServiceFluentImpl(){
    }
    public VirtualServiceFluentImpl(VirtualService instance){
            this.withGateways(instance.getGateways()); 
            this.withHosts(instance.getHosts()); 
            this.withHttp(instance.getHttp()); 
            this.withTcp(instance.getTcp()); 
    }

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

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

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

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

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

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

    public List getGateways(){
            return this.gateways;
    }

    public String getGateway(int index){
            return this.gateways.get(index);
    }

    public String getFirstGateway(){
            return this.gateways.get(0);
    }

    public String getLastGateway(){
            return this.gateways.get(gateways.size() - 1);
    }

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

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

    public A withGateways(String... gateways){
            this.gateways.clear(); if (gateways != null) {for (String item :gateways){ this.addToGateways(item);}} return (A) this;
    }

    public Boolean hasGateways(){
            return gateways != null && !gateways.isEmpty();
    }

    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();
    }

    public A addToHttp(int index,HTTPRoute item){
            if (this.http == null) {this.http = new ArrayList();}
            HTTPRouteBuilder builder = new HTTPRouteBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.http.add(index >= 0 ? index : http.size(), builder); return (A)this;
    }

    public A setToHttp(int index,HTTPRoute item){
            if (this.http == null) {this.http = new ArrayList();}
            HTTPRouteBuilder builder = new HTTPRouteBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= http.size()) { http.add(builder); } else { http.set(index, builder);}
             return (A)this;
    }

    public A addToHttp(HTTPRoute... items){
            if (this.http == null) {this.http = new ArrayList();}
            for (HTTPRoute item : items) {HTTPRouteBuilder builder = new HTTPRouteBuilder(item);_visitables.add(builder);this.http.add(builder);} return (A)this;
    }

    public A addAllToHttp(Collection items){
            if (this.http == null) {this.http = new ArrayList();}
            for (HTTPRoute item : items) {HTTPRouteBuilder builder = new HTTPRouteBuilder(item);_visitables.add(builder);this.http.add(builder);} return (A)this;
    }

    public A removeFromHttp(HTTPRoute... items){
            for (HTTPRoute item : items) {HTTPRouteBuilder builder = new HTTPRouteBuilder(item);_visitables.remove(builder);if (this.http != null) {this.http.remove(builder);}} return (A)this;
    }

    public A removeAllFromHttp(Collection items){
            for (HTTPRoute item : items) {HTTPRouteBuilder builder = new HTTPRouteBuilder(item);_visitables.remove(builder);if (this.http != null) {this.http.remove(builder);}} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildHttp instead.
 */
@Deprecated public List getHttp(){
            return build(http);
    }

    public List buildHttp(){
            return build(http);
    }

    public HTTPRoute buildHttp(int index){
            return this.http.get(index).build();
    }

    public HTTPRoute buildFirstHttp(){
            return this.http.get(0).build();
    }

    public HTTPRoute buildLastHttp(){
            return this.http.get(http.size() - 1).build();
    }

    public HTTPRoute buildMatchingHttp(io.fabric8.kubernetes.api.builder.Predicate predicate){
            for (HTTPRouteBuilder item: http) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withHttp(List http){
            if (this.http != null) { _visitables.removeAll(this.http);}
            if (http != null) {this.http = new ArrayList(); for (HTTPRoute item : http){this.addToHttp(item);}} else { this.http = null;} return (A) this;
    }

    public A withHttp(HTTPRoute... http){
            this.http.clear(); if (http != null) {for (HTTPRoute item :http){ this.addToHttp(item);}} return (A) this;
    }

    public Boolean hasHttp(){
            return http != null && !http.isEmpty();
    }

    public VirtualServiceFluent.HttpNested addNewHttp(){
            return new HttpNestedImpl();
    }

    public VirtualServiceFluent.HttpNested addNewHttpLike(HTTPRoute item){
            return new HttpNestedImpl(-1, item);
    }

    public VirtualServiceFluent.HttpNested setNewHttpLike(int index,HTTPRoute item){
            return new HttpNestedImpl(index, item);
    }

    public VirtualServiceFluent.HttpNested editHttp(int index){
            if (http.size() <= index) throw new RuntimeException("Can't edit http. Index exceeds size.");
            return setNewHttpLike(index, buildHttp(index));
    }

    public VirtualServiceFluent.HttpNested editFirstHttp(){
            if (http.size() == 0) throw new RuntimeException("Can't edit first http. The list is empty.");
            return setNewHttpLike(0, buildHttp(0));
    }

    public VirtualServiceFluent.HttpNested editLastHttp(){
            int index = http.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last http. The list is empty.");
            return setNewHttpLike(index, buildHttp(index));
    }

    public VirtualServiceFluent.HttpNested editMatchingHttp(io.fabric8.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i();}
            TCPRouteBuilder builder = new TCPRouteBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.tcp.add(index >= 0 ? index : tcp.size(), builder); return (A)this;
    }

    public A setToTcp(int index,TCPRoute item){
            if (this.tcp == null) {this.tcp = new ArrayList();}
            TCPRouteBuilder builder = new TCPRouteBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= tcp.size()) { tcp.add(builder); } else { tcp.set(index, builder);}
             return (A)this;
    }

    public A addToTcp(TCPRoute... items){
            if (this.tcp == null) {this.tcp = new ArrayList();}
            for (TCPRoute item : items) {TCPRouteBuilder builder = new TCPRouteBuilder(item);_visitables.add(builder);this.tcp.add(builder);} return (A)this;
    }

    public A addAllToTcp(Collection items){
            if (this.tcp == null) {this.tcp = new ArrayList();}
            for (TCPRoute item : items) {TCPRouteBuilder builder = new TCPRouteBuilder(item);_visitables.add(builder);this.tcp.add(builder);} return (A)this;
    }

    public A removeFromTcp(TCPRoute... items){
            for (TCPRoute item : items) {TCPRouteBuilder builder = new TCPRouteBuilder(item);_visitables.remove(builder);if (this.tcp != null) {this.tcp.remove(builder);}} return (A)this;
    }

    public A removeAllFromTcp(Collection items){
            for (TCPRoute item : items) {TCPRouteBuilder builder = new TCPRouteBuilder(item);_visitables.remove(builder);if (this.tcp != null) {this.tcp.remove(builder);}} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildTcp instead.
 */
@Deprecated public List getTcp(){
            return build(tcp);
    }

    public List buildTcp(){
            return build(tcp);
    }

    public TCPRoute buildTcp(int index){
            return this.tcp.get(index).build();
    }

    public TCPRoute buildFirstTcp(){
            return this.tcp.get(0).build();
    }

    public TCPRoute buildLastTcp(){
            return this.tcp.get(tcp.size() - 1).build();
    }

    public TCPRoute buildMatchingTcp(io.fabric8.kubernetes.api.builder.Predicate predicate){
            for (TCPRouteBuilder item: tcp) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withTcp(List tcp){
            if (this.tcp != null) { _visitables.removeAll(this.tcp);}
            if (tcp != null) {this.tcp = new ArrayList(); for (TCPRoute item : tcp){this.addToTcp(item);}} else { this.tcp = null;} return (A) this;
    }

    public A withTcp(TCPRoute... tcp){
            this.tcp.clear(); if (tcp != null) {for (TCPRoute item :tcp){ this.addToTcp(item);}} return (A) this;
    }

    public Boolean hasTcp(){
            return tcp != null && !tcp.isEmpty();
    }

    public VirtualServiceFluent.TcpNested addNewTcp(){
            return new TcpNestedImpl();
    }

    public VirtualServiceFluent.TcpNested addNewTcpLike(TCPRoute item){
            return new TcpNestedImpl(-1, item);
    }

    public VirtualServiceFluent.TcpNested setNewTcpLike(int index,TCPRoute item){
            return new TcpNestedImpl(index, item);
    }

    public VirtualServiceFluent.TcpNested editTcp(int index){
            if (tcp.size() <= index) throw new RuntimeException("Can't edit tcp. Index exceeds size.");
            return setNewTcpLike(index, buildTcp(index));
    }

    public VirtualServiceFluent.TcpNested editFirstTcp(){
            if (tcp.size() == 0) throw new RuntimeException("Can't edit first tcp. The list is empty.");
            return setNewTcpLike(0, buildTcp(0));
    }

    public VirtualServiceFluent.TcpNested editLastTcp(){
            int index = tcp.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last tcp. The list is empty.");
            return setNewTcpLike(index, buildTcp(index));
    }

    public VirtualServiceFluent.TcpNested editMatchingTcp(io.fabric8.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i extends HTTPRouteFluentImpl> implements VirtualServiceFluent.HttpNested,io.fabric8.kubernetes.api.builder.Nested{

            private final HTTPRouteBuilder builder;
        private final int index;
    
            HttpNestedImpl(int index,HTTPRoute item){
                    this.index = index;
                    this.builder = new HTTPRouteBuilder(this, item);
            }
            HttpNestedImpl(){
                    this.index = -1;
                    this.builder = new HTTPRouteBuilder(this);
            }
    
    public N and(){
            return (N) VirtualServiceFluentImpl.this.setToHttp(index, builder.build());
    }
    public N endHttp(){
            return and();
    }

}
    public class TcpNestedImpl extends TCPRouteFluentImpl> implements VirtualServiceFluent.TcpNested,io.fabric8.kubernetes.api.builder.Nested{

            private final TCPRouteBuilder builder;
        private final int index;
    
            TcpNestedImpl(int index,TCPRoute item){
                    this.index = index;
                    this.builder = new TCPRouteBuilder(this, item);
            }
            TcpNestedImpl(){
                    this.index = -1;
                    this.builder = new TCPRouteBuilder(this);
            }
    
    public N and(){
            return (N) VirtualServiceFluentImpl.this.setToTcp(index, builder.build());
    }
    public N endTcp(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy