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

com.grafana.foundation.accesspolicy.AccessPolicy Maven / Gradle / Ivy

There is a newer version: 11.3.0-1730898216
Show newest version
// Code generated - EDITING IS FUTILE. DO NOT EDIT.

package com.grafana.foundation.accesspolicy;

import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import java.util.LinkedList;

public class AccessPolicy {
    // The scope where these policies should apply 
    @JsonProperty("scope")
    public ResourceRef scope;
    // The role that must apply this policy 
    @JsonProperty("role")
    public RoleRef role;
    // The set of rules to apply.  Note that * is required to modify
    // access policy rules, and that "none" will reject all actions 
    @JsonProperty("rules")
    public List rules;
    
    public String toJSON() throws JsonProcessingException {
        ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
        return ow.writeValueAsString(this);
    }

    
    public static class Builder implements com.grafana.foundation.cog.Builder {
        private final AccessPolicy internal;
        
        public Builder() {
            this.internal = new AccessPolicy();
        }
    public Builder scope(com.grafana.foundation.cog.Builder scope) {
    this.internal.scope = scope.build();
        return this;
    }
    
    public Builder role(com.grafana.foundation.cog.Builder role) {
    this.internal.role = role.build();
        return this;
    }
    
    public Builder rules(com.grafana.foundation.cog.Builder rules) {
		if (this.internal.rules == null) {
			this.internal.rules = new LinkedList<>();
		}
    this.internal.rules.add(rules.build());
        return this;
    }
    public AccessPolicy build() {
            return this.internal;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy