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

me.snowdrop.istio.api.networking.v1alpha3.ServiceEntrySpecFluentImpl Maven / Gradle / Ivy

package me.snowdrop.istio.api.networking.v1alpha3;

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 ServiceEntrySpecFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements ServiceEntrySpecFluent{

    private List addresses;
    private List endpoints;
    private List exportTo;
    private List hosts;
    private ServiceEntryLocation location;
    private List ports;
    private ServiceEntryResolution resolution;
    private List subjectAltNames;

    public ServiceEntrySpecFluentImpl(){
    }
    public ServiceEntrySpecFluentImpl(ServiceEntrySpec instance){
            this.withAddresses(instance.getAddresses()); 
            this.withEndpoints(instance.getEndpoints()); 
            this.withExportTo(instance.getExportTo()); 
            this.withHosts(instance.getHosts()); 
            this.withLocation(instance.getLocation()); 
            this.withPorts(instance.getPorts()); 
            this.withResolution(instance.getResolution()); 
            this.withSubjectAltNames(instance.getSubjectAltNames()); 
    }

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

    public A setToAddresses(int index,String item){
            if (this.addresses == null) {this.addresses = new ArrayList();}
            this.addresses.set(index, item); return (A)this;
    }

    public A addToAddresses(String... items){
            if (this.addresses == null) {this.addresses = new ArrayList();}
            for (String item : items) {this.addresses.add(item);} return (A)this;
    }

    public A addAllToAddresses(Collection items){
            if (this.addresses == null) {this.addresses = new ArrayList();}
            for (String item : items) {this.addresses.add(item);} return (A)this;
    }

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

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

    public List getAddresses(){
            return this.addresses;
    }

    public String getAddress(int index){
            return this.addresses.get(index);
    }

    public String getFirstAddress(){
            return this.addresses.get(0);
    }

    public String getLastAddress(){
            return this.addresses.get(addresses.size() - 1);
    }

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

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

    public A withAddresses(String... addresses){
            if (this.addresses != null) {this.addresses.clear();}
            if (addresses != null) {for (String item :addresses){ this.addToAddresses(item);}} return (A) this;
    }

    public Boolean hasAddresses(){
            return addresses != null && !addresses.isEmpty();
    }

    public A addToEndpoints(int index,Endpoint item){
            if (this.endpoints == null) {this.endpoints = new ArrayList();}
            EndpointBuilder builder = new EndpointBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.endpoints.add(index >= 0 ? index : endpoints.size(), builder); return (A)this;
    }

    public A setToEndpoints(int index,Endpoint item){
            if (this.endpoints == null) {this.endpoints = new ArrayList();}
            EndpointBuilder builder = new EndpointBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= endpoints.size()) { endpoints.add(builder); } else { endpoints.set(index, builder);}
             return (A)this;
    }

    public A addToEndpoints(Endpoint... items){
            if (this.endpoints == null) {this.endpoints = new ArrayList();}
            for (Endpoint item : items) {EndpointBuilder builder = new EndpointBuilder(item);_visitables.add(builder);this.endpoints.add(builder);} return (A)this;
    }

    public A addAllToEndpoints(Collection items){
            if (this.endpoints == null) {this.endpoints = new ArrayList();}
            for (Endpoint item : items) {EndpointBuilder builder = new EndpointBuilder(item);_visitables.add(builder);this.endpoints.add(builder);} return (A)this;
    }

    public A removeFromEndpoints(Endpoint... items){
            for (Endpoint item : items) {EndpointBuilder builder = new EndpointBuilder(item);_visitables.remove(builder);if (this.endpoints != null) {this.endpoints.remove(builder);}} return (A)this;
    }

    public A removeAllFromEndpoints(Collection items){
            for (Endpoint item : items) {EndpointBuilder builder = new EndpointBuilder(item);_visitables.remove(builder);if (this.endpoints != null) {this.endpoints.remove(builder);}} return (A)this;
    }

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

    public List buildEndpoints(){
            return build(endpoints);
    }

    public Endpoint buildEndpoint(int index){
            return this.endpoints.get(index).build();
    }

    public Endpoint buildFirstEndpoint(){
            return this.endpoints.get(0).build();
    }

    public Endpoint buildLastEndpoint(){
            return this.endpoints.get(endpoints.size() - 1).build();
    }

    public Endpoint buildMatchingEndpoint(io.fabric8.kubernetes.api.builder.Predicate predicate){
            for (EndpointBuilder item: endpoints) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withEndpoints(List endpoints){
            if (this.endpoints != null) { _visitables.removeAll(this.endpoints);}
            if (endpoints != null) {this.endpoints = new ArrayList(); for (Endpoint item : endpoints){this.addToEndpoints(item);}} else { this.endpoints = null;} return (A) this;
    }

    public A withEndpoints(Endpoint... endpoints){
            if (this.endpoints != null) {this.endpoints.clear();}
            if (endpoints != null) {for (Endpoint item :endpoints){ this.addToEndpoints(item);}} return (A) this;
    }

    public Boolean hasEndpoints(){
            return endpoints != null && !endpoints.isEmpty();
    }

    public ServiceEntrySpecFluent.EndpointsNested addNewEndpoint(){
            return new EndpointsNestedImpl();
    }

    public ServiceEntrySpecFluent.EndpointsNested addNewEndpointLike(Endpoint item){
            return new EndpointsNestedImpl(-1, item);
    }

    public ServiceEntrySpecFluent.EndpointsNested setNewEndpointLike(int index,Endpoint item){
            return new EndpointsNestedImpl(index, item);
    }

    public ServiceEntrySpecFluent.EndpointsNested editEndpoint(int index){
            if (endpoints.size() <= index) throw new RuntimeException("Can't edit endpoints. Index exceeds size.");
            return setNewEndpointLike(index, buildEndpoint(index));
    }

    public ServiceEntrySpecFluent.EndpointsNested editFirstEndpoint(){
            if (endpoints.size() == 0) throw new RuntimeException("Can't edit first endpoints. The list is empty.");
            return setNewEndpointLike(0, buildEndpoint(0));
    }

    public ServiceEntrySpecFluent.EndpointsNested editLastEndpoint(){
            int index = endpoints.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last endpoints. The list is empty.");
            return setNewEndpointLike(index, buildEndpoint(index));
    }

    public ServiceEntrySpecFluent.EndpointsNested editMatchingEndpoint(io.fabric8.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i();}
            this.exportTo.add(index, item);
            return (A)this;
    }

    public A setToExportTo(int index,String item){
            if (this.exportTo == null) {this.exportTo = new ArrayList();}
            this.exportTo.set(index, item); return (A)this;
    }

    public A addToExportTo(String... items){
            if (this.exportTo == null) {this.exportTo = new ArrayList();}
            for (String item : items) {this.exportTo.add(item);} return (A)this;
    }

    public A addAllToExportTo(Collection items){
            if (this.exportTo == null) {this.exportTo = new ArrayList();}
            for (String item : items) {this.exportTo.add(item);} return (A)this;
    }

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

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

    public List getExportTo(){
            return this.exportTo;
    }

    public String getExportTo(int index){
            return this.exportTo.get(index);
    }

    public String getFirstExportTo(){
            return this.exportTo.get(0);
    }

    public String getLastExportTo(){
            return this.exportTo.get(exportTo.size() - 1);
    }

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

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

    public A withExportTo(String... exportTo){
            if (this.exportTo != null) {this.exportTo.clear();}
            if (exportTo != null) {for (String item :exportTo){ this.addToExportTo(item);}} return (A) this;
    }

    public Boolean hasExportTo(){
            return exportTo != null && !exportTo.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){
            if (this.hosts == null) {this.hosts = new ArrayList();}
            this.hosts.set(index, item); return (A)this;
    }

    public A addToHosts(String... items){
            if (this.hosts == null) {this.hosts = new ArrayList();}
            for (String item : items) {this.hosts.add(item);} return (A)this;
    }

    public A addAllToHosts(Collection items){
            if (this.hosts == null) {this.hosts = new ArrayList();}
            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){
            if (this.hosts != null) {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 ServiceEntryLocation getLocation(){
            return this.location;
    }

    public A withLocation(ServiceEntryLocation location){
            this.location=location; return (A) this;
    }

    public Boolean hasLocation(){
            return this.location != null;
    }

    public A addToPorts(int index,me.snowdrop.istio.api.networking.v1alpha3.Port item){
            if (this.ports == null) {this.ports = new ArrayList();}
            me.snowdrop.istio.api.networking.v1alpha3.PortBuilder builder = new me.snowdrop.istio.api.networking.v1alpha3.PortBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.ports.add(index >= 0 ? index : ports.size(), builder); return (A)this;
    }

    public A setToPorts(int index,me.snowdrop.istio.api.networking.v1alpha3.Port item){
            if (this.ports == null) {this.ports = new ArrayList();}
            me.snowdrop.istio.api.networking.v1alpha3.PortBuilder builder = new me.snowdrop.istio.api.networking.v1alpha3.PortBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= ports.size()) { ports.add(builder); } else { ports.set(index, builder);}
             return (A)this;
    }

    public A addToPorts(me.snowdrop.istio.api.networking.v1alpha3.Port... items){
            if (this.ports == null) {this.ports = new ArrayList();}
            for (me.snowdrop.istio.api.networking.v1alpha3.Port item : items) {me.snowdrop.istio.api.networking.v1alpha3.PortBuilder builder = new me.snowdrop.istio.api.networking.v1alpha3.PortBuilder(item);_visitables.add(builder);this.ports.add(builder);} return (A)this;
    }

    public A addAllToPorts(Collection items){
            if (this.ports == null) {this.ports = new ArrayList();}
            for (me.snowdrop.istio.api.networking.v1alpha3.Port item : items) {me.snowdrop.istio.api.networking.v1alpha3.PortBuilder builder = new me.snowdrop.istio.api.networking.v1alpha3.PortBuilder(item);_visitables.add(builder);this.ports.add(builder);} return (A)this;
    }

    public A removeFromPorts(me.snowdrop.istio.api.networking.v1alpha3.Port... items){
            for (me.snowdrop.istio.api.networking.v1alpha3.Port item : items) {me.snowdrop.istio.api.networking.v1alpha3.PortBuilder builder = new me.snowdrop.istio.api.networking.v1alpha3.PortBuilder(item);_visitables.remove(builder);if (this.ports != null) {this.ports.remove(builder);}} return (A)this;
    }

    public A removeAllFromPorts(Collection items){
            for (me.snowdrop.istio.api.networking.v1alpha3.Port item : items) {me.snowdrop.istio.api.networking.v1alpha3.PortBuilder builder = new me.snowdrop.istio.api.networking.v1alpha3.PortBuilder(item);_visitables.remove(builder);if (this.ports != null) {this.ports.remove(builder);}} return (A)this;
    }

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

    public List buildPorts(){
            return build(ports);
    }

    public me.snowdrop.istio.api.networking.v1alpha3.Port buildPort(int index){
            return this.ports.get(index).build();
    }

    public me.snowdrop.istio.api.networking.v1alpha3.Port buildFirstPort(){
            return this.ports.get(0).build();
    }

    public me.snowdrop.istio.api.networking.v1alpha3.Port buildLastPort(){
            return this.ports.get(ports.size() - 1).build();
    }

    public me.snowdrop.istio.api.networking.v1alpha3.Port buildMatchingPort(io.fabric8.kubernetes.api.builder.Predicate predicate){
            for (PortBuilder item: ports) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withPorts(List ports){
            if (this.ports != null) { _visitables.removeAll(this.ports);}
            if (ports != null) {this.ports = new ArrayList(); for (me.snowdrop.istio.api.networking.v1alpha3.Port item : ports){this.addToPorts(item);}} else { this.ports = null;} return (A) this;
    }

    public A withPorts(me.snowdrop.istio.api.networking.v1alpha3.Port... ports){
            if (this.ports != null) {this.ports.clear();}
            if (ports != null) {for (me.snowdrop.istio.api.networking.v1alpha3.Port item :ports){ this.addToPorts(item);}} return (A) this;
    }

    public Boolean hasPorts(){
            return ports != null && !ports.isEmpty();
    }

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

    public ServiceEntrySpecFluent.PortsNested addNewPort(){
            return new PortsNestedImpl();
    }

    public ServiceEntrySpecFluent.PortsNested addNewPortLike(me.snowdrop.istio.api.networking.v1alpha3.Port item){
            return new PortsNestedImpl(-1, item);
    }

    public ServiceEntrySpecFluent.PortsNested setNewPortLike(int index,me.snowdrop.istio.api.networking.v1alpha3.Port item){
            return new PortsNestedImpl(index, item);
    }

    public ServiceEntrySpecFluent.PortsNested editPort(int index){
            if (ports.size() <= index) throw new RuntimeException("Can't edit ports. Index exceeds size.");
            return setNewPortLike(index, buildPort(index));
    }

    public ServiceEntrySpecFluent.PortsNested editFirstPort(){
            if (ports.size() == 0) throw new RuntimeException("Can't edit first ports. The list is empty.");
            return setNewPortLike(0, buildPort(0));
    }

    public ServiceEntrySpecFluent.PortsNested editLastPort(){
            int index = ports.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last ports. The list is empty.");
            return setNewPortLike(index, buildPort(index));
    }

    public ServiceEntrySpecFluent.PortsNested editMatchingPort(io.fabric8.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i();}
            this.subjectAltNames.add(index, item);
            return (A)this;
    }

    public A setToSubjectAltNames(int index,String item){
            if (this.subjectAltNames == null) {this.subjectAltNames = new ArrayList();}
            this.subjectAltNames.set(index, item); return (A)this;
    }

    public A addToSubjectAltNames(String... items){
            if (this.subjectAltNames == null) {this.subjectAltNames = new ArrayList();}
            for (String item : items) {this.subjectAltNames.add(item);} return (A)this;
    }

    public A addAllToSubjectAltNames(Collection items){
            if (this.subjectAltNames == null) {this.subjectAltNames = new ArrayList();}
            for (String item : items) {this.subjectAltNames.add(item);} return (A)this;
    }

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

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

    public List getSubjectAltNames(){
            return this.subjectAltNames;
    }

    public String getSubjectAltName(int index){
            return this.subjectAltNames.get(index);
    }

    public String getFirstSubjectAltName(){
            return this.subjectAltNames.get(0);
    }

    public String getLastSubjectAltName(){
            return this.subjectAltNames.get(subjectAltNames.size() - 1);
    }

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

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

    public A withSubjectAltNames(String... subjectAltNames){
            if (this.subjectAltNames != null) {this.subjectAltNames.clear();}
            if (subjectAltNames != null) {for (String item :subjectAltNames){ this.addToSubjectAltNames(item);}} return (A) this;
    }

    public Boolean hasSubjectAltNames(){
            return subjectAltNames != null && !subjectAltNames.isEmpty();
    }

    public boolean equals(Object o){
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            if (!super.equals(o)) return false;
            ServiceEntrySpecFluentImpl that = (ServiceEntrySpecFluentImpl) o;
            if (addresses != null ? !addresses.equals(that.addresses) :that.addresses != null) return false;
            if (endpoints != null ? !endpoints.equals(that.endpoints) :that.endpoints != null) return false;
            if (exportTo != null ? !exportTo.equals(that.exportTo) :that.exportTo != null) return false;
            if (hosts != null ? !hosts.equals(that.hosts) :that.hosts != null) return false;
            if (location != null ? !location.equals(that.location) :that.location != null) return false;
            if (ports != null ? !ports.equals(that.ports) :that.ports != null) return false;
            if (resolution != null ? !resolution.equals(that.resolution) :that.resolution != null) return false;
            if (subjectAltNames != null ? !subjectAltNames.equals(that.subjectAltNames) :that.subjectAltNames != null) return false;
            return true;
    }


    public class EndpointsNestedImpl extends EndpointFluentImpl> implements ServiceEntrySpecFluent.EndpointsNested,io.fabric8.kubernetes.api.builder.Nested{

            private final EndpointBuilder builder;
        private final int index;
    
            EndpointsNestedImpl(int index,Endpoint item){
                    this.index = index;
                    this.builder = new EndpointBuilder(this, item);
            }
            EndpointsNestedImpl(){
                    this.index = -1;
                    this.builder = new EndpointBuilder(this);
            }
    
    public N and(){
            return (N) ServiceEntrySpecFluentImpl.this.setToEndpoints(index, builder.build());
    }
    public N endEndpoint(){
            return and();
    }

}
    public class PortsNestedImpl extends PortFluentImpl> implements ServiceEntrySpecFluent.PortsNested,io.fabric8.kubernetes.api.builder.Nested{

            private final PortBuilder builder;
        private final int index;
    
            PortsNestedImpl(int index,me.snowdrop.istio.api.networking.v1alpha3.Port item){
                    this.index = index;
                    this.builder = new PortBuilder(this, item);
            }
            PortsNestedImpl(){
                    this.index = -1;
                    this.builder = new PortBuilder(this);
            }
    
    public N and(){
            return (N) ServiceEntrySpecFluentImpl.this.setToPorts(index, builder.build());
    }
    public N endPort(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy