odrl

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package odrl contains ODRL code

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterValidators

func RegisterValidators(v *validator.Validate) error

This registers all the validators of this package.

Types

type AbstractPolicyRule

type AbstractPolicyRule struct {
	Assigner string `json:"odrl:assigner,omitempty"`
	Assignee string `json:"odrl:assignee,omitempty"`
}

AbstractPolicyRule defines an ODRL abstract policy rule.

type Agreement

type Agreement struct {
	PolicyClass
	Type      string    `json:"@type" validate:"required,eq=odrl:Agreement"`
	ID        string    `json:"@id" validate:"required"`
	Target    string    `json:"odrl:target" validate:"required"`
	Timestamp time.Time `json:"dspace:timestamp"`
}

Agreement is an ODRL agreement.

type Constraint

type Constraint struct {
	RightOperand          string    `json:"odrl:rightOperand"`
	RightOperandReference Reference `json:"odrl:rightOperandReference,omitempty"`
	LeftOperand           string    `json:"odrl:leftOperand" validate:"odrl_leftoperand"`
	Operator              string    `json:"odrl:operator" validate:"odrl_operator"` // TODO: implment custom verifier.
}

Constraint is an ODRL constraint.

type Duty

type Duty struct {
	AbstractPolicyRule
	ID         string       `json:"@id,omitempty"`
	Action     string       `json:"action,omitempty" validate:"odrl_action"`
	Constraint []Constraint `json:"constraint,omitempty" validate:"dive"`
}

Duty is an ODRL duty.

type MessageOffer

type MessageOffer struct {
	PolicyClass
	Type   string `json:"@type" validate:"required,eq=odrl:Offer"`
	Target string `json:"odrl:target" validate:"required"`
}

MessageOffer is an ODRL MessageOffer.

type Offer

type Offer struct {
	MessageOffer
}

Offer is an ODRL offer.

type Permission

type Permission struct {
	AbstractPolicyRule
	Action     string       `json:"action" validate:"odrl_action"`
	Constraint []Constraint `json:"constraint,omitempty" validate:"dive"`
	Duty       Duty         `json:"duty,omitempty"`
}

Permission is a permisson entry.

type PolicyClass

type PolicyClass struct {
	AbstractPolicyRule
	ID          string       `json:"@id"`                         // FIXME: Maybe re-add the required validation?
	ProviderID  string       `json:"dspace:providerId,omitempty"` // Got from an example, not in standard.
	Profile     []Reference  `json:"odrl:profile,omitempty" validate:"dive"`
	Permission  []Permission `json:"odrl:permission,omitempty" validate:"dive"`
	Obligation  []Duty       `json:"odrl:obligation,omitempty" validate:"dive"`
	Prohibition []any        `json:"odrl:prohibition"` // Spec for this was missing but is required, even if empty.
}

PolicyClass is an ODRL PolicyClass.

type Reference

type Reference struct {
	ID string `json:"@id,omitempty" validate:"required"`
}

Reference is a reference.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL