Wardrik. Scope
(wardrik_protocol v0.1.0-rc.1)
Copy Markdown
Who is acting through Wardrik, and what they may do.
scope = MyApp.AgentRuntime.as("acme/@maria", roles: [:owner], resources: ["acme/@maria/*"])Wardrik.as/3 makes a scope. Wardrik.grant/2 adds to it.
Fields
:server- theWardrik.Serverthat runs its operations.:wardrik- which Wardrik, by name.:principal- who is acting.:grants- what the authorizer reads to decide what they may do.:policy- in a token's scope, the policy every agent it defines is held to.:expires- in a token's scope, when the token expires.:labels- in an agent's scope, the labels of what its run has read. Messages it sends carry them too.:operation- the operation running, while one runs.
Summary
Functions
Adds a statement built from opts to the scope's grants. See Wardrik.Statement.new/1.
Returns a scope for principal on wardrik, run by server.
Runs operation id with input through the scope's server.
Streams operation id with input through the scope's server.
Types
@type t() :: %Wardrik.Scope{ expires: DateTime.t() | nil, grants: term(), labels: [String.t()], operation: WardrikProtocol.operation() | nil, policy: String.t() | map() | nil, principal: WardrikCore.Principal.t(), server: module(), wardrik: atom() | struct() }
Functions
Adds a statement built from opts to the scope's grants. See Wardrik.Statement.new/1.
Returns a scope for principal on wardrik, run by server.
grants is a list of Wardrik.Statements, or the options for one.
@spec run(t(), String.t(), map()) :: {:ok, term()} | {:error, Wardrik.Error.t()}
Runs operation id with input through the scope's server.
@spec stream(t(), String.t(), map()) :: {:ok, Enumerable.t()} | {:error, Wardrik.Error.t()}
Streams operation id with input through the scope's server.