Jidoka.Agent.Spec.Controls.Operation (Jidoka v0.9.0)

Copy Markdown View Source

Policy control attached to model-callable operations.

Summary

Functions

Normalizes an existing operation control, keyword list, or map.

Returns true when this operation control applies to an operation spec or match data.

Returns true when this operation control applies to an operation name/kind.

Builds an operation control from keyword or map attributes.

Builds an operation control and raises if the attributes are invalid.

Returns the Zoi schema for an operation control.

Returns the operation kinds that a control can match.

Types

t()

@type t() :: %Jidoka.Agent.Spec.Controls.Operation{
  control: atom(),
  match: map(),
  metadata: map()
}

Functions

from_input(operation)

@spec from_input(t() | keyword() | map()) :: {:ok, t()} | {:error, term()}

Normalizes an existing operation control, keyword list, or map.

matches?(control, operation)

@spec matches?(t(), Jidoka.Agent.Spec.Operation.t() | map()) :: boolean()

Returns true when this operation control applies to an operation spec or match data.

matches?(operation, operation_name, operation_kind)

@spec matches?(t(), String.t(), atom()) :: boolean()

Returns true when this operation control applies to an operation name/kind.

new(attrs)

@spec new(keyword() | map()) :: {:ok, t()} | {:error, term()}

Builds an operation control from keyword or map attributes.

new!(attrs)

@spec new!(keyword() | map()) :: t()

Builds an operation control and raises if the attributes are invalid.

schema()

@spec schema() :: Zoi.schema()

Returns the Zoi schema for an operation control.

valid_kinds()

@spec valid_kinds() :: [atom()]

Returns the operation kinds that a control can match.