Module: ILO_SDK::ServiceRootHelper

Included in:
Client
Defined in:
lib/ilo-sdk/helpers/service_root_helper.rb

Overview

Contains helper methods for Service Root Actions

Instance Method Summary collapse

Instance Method Details

#get_registry(registry_prefix) ⇒ Array

Get the Registry with given registry_prefix

Parameters:

  • registry_prefix (String, Symbol)

Returns:

  • (Array)

    registry

Raises:

  • (RuntimeError)

    if the request failed



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/ilo-sdk/helpers/service_root_helper.rb', line 37

def get_registry(registry_prefix)
  response = rest_get('/redfish/v1/Registries/')
  registries = response_handler(response)['Items']
  registry = registries.select { |reg| reg['Schema'].start_with?(registry_prefix) }
  info = []
  registry.each do |reg|
    response = rest_get(reg['Location'][0]['Uri']['extref'])
    registry_store = response_handler(response)
    info.push(registry_store)
  end
  info
end

#get_schema(schema_prefix) ⇒ Array

Get the schema information with given prefix

Parameters:

  • schema_prefix (String, Symbol)

Returns:

  • (Array)

    schema

Raises:

  • (RuntimeError)

    if the request failed



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ilo-sdk/helpers/service_root_helper.rb', line 19

def get_schema(schema_prefix)
  response = rest_get('/redfish/v1/Schemas/')
  schemas = response_handler(response)['Items']
  schema = schemas.select { |s| s['Schema'].start_with?(schema_prefix) }
  raise "NO schema found with this schema prefix : #{schema_prefix}" if schema.empty?
  info = []
  schema.each do |sc|
    response = rest_get(sc['Location'][0]['Uri']['extref'])
    schema_store = response_handler(response)
    info.push(schema_store)
  end
  info
end