Class: Seahorse::Client::ParamValidator

Inherits:
Object
  • Object
show all
Defined in:
aws-sdk-core/lib/seahorse/client/param_validator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ParamValidator

Parameters:

Options Hash (options):

  • :validate_required (Boolean) — default: true

14
15
16
17
# File 'aws-sdk-core/lib/seahorse/client/param_validator.rb', line 14

def initialize(shape, options = {})
  @shape = shape || Seahorse::Model::Shapes::Structure.new
  @validate_required = options[:validate_required] != false
end

Class Method Details

.validate!(shape, params) ⇒ void

This method returns an undefined value.

Parameters:


8
9
10
# File 'aws-sdk-core/lib/seahorse/client/param_validator.rb', line 8

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

Instance Method Details

#validate!(params) ⇒ void

This method returns an undefined value.

Parameters:

  • params (Hash)

Raises:

  • (ArgumentError)

21
22
23
24
25
# File 'aws-sdk-core/lib/seahorse/client/param_validator.rb', line 21

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