Packages

Elixir bindings for cedar_policy rust package

Current section

Files

Jump to
cedar_policy lib entity.ex
Raw

lib/entity.ex

defmodule CedarPolicy.Entity do
defstruct [:id, :attrs, :parents, :tags]
alias CedarPolicy.EntityUid
alias CedarPolicy.Record
@type t() :: %CedarPolicy.Entity{
id: EntityUid.t(),
attrs: Record.t(),
parents: list(EntityUid.t()),
tags: Record.t()
}
@spec new(
id :: EntityUid.t(),
attrs :: Record.t(),
parents :: list(EntityUid.t()),
tags :: Record.t()
) :: t()
def new(id, attrs \\ [], parents \\ [], tags \\ [])
def new(id, attrs, parents, tags)
when is_struct(id, EntityUid) and
is_list(parents) and
is_list(attrs) and
is_list(tags) do
%CedarPolicy.Entity{
id: id,
attrs: attrs,
parents: parents,
tags: tags
}
end
end