Class: Aws::ParamValidator Private

Inherits:
Object
  • Object
show all
Includes:
Seahorse::Model::Shapes
Defined in:
lib/aws-sdk-core/param_validator.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

EXPECTED_GOT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"expected %s to be %s, got value %s (class: %s) instead."

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rules, options = {}) ⇒ ParamValidator

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ParamValidator.

Parameters:

Options Hash (options):

  • :validate_required (Boolean) — default: true


18
19
20
21
# File 'lib/aws-sdk-core/param_validator.rb', line 18

def initialize(rules, options = {})
  @rules = rules
  @validate_required = options[:validate_required] != false
end

Class Method Details

.validate!(rules, params) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:



12
13
14
# File 'lib/aws-sdk-core/param_validator.rb', line 12

def self.validate!(rules, params)
  new(rules).validate!(params)
end

Instance Method Details

#validate!(params) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

  • params (Hash)

Raises:

  • (ArgumentError)


25
26
27
28
29
# File 'lib/aws-sdk-core/param_validator.rb', line 25

def validate!(params)
  errors = []
  structure(@rules, params, errors, 'params') if @rules
  raise ArgumentError, error_messages(errors) unless errors.empty?
end