All Downloads are FREE. Search and download functionalities are using the official Maven repository.

annotations.io.fabric8.openshift.api.model.ClusterRoleFluentImpl Maven / Gradle / Ivy

There is a newer version: 4.1.1
Show newest version
package io.fabric8.openshift.api.model;

import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.lang.String;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.fabric8.kubernetes.api.builder.VisitableBuilder;
import javax.validation.Valid;
import io.fabric8.kubernetes.api.model.validators.CheckObjectMeta;
import java.util.List;
import java.util.ArrayList;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import java.lang.Object;
import io.fabric8.kubernetes.api.builder.Nested;
import io.fabric8.kubernetes.api.model.ObjectMetaFluentImpl;
import io.fabric8.kubernetes.api.model.ObjectMetaBuilder;

public class ClusterRoleFluentImpl> extends BaseFluent implements ClusterRoleFluent{

    private String apiVersion;
    private String kind;
    private VisitableBuilder metadata;
    private List> rules =  new ArrayList>();

    public ClusterRoleFluentImpl(){
    }
    public ClusterRoleFluentImpl(ClusterRole instance){
            this.withApiVersion(instance.getApiVersion()); 
            this.withKind(instance.getKind()); 
            this.withMetadata(instance.getMetadata()); 
            this.withRules(instance.getRules()); 
    }

    public String getApiVersion(){
            return this.apiVersion;
    }

    public A withApiVersion(String apiVersion){
            this.apiVersion=apiVersion; return (A) this;
    }

    public String getKind(){
            return this.kind;
    }

    public A withKind(String kind){
            this.kind=kind; return (A) this;
    }

    public ObjectMeta getMetadata(){
            return this.metadata!=null?this.metadata.build():null;
    }

    public A withMetadata(ObjectMeta metadata){
            if (metadata!=null){ this.metadata= new ObjectMetaBuilder(metadata); _visitables.add(this.metadata);} return (A) this;
    }

    public ClusterRoleFluent.MetadataNested withNewMetadata(){
            return new MetadataNestedImpl();
    }

    public ClusterRoleFluent.MetadataNested withNewMetadataLike(ObjectMeta item){
            return new MetadataNestedImpl(item);
    }

    public ClusterRoleFluent.MetadataNested editMetadata(){
            return withNewMetadataLike(getMetadata());
    }

    public A addToRules(PolicyRule... items){
            for (PolicyRule item : items) {PolicyRuleBuilder builder = new PolicyRuleBuilder(item);_visitables.add(builder);this.rules.add(builder);} return (A)this;
    }

    public A removeFromRules(PolicyRule... items){
            for (PolicyRule item : items) {PolicyRuleBuilder builder = new PolicyRuleBuilder(item);_visitables.remove(builder);this.rules.remove(builder);} return (A)this;
    }

    public List getRules(){
            return build(rules);
    }

    public A withRules(List rules){
            this.rules.clear();
            if (rules != null) {for (PolicyRule item : rules){this.addToRules(item);}} return (A) this;
    }

    public A withRules(PolicyRule... rules){
            this.rules.clear(); if (rules != null) {for (PolicyRule item :rules){ this.addToRules(item);}} return (A) this;
    }

    public ClusterRoleFluent.RulesNested addNewRule(){
            return new RulesNestedImpl();
    }

    public ClusterRoleFluent.RulesNested addNewRuleLike(PolicyRule item){
            return new RulesNestedImpl(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;
            ClusterRoleFluentImpl that = (ClusterRoleFluentImpl) o;
            if (apiVersion != null ? !apiVersion.equals(that.apiVersion) :that.apiVersion != null) return false;
            if (kind != null ? !kind.equals(that.kind) :that.kind != null) return false;
            if (metadata != null ? !metadata.equals(that.metadata) :that.metadata != null) return false;
            if (rules != null ? !rules.equals(that.rules) :that.rules != null) return false;
            return true;
    }


    public class MetadataNestedImpl extends ObjectMetaFluentImpl> implements ClusterRoleFluent.MetadataNested,Nested{

            private final ObjectMetaBuilder builder;
    
            MetadataNestedImpl(ObjectMeta item){
                    this.builder = new ObjectMetaBuilder(this, item);
            }
            MetadataNestedImpl(){
                    this.builder = new ObjectMetaBuilder(this);
            }
    
    public N and(){
            return (N) ClusterRoleFluentImpl.this.withMetadata(builder.build());
    }
    public N endMetadata(){
            return and();
    }

}
    public class RulesNestedImpl extends PolicyRuleFluentImpl> implements ClusterRoleFluent.RulesNested,Nested{

            private final PolicyRuleBuilder builder;
    
            RulesNestedImpl(){
                    this.builder = new PolicyRuleBuilder(this);
            }
            RulesNestedImpl(PolicyRule item){
                    this.builder = new PolicyRuleBuilder(this, item);
            }
    
    public N and(){
            return (N) ClusterRoleFluentImpl.this.addToRules(builder.build());
    }
    public N endRule(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy