Class: Cerbos::Output::CheckResources::Result::Output

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

Overview

User-defined output from a policy rule evaluation.

Instance Attribute Summary collapse

Instance Attribute Details

#actionString (readonly)

The action that was being evaluated when the output was produced.

Requires the Cerbos policy decision point server to be at least v0.51.

Returns:

  • (String)


236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/cerbos/output/check_resources.rb', line 236

CheckResources::Result::Output = Output.new_class(:action, :source, :value, :error) do
  # @!attribute [r] action
  #   The action that was being evaluated when the output was produced.
  #
  #   Requires the Cerbos policy decision point server to be at least v0.51.
  #
  #   @return [String]

  # @!attribute [r] source
  #   The identifier of the policy rule that produced the output.
  #
  #   @return [String]

  # @!attribute [r] value
  #   The result of evaluating the output expression.
  #
  #   @return [String, Numeric, Boolean, Array, Hash, nil]

  # @!attribute [r] error
  #   Error encountered when evaluating the output expression (if any).
  #
  #   @return [String, nil]

  def self.from_protobuf(output_entry)
    new(
      action: output_entry.action,
      source: output_entry.src,
      value: output_entry.val&.to_ruby(true),
      error: output_entry.error.empty? ? nil : output_entry.error
    )
  end
end

#errorString? (readonly)

Error encountered when evaluating the output expression (if any).

Returns:

  • (String, nil)


236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/cerbos/output/check_resources.rb', line 236

CheckResources::Result::Output = Output.new_class(:action, :source, :value, :error) do
  # @!attribute [r] action
  #   The action that was being evaluated when the output was produced.
  #
  #   Requires the Cerbos policy decision point server to be at least v0.51.
  #
  #   @return [String]

  # @!attribute [r] source
  #   The identifier of the policy rule that produced the output.
  #
  #   @return [String]

  # @!attribute [r] value
  #   The result of evaluating the output expression.
  #
  #   @return [String, Numeric, Boolean, Array, Hash, nil]

  # @!attribute [r] error
  #   Error encountered when evaluating the output expression (if any).
  #
  #   @return [String, nil]

  def self.from_protobuf(output_entry)
    new(
      action: output_entry.action,
      source: output_entry.src,
      value: output_entry.val&.to_ruby(true),
      error: output_entry.error.empty? ? nil : output_entry.error
    )
  end
end

#sourceString (readonly)

The identifier of the policy rule that produced the output.

Returns:

  • (String)


236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/cerbos/output/check_resources.rb', line 236

CheckResources::Result::Output = Output.new_class(:action, :source, :value, :error) do
  # @!attribute [r] action
  #   The action that was being evaluated when the output was produced.
  #
  #   Requires the Cerbos policy decision point server to be at least v0.51.
  #
  #   @return [String]

  # @!attribute [r] source
  #   The identifier of the policy rule that produced the output.
  #
  #   @return [String]

  # @!attribute [r] value
  #   The result of evaluating the output expression.
  #
  #   @return [String, Numeric, Boolean, Array, Hash, nil]

  # @!attribute [r] error
  #   Error encountered when evaluating the output expression (if any).
  #
  #   @return [String, nil]

  def self.from_protobuf(output_entry)
    new(
      action: output_entry.action,
      source: output_entry.src,
      value: output_entry.val&.to_ruby(true),
      error: output_entry.error.empty? ? nil : output_entry.error
    )
  end
end

#valueString, ... (readonly)

The result of evaluating the output expression.

Returns:

  • (String, Numeric, Boolean, Array, Hash, nil)


236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/cerbos/output/check_resources.rb', line 236

CheckResources::Result::Output = Output.new_class(:action, :source, :value, :error) do
  # @!attribute [r] action
  #   The action that was being evaluated when the output was produced.
  #
  #   Requires the Cerbos policy decision point server to be at least v0.51.
  #
  #   @return [String]

  # @!attribute [r] source
  #   The identifier of the policy rule that produced the output.
  #
  #   @return [String]

  # @!attribute [r] value
  #   The result of evaluating the output expression.
  #
  #   @return [String, Numeric, Boolean, Array, Hash, nil]

  # @!attribute [r] error
  #   Error encountered when evaluating the output expression (if any).
  #
  #   @return [String, nil]

  def self.from_protobuf(output_entry)
    new(
      action: output_entry.action,
      source: output_entry.src,
      value: output_entry.val&.to_ruby(true),
      error: output_entry.error.empty? ? nil : output_entry.error
    )
  end
end