com.grafana.foundation.accesspolicy.AccessPolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grafana-foundation-sdk Show documentation
Show all versions of grafana-foundation-sdk Show documentation
A set of tools, types and libraries for building and manipulating Grafana objects.
// 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;
}
}
}