io.alauda.kubernetes.api.model.extensions.NetworkPolicyPeerFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model.extensions;
import io.alauda.kubernetes.api.model.LabelSelectorBuilder;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.alauda.kubernetes.api.model.LabelSelectorFluentImpl;
import io.alauda.kubernetes.api.builder.Nested;
import io.alauda.kubernetes.api.model.LabelSelector;
import java.lang.Deprecated;
import javax.validation.Valid;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.lang.Object;
import java.lang.Boolean;
public class NetworkPolicyPeerFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements NetworkPolicyPeerFluent{
private LabelSelectorBuilder namespaceSelector;
private LabelSelectorBuilder podSelector;
public NetworkPolicyPeerFluentImpl(){
}
public NetworkPolicyPeerFluentImpl(NetworkPolicyPeer instance){
this.withNamespaceSelector(instance.getNamespaceSelector());
this.withPodSelector(instance.getPodSelector());
}
/**
* This method has been deprecated, please use method buildNamespaceSelector instead.
*/
@Deprecated public LabelSelector getNamespaceSelector(){
return this.namespaceSelector!=null?this.namespaceSelector.build():null;
}
public LabelSelector buildNamespaceSelector(){
return this.namespaceSelector!=null?this.namespaceSelector.build():null;
}
public A withNamespaceSelector(LabelSelector namespaceSelector){
_visitables.remove(this.namespaceSelector);
if (namespaceSelector!=null){ this.namespaceSelector= new LabelSelectorBuilder(namespaceSelector); _visitables.add(this.namespaceSelector);} return (A) this;
}
public Boolean hasNamespaceSelector(){
return this.namespaceSelector!=null;
}
public NetworkPolicyPeerFluent.NamespaceSelectorNested withNewNamespaceSelector(){
return new NamespaceSelectorNestedImpl();
}
public NetworkPolicyPeerFluent.NamespaceSelectorNested withNewNamespaceSelectorLike(LabelSelector item){
return new NamespaceSelectorNestedImpl(item);
}
public NetworkPolicyPeerFluent.NamespaceSelectorNested editNamespaceSelector(){
return withNewNamespaceSelectorLike(getNamespaceSelector());
}
public NetworkPolicyPeerFluent.NamespaceSelectorNested editOrNewNamespaceSelector(){
return withNewNamespaceSelectorLike(getNamespaceSelector() != null ? getNamespaceSelector(): new LabelSelectorBuilder().build());
}
public NetworkPolicyPeerFluent.NamespaceSelectorNested editOrNewNamespaceSelectorLike(LabelSelector item){
return withNewNamespaceSelectorLike(getNamespaceSelector() != null ? getNamespaceSelector(): item);
}
/**
* This method has been deprecated, please use method buildPodSelector instead.
*/
@Deprecated public LabelSelector getPodSelector(){
return this.podSelector!=null?this.podSelector.build():null;
}
public LabelSelector buildPodSelector(){
return this.podSelector!=null?this.podSelector.build():null;
}
public A withPodSelector(LabelSelector podSelector){
_visitables.remove(this.podSelector);
if (podSelector!=null){ this.podSelector= new LabelSelectorBuilder(podSelector); _visitables.add(this.podSelector);} return (A) this;
}
public Boolean hasPodSelector(){
return this.podSelector!=null;
}
public NetworkPolicyPeerFluent.PodSelectorNested withNewPodSelector(){
return new PodSelectorNestedImpl();
}
public NetworkPolicyPeerFluent.PodSelectorNested withNewPodSelectorLike(LabelSelector item){
return new PodSelectorNestedImpl(item);
}
public NetworkPolicyPeerFluent.PodSelectorNested editPodSelector(){
return withNewPodSelectorLike(getPodSelector());
}
public NetworkPolicyPeerFluent.PodSelectorNested editOrNewPodSelector(){
return withNewPodSelectorLike(getPodSelector() != null ? getPodSelector(): new LabelSelectorBuilder().build());
}
public NetworkPolicyPeerFluent.PodSelectorNested editOrNewPodSelectorLike(LabelSelector item){
return withNewPodSelectorLike(getPodSelector() != null ? getPodSelector(): item);
}
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
NetworkPolicyPeerFluentImpl that = (NetworkPolicyPeerFluentImpl) o;
if (namespaceSelector != null ? !namespaceSelector.equals(that.namespaceSelector) :that.namespaceSelector != null) return false;
if (podSelector != null ? !podSelector.equals(that.podSelector) :that.podSelector != null) return false;
return true;
}
public class NamespaceSelectorNestedImpl extends LabelSelectorFluentImpl> implements NetworkPolicyPeerFluent.NamespaceSelectorNested,io.alauda.kubernetes.api.builder.Nested{
private final LabelSelectorBuilder builder;
NamespaceSelectorNestedImpl(LabelSelector item){
this.builder = new LabelSelectorBuilder(this, item);
}
NamespaceSelectorNestedImpl(){
this.builder = new LabelSelectorBuilder(this);
}
public N and(){
return (N) NetworkPolicyPeerFluentImpl.this.withNamespaceSelector(builder.build());
}
public N endNamespaceSelector(){
return and();
}
}
public class PodSelectorNestedImpl extends LabelSelectorFluentImpl> implements NetworkPolicyPeerFluent.PodSelectorNested,io.alauda.kubernetes.api.builder.Nested{
private final LabelSelectorBuilder builder;
PodSelectorNestedImpl(LabelSelector item){
this.builder = new LabelSelectorBuilder(this, item);
}
PodSelectorNestedImpl(){
this.builder = new LabelSelectorBuilder(this);
}
public N and(){
return (N) NetworkPolicyPeerFluentImpl.this.withPodSelector(builder.build());
}
public N endPodSelector(){
return and();
}
}
}