CIMI: Use #collection_class_for helper for all collections in client
diff --git a/clients/cimi/lib/entities/address.rb b/clients/cimi/lib/entities/address.rb index f468bb0..7973dbf 100644 --- a/clients/cimi/lib/entities/address.rb +++ b/clients/cimi/lib/entities/address.rb
@@ -23,9 +23,9 @@ get '/cimi/addresses' do address_template_xml = get_entity_collection('address_templates', credentials) - @address_templates = CIMI::Model::AddressTemplateCollection.from_xml(address_template_xml) + @address_templates = collection_class_for(:address_template).from_xml(address_template_xml) addresses_xml = get_entity_collection('addresses', credentials) - @addresses = CIMI::Model::AddressCollection.from_xml(addresses_xml) + @addresses = collection_class_for(:address).from_xml(addresses_xml) haml :'addresses/index' end @@ -39,7 +39,7 @@ end.to_xml begin result = create_entity('addresses', address_xml, credentials) - address = CIMI::Model::AddressCollection.from_xml(result) + address = collection_class_for(:address).from_xml(result) flash[:success] = "Address was successfully created." redirect "/cimi/addresses/#{address.name}", 302 rescue => e
diff --git a/clients/cimi/lib/entities/address_template.rb b/clients/cimi/lib/entities/address_template.rb index 667e647..bba2d40 100644 --- a/clients/cimi/lib/entities/address_template.rb +++ b/clients/cimi/lib/entities/address_template.rb
@@ -23,7 +23,7 @@ get '/cimi/address_templates' do address_template_xml = get_entity_collection('address_templates', credentials) - @address_templates = CIMI::Model::AddressTemplateCollection.from_xml(address_template_xml) + @address_templates = collection_class_for(:address_template).from_xml(address_template_xml) haml :'address_templates/index' end
diff --git a/clients/cimi/lib/entities/forwarding_group.rb b/clients/cimi/lib/entities/forwarding_group.rb index 344a162..de8c333 100644 --- a/clients/cimi/lib/entities/forwarding_group.rb +++ b/clients/cimi/lib/entities/forwarding_group.rb
@@ -23,7 +23,7 @@ get '/cimi/forwarding_groups' do fgs_xml = get_entity_collection('forwarding_groups', credentials) - @fgs = CIMI::Model::ForwardingGroupCollection.from_xml(fgs_xml) + @fgs = collection_class_for(:forwarding_group).from_xml(fgs_xml) haml :'forwarding_groups/index' end
diff --git a/clients/cimi/lib/entities/forwarding_group_template.rb b/clients/cimi/lib/entities/forwarding_group_template.rb index 1636ad8..81377c6 100644 --- a/clients/cimi/lib/entities/forwarding_group_template.rb +++ b/clients/cimi/lib/entities/forwarding_group_template.rb
@@ -23,7 +23,7 @@ get '/cimi/forwarding_group_templates' do fg_templates_xml = get_entity_collection('forwarding_group_templates', credentials) - @fg_templates = CIMI::Model::ForwardingGroupTemplateCollection.from_xml(fg_templates_xml) + @fg_templates = collection_class_for(:forwarding_group_template).from_xml(fg_templates_xml) haml :'forwarding_group_templates/index' end
diff --git a/clients/cimi/lib/entities/machine.rb b/clients/cimi/lib/entities/machine.rb index fef25c8..72286d0 100644 --- a/clients/cimi/lib/entities/machine.rb +++ b/clients/cimi/lib/entities/machine.rb
@@ -110,7 +110,7 @@ end.to_xml begin result = create_entity('machines', machine_xml, credentials) - machine = CIMI::Model::MachineCollection.from_xml(result) + machine = collection_class_for(:machine).from_xml(result) flash[:success] = "Machine was successfully created." redirect "/cimi/machines/#{machine.name}", 302 rescue => e
diff --git a/clients/cimi/lib/entities/machine_admin.rb b/clients/cimi/lib/entities/machine_admin.rb index 027a9d0..c7077cc 100644 --- a/clients/cimi/lib/entities/machine_admin.rb +++ b/clients/cimi/lib/entities/machine_admin.rb
@@ -37,7 +37,7 @@ get '/cimi/machine_admins' do machine_admin_xml = get_entity_collection('machine_admins', credentials) - @machine_admins = CIMI::Model::MachineAdminCollection.from_xml(machine_admin_xml) + @machine_admins = collection_class_for(:machine_admin).from_xml(machine_admin_xml) haml :'machine_admins/index' end @@ -53,7 +53,7 @@ end.to_xml begin result = create_entity('machine_admins', machine_admin_xml, credentials) - machine_admin = CIMI::Model::MachineAdminCollection.from_xml(result) + machine_admin = collection_class_for(:machine_admin).from_xml(result) flash[:success] = "MachineAdmin was successfully created." redirect "/cimi/machine_admins/#{machine_admin.name}", 302 rescue => e
diff --git a/clients/cimi/lib/entities/machine_configuration.rb b/clients/cimi/lib/entities/machine_configuration.rb index 105c243..fde1b3b 100644 --- a/clients/cimi/lib/entities/machine_configuration.rb +++ b/clients/cimi/lib/entities/machine_configuration.rb
@@ -23,7 +23,7 @@ get '/cimi/machine_configurations' do machine_conf_xml = get_entity_collection('machine_configurations', credentials) - @machine_configurations = CIMI::Model::MachineConfigurationCollection.from_xml(machine_conf_xml) + @machine_configurations = collection_class_for(:machine_configuration).from_xml(machine_conf_xml) haml :'machine_configurations/index' end
diff --git a/clients/cimi/lib/entities/machine_image.rb b/clients/cimi/lib/entities/machine_image.rb index bab5839..0e72cc9 100644 --- a/clients/cimi/lib/entities/machine_image.rb +++ b/clients/cimi/lib/entities/machine_image.rb
@@ -23,7 +23,7 @@ get '/cimi/machine_images' do machine_image_xml = get_entity_collection('machine_images', credentials) - @machine_images = CIMI::Model::MachineImageCollection.from_xml(machine_image_xml) + @machine_images = collection_class_for(:machine_image).from_xml(machine_image_xml) haml :'machine_images/index' end
diff --git a/clients/cimi/lib/entities/machine_template.rb b/clients/cimi/lib/entities/machine_template.rb index 9986639..c7a0717 100644 --- a/clients/cimi/lib/entities/machine_template.rb +++ b/clients/cimi/lib/entities/machine_template.rb
@@ -23,11 +23,11 @@ get '/cimi/machine_templates' do machine_image_xml = get_entity_collection('machine_images', credentials) - @machine_images = CIMI::Model::MachineImageCollection.from_xml(machine_image_xml) + @machine_images = collection_class_for(:machine_image).from_xml(machine_image_xml) machine_conf_xml = get_entity_collection('machine_configurations', credentials) - @machine_configurations = CIMI::Model::MachineConfigurationCollection.from_xml(machine_conf_xml) + @machine_configurations = collection_class_for(:machine_configuration).from_xml(machine_conf_xml) machine_template_xml = get_entity_collection('machine_templates', credentials) - @machine_templates = CIMI::Model::MachineTemplateCollection.from_xml(machine_template_xml) + @machine_templates = collection_class_for(:machine_template).from_xml(machine_template_xml) haml :'machine_templates/index' end @@ -42,7 +42,7 @@ end.to_xml begin result = create_entity('machine_templates', machine_template_xml, credentials) - machine_template = CIMI::Model::MachineTemplateCollection.from_xml(result) + machine_template = collection_class_for(:machine_template).from_xml(result) flash[:success] = "Machine Template was successfully created." redirect "/cimi/machine_templates/#{machine_template.name}", 302 rescue => e
diff --git a/clients/cimi/lib/entities/network.rb b/clients/cimi/lib/entities/network.rb index db1f011..af81726 100644 --- a/clients/cimi/lib/entities/network.rb +++ b/clients/cimi/lib/entities/network.rb
@@ -23,11 +23,11 @@ get '/cimi/networks' do forwarding_groups_xml = get_entity_collection('forwarding_groups', credentials) - @forwarding_groups = CIMI::Model::ForwardingGroupCollection.from_xml(forwarding_groups_xml) + @forwarding_groups = collection_class_for(:forwarding_group).from_xml(forwarding_groups_xml) network_config_xml = get_entity_collection('network_configurations', credentials) - @network_configurations = CIMI::Model::NetworkConfigurationCollection.from_xml(network_config_xml) + @network_configurations = collection_class_for(:network_configuration).from_xml(network_config_xml) networks_xml = get_entity_collection('networks', credentials) - @networks = CIMI::Model::NetworkCollection.from_xml(networks_xml) + @networks = collection_class_for(:network).from_xml(networks_xml) haml :'networks/index' end @@ -44,7 +44,7 @@ end.to_xml begin result = create_entity('networks', network_xml, credentials) - network = CIMI::Model::NetworkCollection.from_xml(result) + network = collection_class_for(:network).from_xml(result) flash[:success] = "Network was successfully created." redirect "/cimi/networks/#{network.name}", 302 rescue => e
diff --git a/clients/cimi/lib/entities/network_configuration.rb b/clients/cimi/lib/entities/network_configuration.rb index 2180126..d7312db 100644 --- a/clients/cimi/lib/entities/network_configuration.rb +++ b/clients/cimi/lib/entities/network_configuration.rb
@@ -23,7 +23,7 @@ get '/cimi/network_configurations' do network_configs_xml = get_entity_collection('network_configurations', credentials) - @network_configs = CIMI::Model::NetworkConfigurationCollection.from_xml(network_configs_xml) + @network_configs = collection_class_for(:network_configuration).from_xml(network_configs_xml) haml :'network_configurations/index' end
diff --git a/clients/cimi/lib/entities/network_port.rb b/clients/cimi/lib/entities/network_port.rb index 3e823ad..e0bb845 100644 --- a/clients/cimi/lib/entities/network_port.rb +++ b/clients/cimi/lib/entities/network_port.rb
@@ -23,7 +23,7 @@ get '/cimi/network_ports' do network_ports_xml = get_entity_collection('network_ports', credentials) - @network_ports = CIMI::Model::NetworkPortCollection.from_xml(network_ports_xml) + @network_ports = collection_class_for(:network_port).from_xml(network_ports_xml) haml :'network_ports/index' end
diff --git a/clients/cimi/lib/entities/network_port_configuration.rb b/clients/cimi/lib/entities/network_port_configuration.rb index 84d5669..3538020 100644 --- a/clients/cimi/lib/entities/network_port_configuration.rb +++ b/clients/cimi/lib/entities/network_port_configuration.rb
@@ -23,7 +23,7 @@ get '/cimi/network_port_configurations' do network_port_configs_xml = get_entity_collection('network_port_configurations', credentials) - @network_port_configs = CIMI::Model::NetworkPortConfigurationCollection.from_xml(network_port_configs_xml) + @network_port_configs = collection_class_for(:network_port_configuration).from_xml(network_port_configs_xml) haml :'network_port_configurations/index' end
diff --git a/clients/cimi/lib/entities/network_port_template.rb b/clients/cimi/lib/entities/network_port_template.rb index bab4acf..3c05fa4 100644 --- a/clients/cimi/lib/entities/network_port_template.rb +++ b/clients/cimi/lib/entities/network_port_template.rb
@@ -23,7 +23,7 @@ get '/cimi/network_port_templates' do network_port_templates_xml = get_entity_collection('network_port_templates', credentials) - @network_port_templates = CIMI::Model::NetworkPortTemplateCollection.from_xml(network_port_templates_xml) + @network_port_templates = collection_class_for(:network_port_template).from_xml(network_port_templates_xml) haml :'network_port_templates/index' end
diff --git a/clients/cimi/lib/entities/network_template.rb b/clients/cimi/lib/entities/network_template.rb index 97983b5..f967928 100644 --- a/clients/cimi/lib/entities/network_template.rb +++ b/clients/cimi/lib/entities/network_template.rb
@@ -23,7 +23,7 @@ get '/cimi/network_templates' do network_templates_xml = get_entity_collection('network_templates', credentials) - @network_templates = CIMI::Model::NetworkTemplateCollection.from_xml(network_templates_xml) + @network_templates = collection_class_for(:network_template).from_xml(network_templates_xml) haml :'network_templates/index' end
diff --git a/clients/cimi/lib/entities/routing_group.rb b/clients/cimi/lib/entities/routing_group.rb index 5365393..b39e831 100644 --- a/clients/cimi/lib/entities/routing_group.rb +++ b/clients/cimi/lib/entities/routing_group.rb
@@ -23,7 +23,7 @@ get '/cimi/routing_groups' do routing_groups_xml = get_entity_collection('routing_groups', credentials) - @routing_groups = CIMI::Model::RoutingGroupCollection.from_xml(routing_groups_xml) + @routing_groups = collection_class_for(:routing_group).from_xml(routing_groups_xml) haml :'routing_groups/index' end
diff --git a/clients/cimi/lib/entities/routing_group_template.rb b/clients/cimi/lib/entities/routing_group_template.rb index 88a0a47..88e182f 100644 --- a/clients/cimi/lib/entities/routing_group_template.rb +++ b/clients/cimi/lib/entities/routing_group_template.rb
@@ -23,7 +23,7 @@ get '/cimi/routing_group_templates' do rg_templates_xml = get_entity_collection('routing_group_templates', credentials) - @rg_templates = CIMI::Model::RoutingGroupTemplateCollection.from_xml(rg_templates_xml) + @rg_templates = collection_class_for(:routing_group_template).from_xml(rg_templates_xml) haml :'routing_group_templates/index' end
diff --git a/clients/cimi/lib/entities/volume.rb b/clients/cimi/lib/entities/volume.rb index 4e3ef69..d87023d 100644 --- a/clients/cimi/lib/entities/volume.rb +++ b/clients/cimi/lib/entities/volume.rb
@@ -23,7 +23,7 @@ get '/cimi/volumes' do volumes_xml = get_entity_collection('volumes', credentials) - @volumes = CIMI::Model::VolumeCollection.from_xml(volumes_xml) + @volumes = collection_class_for(:volume).from_xml(volumes_xml) haml :'volumes/index' end
diff --git a/clients/cimi/lib/entities/volume_configuration.rb b/clients/cimi/lib/entities/volume_configuration.rb index 7008696..047591c 100644 --- a/clients/cimi/lib/entities/volume_configuration.rb +++ b/clients/cimi/lib/entities/volume_configuration.rb
@@ -23,7 +23,7 @@ get '/cimi/volume_configurations' do volume_conf_xml = get_entity_collection('volume_configurations', credentials) - @volume_configurations = CIMI::Model::VolumeConfigurationCollection.from_xml(volume_conf_xml) + @volume_configurations = collection_class_for(:volume_configuration).from_xml(volume_conf_xml) haml :'volume_configurations/index' end
diff --git a/clients/cimi/lib/entities/volume_image.rb b/clients/cimi/lib/entities/volume_image.rb index f3cc56b..9800d9a 100644 --- a/clients/cimi/lib/entities/volume_image.rb +++ b/clients/cimi/lib/entities/volume_image.rb
@@ -23,7 +23,7 @@ get '/cimi/volume_images' do volume_images_xml = get_entity_collection('volume_images', credentials) - @volume_images = CIMI::Model::VolumeImageCollection.from_xml(volume_images_xml) + @volume_images = collection_class_for(:volume_image).from_xml(volume_images_xml) haml :'volume_images/index' end
diff --git a/clients/cimi/lib/entities/vsp.rb b/clients/cimi/lib/entities/vsp.rb index ccf02c9..cd126bb 100644 --- a/clients/cimi/lib/entities/vsp.rb +++ b/clients/cimi/lib/entities/vsp.rb
@@ -23,7 +23,7 @@ get '/cimi/vsps' do vsps_xml = get_entity_collection('vsps', credentials) - @vsps = CIMI::Model::VSPCollection.from_xml(vsps_xml) + @vsps = collection_class_for(:vsp).from_xml(vsps_xml) haml :'vsps/index' end
diff --git a/clients/cimi/lib/entities/vsp_configuration.rb b/clients/cimi/lib/entities/vsp_configuration.rb index 9d50090..0c29596 100644 --- a/clients/cimi/lib/entities/vsp_configuration.rb +++ b/clients/cimi/lib/entities/vsp_configuration.rb
@@ -23,7 +23,7 @@ get '/cimi/vsp_configurations' do vsp_configs_xml = get_entity_collection('vsp_configurations', credentials) - @vsp_configs = CIMI::Model::VSPConfigurationCollection.from_xml(vsp_configs_xml) + @vsp_configs = collection_class_for(:vsp_configuration).from_xml(vsp_configs_xml) haml :'vsp_configurations/index' end
diff --git a/clients/cimi/lib/entities/vsp_template.rb b/clients/cimi/lib/entities/vsp_template.rb index 93f238f..4845617 100644 --- a/clients/cimi/lib/entities/vsp_template.rb +++ b/clients/cimi/lib/entities/vsp_template.rb
@@ -23,7 +23,7 @@ get '/cimi/vsp_templates' do vsp_templates_xml = get_entity_collection('vsp_templates', credentials) - @vsp_templates = CIMI::Model::VSPTemplateCollection.from_xml(vsp_templates_xml) + @vsp_templates = collection_class_for(:vsp_template).from_xml(vsp_templates_xml) haml :'vsp_templates/index' end