annotations.io.alauda.kubernetes.api.model.SecurityContextFluentImpl Maven / Gradle / Ivy
package io.alauda.kubernetes.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.alauda.kubernetes.api.builder.Nested;
import java.lang.String;
import java.lang.Deprecated;
import javax.validation.Valid;
import io.alauda.kubernetes.api.builder.BaseFluent;
import java.lang.Long;
import java.lang.Object;
import java.lang.Boolean;
public class SecurityContextFluentImpl> extends io.alauda.kubernetes.api.builder.BaseFluent implements SecurityContextFluent{
private CapabilitiesBuilder capabilities;
private Boolean privileged;
private Boolean readOnlyRootFilesystem;
private Boolean runAsNonRoot;
private Long runAsUser;
private SELinuxOptionsBuilder seLinuxOptions;
public SecurityContextFluentImpl(){
}
public SecurityContextFluentImpl(SecurityContext instance){
this.withCapabilities(instance.getCapabilities());
this.withPrivileged(instance.getPrivileged());
this.withReadOnlyRootFilesystem(instance.getReadOnlyRootFilesystem());
this.withRunAsNonRoot(instance.getRunAsNonRoot());
this.withRunAsUser(instance.getRunAsUser());
this.withSeLinuxOptions(instance.getSeLinuxOptions());
}
/**
* This method has been deprecated, please use method buildCapabilities instead.
*/
@Deprecated public Capabilities getCapabilities(){
return this.capabilities!=null?this.capabilities.build():null;
}
public Capabilities buildCapabilities(){
return this.capabilities!=null?this.capabilities.build():null;
}
public A withCapabilities(Capabilities capabilities){
_visitables.remove(this.capabilities);
if (capabilities!=null){ this.capabilities= new CapabilitiesBuilder(capabilities); _visitables.add(this.capabilities);} return (A) this;
}
public Boolean hasCapabilities(){
return this.capabilities!=null;
}
public SecurityContextFluent.CapabilitiesNested withNewCapabilities(){
return new CapabilitiesNestedImpl();
}
public SecurityContextFluent.CapabilitiesNested withNewCapabilitiesLike(Capabilities item){
return new CapabilitiesNestedImpl(item);
}
public SecurityContextFluent.CapabilitiesNested editCapabilities(){
return withNewCapabilitiesLike(getCapabilities());
}
public SecurityContextFluent.CapabilitiesNested editOrNewCapabilities(){
return withNewCapabilitiesLike(getCapabilities() != null ? getCapabilities(): new CapabilitiesBuilder().build());
}
public SecurityContextFluent.CapabilitiesNested editOrNewCapabilitiesLike(Capabilities item){
return withNewCapabilitiesLike(getCapabilities() != null ? getCapabilities(): item);
}
public Boolean isPrivileged(){
return this.privileged;
}
public A withPrivileged(Boolean privileged){
this.privileged=privileged; return (A) this;
}
public Boolean hasPrivileged(){
return this.privileged!=null;
}
public Boolean isReadOnlyRootFilesystem(){
return this.readOnlyRootFilesystem;
}
public A withReadOnlyRootFilesystem(Boolean readOnlyRootFilesystem){
this.readOnlyRootFilesystem=readOnlyRootFilesystem; return (A) this;
}
public Boolean hasReadOnlyRootFilesystem(){
return this.readOnlyRootFilesystem!=null;
}
public Boolean isRunAsNonRoot(){
return this.runAsNonRoot;
}
public A withRunAsNonRoot(Boolean runAsNonRoot){
this.runAsNonRoot=runAsNonRoot; return (A) this;
}
public Boolean hasRunAsNonRoot(){
return this.runAsNonRoot!=null;
}
public Long getRunAsUser(){
return this.runAsUser;
}
public A withRunAsUser(Long runAsUser){
this.runAsUser=runAsUser; return (A) this;
}
public Boolean hasRunAsUser(){
return this.runAsUser!=null;
}
/**
* This method has been deprecated, please use method buildSeLinuxOptions instead.
*/
@Deprecated public SELinuxOptions getSeLinuxOptions(){
return this.seLinuxOptions!=null?this.seLinuxOptions.build():null;
}
public SELinuxOptions buildSeLinuxOptions(){
return this.seLinuxOptions!=null?this.seLinuxOptions.build():null;
}
public A withSeLinuxOptions(SELinuxOptions seLinuxOptions){
_visitables.remove(this.seLinuxOptions);
if (seLinuxOptions!=null){ this.seLinuxOptions= new SELinuxOptionsBuilder(seLinuxOptions); _visitables.add(this.seLinuxOptions);} return (A) this;
}
public Boolean hasSeLinuxOptions(){
return this.seLinuxOptions!=null;
}
public SecurityContextFluent.SeLinuxOptionsNested withNewSeLinuxOptions(){
return new SeLinuxOptionsNestedImpl();
}
public SecurityContextFluent.SeLinuxOptionsNested withNewSeLinuxOptionsLike(SELinuxOptions item){
return new SeLinuxOptionsNestedImpl(item);
}
public SecurityContextFluent.SeLinuxOptionsNested editSeLinuxOptions(){
return withNewSeLinuxOptionsLike(getSeLinuxOptions());
}
public SecurityContextFluent.SeLinuxOptionsNested editOrNewSeLinuxOptions(){
return withNewSeLinuxOptionsLike(getSeLinuxOptions() != null ? getSeLinuxOptions(): new SELinuxOptionsBuilder().build());
}
public SecurityContextFluent.SeLinuxOptionsNested editOrNewSeLinuxOptionsLike(SELinuxOptions item){
return withNewSeLinuxOptionsLike(getSeLinuxOptions() != null ? getSeLinuxOptions(): item);
}
public A withNewSeLinuxOptions(String level,String role,String type,String user){
return (A)withSeLinuxOptions(new SELinuxOptions(level, role, type, user));
}
public boolean equals(Object o){
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
SecurityContextFluentImpl that = (SecurityContextFluentImpl) o;
if (capabilities != null ? !capabilities.equals(that.capabilities) :that.capabilities != null) return false;
if (privileged != null ? !privileged.equals(that.privileged) :that.privileged != null) return false;
if (readOnlyRootFilesystem != null ? !readOnlyRootFilesystem.equals(that.readOnlyRootFilesystem) :that.readOnlyRootFilesystem != null) return false;
if (runAsNonRoot != null ? !runAsNonRoot.equals(that.runAsNonRoot) :that.runAsNonRoot != null) return false;
if (runAsUser != null ? !runAsUser.equals(that.runAsUser) :that.runAsUser != null) return false;
if (seLinuxOptions != null ? !seLinuxOptions.equals(that.seLinuxOptions) :that.seLinuxOptions != null) return false;
return true;
}
public class CapabilitiesNestedImpl extends CapabilitiesFluentImpl> implements SecurityContextFluent.CapabilitiesNested,io.alauda.kubernetes.api.builder.Nested{
private final CapabilitiesBuilder builder;
CapabilitiesNestedImpl(Capabilities item){
this.builder = new CapabilitiesBuilder(this, item);
}
CapabilitiesNestedImpl(){
this.builder = new CapabilitiesBuilder(this);
}
public N and(){
return (N) SecurityContextFluentImpl.this.withCapabilities(builder.build());
}
public N endCapabilities(){
return and();
}
}
public class SeLinuxOptionsNestedImpl extends SELinuxOptionsFluentImpl> implements SecurityContextFluent.SeLinuxOptionsNested,io.alauda.kubernetes.api.builder.Nested{
private final SELinuxOptionsBuilder builder;
SeLinuxOptionsNestedImpl(SELinuxOptions item){
this.builder = new SELinuxOptionsBuilder(this, item);
}
SeLinuxOptionsNestedImpl(){
this.builder = new SELinuxOptionsBuilder(this);
}
public N and(){
return (N) SecurityContextFluentImpl.this.withSeLinuxOptions(builder.build());
}
public N endSeLinuxOptions(){
return and();
}
}
}