me.snowdrop.istio.api.model.v1.networking.ServiceEntryFluentImpl 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 ServiceEntryFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements ServiceEntryFluent{
private List addresses;
private List endpoints;
private List hosts;
private ServiceEntryLocation location;
private List ports;
private ServiceEntryResolution resolution;
public ServiceEntryFluentImpl(){
}
public ServiceEntryFluentImpl(ServiceEntry instance){
this.withAddresses(instance.getAddresses());
this.withEndpoints(instance.getEndpoints());
this.withHosts(instance.getHosts());
this.withLocation(instance.getLocation());
this.withPorts(instance.getPorts());
this.withResolution(instance.getResolution());
}
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){
this.addresses.set(index, item); return (A)this;
}
public A addToAddresses(String... items){
for (String item : items) {this.addresses.add(item);} return (A)this;
}
public A addAllToAddresses(Collection items){
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){
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.
*/
@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){
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 ServiceEntryFluent.EndpointsNested addNewEndpoint(){
return new EndpointsNestedImpl();
}
public ServiceEntryFluent.EndpointsNested addNewEndpointLike(Endpoint item){
return new EndpointsNestedImpl(-1, item);
}
public ServiceEntryFluent.EndpointsNested setNewEndpointLike(int index,Endpoint item){
return new EndpointsNestedImpl(index, item);
}
public ServiceEntryFluent.EndpointsNested editEndpoint(int index){
if (endpoints.size() <= index) throw new RuntimeException("Can't edit endpoints. Index exceeds size.");
return setNewEndpointLike(index, buildEndpoint(index));
}
public ServiceEntryFluent.EndpointsNested editFirstEndpoint(){
if (endpoints.size() == 0) throw new RuntimeException("Can't edit first endpoints. The list is empty.");
return setNewEndpointLike(0, buildEndpoint(0));
}
public ServiceEntryFluent.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 ServiceEntryFluent.EndpointsNested editMatchingEndpoint(io.fabric8.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i();}
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 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,Port item){
if (this.ports == null) {this.ports = new ArrayList();}
PortBuilder builder = new 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,Port item){
if (this.ports == null) {this.ports = new ArrayList();}
PortBuilder builder = new 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(Port... items){
if (this.ports == null) {this.ports = new ArrayList();}
for (Port item : items) {PortBuilder builder = new 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 (Port item : items) {PortBuilder builder = new PortBuilder(item);_visitables.add(builder);this.ports.add(builder);} return (A)this;
}
public A removeFromPorts(Port... items){
for (Port item : items) {PortBuilder builder = new PortBuilder(item);_visitables.remove(builder);if (this.ports != null) {this.ports.remove(builder);}} return (A)this;
}
public A removeAllFromPorts(Collection items){
for (Port item : items) {PortBuilder builder = new 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.
*/
@Deprecated public List getPorts(){
return build(ports);
}
public List buildPorts(){
return build(ports);
}
public Port buildPort(int index){
return this.ports.get(index).build();
}
public Port buildFirstPort(){
return this.ports.get(0).build();
}
public Port buildLastPort(){
return this.ports.get(ports.size() - 1).build();
}
public 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 (Port item : ports){this.addToPorts(item);}} else { this.ports = null;} return (A) this;
}
public A withPorts(Port... ports){
this.ports.clear(); if (ports != null) {for (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 ServiceEntryFluent.PortsNested addNewPort(){
return new PortsNestedImpl();
}
public ServiceEntryFluent.PortsNested addNewPortLike(Port item){
return new PortsNestedImpl(-1, item);
}
public ServiceEntryFluent.PortsNested setNewPortLike(int index,Port item){
return new PortsNestedImpl(index, item);
}
public ServiceEntryFluent.PortsNested editPort(int index){
if (ports.size() <= index) throw new RuntimeException("Can't edit ports. Index exceeds size.");
return setNewPortLike(index, buildPort(index));
}
public ServiceEntryFluent.PortsNested editFirstPort(){
if (ports.size() == 0) throw new RuntimeException("Can't edit first ports. The list is empty.");
return setNewPortLike(0, buildPort(0));
}
public ServiceEntryFluent.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 ServiceEntryFluent.PortsNested editMatchingPort(io.fabric8.kubernetes.api.builder.Predicate predicate){
int index = -1;
for (int i=0;i extends EndpointFluentImpl> implements ServiceEntryFluent.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) ServiceEntryFluentImpl.this.setToEndpoints(index, builder.build());
}
public N endEndpoint(){
return and();
}
}
public class PortsNestedImpl extends PortFluentImpl> implements ServiceEntryFluent.PortsNested,io.fabric8.kubernetes.api.builder.Nested{
private final PortBuilder builder;
private final int index;
PortsNestedImpl(int index,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) ServiceEntryFluentImpl.this.setToPorts(index, builder.build());
}
public N endPort(){
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy