Method: OneviewSDK::Client#get_all

Defined in:
lib/oneview-sdk/client.rb

#get_all(type, api_ver = @api_version, variant = nil) ⇒ Array<Resource>

Get array of all resources of a specified type

Examples:

Get all Ethernet Networks

networks = @client.get_all('EthernetNetworks')
synergy_networks = @client.get_all('EthernetNetworks', 300, 'Synergy')

Parameters:

  • type (String)

    Resource type

  • api_ver (Integer) (defaults to: @api_version)

    API module version to fetch resources from

  • variant (String) (defaults to: nil)

    API module variant to fetch resource from

Returns:

Raises:

  • (TypeError)

    if the type is invalid



119
120
121
122
123
# File 'lib/oneview-sdk/client.rb', line 119

def get_all(type, api_ver = @api_version, variant = nil)
  klass = OneviewSDK.resource_named(type, api_ver, variant)
  raise TypeError, "Invalid resource type '#{type}'. OneviewSDK::API#{api_ver} does not contain a class like it." unless klass
  klass.get_all(self)
end