
io.kubernetes.client.openapi.models.V1ServiceSpecFluentImpl Maven / Gradle / Ivy
/*
Copyright 2022 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package io.kubernetes.client.openapi.models;
import io.kubernetes.client.fluent.BaseFluent;
import io.kubernetes.client.fluent.Nested;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
/** Generated */
@SuppressWarnings(value = "unchecked")
public class V1ServiceSpecFluentImpl> extends BaseFluent
implements V1ServiceSpecFluent {
public V1ServiceSpecFluentImpl() {}
public V1ServiceSpecFluentImpl(io.kubernetes.client.openapi.models.V1ServiceSpec instance) {
this.withAllocateLoadBalancerNodePorts(instance.getAllocateLoadBalancerNodePorts());
this.withClusterIP(instance.getClusterIP());
this.withClusterIPs(instance.getClusterIPs());
this.withExternalIPs(instance.getExternalIPs());
this.withExternalName(instance.getExternalName());
this.withExternalTrafficPolicy(instance.getExternalTrafficPolicy());
this.withHealthCheckNodePort(instance.getHealthCheckNodePort());
this.withInternalTrafficPolicy(instance.getInternalTrafficPolicy());
this.withIpFamilies(instance.getIpFamilies());
this.withIpFamilyPolicy(instance.getIpFamilyPolicy());
this.withLoadBalancerClass(instance.getLoadBalancerClass());
this.withLoadBalancerIP(instance.getLoadBalancerIP());
this.withLoadBalancerSourceRanges(instance.getLoadBalancerSourceRanges());
this.withPorts(instance.getPorts());
this.withPublishNotReadyAddresses(instance.getPublishNotReadyAddresses());
this.withSelector(instance.getSelector());
this.withSessionAffinity(instance.getSessionAffinity());
this.withSessionAffinityConfig(instance.getSessionAffinityConfig());
this.withType(instance.getType());
}
private Boolean allocateLoadBalancerNodePorts;
private String clusterIP;
private List clusterIPs;
private java.util.List externalIPs;
private java.lang.String externalName;
private java.lang.String externalTrafficPolicy;
private Integer healthCheckNodePort;
private java.lang.String internalTrafficPolicy;
private java.util.List ipFamilies;
private java.lang.String ipFamilyPolicy;
private java.lang.String loadBalancerClass;
private java.lang.String loadBalancerIP;
private java.util.List loadBalancerSourceRanges;
private ArrayList ports;
private java.lang.Boolean publishNotReadyAddresses;
private Map selector;
private java.lang.String sessionAffinity;
private V1SessionAffinityConfigBuilder sessionAffinityConfig;
private java.lang.String type;
public java.lang.Boolean getAllocateLoadBalancerNodePorts() {
return this.allocateLoadBalancerNodePorts;
}
public A withAllocateLoadBalancerNodePorts(java.lang.Boolean allocateLoadBalancerNodePorts) {
this.allocateLoadBalancerNodePorts = allocateLoadBalancerNodePorts;
return (A) this;
}
public java.lang.Boolean hasAllocateLoadBalancerNodePorts() {
return this.allocateLoadBalancerNodePorts != null;
}
public java.lang.String getClusterIP() {
return this.clusterIP;
}
public A withClusterIP(java.lang.String clusterIP) {
this.clusterIP = clusterIP;
return (A) this;
}
public java.lang.Boolean hasClusterIP() {
return this.clusterIP != null;
}
public A addToClusterIPs(java.lang.Integer index, java.lang.String item) {
if (this.clusterIPs == null) {
this.clusterIPs = new java.util.ArrayList();
}
this.clusterIPs.add(index, item);
return (A) this;
}
public A setToClusterIPs(java.lang.Integer index, java.lang.String item) {
if (this.clusterIPs == null) {
this.clusterIPs = new java.util.ArrayList();
}
this.clusterIPs.set(index, item);
return (A) this;
}
public A addToClusterIPs(java.lang.String... items) {
if (this.clusterIPs == null) {
this.clusterIPs = new java.util.ArrayList();
}
for (java.lang.String item : items) {
this.clusterIPs.add(item);
}
return (A) this;
}
public A addAllToClusterIPs(Collection items) {
if (this.clusterIPs == null) {
this.clusterIPs = new java.util.ArrayList();
}
for (java.lang.String item : items) {
this.clusterIPs.add(item);
}
return (A) this;
}
public A removeFromClusterIPs(java.lang.String... items) {
for (java.lang.String item : items) {
if (this.clusterIPs != null) {
this.clusterIPs.remove(item);
}
}
return (A) this;
}
public A removeAllFromClusterIPs(java.util.Collection items) {
for (java.lang.String item : items) {
if (this.clusterIPs != null) {
this.clusterIPs.remove(item);
}
}
return (A) this;
}
public java.util.List getClusterIPs() {
return this.clusterIPs;
}
public java.lang.String getClusterIP(java.lang.Integer index) {
return this.clusterIPs.get(index);
}
public java.lang.String getFirstClusterIP() {
return this.clusterIPs.get(0);
}
public java.lang.String getLastClusterIP() {
return this.clusterIPs.get(clusterIPs.size() - 1);
}
public java.lang.String getMatchingClusterIP(Predicate predicate) {
for (java.lang.String item : clusterIPs) {
if (predicate.test(item)) {
return item;
}
}
return null;
}
public java.lang.Boolean hasMatchingClusterIP(
java.util.function.Predicate predicate) {
for (java.lang.String item : clusterIPs) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withClusterIPs(java.util.List clusterIPs) {
if (clusterIPs != null) {
this.clusterIPs = new java.util.ArrayList();
for (java.lang.String item : clusterIPs) {
this.addToClusterIPs(item);
}
} else {
this.clusterIPs = null;
}
return (A) this;
}
public A withClusterIPs(java.lang.String... clusterIPs) {
if (this.clusterIPs != null) {
this.clusterIPs.clear();
}
if (clusterIPs != null) {
for (java.lang.String item : clusterIPs) {
this.addToClusterIPs(item);
}
}
return (A) this;
}
public java.lang.Boolean hasClusterIPs() {
return clusterIPs != null && !clusterIPs.isEmpty();
}
public A addToExternalIPs(java.lang.Integer index, java.lang.String item) {
if (this.externalIPs == null) {
this.externalIPs = new java.util.ArrayList();
}
this.externalIPs.add(index, item);
return (A) this;
}
public A setToExternalIPs(java.lang.Integer index, java.lang.String item) {
if (this.externalIPs == null) {
this.externalIPs = new java.util.ArrayList();
}
this.externalIPs.set(index, item);
return (A) this;
}
public A addToExternalIPs(java.lang.String... items) {
if (this.externalIPs == null) {
this.externalIPs = new java.util.ArrayList();
}
for (java.lang.String item : items) {
this.externalIPs.add(item);
}
return (A) this;
}
public A addAllToExternalIPs(java.util.Collection items) {
if (this.externalIPs == null) {
this.externalIPs = new java.util.ArrayList();
}
for (java.lang.String item : items) {
this.externalIPs.add(item);
}
return (A) this;
}
public A removeFromExternalIPs(java.lang.String... items) {
for (java.lang.String item : items) {
if (this.externalIPs != null) {
this.externalIPs.remove(item);
}
}
return (A) this;
}
public A removeAllFromExternalIPs(java.util.Collection items) {
for (java.lang.String item : items) {
if (this.externalIPs != null) {
this.externalIPs.remove(item);
}
}
return (A) this;
}
public java.util.List getExternalIPs() {
return this.externalIPs;
}
public java.lang.String getExternalIP(java.lang.Integer index) {
return this.externalIPs.get(index);
}
public java.lang.String getFirstExternalIP() {
return this.externalIPs.get(0);
}
public java.lang.String getLastExternalIP() {
return this.externalIPs.get(externalIPs.size() - 1);
}
public java.lang.String getMatchingExternalIP(
java.util.function.Predicate predicate) {
for (java.lang.String item : externalIPs) {
if (predicate.test(item)) {
return item;
}
}
return null;
}
public java.lang.Boolean hasMatchingExternalIP(
java.util.function.Predicate predicate) {
for (java.lang.String item : externalIPs) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withExternalIPs(java.util.List externalIPs) {
if (externalIPs != null) {
this.externalIPs = new java.util.ArrayList();
for (java.lang.String item : externalIPs) {
this.addToExternalIPs(item);
}
} else {
this.externalIPs = null;
}
return (A) this;
}
public A withExternalIPs(java.lang.String... externalIPs) {
if (this.externalIPs != null) {
this.externalIPs.clear();
}
if (externalIPs != null) {
for (java.lang.String item : externalIPs) {
this.addToExternalIPs(item);
}
}
return (A) this;
}
public java.lang.Boolean hasExternalIPs() {
return externalIPs != null && !externalIPs.isEmpty();
}
public java.lang.String getExternalName() {
return this.externalName;
}
public A withExternalName(java.lang.String externalName) {
this.externalName = externalName;
return (A) this;
}
public java.lang.Boolean hasExternalName() {
return this.externalName != null;
}
public java.lang.String getExternalTrafficPolicy() {
return this.externalTrafficPolicy;
}
public A withExternalTrafficPolicy(java.lang.String externalTrafficPolicy) {
this.externalTrafficPolicy = externalTrafficPolicy;
return (A) this;
}
public java.lang.Boolean hasExternalTrafficPolicy() {
return this.externalTrafficPolicy != null;
}
public java.lang.Integer getHealthCheckNodePort() {
return this.healthCheckNodePort;
}
public A withHealthCheckNodePort(java.lang.Integer healthCheckNodePort) {
this.healthCheckNodePort = healthCheckNodePort;
return (A) this;
}
public java.lang.Boolean hasHealthCheckNodePort() {
return this.healthCheckNodePort != null;
}
public java.lang.String getInternalTrafficPolicy() {
return this.internalTrafficPolicy;
}
public A withInternalTrafficPolicy(java.lang.String internalTrafficPolicy) {
this.internalTrafficPolicy = internalTrafficPolicy;
return (A) this;
}
public java.lang.Boolean hasInternalTrafficPolicy() {
return this.internalTrafficPolicy != null;
}
public A addToIpFamilies(java.lang.Integer index, java.lang.String item) {
if (this.ipFamilies == null) {
this.ipFamilies = new java.util.ArrayList();
}
this.ipFamilies.add(index, item);
return (A) this;
}
public A setToIpFamilies(java.lang.Integer index, java.lang.String item) {
if (this.ipFamilies == null) {
this.ipFamilies = new java.util.ArrayList();
}
this.ipFamilies.set(index, item);
return (A) this;
}
public A addToIpFamilies(java.lang.String... items) {
if (this.ipFamilies == null) {
this.ipFamilies = new java.util.ArrayList();
}
for (java.lang.String item : items) {
this.ipFamilies.add(item);
}
return (A) this;
}
public A addAllToIpFamilies(java.util.Collection items) {
if (this.ipFamilies == null) {
this.ipFamilies = new java.util.ArrayList();
}
for (java.lang.String item : items) {
this.ipFamilies.add(item);
}
return (A) this;
}
public A removeFromIpFamilies(java.lang.String... items) {
for (java.lang.String item : items) {
if (this.ipFamilies != null) {
this.ipFamilies.remove(item);
}
}
return (A) this;
}
public A removeAllFromIpFamilies(java.util.Collection items) {
for (java.lang.String item : items) {
if (this.ipFamilies != null) {
this.ipFamilies.remove(item);
}
}
return (A) this;
}
public java.util.List getIpFamilies() {
return this.ipFamilies;
}
public java.lang.String getIpFamily(java.lang.Integer index) {
return this.ipFamilies.get(index);
}
public java.lang.String getFirstIpFamily() {
return this.ipFamilies.get(0);
}
public java.lang.String getLastIpFamily() {
return this.ipFamilies.get(ipFamilies.size() - 1);
}
public java.lang.String getMatchingIpFamily(
java.util.function.Predicate predicate) {
for (java.lang.String item : ipFamilies) {
if (predicate.test(item)) {
return item;
}
}
return null;
}
public java.lang.Boolean hasMatchingIpFamily(
java.util.function.Predicate predicate) {
for (java.lang.String item : ipFamilies) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withIpFamilies(java.util.List ipFamilies) {
if (ipFamilies != null) {
this.ipFamilies = new java.util.ArrayList();
for (java.lang.String item : ipFamilies) {
this.addToIpFamilies(item);
}
} else {
this.ipFamilies = null;
}
return (A) this;
}
public A withIpFamilies(java.lang.String... ipFamilies) {
if (this.ipFamilies != null) {
this.ipFamilies.clear();
}
if (ipFamilies != null) {
for (java.lang.String item : ipFamilies) {
this.addToIpFamilies(item);
}
}
return (A) this;
}
public java.lang.Boolean hasIpFamilies() {
return ipFamilies != null && !ipFamilies.isEmpty();
}
public java.lang.String getIpFamilyPolicy() {
return this.ipFamilyPolicy;
}
public A withIpFamilyPolicy(java.lang.String ipFamilyPolicy) {
this.ipFamilyPolicy = ipFamilyPolicy;
return (A) this;
}
public java.lang.Boolean hasIpFamilyPolicy() {
return this.ipFamilyPolicy != null;
}
public java.lang.String getLoadBalancerClass() {
return this.loadBalancerClass;
}
public A withLoadBalancerClass(java.lang.String loadBalancerClass) {
this.loadBalancerClass = loadBalancerClass;
return (A) this;
}
public java.lang.Boolean hasLoadBalancerClass() {
return this.loadBalancerClass != null;
}
public java.lang.String getLoadBalancerIP() {
return this.loadBalancerIP;
}
public A withLoadBalancerIP(java.lang.String loadBalancerIP) {
this.loadBalancerIP = loadBalancerIP;
return (A) this;
}
public java.lang.Boolean hasLoadBalancerIP() {
return this.loadBalancerIP != null;
}
public A addToLoadBalancerSourceRanges(java.lang.Integer index, java.lang.String item) {
if (this.loadBalancerSourceRanges == null) {
this.loadBalancerSourceRanges = new java.util.ArrayList();
}
this.loadBalancerSourceRanges.add(index, item);
return (A) this;
}
public A setToLoadBalancerSourceRanges(java.lang.Integer index, java.lang.String item) {
if (this.loadBalancerSourceRanges == null) {
this.loadBalancerSourceRanges = new java.util.ArrayList();
}
this.loadBalancerSourceRanges.set(index, item);
return (A) this;
}
public A addToLoadBalancerSourceRanges(java.lang.String... items) {
if (this.loadBalancerSourceRanges == null) {
this.loadBalancerSourceRanges = new java.util.ArrayList();
}
for (java.lang.String item : items) {
this.loadBalancerSourceRanges.add(item);
}
return (A) this;
}
public A addAllToLoadBalancerSourceRanges(java.util.Collection items) {
if (this.loadBalancerSourceRanges == null) {
this.loadBalancerSourceRanges = new java.util.ArrayList();
}
for (java.lang.String item : items) {
this.loadBalancerSourceRanges.add(item);
}
return (A) this;
}
public A removeFromLoadBalancerSourceRanges(java.lang.String... items) {
for (java.lang.String item : items) {
if (this.loadBalancerSourceRanges != null) {
this.loadBalancerSourceRanges.remove(item);
}
}
return (A) this;
}
public A removeAllFromLoadBalancerSourceRanges(java.util.Collection items) {
for (java.lang.String item : items) {
if (this.loadBalancerSourceRanges != null) {
this.loadBalancerSourceRanges.remove(item);
}
}
return (A) this;
}
public java.util.List getLoadBalancerSourceRanges() {
return this.loadBalancerSourceRanges;
}
public java.lang.String getLoadBalancerSourceRange(java.lang.Integer index) {
return this.loadBalancerSourceRanges.get(index);
}
public java.lang.String getFirstLoadBalancerSourceRange() {
return this.loadBalancerSourceRanges.get(0);
}
public java.lang.String getLastLoadBalancerSourceRange() {
return this.loadBalancerSourceRanges.get(loadBalancerSourceRanges.size() - 1);
}
public java.lang.String getMatchingLoadBalancerSourceRange(
java.util.function.Predicate predicate) {
for (java.lang.String item : loadBalancerSourceRanges) {
if (predicate.test(item)) {
return item;
}
}
return null;
}
public java.lang.Boolean hasMatchingLoadBalancerSourceRange(
java.util.function.Predicate predicate) {
for (java.lang.String item : loadBalancerSourceRanges) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withLoadBalancerSourceRanges(java.util.List loadBalancerSourceRanges) {
if (loadBalancerSourceRanges != null) {
this.loadBalancerSourceRanges = new java.util.ArrayList();
for (java.lang.String item : loadBalancerSourceRanges) {
this.addToLoadBalancerSourceRanges(item);
}
} else {
this.loadBalancerSourceRanges = null;
}
return (A) this;
}
public A withLoadBalancerSourceRanges(java.lang.String... loadBalancerSourceRanges) {
if (this.loadBalancerSourceRanges != null) {
this.loadBalancerSourceRanges.clear();
}
if (loadBalancerSourceRanges != null) {
for (java.lang.String item : loadBalancerSourceRanges) {
this.addToLoadBalancerSourceRanges(item);
}
}
return (A) this;
}
public java.lang.Boolean hasLoadBalancerSourceRanges() {
return loadBalancerSourceRanges != null && !loadBalancerSourceRanges.isEmpty();
}
public A addToPorts(
java.lang.Integer index, io.kubernetes.client.openapi.models.V1ServicePort item) {
if (this.ports == null) {
this.ports = new java.util.ArrayList();
}
io.kubernetes.client.openapi.models.V1ServicePortBuilder builder =
new io.kubernetes.client.openapi.models.V1ServicePortBuilder(item);
_visitables.get("ports").add(index >= 0 ? index : _visitables.get("ports").size(), builder);
this.ports.add(index >= 0 ? index : ports.size(), builder);
return (A) this;
}
public A setToPorts(
java.lang.Integer index, io.kubernetes.client.openapi.models.V1ServicePort item) {
if (this.ports == null) {
this.ports =
new java.util.ArrayList();
}
io.kubernetes.client.openapi.models.V1ServicePortBuilder builder =
new io.kubernetes.client.openapi.models.V1ServicePortBuilder(item);
if (index < 0 || index >= _visitables.get("ports").size()) {
_visitables.get("ports").add(builder);
} else {
_visitables.get("ports").set(index, builder);
}
if (index < 0 || index >= ports.size()) {
ports.add(builder);
} else {
ports.set(index, builder);
}
return (A) this;
}
public A addToPorts(io.kubernetes.client.openapi.models.V1ServicePort... items) {
if (this.ports == null) {
this.ports =
new java.util.ArrayList();
}
for (io.kubernetes.client.openapi.models.V1ServicePort item : items) {
io.kubernetes.client.openapi.models.V1ServicePortBuilder builder =
new io.kubernetes.client.openapi.models.V1ServicePortBuilder(item);
_visitables.get("ports").add(builder);
this.ports.add(builder);
}
return (A) this;
}
public A addAllToPorts(
java.util.Collection items) {
if (this.ports == null) {
this.ports =
new java.util.ArrayList();
}
for (io.kubernetes.client.openapi.models.V1ServicePort item : items) {
io.kubernetes.client.openapi.models.V1ServicePortBuilder builder =
new io.kubernetes.client.openapi.models.V1ServicePortBuilder(item);
_visitables.get("ports").add(builder);
this.ports.add(builder);
}
return (A) this;
}
public A removeFromPorts(io.kubernetes.client.openapi.models.V1ServicePort... items) {
for (io.kubernetes.client.openapi.models.V1ServicePort item : items) {
io.kubernetes.client.openapi.models.V1ServicePortBuilder builder =
new io.kubernetes.client.openapi.models.V1ServicePortBuilder(item);
_visitables.get("ports").remove(builder);
if (this.ports != null) {
this.ports.remove(builder);
}
}
return (A) this;
}
public A removeAllFromPorts(
java.util.Collection items) {
for (io.kubernetes.client.openapi.models.V1ServicePort item : items) {
io.kubernetes.client.openapi.models.V1ServicePortBuilder builder =
new io.kubernetes.client.openapi.models.V1ServicePortBuilder(item);
_visitables.get("ports").remove(builder);
if (this.ports != null) {
this.ports.remove(builder);
}
}
return (A) this;
}
public A removeMatchingFromPorts(
java.util.function.Predicate
predicate) {
if (ports == null) return (A) this;
final Iterator each =
ports.iterator();
final List visitables = _visitables.get("ports");
while (each.hasNext()) {
io.kubernetes.client.openapi.models.V1ServicePortBuilder builder = each.next();
if (predicate.test(builder)) {
visitables.remove(builder);
each.remove();
}
}
return (A) this;
}
/**
* This method has been deprecated, please use method buildPorts instead.
*
* @return The buildable object.
*/
@Deprecated
public java.util.List getPorts() {
return ports != null ? build(ports) : null;
}
public java.util.List buildPorts() {
return ports != null ? build(ports) : null;
}
public io.kubernetes.client.openapi.models.V1ServicePort buildPort(java.lang.Integer index) {
return this.ports.get(index).build();
}
public io.kubernetes.client.openapi.models.V1ServicePort buildFirstPort() {
return this.ports.get(0).build();
}
public io.kubernetes.client.openapi.models.V1ServicePort buildLastPort() {
return this.ports.get(ports.size() - 1).build();
}
public io.kubernetes.client.openapi.models.V1ServicePort buildMatchingPort(
java.util.function.Predicate
predicate) {
for (io.kubernetes.client.openapi.models.V1ServicePortBuilder item : ports) {
if (predicate.test(item)) {
return item.build();
}
}
return null;
}
public java.lang.Boolean hasMatchingPort(
java.util.function.Predicate
predicate) {
for (io.kubernetes.client.openapi.models.V1ServicePortBuilder item : ports) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withPorts(java.util.List ports) {
if (this.ports != null) {
_visitables.get("ports").removeAll(this.ports);
}
if (ports != null) {
this.ports = new java.util.ArrayList();
for (io.kubernetes.client.openapi.models.V1ServicePort item : ports) {
this.addToPorts(item);
}
} else {
this.ports = null;
}
return (A) this;
}
public A withPorts(io.kubernetes.client.openapi.models.V1ServicePort... ports) {
if (this.ports != null) {
this.ports.clear();
}
if (ports != null) {
for (io.kubernetes.client.openapi.models.V1ServicePort item : ports) {
this.addToPorts(item);
}
}
return (A) this;
}
public java.lang.Boolean hasPorts() {
return ports != null && !ports.isEmpty();
}
public V1ServiceSpecFluent.PortsNested addNewPort() {
return new V1ServiceSpecFluentImpl.PortsNestedImpl();
}
public io.kubernetes.client.openapi.models.V1ServiceSpecFluent.PortsNested addNewPortLike(
io.kubernetes.client.openapi.models.V1ServicePort item) {
return new V1ServiceSpecFluentImpl.PortsNestedImpl(-1, item);
}
public io.kubernetes.client.openapi.models.V1ServiceSpecFluent.PortsNested setNewPortLike(
java.lang.Integer index, io.kubernetes.client.openapi.models.V1ServicePort item) {
return new io.kubernetes.client.openapi.models.V1ServiceSpecFluentImpl.PortsNestedImpl(
index, item);
}
public io.kubernetes.client.openapi.models.V1ServiceSpecFluent.PortsNested editPort(
java.lang.Integer index) {
if (ports.size() <= index) throw new RuntimeException("Can't edit ports. Index exceeds size.");
return setNewPortLike(index, buildPort(index));
}
public io.kubernetes.client.openapi.models.V1ServiceSpecFluent.PortsNested editFirstPort() {
if (ports.size() == 0) throw new RuntimeException("Can't edit first ports. The list is empty.");
return setNewPortLike(0, buildPort(0));
}
public io.kubernetes.client.openapi.models.V1ServiceSpecFluent.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 io.kubernetes.client.openapi.models.V1ServiceSpecFluent.PortsNested editMatchingPort(
java.util.function.Predicate
predicate) {
int index = -1;
for (int i = 0; i < ports.size(); i++) {
if (predicate.test(ports.get(i))) {
index = i;
break;
}
}
if (index < 0) throw new RuntimeException("Can't edit matching ports. No match found.");
return setNewPortLike(index, buildPort(index));
}
public java.lang.Boolean getPublishNotReadyAddresses() {
return this.publishNotReadyAddresses;
}
public A withPublishNotReadyAddresses(java.lang.Boolean publishNotReadyAddresses) {
this.publishNotReadyAddresses = publishNotReadyAddresses;
return (A) this;
}
public java.lang.Boolean hasPublishNotReadyAddresses() {
return this.publishNotReadyAddresses != null;
}
public A addToSelector(java.lang.String key, java.lang.String value) {
if (this.selector == null && key != null && value != null) {
this.selector = new LinkedHashMap();
}
if (key != null && value != null) {
this.selector.put(key, value);
}
return (A) this;
}
public A addToSelector(java.util.Map map) {
if (this.selector == null && map != null) {
this.selector = new java.util.LinkedHashMap();
}
if (map != null) {
this.selector.putAll(map);
}
return (A) this;
}
public A removeFromSelector(java.lang.String key) {
if (this.selector == null) {
return (A) this;
}
if (key != null && this.selector != null) {
this.selector.remove(key);
}
return (A) this;
}
public A removeFromSelector(java.util.Map map) {
if (this.selector == null) {
return (A) this;
}
if (map != null) {
for (Object key : map.keySet()) {
if (this.selector != null) {
this.selector.remove(key);
}
}
}
return (A) this;
}
public java.util.Map getSelector() {
return this.selector;
}
public A withSelector(java.util.Map selector) {
if (selector == null) {
this.selector = null;
} else {
this.selector = new java.util.LinkedHashMap(selector);
}
return (A) this;
}
public java.lang.Boolean hasSelector() {
return this.selector != null;
}
public java.lang.String getSessionAffinity() {
return this.sessionAffinity;
}
public A withSessionAffinity(java.lang.String sessionAffinity) {
this.sessionAffinity = sessionAffinity;
return (A) this;
}
public java.lang.Boolean hasSessionAffinity() {
return this.sessionAffinity != null;
}
/**
* This method has been deprecated, please use method buildSessionAffinityConfig instead.
*
* @return The buildable object.
*/
@java.lang.Deprecated
public io.kubernetes.client.openapi.models.V1SessionAffinityConfig getSessionAffinityConfig() {
return this.sessionAffinityConfig != null ? this.sessionAffinityConfig.build() : null;
}
public io.kubernetes.client.openapi.models.V1SessionAffinityConfig buildSessionAffinityConfig() {
return this.sessionAffinityConfig != null ? this.sessionAffinityConfig.build() : null;
}
public A withSessionAffinityConfig(
io.kubernetes.client.openapi.models.V1SessionAffinityConfig sessionAffinityConfig) {
_visitables.get("sessionAffinityConfig").remove(this.sessionAffinityConfig);
if (sessionAffinityConfig != null) {
this.sessionAffinityConfig = new V1SessionAffinityConfigBuilder(sessionAffinityConfig);
_visitables.get("sessionAffinityConfig").add(this.sessionAffinityConfig);
}
return (A) this;
}
public java.lang.Boolean hasSessionAffinityConfig() {
return this.sessionAffinityConfig != null;
}
public V1ServiceSpecFluent.SessionAffinityConfigNested withNewSessionAffinityConfig() {
return new V1ServiceSpecFluentImpl.SessionAffinityConfigNestedImpl();
}
public io.kubernetes.client.openapi.models.V1ServiceSpecFluent.SessionAffinityConfigNested
withNewSessionAffinityConfigLike(
io.kubernetes.client.openapi.models.V1SessionAffinityConfig item) {
return new io.kubernetes.client.openapi.models.V1ServiceSpecFluentImpl
.SessionAffinityConfigNestedImpl(item);
}
public io.kubernetes.client.openapi.models.V1ServiceSpecFluent.SessionAffinityConfigNested
editSessionAffinityConfig() {
return withNewSessionAffinityConfigLike(getSessionAffinityConfig());
}
public io.kubernetes.client.openapi.models.V1ServiceSpecFluent.SessionAffinityConfigNested
editOrNewSessionAffinityConfig() {
return withNewSessionAffinityConfigLike(
getSessionAffinityConfig() != null
? getSessionAffinityConfig()
: new io.kubernetes.client.openapi.models.V1SessionAffinityConfigBuilder().build());
}
public io.kubernetes.client.openapi.models.V1ServiceSpecFluent.SessionAffinityConfigNested
editOrNewSessionAffinityConfigLike(
io.kubernetes.client.openapi.models.V1SessionAffinityConfig item) {
return withNewSessionAffinityConfigLike(
getSessionAffinityConfig() != null ? getSessionAffinityConfig() : item);
}
public java.lang.String getType() {
return this.type;
}
public A withType(java.lang.String type) {
this.type = type;
return (A) this;
}
public java.lang.Boolean hasType() {
return this.type != null;
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
V1ServiceSpecFluentImpl that = (V1ServiceSpecFluentImpl) o;
if (allocateLoadBalancerNodePorts != null
? !allocateLoadBalancerNodePorts.equals(that.allocateLoadBalancerNodePorts)
: that.allocateLoadBalancerNodePorts != null) return false;
if (clusterIP != null ? !clusterIP.equals(that.clusterIP) : that.clusterIP != null)
return false;
if (clusterIPs != null ? !clusterIPs.equals(that.clusterIPs) : that.clusterIPs != null)
return false;
if (externalIPs != null ? !externalIPs.equals(that.externalIPs) : that.externalIPs != null)
return false;
if (externalName != null ? !externalName.equals(that.externalName) : that.externalName != null)
return false;
if (externalTrafficPolicy != null
? !externalTrafficPolicy.equals(that.externalTrafficPolicy)
: that.externalTrafficPolicy != null) return false;
if (healthCheckNodePort != null
? !healthCheckNodePort.equals(that.healthCheckNodePort)
: that.healthCheckNodePort != null) return false;
if (internalTrafficPolicy != null
? !internalTrafficPolicy.equals(that.internalTrafficPolicy)
: that.internalTrafficPolicy != null) return false;
if (ipFamilies != null ? !ipFamilies.equals(that.ipFamilies) : that.ipFamilies != null)
return false;
if (ipFamilyPolicy != null
? !ipFamilyPolicy.equals(that.ipFamilyPolicy)
: that.ipFamilyPolicy != null) return false;
if (loadBalancerClass != null
? !loadBalancerClass.equals(that.loadBalancerClass)
: that.loadBalancerClass != null) return false;
if (loadBalancerIP != null
? !loadBalancerIP.equals(that.loadBalancerIP)
: that.loadBalancerIP != null) return false;
if (loadBalancerSourceRanges != null
? !loadBalancerSourceRanges.equals(that.loadBalancerSourceRanges)
: that.loadBalancerSourceRanges != null) return false;
if (ports != null ? !ports.equals(that.ports) : that.ports != null) return false;
if (publishNotReadyAddresses != null
? !publishNotReadyAddresses.equals(that.publishNotReadyAddresses)
: that.publishNotReadyAddresses != null) return false;
if (selector != null ? !selector.equals(that.selector) : that.selector != null) return false;
if (sessionAffinity != null
? !sessionAffinity.equals(that.sessionAffinity)
: that.sessionAffinity != null) return false;
if (sessionAffinityConfig != null
? !sessionAffinityConfig.equals(that.sessionAffinityConfig)
: that.sessionAffinityConfig != null) return false;
if (type != null ? !type.equals(that.type) : that.type != null) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(
allocateLoadBalancerNodePorts,
clusterIP,
clusterIPs,
externalIPs,
externalName,
externalTrafficPolicy,
healthCheckNodePort,
internalTrafficPolicy,
ipFamilies,
ipFamilyPolicy,
loadBalancerClass,
loadBalancerIP,
loadBalancerSourceRanges,
ports,
publishNotReadyAddresses,
selector,
sessionAffinity,
sessionAffinityConfig,
type,
super.hashCode());
}
public java.lang.String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (allocateLoadBalancerNodePorts != null) {
sb.append("allocateLoadBalancerNodePorts:");
sb.append(allocateLoadBalancerNodePorts + ",");
}
if (clusterIP != null) {
sb.append("clusterIP:");
sb.append(clusterIP + ",");
}
if (clusterIPs != null && !clusterIPs.isEmpty()) {
sb.append("clusterIPs:");
sb.append(clusterIPs + ",");
}
if (externalIPs != null && !externalIPs.isEmpty()) {
sb.append("externalIPs:");
sb.append(externalIPs + ",");
}
if (externalName != null) {
sb.append("externalName:");
sb.append(externalName + ",");
}
if (externalTrafficPolicy != null) {
sb.append("externalTrafficPolicy:");
sb.append(externalTrafficPolicy + ",");
}
if (healthCheckNodePort != null) {
sb.append("healthCheckNodePort:");
sb.append(healthCheckNodePort + ",");
}
if (internalTrafficPolicy != null) {
sb.append("internalTrafficPolicy:");
sb.append(internalTrafficPolicy + ",");
}
if (ipFamilies != null && !ipFamilies.isEmpty()) {
sb.append("ipFamilies:");
sb.append(ipFamilies + ",");
}
if (ipFamilyPolicy != null) {
sb.append("ipFamilyPolicy:");
sb.append(ipFamilyPolicy + ",");
}
if (loadBalancerClass != null) {
sb.append("loadBalancerClass:");
sb.append(loadBalancerClass + ",");
}
if (loadBalancerIP != null) {
sb.append("loadBalancerIP:");
sb.append(loadBalancerIP + ",");
}
if (loadBalancerSourceRanges != null && !loadBalancerSourceRanges.isEmpty()) {
sb.append("loadBalancerSourceRanges:");
sb.append(loadBalancerSourceRanges + ",");
}
if (ports != null && !ports.isEmpty()) {
sb.append("ports:");
sb.append(ports + ",");
}
if (publishNotReadyAddresses != null) {
sb.append("publishNotReadyAddresses:");
sb.append(publishNotReadyAddresses + ",");
}
if (selector != null && !selector.isEmpty()) {
sb.append("selector:");
sb.append(selector + ",");
}
if (sessionAffinity != null) {
sb.append("sessionAffinity:");
sb.append(sessionAffinity + ",");
}
if (sessionAffinityConfig != null) {
sb.append("sessionAffinityConfig:");
sb.append(sessionAffinityConfig + ",");
}
if (type != null) {
sb.append("type:");
sb.append(type);
}
sb.append("}");
return sb.toString();
}
public A withAllocateLoadBalancerNodePorts() {
return withAllocateLoadBalancerNodePorts(true);
}
public A withPublishNotReadyAddresses() {
return withPublishNotReadyAddresses(true);
}
class PortsNestedImpl extends V1ServicePortFluentImpl>
implements io.kubernetes.client.openapi.models.V1ServiceSpecFluent.PortsNested, Nested {
PortsNestedImpl(
java.lang.Integer index, io.kubernetes.client.openapi.models.V1ServicePort item) {
this.index = index;
this.builder = new V1ServicePortBuilder(this, item);
}
PortsNestedImpl() {
this.index = -1;
this.builder = new io.kubernetes.client.openapi.models.V1ServicePortBuilder(this);
}
io.kubernetes.client.openapi.models.V1ServicePortBuilder builder;
java.lang.Integer index;
public N and() {
return (N) V1ServiceSpecFluentImpl.this.setToPorts(index, builder.build());
}
public N endPort() {
return and();
}
}
class SessionAffinityConfigNestedImpl
extends V1SessionAffinityConfigFluentImpl>
implements io.kubernetes.client.openapi.models.V1ServiceSpecFluent
.SessionAffinityConfigNested<
N>,
io.kubernetes.client.fluent.Nested {
SessionAffinityConfigNestedImpl(V1SessionAffinityConfig item) {
this.builder = new V1SessionAffinityConfigBuilder(this, item);
}
SessionAffinityConfigNestedImpl() {
this.builder = new io.kubernetes.client.openapi.models.V1SessionAffinityConfigBuilder(this);
}
io.kubernetes.client.openapi.models.V1SessionAffinityConfigBuilder builder;
public N and() {
return (N) V1ServiceSpecFluentImpl.this.withSessionAffinityConfig(builder.build());
}
public N endSessionAffinityConfig() {
return and();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy