Class: Cerbos::Output::PlanResources::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/cerbos/output/plan_resources.rb

Overview

Additional information about the query plan.

Instance Attribute Summary collapse

Instance Attribute Details

#condition_stringString (readonly)

The query condition abstract syntax tree rendered as a human-readable string, to help with debugging.

Returns:

  • (String)


132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/cerbos/output/plan_resources.rb', line 132

PlanResources::Metadata = Output.new_class(:condition_string, :matched_scope) do
  # @!attribute [r] condition_string
  #   The query condition abstract syntax tree rendered as a human-readable string, to help with debugging.
  #
  #   @return [String]

  # @!attribute [r] matched_scope
  #   The policy scope that was used to plan the query.
  #
  #   @return [String]
  #
  #   @see https://docs.cerbos.dev/cerbos/latest/policies/scoped_policies.html Scoped policies

  def self.from_protobuf(meta)
    return nil if meta.nil?

    new(
      condition_string: meta.filter_debug,
      matched_scope: meta.matched_scope
    )
  end
end

#matched_scopeString (readonly)

The policy scope that was used to plan the query.

Returns:

  • (String)

See Also:



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/cerbos/output/plan_resources.rb', line 132

PlanResources::Metadata = Output.new_class(:condition_string, :matched_scope) do
  # @!attribute [r] condition_string
  #   The query condition abstract syntax tree rendered as a human-readable string, to help with debugging.
  #
  #   @return [String]

  # @!attribute [r] matched_scope
  #   The policy scope that was used to plan the query.
  #
  #   @return [String]
  #
  #   @see https://docs.cerbos.dev/cerbos/latest/policies/scoped_policies.html Scoped policies

  def self.from_protobuf(meta)
    return nil if meta.nil?

    new(
      condition_string: meta.filter_debug,
      matched_scope: meta.matched_scope
    )
  end
end