ExCedar.Entity (ex_cedar v0.1.2)

Copy Markdown View Source

Cedar entity — a uid, a map of attributes, and a list of parent UIDs.

Build entity structs and pass a list of them to ExCedar.Entities.from_list/1.

%ExCedar.Entity{
  uid: ExCedar.EntityUid.new("User", "alice"),
  attributes: %{"department" => "eng", "level" => 7},
  parents: [ExCedar.EntityUid.new("Group", "admins")]
}

Attribute values follow Cedar's JSON value encoding rules (booleans, integers, strings, lists as sets, maps as records, entity references, and extension values like ExCedar.Decimal and ExCedar.IpAddr).

Summary

Functions

Encodes the entity as a Cedar entities JSON object.

Types

t()

@type t() :: %ExCedar.Entity{
  attributes: map(),
  parents: [ExCedar.EntityUid.t()],
  uid: ExCedar.EntityUid.t()
}

Functions

to_json(entity)

@spec to_json(t()) :: map()

Encodes the entity as a Cedar entities JSON object.