Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidRuleFormat is returned when a rule format is invalid. ErrInvalidRuleFormat = errors.New("rule is invalid: should have at least one resource.<attribute> or a principal.<attribute>") )
Functions ¶
This section is empty.
Types ¶
type Rule ¶
type Rule struct { ResourceAttribute string `json:"resource_attribute"` PrincipalAttribute string `json:"principal_attribute"` Operator RuleOperator `json:"operator"` Value string `json:"Value"` }
Rule represents an attribute rule containing the attribute name and the operator to apply to a given value.
func ConvertStringToRuleOperator ¶
ConvertStringToRuleOperator converts a string to a RuleOperator.
func (*Rule) MatchPrincipal ¶
func (r *Rule) MatchPrincipal(attributes model.Attributes) bool
func (*Rule) MatchResource ¶
func (r *Rule) MatchResource(attributes model.Attributes) bool
type RuleOperator ¶
type RuleOperator string
const ( // RuleOperatorEqual represents an equal attribute rule. // For example: my.owner_id == 123 RuleOperatorEqual RuleOperator = "==" // RuleOperatorGreater represents a greater value attribute rule. // For example: my.number > 123 RuleOperatorGreater RuleOperator = ">" // RuleOperatorGreater represents a greater or equal value attribute rule. // For example: my.number >= 123 RuleOperatorGreaterEqual RuleOperator = ">=" // RuleOperatorLower represents a lower value attribute rule. // For example: my.number < 123 RuleOperatorLower RuleOperator = "<" // RuleOperatorLowerEqual represents a lower or equal value attribute rule. // For example: my.number <= 123 RuleOperatorLowerEqual RuleOperator = "<=" // RuleOperatorEqual represents a NOT equal attribute rule. // For example: my.owner_id != 123 RuleOperatorNotEqual RuleOperator = "!=" )
Click to show internal directories.
Click to hide internal directories.