class Aws::Endpoints::ErrorRule

This class is deprecated. It is used by the Runtime endpoint resolution approach. It has been replaced by a code generated approach in each service gem. It can be removed in a new major version. It has to exist because old service gems can use a new core version. @api private

Attributes

conditions[R]
documentation[R]
error[R]
type[R]

Public Class Methods

new(type: 'error', conditions:, error: nil, documentation: nil) click to toggle source
# File lib/aws-sdk-core/endpoints/error_rule.rb, line 12
def initialize(type: 'error', conditions:, error: nil, documentation: nil)
  @type = type
  @conditions = Condition.from_json(conditions)
  @error = error
  @documentation = documentation
end

Public Instance Methods

match(parameters, assigned = {}) click to toggle source
# File lib/aws-sdk-core/endpoints/error_rule.rb, line 24
def match(parameters, assigned = {})
  assigns = assigned.dup
  matched = conditions.all? do |condition|
    output = condition.match?(parameters, assigns)
    assigns = assigns.merge(condition.assigned) if condition.assign
    output
  end
  resolved_error(parameters, assigns) if matched
end

Private Instance Methods

resolved_error(parameters, assigns) click to toggle source
# File lib/aws-sdk-core/endpoints/error_rule.rb, line 36
def resolved_error(parameters, assigns)
  error = resolve_value(@error, parameters, assigns)
  ArgumentError.new(error)
end