io.fabric8.kubernetes.api.model.extensions.IngressRuleFluent Maven / Gradle / Ivy
package io.fabric8.kubernetes.api.model.extensions;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.lang.String;
import java.util.LinkedHashMap;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.lang.Object;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class IngressRuleFluent> extends BaseFluent{
public IngressRuleFluent() {
}
public IngressRuleFluent(IngressRule instance) {
this.copyInstance(instance);
}
private String host;
private HTTPIngressRuleValueBuilder http;
private Map additionalProperties;
protected void copyInstance(IngressRule instance) {
instance = (instance != null ? instance : new IngressRule());
if (instance != null) {
this.withHost(instance.getHost());
this.withHttp(instance.getHttp());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public String getHost() {
return this.host;
}
public A withHost(String host) {
this.host = host;
return (A) this;
}
public boolean hasHost() {
return this.host != null;
}
public HTTPIngressRuleValue buildHttp() {
return this.http != null ? this.http.build() : null;
}
public A withHttp(HTTPIngressRuleValue http) {
this._visitables.remove("http");
if (http != null) {
this.http = new HTTPIngressRuleValueBuilder(http);
this._visitables.get("http").add(this.http);
} else {
this.http = null;
this._visitables.get("http").remove(this.http);
}
return (A) this;
}
public boolean hasHttp() {
return this.http != null;
}
public HttpNested withNewHttp() {
return new HttpNested(null);
}
public HttpNested withNewHttpLike(HTTPIngressRuleValue item) {
return new HttpNested(item);
}
public HttpNested editHttp() {
return withNewHttpLike(java.util.Optional.ofNullable(buildHttp()).orElse(null));
}
public HttpNested editOrNewHttp() {
return withNewHttpLike(java.util.Optional.ofNullable(buildHttp()).orElse(new HTTPIngressRuleValueBuilder().build()));
}
public HttpNested editOrNewHttpLike(HTTPIngressRuleValue item) {
return withNewHttpLike(java.util.Optional.ofNullable(buildHttp()).orElse(item));
}
public A addToAdditionalProperties(String key,Object value) {
if(this.additionalProperties == null && key != null && value != null) { this.additionalProperties = new LinkedHashMap(); }
if(key != null && value != null) {this.additionalProperties.put(key, value);} return (A)this;
}
public A addToAdditionalProperties(Map map) {
if(this.additionalProperties == null && map != null) { this.additionalProperties = new LinkedHashMap(); }
if(map != null) { this.additionalProperties.putAll(map);} return (A)this;
}
public A removeFromAdditionalProperties(String key) {
if(this.additionalProperties == null) { return (A) this; }
if(key != null && this.additionalProperties != null) {this.additionalProperties.remove(key);} return (A)this;
}
public A removeFromAdditionalProperties(Map map) {
if(this.additionalProperties == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.additionalProperties != null){this.additionalProperties.remove(key);}}} return (A)this;
}
public Map getAdditionalProperties() {
return this.additionalProperties;
}
public A withAdditionalProperties(Map additionalProperties) {
if (additionalProperties == null) {
this.additionalProperties = null;
} else {
this.additionalProperties = new LinkedHashMap(additionalProperties);
}
return (A) this;
}
public boolean hasAdditionalProperties() {
return this.additionalProperties != null;
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
IngressRuleFluent that = (IngressRuleFluent) o;
if (!java.util.Objects.equals(host, that.host)) return false;
if (!java.util.Objects.equals(http, that.http)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(host, http, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (host != null) { sb.append("host:"); sb.append(host + ","); }
if (http != null) { sb.append("http:"); sb.append(http + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
public class HttpNested extends HTTPIngressRuleValueFluent> implements Nested{
HttpNested(HTTPIngressRuleValue item) {
this.builder = new HTTPIngressRuleValueBuilder(this, item);
}
HTTPIngressRuleValueBuilder builder;
public N and() {
return (N) IngressRuleFluent.this.withHttp(builder.build());
}
public N endHttp() {
return and();
}
}
}