io.alauda.kubernetes.api.model.extensions.PodSecurityPolicySpecBuilder Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model.extensions;
import io.alauda.kubernetes.api.builder.VisitableBuilder;
import java.lang.Object;
import java.lang.Boolean;
public class PodSecurityPolicySpecBuilder extends PodSecurityPolicySpecFluentImpl implements VisitableBuilder{
PodSecurityPolicySpecFluent> fluent;
Boolean validationEnabled;
public PodSecurityPolicySpecBuilder(){
this(true);
}
public PodSecurityPolicySpecBuilder(Boolean validationEnabled){
this(new PodSecurityPolicySpec(), validationEnabled);
}
public PodSecurityPolicySpecBuilder(PodSecurityPolicySpecFluent> fluent){
this(fluent, true);
}
public PodSecurityPolicySpecBuilder(PodSecurityPolicySpecFluent> fluent,Boolean validationEnabled){
this(fluent, new PodSecurityPolicySpec(), validationEnabled);
}
public PodSecurityPolicySpecBuilder(PodSecurityPolicySpecFluent> fluent,PodSecurityPolicySpec instance){
this(fluent, instance, true);
}
public PodSecurityPolicySpecBuilder(PodSecurityPolicySpecFluent> fluent,PodSecurityPolicySpec instance,Boolean validationEnabled){
this.fluent = fluent;
fluent.withAllowedCapabilities(instance.getAllowedCapabilities());
fluent.withDefaultAddCapabilities(instance.getDefaultAddCapabilities());
fluent.withFsGroup(instance.getFsGroup());
fluent.withHostIPC(instance.getHostIPC());
fluent.withHostNetwork(instance.getHostNetwork());
fluent.withHostPID(instance.getHostPID());
fluent.withHostPorts(instance.getHostPorts());
fluent.withPrivileged(instance.getPrivileged());
fluent.withReadOnlyRootFilesystem(instance.getReadOnlyRootFilesystem());
fluent.withRequiredDropCapabilities(instance.getRequiredDropCapabilities());
fluent.withRunAsUser(instance.getRunAsUser());
fluent.withSeLinux(instance.getSeLinux());
fluent.withSupplementalGroups(instance.getSupplementalGroups());
fluent.withVolumes(instance.getVolumes());
this.validationEnabled = validationEnabled;
}
public PodSecurityPolicySpecBuilder(PodSecurityPolicySpec instance){
this(instance,true);
}
public PodSecurityPolicySpecBuilder(PodSecurityPolicySpec instance,Boolean validationEnabled){
this.fluent = this;
this.withAllowedCapabilities(instance.getAllowedCapabilities());
this.withDefaultAddCapabilities(instance.getDefaultAddCapabilities());
this.withFsGroup(instance.getFsGroup());
this.withHostIPC(instance.getHostIPC());
this.withHostNetwork(instance.getHostNetwork());
this.withHostPID(instance.getHostPID());
this.withHostPorts(instance.getHostPorts());
this.withPrivileged(instance.getPrivileged());
this.withReadOnlyRootFilesystem(instance.getReadOnlyRootFilesystem());
this.withRequiredDropCapabilities(instance.getRequiredDropCapabilities());
this.withRunAsUser(instance.getRunAsUser());
this.withSeLinux(instance.getSeLinux());
this.withSupplementalGroups(instance.getSupplementalGroups());
this.withVolumes(instance.getVolumes());
this.validationEnabled = validationEnabled;
}
public PodSecurityPolicySpec build(){
PodSecurityPolicySpec buildable = new PodSecurityPolicySpec(fluent.getAllowedCapabilities(),fluent.getDefaultAddCapabilities(),fluent.getFsGroup(),fluent.isHostIPC(),fluent.isHostNetwork(),fluent.isHostPID(),fluent.getHostPorts(),fluent.isPrivileged(),fluent.isReadOnlyRootFilesystem(),fluent.getRequiredDropCapabilities(),fluent.getRunAsUser(),fluent.getSeLinux(),fluent.getSupplementalGroups(),fluent.getVolumes());
io.alauda.kubernetes.api.builder.ValidationUtils.validate(buildable);
return buildable;
}
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
PodSecurityPolicySpecBuilder that = (PodSecurityPolicySpecBuilder) o;
if (fluent != null &&fluent != this ? !fluent.equals(that.fluent) :that.fluent != null &&fluent != this ) return false;
if (validationEnabled != null ? !validationEnabled.equals(that.validationEnabled) :that.validationEnabled != null) return false;
return true;
}
}