Class: XClarityClient::Schemas

Inherits:
Object
  • Object
show all
Defined in:
lib/xclarity_client/schemas.rb

Constant Summary collapse

REQ_SCHEMA =
{
  :deploy_osimage                  => @hostplatforms,
  :set_globalsettings              => @globalsettings,
  :create_remotefileserver_profile => @remotefs
}.freeze

Class Method Summary collapse

Class Method Details

.validate_input(schema_name, data) ⇒ Object



170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/xclarity_client/schemas.rb', line 170

def self.validate_input(schema_name, data)
  x = JSON::Validator.fully_validate(self::REQ_SCHEMA[schema_name], data)
  unless x.empty?
    errmsg = "input validation failed for data #{data}"
    $lxca_log.error('XClarityClient::Schemas validate_input', errmsg.to_s)
    g = ''
    x.each do |k|
      $lxca_log.error('XClarityClient::Schemas validate_input', k)
      g << "#{k},  "
    end; return { :result => 'Input validation failed', :message => g }
  end; return { :result => 'success' }
end